[Nagiosplug-devel] Remote execution of plugins reporting localresults

Andrew Cruse andrew at profitability.net
Thu Aug 7 19:41:16 CEST 2008


All you're doing there is checking for the number of files in /tmp on your
Nagios server with all three checks.  If you need those checks to run on
other servers, you'll need to investigate something like NRPE, check_by_ssh,
or any of the other remote check tools available.
 
Andrew

  _____  

From: nagiosplug-devel-bounces at lists.sourceforge.net
[mailto:nagiosplug-devel-bounces at lists.sourceforge.net] On Behalf Of Caron,
Chris
Sent: Thursday, August 07, 2008 1:34 PM
To: nagiosplug-devel at lists.sourceforge.net
Subject: [Nagiosplug-devel] Remote execution of plugins reporting
localresults



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

 

 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.12/1597 - Release Date: 8/7/2008
5:54 AM


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20080807/a8a4191d/attachment.html>


More information about the Devel mailing list