Nagios Training: Create a Passive Service Check

by Mike on September 15, 2009 · 1 comment

in Nagios

Create a Passive Service Test
Now the real work begins.  The test script is a way to check to see if your client is connecting to the Nagios server passively. This script is placed on the client and should produce results on the Nagios server.

Lesson 5 | Lesson 7

/bin/echo $CMD | /usr/sbin/send_nsca -H -d ‘;’ -c $CFG

Here is a common error you will see in /var/log/messages on the Nagios server, “service could not be found”.
Sep 10 16:42:31 fw3 nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;nagpass;ssh;2;test
Sep 10 16:42:31 fw3 nagios: Warning:  Passive check result was received for service ‘ssh’ on host ‘nagpass’, but the service could not be found!
The solution is all in the set up on the Nagios server and client so they are communicating correctly.

Configure the Web Interface to Accept the Passive Service  Checks
In order to get the web interface working correctly you need to use a dummy service definition as Nagios requires a host/service combination to use the web interface.

Now if you closely examine the test script above you will see the CMD variable is the key to avoiding problems.  The “Processes” is the name that must also be placed in the service definition on the Nagios server.  The service_description is key to the communication.


Here is an example dummy service for the services.cfg.
define service{
use                     generic-service
host_name               nagpass
service_description     Processes
check_command           check_null
passive_checks_enabled  1
active_checks_enabled   0
flap_detection_enabled  0
because this is passive the check_command needs to be a dummy command.  Here is the dummy command that needs to be entered into the commands.cfg file.  Remember that all commands need to be defined.

define command{
command_name    check_null
command_line    /bin/true
When you run the test script you should see that the Nagios server is processing the information in the logs.

Previous post:

Next post: