Page 1 of 1

Nagios Core - SCHEDULE_FORCED_SVC_CHECK not working anymore

Posted: Tue Nov 06, 2018 5:30 am
by Cujka
Hello,
I am using Nagios Core 3.5.1 in Ubuntu Ubuntu 14.04.5 LTS.
Suddenly since yesterday, I am facing problem with force checks.

When I execute force check from web gui, its said "Your command request was successfully submitted to Nagios for processing."

I can even see it in nagios3.log "[1541498447] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;host.ext;Network bandwidth;1541498445"

but its actually not fired as process in system background...

When I run testing script:
now=`date +%s`
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] ADD_HOST_COMMENT;host.ext;1;Comment;Comment test" > $commandfile
It works! it ads comment to host.

But when I run:
/usr/bin/printf "[%lu] SCHEDULE_HOST_CHECK;host.ext;$NOW" > $commandfile
It doesn work! I can see in log, it was fired. But command to ping host isnt executed...

Any idea?
Thanks lot for help...
Peter.

Re: Nagios Core - SCHEDULE_FORCED_SVC_CHECK not working anym

Posted: Tue Nov 06, 2018 4:19 pm
by scottwilkerson
To be clear, are you saying the "Last Check Time" for the service isn't updating along with the check results?

Re: Nagios Core - SCHEDULE_FORCED_SVC_CHECK not working anym

Posted: Tue Nov 06, 2018 4:28 pm
by scottwilkerson
looking at your example script you have this

Code: Select all

now=`date +%s`
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] ADD_HOST_COMMENT;host.ext;1;Comment;Comment test" > $commandfile
and the command in your second line is calling $NOW which is a different case than $now and the variable wouldn't populate if you had that same this.

Let's also try this:

Code: Select all

now=`date +%s`
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] SCHEDULE_HOST_CHECK;host.ext;$now" > $commandfile

Re: Nagios Core - SCHEDULE_FORCED_SVC_CHECK not working anym

Posted: Wed Nov 07, 2018 2:35 am
by Cujka
Hello,
thanks for you reply.

After few hours of leaving server with nagios alone, I just tried it and... It works again - miracle? It fixed itself... I cant reproduce the error ;-(
I hate this situation :-(

Peter

Re: Nagios Core - SCHEDULE_FORCED_SVC_CHECK not working anym

Posted: Wed Nov 07, 2018 10:05 am
by scottwilkerson
I'm glad to hear it is working again, but I agree it's not an optimal outcome because you are going to be unable to find the root cause.