adding hosts outside of NagiosXI from script
Posted: Fri Dec 02, 2011 5:11 pm
Greetings,
I have a plethora of hosts that need to be added/deleted dynamically to/from my NagiosXI instance, however, I cannot use the UI, Auto-Discovery or the Bulk Import Tool. Here is the situation: We have our servers in AWS EC2, managed by Rightscale for auto-scaling deployments. At a certain threshold in our RS array, it kicks off the server build templates/scripts and creates X number of instances, but also when a different threshold is reached, it will kick off server decommissioning scripts and the instances go away. As you can see, this makes monitoring a nightmare for consistency.
I would love to see a function that could be called from a shell/python/perl script that would add itself upon creation to NagiosXI, set the correct templates based on the AWS EC2 tag I have set for "role" and a 2nd script I could add to the decomm scripts that would remove it from monitoring all together. I've looked at the Bulk Import Tool and it has the capabilities of reading all of the parameters I need to add/organize hosts from a CSV, but I need a programmatic way of calling it at the command line, since I am not going to be awake at 3am to manually import 600+ new servers that just got deployed because our load increased, only to have them go away when the load eventually decreases and all of the "terminated" servers are throwing up unavailability alerts.
I imagine there is a way to call something like the nagiosql_delete_host.php script manually from the box itself, as it gets decommed, but I can't find anything out there to add the host itself, initially. All of the config generators out there are for Nagios Core and all of the configs I have looked at on the XI server have an admonishment to not change anything, because those files get dynamically created/overwritten periodically. Is there anything in your bag of tricks that can get me through this major headache? Bear in mind, I don't have a lot of hair left to be pulled out, as I have been doing to try and figure this out for weeks now.
Thanks,
-Todd Groten
I have a plethora of hosts that need to be added/deleted dynamically to/from my NagiosXI instance, however, I cannot use the UI, Auto-Discovery or the Bulk Import Tool. Here is the situation: We have our servers in AWS EC2, managed by Rightscale for auto-scaling deployments. At a certain threshold in our RS array, it kicks off the server build templates/scripts and creates X number of instances, but also when a different threshold is reached, it will kick off server decommissioning scripts and the instances go away. As you can see, this makes monitoring a nightmare for consistency.
I would love to see a function that could be called from a shell/python/perl script that would add itself upon creation to NagiosXI, set the correct templates based on the AWS EC2 tag I have set for "role" and a 2nd script I could add to the decomm scripts that would remove it from monitoring all together. I've looked at the Bulk Import Tool and it has the capabilities of reading all of the parameters I need to add/organize hosts from a CSV, but I need a programmatic way of calling it at the command line, since I am not going to be awake at 3am to manually import 600+ new servers that just got deployed because our load increased, only to have them go away when the load eventually decreases and all of the "terminated" servers are throwing up unavailability alerts.
I imagine there is a way to call something like the nagiosql_delete_host.php script manually from the box itself, as it gets decommed, but I can't find anything out there to add the host itself, initially. All of the config generators out there are for Nagios Core and all of the configs I have looked at on the XI server have an admonishment to not change anything, because those files get dynamically created/overwritten periodically. Is there anything in your bag of tricks that can get me through this major headache? Bear in mind, I don't have a lot of hair left to be pulled out, as I have been doing to try and figure this out for weeks now.
Thanks,
-Todd Groten