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, Linux system administrator, RedHat Certified Engineer (RHCE), AWS SysOps/Solutions Architect, Free/Open source geek, author, interested in environment, calligraphy, and I believe that “Details Matter”!

Automation, data, and metrics are my preferred areas. I have a built-in monitoring chip, and too lazy to do anything manually :D

Popular Posts