Auto/Bulk Add devices in Cacti
Hi folks, I was doing some work with Cacti, and I had to add multiple devices in the graphing console automatically. Actually, the script is still incomplete and I have only added the graphs that don’t need a Data queries. This system consist of custom host templates and scripts (Like using iControl for F5 Monitoring and WebAPI for Bluecoat Monitoring), I may post those scripts later, but I thought, you could use this as a starting point.
For people who are wondering, cacti is a open source rrdtool based monitoring system, with a huge user base I must say. (http://cacti.net/) . It has multiple plugins which makes it even more fun to use.
Ok, things to note before you go on using the Script
- Cacti system, built and ready
- The graphs will be added in tree with subdivisions as areas. In my case, I divided into (Americas, Asia Pacific and Europe and Middle East)
- This script adds the device and decides the zones by the domain name.
- You need another bootstrap script to call this for adding multiple devices.
- You can use any device template, please notice, that the interface graphs will not be added as I haven’t coded it to go to data queries).
- I have also installed the Plugin Architecture and installed the “Monitor Plugin” (http://docs.cacti.net/plugin:monitor)
- I will also add the device to monitoring using the script.
In the above script, I have used 3 different domain names, in order for the region to be determined.
You will have to create a treee structure prior to this like this
- Device Type (Tree Name)
- Americas (header)
- EMEA (header)
- ASPAC (header)
Another point I failed to mention is that, this is not the final script that I created, I followed the perl best practices in development and also made it modular, but I throw this out, so people can play with the script. Once I have the final script, I may post it on another blog. you can couple this with PHP and call it from there for bulk addition and things like that.
Till then, Ciao…