RESTART_PROGRAM ext command not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Pradeeps
Posts: 38
Joined: Thu Dec 22, 2016 11:05 am

RESTART_PROGRAM ext command not working

Post 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?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: RESTART_PROGRAM ext command not working

Post by cdienger »

It is performing a reload. It's like running "service nagios reload" instead of "service nagios restart".
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pradeeps
Posts: 38
Joined: Thu Dec 22, 2016 11:05 am

Re: RESTART_PROGRAM ext command not working

Post by Pradeeps »

That makes sense now. However, I dont see any new changes being reflected.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: RESTART_PROGRAM ext command not working

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pradeeps
Posts: 38
Joined: Thu Dec 22, 2016 11:05 am

Re: RESTART_PROGRAM ext command not working

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: RESTART_PROGRAM ext command not working

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked