I didn't see anything in the ncpa_passive.log.
I think there is a feature/bug in the way that the nrds.pl and crontab entry work for ncpa passive client checks.
If there is a problem with the token identity, port or script argument, everything works like it should returning an error to the nagios server. However if the plugin script provided to ncpa_check won't execute (doesn't exist or something else) that causes the output to return a single newline ... with two side effects.
1) The check fails in such a way to allow an active takeover of the service check by the nagios server. This is a good thing.
2) The check remains in a failed state with no error or update. If there is no active takeover, monitoring on this service check is lost without notification. Adding the active takover helps, but there is still no notification of a problem, so the client issue will never get fixed.
Is this the expected behavior? Am I doing something wrong?
I've tested some minor modifications which could address this issue by
1) adding a check at the beginning of nrds.pl to see if the ncpa_posix_listener process is running. If not, don't do anything further. This assumes that ncpa is in use and is not a general solution, but the idea is to somehow inhibit the nrds.pl from running.
2) Check for an empty output result and generate a output string to pass back to the nagios server, thereby providing enough data to update the nagios server.
If there is a problem with the client script while the listener is running, you could get a flapping state between errors and a valid state. (This is most likely if the service check is out of sync with it's command line from the nrds config file.) Still, you will get an error.
I also added a verbose option to display what nrds.pl is doing to help understand what's happening.
Here's the diff on the code between version 0.1 and what I added...
Code: Select all
root@kchenowe-ubuntu:/usr/local/nrdp/clients/nrds# diff nrds.pl nrds.pl.original
14c14
< my $RELEASE = "Revision 0.1a"; # this script modified by Kendall Chenoweth
---
> my $RELEASE = "Revision 0.1";
52,59d51
< $cannot_execute_script = 0;
< $listener_running = `ps -eaf | grep ncpa_posix_listener | grep -v grep | wc -l`;
< if ($listener_running < 1)
< {
< print ("NCPA listening process is not active\n");
< exit 1;
< }
<
68d59
< "verbose|v" => \$verbose,
101d91
< chop ($output);
108d97
<
113,117d101
< if ($output eq "")
< {
< $output = "Unknown error occured processing plugin";
< $cannot_execute_script = 1;
< }
121,124d104
< if ($cannot_execute_script)
< {
< system ("echo \"ERROR: $output ($status) - $cmd\" >> /usr/local/nrdp/clients/nrds/nrds.log");
< }
126,129d105
< if ($verbose)
< {
< print ("Sending output from $cmd\n\toutput=$output\n\tstatus=$status\n\tsenddata=$senddata\n");
< }