Problem Executing Passive Checks
Muhammad Haseeb
haseeb at carepvtltd.com
Mon Aug 29 06:50:27 CEST 2011
In terminal logged in as nagios, check executed successfully but problem arise when I reschedule the service and it gets to OK state.
Is there any problem in executing custom checks using GUI.
How can I execute custom checks from GUI.
Looking forward to your reply.
Regards
Muhammad Haseeb
From: Martin Hugo [mailto:Martin_Hugo at hboe.org]
Sent: Friday, August 26, 2011 6:56 PM
To: 'Nagios Users List'
Subject: Re: [Nagios-users] Problem Executing Passive Checks
Try the check from terminal as the same user as GUI and see what happens.
Marty
From: Muhammad Haseeb [mailto:haseeb at carepvtltd.com]<mailto:[mailto:haseeb at carepvtltd.com]>
Sent: Friday, August 26, 2011 9:11 AM
To: Nagios Users List
Subject: Re: [Nagios-users] Problem Executing Passive Checks
Yes, I used terminal as root user and from GUI script executed logged in nagios.log file.
From: Martin Hugo [mailto:Martin_Hugo at hboe.org]<mailto:[mailto:Martin_Hugo at hboe.org]>
Sent: Friday, August 26, 2011 5:52 PM
To: 'Nagios Users List'
Subject: Re: [Nagios-users] Problem Executing Passive Checks
A GUI instigated check may run under a different username than that used in a terminal script. Were you root in terminal?
Marty
From: Muhammad Haseeb [mailto:haseeb at carepvtltd.com]<mailto:[mailto:haseeb at carepvtltd.com]>
Sent: Friday, August 26, 2011 8:05 AM
To: Nagios Users List
Subject: Re: [Nagios-users] Problem Executing Passive Checks
Can anyone solve my problem. I am waiting for reply.
From: Muhammad Haseeb [mailto:haseeb at carepvtltd.com]<mailto:[mailto:haseeb at carepvtltd.com]>
Sent: Thursday, August 25, 2011 2:37 PM
To: nagios-users at lists.sourceforge.net<mailto:nagios-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20110829/58390b87/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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
More information about the Users
mailing list