[Nagiosplug-help] NRPE returns correct data, while Nagios shows "No Output"

Ralph.Grothe at itdz-berlin.de Ralph.Grothe at itdz-berlin.de
Thu Jan 17 09:29:09 CET 2008


Hi James,

I am not sure if my constraints are comparable to yours,
but here's the method how I get around having nrpe run commands
that require elevated privileges.

Though in this simple case it would have been easy to just make
the /var/log/messages world readable on this nrpe node
I didn't want to interfere with the policies of the owners/admins
of this host.
So I created a simple sudo rule that allows user nagios to
execute the command that I defined in nrpe.cfg
to parse the messages syslog file for entries from the kernel.


The nrpe daemon is spawned by xinetd and runs under nagios' uid.

$ grep user /etc/xinetd.d/nrpe 
        user            = nagios

The sudo rule for nagios allows him to run the check_log2.pl
script (in contrib subdir of standard Nagios-Plugins)
under euid of root.

$ sudo -l
User nagios may run the following commands on this host:
    (root) NOPASSWD:
/usr/lib64/nagios/plugins/contrib/check_log2.pl


And this is how the nrpe command is defined

$ grep check_syslog /etc/nagios/nrpe.cfg
command[check_syslog_VMUNIX]=/usr/bin/sudo
/usr/lib64/nagios/plugins/contrib/check_log2.pl -l
/var/log/messages -s /tmp/messages.log_seek_kernel.txt -p kernel


This would be called from the Nagios server as usual as

$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

with $ARG1$ being "check_syslog_VMUNIX" in my case
and passed in within the respective service definition.

HTH


-----Original Message-----
From: nagiosplug-help-bounces at lists.sourceforge.net
[mailto:nagiosplug-help-bounces at lists.sourceforge.net]On Behalf
Of James Bewley
Sent: Wednesday, January 16, 2008 5:44 PM
To: nagiosplug-help at lists.sourceforge.net
Subject: [Nagiosplug-help] NRPE returns correct data,while Nagios
shows "No Output"


Hi all, 

I've written some custom plugins that monitor some software
around a cluster.  I can run them on the individual cluster nodes
with "sudo -u /usr/local/nagios/libexec/plugin.pl" and i get a
single line printed to stdout and the correct return value. 

All looks good?

So then I run the nrpe client on the nagios server to retrieve
the values returned from the plugin like so:
"sudo -u nagios /usr/local/nagios/libexec/check_nrpe -H
cluster_node -t 30 -c check_remote_plugin" 

Which also prints the expected string and return value ( which is
something like "plugin:OK blahh text \n")
and returns the correct value ( 0 in this OK state).

So far so good?

But when I go to the nagios servers web page (status grid) I get
WARNING "(No output!)" 

I've been scratching my head about this for a while now, can
anyone over a solution??

James
james at avbrief dot com




More information about the Help mailing list