19/06/2016

Add a new host to Opsview via API - Python

Once a wise man said: "You can't manage, what you don't measure!" (and this one of my favorite quotes btw). That's why monitoring is an essential part of any system administration.

For that reason, Nagios was a good solution and had a good market share for a long time. But Nagios wasn't a perfect solution, hence it got a lot of derivatives like Icinga (my preferred Nagios based app now) and Opsview to make it easier to use.

I used Opsview for a long time, before moving to Icinga because Opsview got more restrictions! i.e. it moved from open source to close source model.

Nowadays, I moved totally from old Nagios style to time-series like InfluxData and its stack, TICK stack: Telegraf, InfluxDB, Chronograph, and Kapacitor (but I always would prefer Grafana over Chronograph).

But I think there are many people still have legacy components, so here is a script I wrote it two years ago, and I update it from time to time ... I'm not sure who is still using Opsview, but at least it's here.

This script is simply used to add a new host to Opsview automatically. It can be used independently or as I used to use it as part of automation tool like Ansible (I think will push this later).

Get it!

You can find it on my GitHub repo: Add host to Opsview via API.

So, how to use?

The ini file has info that will used to connect to Opsview Server (Opsview URL, user, password, and host templates).
python add_host_to_opsview.py --group-name GROUP_NAME --server-name SERVER_NAME --server-ip SERVER_IP  --ini-file PATH_TO_INI_FILE

Requirement?

There are no special requirements, just the user that used to connect to Opsview should have administration privileges.

Compatibility?

This script is tested with latest Open Source version of Opsview! (as I remember it was Opsview 3.20131016)

Have a nice monitoring :-)
Powered by Blogger.

Hello, my name is Ahmed AbouZaid and this is my "lite" technical blog!

I'm a passionate DevOps engineer, Cloud/Kubernetes specialist, Free/Open source geek, and an author.

I believe in self CI/CD (Continuous Improvements/Development), also that "the whole is greater than the sum of its parts".

DevOps transformation, automation, data, and metrics are my preferred areas. And I like to help both businesses and people to grow.

Contact Me

Name

Email *

Message *

Latest Post

DevOps is not only a culture - Discussion Panel

Today is my second session JobStack 2023 after my previous one yesterday titled " Platform Engineering: Manage your infrastructure u...

Popular Posts

Blog Archive