Automatic writing of config files + restart with nagiosql

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
kjamieson
Posts: 5
Joined: Mon Aug 02, 2010 6:16 pm

Automatic writing of config files + restart with nagiosql

Post by kjamieson »

We recently upgraded to 2009R1.4, and while the upgrade worked fine it unfortunately ended up breaking a script that I was using to automate restarting Nagios. Essentially, I am adding hosts into the NagiosQL database and was then using curl to login to NagiosXI and apply the changes. NagiosQL would write out its contents to config files, Nagios XI would restart, and my new hosts/services would be running.

I realize that NagiosQL doesn't have a commandline or an API to trigger something like this, so I'm wondering if anyone else in the Nagios XI community has a script that would do this in a better way. I might be able to rewrite the curl script but given the changes with the Javascript to fix a security problem, I don't want to spend time on it if there is a better way.

Kevin
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Automatic writing of config files + restart with nagiosql

Post by mguthrie »

Take a look at the /usr/local/nagiosxi/scripts directory. The "reconfigure_nagios.sh" executes the same processes as the "Apply Configuration" button in XI. There are other scripts in there that also execute processes for NagiosQL as well.
kjamieson
Posts: 5
Joined: Mon Aug 02, 2010 6:16 pm

Re: Automatic writing of config files + restart with nagiosql

Post by kjamieson »

Wow, that is awesome. Wish I'd found those scripts awhile ago - thanks so much for pointing them out! Life just got a little easier..

Kevin
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Automatic writing of config files + restart with nagiosql

Post by mguthrie »

Yeah, we use them more for support and installation stuff, but if you're automating things with scripts I'd imagine those can be pretty handy. Good luck!
Locked