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


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


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, I'm a passionate Tech Lead DevOps Engineer. 👋

With 16+ years of open-source contributions, 12+ years of professional hands-on experience in DevOps, and an M.Sc. in Data Engineering from Edinburgh Napier University (UK), I enjoy facilitating the growth of both businesses and individuals.

I specialize in Cloud-Native and Kubernetes. I'm also a Free/Open source geek and book author. My favorite topics are DevOps transformation, automation, data, and metrics.

Contact Me


Email *

Message *

Start Your DevOps Engineer Journey!

Start Your DevOps Engineer Journey!
Start your DevOps career for free the Agile way in 2024 with the Dynamic DevOps Roadmap ⭐

Latest Post

2023 Highlights

Image generated with Craiyon . Finally, 2023 is over! What a year! One more crazy year, but it was the culmination ...

Popular Posts

Blog Archive