I have Nagios/NSCA setup for a perl custom script that runs on the nagioshost.
I have it configured like:
echo "myhost;myservice;1;Message"|/usr/local/nagios/libexec/send_nsca -to 10 -d ';' -c /etc/send_nsca.cfg -H localhost
It works flawlessly..
So my query, is there a way in Nagios or NSCA to count the passive checks?
i.e. the no of times Nagios receives a alert for myservice
on myhost
Note: the custom script never sends 'OK' for a service
You could configure
nsca
(daemon) to output debugging to syslog by setting thedebug = 1
in nsca.cfg. Make sure the debug option doesn't appear multiple times with different values in the config file, or it could be overridden. Happened to me :).nsca.cfg:
Example output in /var/log/messages on CentOS 7:
The next step is to process the logs to get the info/numbers you want. There are lots of ways to do that...
Example as you requested: the no of times Nagios receives a alert for myservice on myhost
Here you see processing the log show there is 1 entry that matches your criteria.
If you can script or program, you can probably write something that will work quite well even for many client hosts submitting passive checks once you have this data in your logs.