Can anyone solve my problem. I am waiting for reply.

From: Muhammad Haseeb [mailto:has...@carepvtltd.com]
Sent: Thursday, August 25, 2011 2:37 PM
To: nagios-users@lists.sourceforge.net
Subject: [Nagios-users] Problem Executing Passive Checks

Hi

I want to get information for hosts and services when user needs it using 
Service Command - Re-schedule the next check of this service in Nagios GUI. I 
write submit command in commands.cfg and in services.cfg I define passive 
service which is used that command as check command.

I used the sample script provided by Nagios for sending commands to Nagios. 
Script successfully execute in terminal but when I initiate from Nagios GUI 
using Reschedule Service Command, it gets executed and after that it gets to OK 
state with (null) plugin output every time as shown in below nagios logs.

I used the nagios 3.2.2, nagios pugins 1.4.15 and Fedora 12 32bit.

Following is the configuration, nagios log file and sample scripts.

Commands.cfg

define command{
                command_name   passive_check
                command_line   /$USER1$/submit_check_result $HOSTNAME$ 
"$SERVICEDESC$" $ARG1$
                }

Services.cfg

define service {
  use                                                       generic-service ; 
your template
  host_name                                       anjum
  service_description                      passive_test
  is_volatile                                          1 ; every change is 
logged ...
  max_check_attempts                  1 ; a change is after only 1 try ...
  active_checks_enabled              0 ; unset template's default ...
  passive_checks_enabled           1 ; ditto ...
  check_freshness                            0
  freshness_threshold                    300
  notification_options                     n ; no notifications ...
  check_command                           passive_check
}

Sample Script

echocmd="/bin/echo"

CommandFile="/usr/local/nagios/var/rw/nagios.cmd"

# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`

# create the command line to add to the command file
cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4"

# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`

Log file

[1314265019] EXTERNAL COMMAND: 
SCHEDULE_FORCED_SVC_CHECK;anjum;passive_test;1314265018
[1314265019] EXTERNAL COMMAND: 
PROCESS_SERVICE_CHECK_RESULT;anjum;passive_test;1;haseeb
[1314265029] PASSIVE SERVICE CHECK: anjum;passive_test;1;haseeb
[1314265029] SERVICE ALERT: anjum;passive_test;WARNING;HARD;1;haseeb
[1314265029] SERVICE ALERT: anjum;passive_test;OK;HARD;1;(null)
[1314265236] EXTERNAL COMMAND: 
SCHEDULE_FORCED_SVC_CHECK;anjum;passive_test;1314265235
[1314265236] EXTERNAL COMMAND: 
PROCESS_SERVICE_CHECK_RESULT;anjum;passive_test;1;haseeb
[1314265239] PASSIVE SERVICE CHECK: anjum;passive_test;1;haseeb
[1314265239] SERVICE ALERT: anjum;passive_test;WARNING;HARD;1;haseeb
[1314265239] SERVICE ALERT: anjum;passive_test;OK;HARD;1;(null)

As mention in above log, after executing my passive check, service alert is 
raised and suddenly another service alert with OK state and (null) plugin 
output is raised and visible in Nagios GUI.

Looking forward for quick response.

Thanks.

Regards
Muhammad Haseeb
Software Engineer
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to