Page 1 of 1

Automatic writing of config files + restart with nagiosql

Posted: Mon Jan 31, 2011 6:43 pm
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

Re: Automatic writing of config files + restart with nagiosql

Posted: Tue Feb 01, 2011 10:36 am
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.

Re: Automatic writing of config files + restart with nagiosql

Posted: Tue Feb 01, 2011 12:41 pm
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

Re: Automatic writing of config files + restart with nagiosql

Posted: Tue Feb 01, 2011 2:17 pm
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!