Page 1 of 2

Cloning/copying existing passive service checks - NRDS

Posted: Tue Mar 10, 2015 2:11 pm
by skynardo
We have a fairly new Nagios XI 2014 R2.5 system. I have tested out some standard custom plugins to monitor our AIX lpars using NRDS passive checks. I have also created an aix_host_template (which uses active check_host-alive) and 2 different aix_service_templates with settings specific to these pugins. I have scripted up and install script to begin rolling this out to our dev lpars but I am trying to come up with a method to copy/clone my default aix host with template and default aix service checks with their respective templates in Nagios XI. I initially created a new host object by doing a copy of my test box and changing the hostname using XI core config mgr. So far so good. I then tried going into Tools, Bulk mods, add a service, select my first standard service and added my new host object created in step 1. After applying config and restart, the service did not show up in Nagios. I had to first go into Unconfigured objects and configure the passive checks before they would show up. When I checked the templates on the services they are all using the xiwizard_passive service template. I guess I am looking for recommendations on how to roll this out with the least number of config clicks, or preferably, is there a command line interface or some other bulk way to do this type of thing?

Re: Cloning/copying existing passive service checks - NRDS

Posted: Tue Mar 10, 2015 4:35 pm
by abrist
As you are using nrds, you really should use the nrds UI to create these configs and push them. XI should automagically add the checks to the details UI as they come in.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Wed Mar 11, 2015 8:31 am
by skynardo
I guess there is currently not a way to tell Nagios to create the new objects with the Templates that I want to use? It would be a nice feature to be able to select a number of unconfigured objects and select the Template(s) to be used when creating the objects. Also, I looked at the Bulk Mod Tool and I don't see a way to set a Host or Service Template there either.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Wed Mar 11, 2015 1:15 pm
by lmiltchev
Have you tried using the automated host management in XI? This may be another option that you can look at.

http://assets.nagios.com/downloads/nagi ... gement.pdf

Re: Cloning/copying existing passive service checks - NRDS

Posted: Wed Mar 11, 2015 3:20 pm
by skynardo
Thanks lmiltchev! That looks like a winner.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Wed Mar 11, 2015 3:22 pm
by tmcdonald
We'll leave the thread open for a bit in case you have further (related) questions.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Thu Mar 12, 2015 9:58 am
by skynardo
I was able to modify newly configured passive host/service definitions using a modified config file and the import directory. While this changed the Template for the host and services, there are "leftover" config settings for check/retry interval, max checks and check interval on the Check Settings tab as well as Notification Period and notification interval on the Alert Setting tab. These are overriding the settings in my Templates that I want to use. I next tried to use the nagiosql_delete_service.php script to try and delete the objects so I could turn around and import them back in to resolve this issue. I was able to delete the 4 servcies, but when trying to delete the host I get
[root@ut528 scripts]# ./nagiosql_delete_host.php --host=devserver111
URL: http://localhost/nagiosxi/includes/components/ccm/
Unable to delete host devserver111. Host has dependent relationships
Im not sure what the error msg is referring to or if there is some other way to accomplish this.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Thu Mar 12, 2015 10:05 am
by skynardo
Hmm, so checking Service Status in Nagios XI, I see the services were still there though the script said it successfully deleted them. I guess I need to run reconfigure_nagios.sh after service delete and before host_delete? Also, wondering what happens if nrds sends in a passive check after deletion but prior to re-import.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Thu Mar 12, 2015 10:12 am
by abrist
skynardo wrote: I guess I need to run reconfigure_nagios.sh after service delete and before host_delete?
Not necessarily, you will need to delete the services before the hosts though. You should be able to perform all the desired deletes (in the proper order) before running teh reconfigure script.
skynardo wrote:Also, wondering what happens if nrds sends in a passive check after deletion but prior to re-import.
This could actually be an issue as the service/host may be recreated by nrds before the re-import if reconfigure is run after the deletes but before the import. You may want to perform the deletes and prepare the import files before running reconfigure, that way, all actions are completed with one nagios restart.

Re: Cloning/copying existing passive service checks - NRDS

Posted: Thu Mar 12, 2015 11:58 am
by skynardo
So are unconfigured objects (both host and services) actual database objects that can be deleted using the nagiosql scripts? (Rather than configuring them, then deleting them)
If yes, then I'd like to just get the list of unconfigured objects, stage standard cfg files in the import dir for these servers, then delete the unconfigured objects and reconfigure.
If this sounds feasible I will test it out.