[Nagiosplug-devel] Remote execution of plugins reporting localresults

Marc Powell marc at ena.com
Thu Aug 7 19:50:09 CEST 2008



> -----Original Message-----
> 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 12: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'.

Hello!

> 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).

Nagios doesn't lie, of course... HostA is the host running nagios, isn't
it?

> #!/bin/sh
> 
> #
> 
> # ## Plugin for Nagios to tell if it lies :)
> 

Simple indeed.

> Here is your command information:

>       command_line      /usr/lib/nagios/plugins/check_test

Ok

> 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


>       check_command   check_test
> 
>  }
> 
> define service{
> 
>       # Name of service template to use
> 
>       use    generic-service
> 
>       host_name   node02.rhc1

>       check_command   check_test
> 
>  }
> 
> define service{
> 
>       # Name of service template to use
> 
>       use    generic-service
> 
>       host_name   node03.rhc1

>       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? :-)

How are you telling nagios that it's supposed to 'connect' to the remote
machines? How is nagios to know how to do that (telnet? ssh? rpc?
Other?). Nagios always runs plugins on the machine nagios is running on.
Always. Either the plugin itself needs to know how to connect to the
remote hosts and 'do it's thing' or you need to use a wrapper to do that
for you. Common wrappers are NRPE and check-by-ssh for example. They
contain the knowledge of how to connect to remote machines and run
plugins installed there, returning the results back to nagios.

--
Marc
 





More information about the Devel mailing list