Page 1 of 1

RESTART_PROGRAM ext command not working

Posted: Wed Dec 05, 2018 12:20 pm
by Pradeeps
Hello Folk,

I am using Nagiosql frontend (3.4) for the core (4.2.4). I noticed "Restart Nagios - Do it" not actually restarting the nagios daemon. Doing some research on that, I got below code which I can try through cli.

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the RESTART_PROGRAM command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/bin/printf "[%lu] RESTART_PROGRAM\n" $now > $commandfile

However, even after running the above script, I see it makes no difference. I see this in the log when i run the script ,

Code: Select all

Dec  5 16:34:17 nagios-core-4 nagios: EXTERNAL COMMAND: RESTART_PROGRAM;
Dec  5 16:34:17 nagios-core-4 nagios: PROGRAM_RESTART event encountered, restarting...
but its not actually restarting the daemon. Can anyone give your ideas if am missing anything?

Re: RESTART_PROGRAM ext command not working

Posted: Thu Dec 06, 2018 2:37 pm
by cdienger
It is performing a reload. It's like running "service nagios reload" instead of "service nagios restart".

Re: RESTART_PROGRAM ext command not working

Posted: Mon Dec 10, 2018 4:13 pm
by Pradeeps
That makes sense now. However, I dont see any new changes being reflected.

Re: RESTART_PROGRAM ext command not working

Posted: Tue Dec 11, 2018 5:38 pm
by cdienger
You may need to refresh your browser or clarify how you tested. I tested by making a small change to a hostname, ran the restart script, and then refreshed the page and could see the change was applied.

Re: RESTART_PROGRAM ext command not working

Posted: Thu Jan 24, 2019 11:35 am
by Pradeeps
Apologies for the delayed response. The way I am testing is, after I hit "Restart Nagios" in nagioql, I login to "thruk" to see if there is any changes being reflected but I see none. However I can see after running "service nagios restart" through cli.

Re: RESTART_PROGRAM ext command not working

Posted: Thu Jan 24, 2019 3:51 pm
by cdienger
Are you sure nagiosql is in fact running the RESTART_PROGRAM command? Is it successfully writing the config changes to disk(/usr/local/nagios/etc/objects/) before doing so?

Given both nagiosql and thruk are third party tools, a better test of the nagios system would be to make a change to a config file(usr/local/nagios/etc/objects/), run the script again, and then look for the change in the Nagios web interface.