[Nagiosplug-devel] Remote execution of plugins reporting local results
Caron, Chris
caronc at navcanada.ca
Thu Aug 7 19:34:14 CEST 2008
Hi Everyone,
I'm new to Nagios as well as this community, and am having a small issue
with the development of a 'Nagios plugin'.
All existing plug-ins I use, as well as the ones found on NagiosExchange
seem to work great... however I wrote a simple script following the
rules (or so I think) which outputs perfectly on my Nagios console. The
problem is; Nagios seems to be executing this script locally and placing
its result on each host (on the web interface).
The tool I run is fairly complicated, but if I strip out all the content
and do a simple file count in a directory, I get the same results.
Assume 3 hosts: HostA, HostB, and HostC where HostA runs the web
application. The output on all 3 hosts always pertains to what is on
HostA. Essentially 'Nagios' is 'lying' :-) to me when it reports
information on other hosts (but for this plugin only).
To reproduce this (the code is significantly reduced to avoid making
this email larger then it already is), just make a simple check_test
plugin (in the plugin dir) with this content:
#!/bin/sh
#
# ## Plugin for Nagios to tell if it lies :)
# Usage: ./check_test
STATE_OK=0
COUNT=$(ls /tmp | wc -l)
MESG="OK - $COUNT"
EXITSTATUS=$STATE_OK
echo "$MESG"
exit $EXITSTATUS
Here is your command information:
define command{
command_name check_test
command_line /usr/lib/nagios/plugins/check_test
}
Here is the service information (update the host x3):
# Service definition
define service{
# Name of service template to use
use generic-service
host_name node01.rhc1
service_description Test
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_test
}
define service{
# Name of service template to use
use generic-service
host_name node02.rhc1
service_description Test
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_test
}
define service{
# Name of service template to use
use generic-service
host_name node03.rhc1
service_description Test
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_test
}
The output from the above on my machine reports 'OK - 14' on each and
every host in Nagios. There are in-fact '14' files on Node 01 (host A
as per the example above), but there is a completely different file
count on the other 2 nodes. Why does Nagios fill in the results from the
host using the 'www' package in replace of all other hosts for 'only'
this plugin? Or... to rephrase the question: what am I doing wrong? :-)
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20080807/0f62aa6a/attachment.html>
More information about the Devel
mailing list