Can't get nrpe to run rrdtraf

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Can't get nrpe to run rrdtraf

Post by mkupec »

I'm having an issue trying to get the plugin check_rrdtraf to work with check_nrpe so I can monitor MRTG servers that are on a diferent linux box vs the one that is running Nagios.

I can get Nagios to run any of the example plugin's from both the system prompt and withint Nagios, however when I try and run check_rrdtraf from the system prompt to verify it's working right, all I get is the help page for check_rrdtraf.All the logs don't seem to be capturing anything, or possibly I'm looking at the wrong log file (shouldn't it be going to the nagios.log file?).

I believe I followed the instructions right for setting up NRPE, below is what I have in each ".cfg" file:

On Host machine I have added the following to the commands.cfg file:

# 'check_nrpe command' definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -C $ARG1$
}

# 'check_local_rrdtraf' command definition
define command{
command_name check_rrdtraf
command_line $USER1$/check_rrdtraf -H $HOSTADDRESS$ -f $ARG1$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}

On the remote machine, I have the following in the nrpe.cfg file:

command[check_rrdtraf]=/usr/local/nagios/lib/check_rrdtraf -f $ARG1$ -w $ARG2$ -c $ARG3$ -e $ARG4$

I also have the following in the nrpe.cfg file on the remote machine and I ran the configure script using the --enable-command-args setting:

allowed_hosts=127.0.0.1,1.2.3.82
dont_blame_nrpe=1

Check_nrpe seems to work OK with all the examples, just doesn't want to play well with check_rrdtraf when I try running it at the system prompt to test it. Below is the syntax I used at the system prompt:

# /usr/local/nagios/libexec/check_nrpe -H 1.2.3.82 \
-c check_rrdtraf /srv/www/htdocs/Server_Switch/1.2.3.15_gi1_0_1.rrd \
67108864,120795995 67108864,120795995 300

Again, when I run above, I get the help info for check_rdtraf instead of the actual results.

Anyone see anything that I'm missing?

NOTE: Host server IP: 1.2.3.80
Remote server IP: 1.2.3.82

Any help would be highly appreciated!
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Can't get nrpe to run rrdtraf

Post by agriffin »

Can you run check_rrdtraf from the command line without NRPE (locally on the system)?
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Re: Can't get nrpe to run rrdtraf

Post by mkupec »

Let me change what I wrote below - I'm assuming you mean on the remote system since that is where the rrd files are! 8-)

So at the command pormpt, on the remote system I run this:

# /usr/local/nagios/lib/check_rrdtraf -f /srv/www/htdocs/Server_Switch/10.1.4.15_gi1_0_1.rrd \
-w 67108864,120795995 -c 67018864,120795995 -e 180

and I get this as an output:

OK - Current BW in: 23.62Kbps Out: 36.40Kbps|in=23.627155Kb/s;67108864;67018864 out=36.404388Kb/s;120795995;120795995

Pretty much mathces up what I see in the routers2 info on the remote MRTG box and shows that check_rrdtraf is working on the remote MRTG system.

Just ignore the rest below - took walking my beagles to celar my head enough to realise what you were asking!


On the host system or the remote?

The host system doesn't have any part of MRTG or RRDTOOL installed in it, It's just running Nagios and it's basic install files. If I could run the check_rrdtraf form the Host machine to access files on the remote, I wouldn't need check_nrpe.

The remote system has only NRPE installed and the Nagios plugins. No Nagios there to run the plugin check_rrdtraf.

Is there a way to run check_rrdtraf without having to install Nagios on the remote system?
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Re: Can't get nrpe to run rrdtraf

Post by mkupec »

Just an additional thought here:

When I built the latest check_nrpe, it's install script placed the check_nrpe in the /usr/local/nagios/lib directpory that it created instead of the libexec directory that Nagios creates.

In the config file on the remote machines, the nrpe.cfg file references /usr/local/nagios/lib folder. It doid the same on the host machine eventhought all the other plugins are in the "./libexec/" folder. Since the Host server is expecting all the plugins in the "./libexec/' folder, I just copied the check_nrpe file into the "./libexec/" folder with the rest.

Anyway, I'm wondering if I should create a /usr/local/nagios/libexec folder on the rempote MRTG system and copy the plugins into that folder then edit the nrpe.cfg to use such folder instead of the /usr/local/nagios/lib folder.

Haven't found anything in the forum about this, but I also havcen't found too many folks having to use nrpe! eveyone must have very small network to monitor, or real fast systems that can handle running Nagios, MRTG, RRDTOOL, and routers2 all together on one machine!
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Can't get nrpe to run rrdtraf

Post by agriffin »

The folder you put your plugins into shouldn't matter as long as NRPE is pointed at them properly.
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Re: Can't get nrpe to run rrdtraf

Post by mkupec »

OK - I've started from scratch again with installing and trying to get NRPE to work.

Here's basic info on my setup:

Nagios Server: 10.20.30.80
MRTG/RRDTool: server: 10.20.30.82

Configuration changes on NAGIOS server:

File: /srv/local/nagios/etc/objects/commands.cfg

Lines added:

# 'check_rrdtraf' command definition
defince command{
command_name check_rrdtraf
command_line $USER1$/check_rrdtraf -f $ARG1$ -c $ARG2$ -w $ARG3$ -e $ARG4$
}

# 'check_nrpe' command definition
defince command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}


Configuration changes on MRTG\RRDTool server:

File: /srv/local/nagios/etc/nrpe.cfg

Lines added:

command[check_arg_rrdtraf]=/usr/local/nagios/libexec/check_rrdtraf -f $ARG1$ -w $ARG2$ -c $ARG3$ -e $ARG4$


The file check_rrdtraf is in the /usr/local/nagios/libexec folder on both systems and has identical permisionns as the pother files in that folder.


Back on the NAGIOS server, I've added this new plugin to one of the switch configuration files in the /srv/local/nagios/etc/switches folder.
The syntax I've used is as follows:

define service{
use generic-service
host_name Server_Switch
service_description GigabitEthernet 1/0/1
check_command check_nrpe! -H 10.20.30.82 -c check_rrdtraf - /srv/www/htdocs/Server_Switch.10.20.30.15_gi1_0_1.rrd 67108864,120795995 67108864,120795995 180
}

The above checks out ok using the "nagios -v nagios.cfg" check so I the restart the service to load the config.

Only result I get in Nagios is a response that there's "No output returned from plugin" for the specific interface.

If I run the above from the command line on the Nagios box, I get the following results:

NetMon-NAGIOS:~ # /usr/local/nagios/libexec/check_nrpe -H 10.1.4.82 -c check_arg_rrdtraf -a /srv/www/htdocs/Server_Switch/10.1.4.15_gi1_0_1.rrd 67108864,120795995 67108864,120795995 180
OK - Current BW in: 585.75Kbps Out: 600.01Kbps|in=585.753407Kb/s;67108864;67108864 out=600.010759Kb/s;120795995;120795995
NetMon-NAGIOS:~ #

It looks like from the command line on the Nagios server, I can get data back from the MRTG/RRDTool server, however the Nagios APP is still having issues. What am I doing wrong here? Has anyone had success running NRPE using anything but the examples listed with it? Considering it hasn't had and activity with the file since 2008, I'm surprised it's expected to work today under openSUSE 12.1. Am I just wasting my time trying tpo get the plugin to work properly?
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Can't get nrpe to run rrdtraf

Post by agriffin »

Can you run your command line test again, but this time as the nagios user rather than root?

Code: Select all

su nagios -s /bin/bash -c '/usr/local/nagios/libexec/check_nrpe -H 10.1.4.82 -c check_arg_rrdtraf -a /srv/www/htdocs/Server_Switch/10.1.4.15_gi1_0_1.rrd 67108864,120795995 67108864,120795995 180'
If that fails, then you probably have a permission problem somewhere. Can the nagios user read the rrd files you're telling it to check?
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Re: Can't get nrpe to run rrdtraf

Post by mkupec »

I hought that might bewhat it was, however here are the results:

login as: root
Using keyboard-interactive authentication.
Password:
Last login: Mon Jul 2 12:52:28 2012 from 10.1.4.90
Have a lot of fun...
NetMon-Nagios:~ # su nagios -s /bin/bash -c '/usr/local/nagios/libexec/check_nrpe -H 10.1.4.82 -c check_arg_rrdtraf -a /srv/www/htdocs/Server_Switch/10.1.4.15_gi1_0_1.rrd 67108864,120795995 67108864,120795995 180'
OK - Current BW in: 483.01Kbps Out: 550.01Kbps|in=483.013813Kb/s;67108864;67108864 out=550.012648Kb/s;120795995;120795995
NetMon-Nagios:~ # ^C

FWIW - below is what I see on the one interface I've applied this to:

Current Status: UNKNOWN (for 4d 0h 35m 58s)
Status Information: (No output returned from plugin)
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.13
Last Modified: 11-11-2011
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

Usage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]

Options:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.

Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.

Performance Data:
Current Attempt: 3/3 (HARD state)
Last Check Time: 07-02-2012 12:55:44
Check Type: ACTIVE
Check Latency / Duration: 0.214 / 0.006 seconds
Next Scheduled Check: 07-02-2012 13:05:44
Last State Change: 06-28-2012 12:24:18
Last Notification: 07-02-2012 12:25:53 (notification 96)
Is This Service Flapping? NO (0.00% state change)
In Scheduled Downtime? NO
Last Update: 07-02-2012 13:00:13 ( 0d 0h 0m 3s ago)
mkupec
Posts: 11
Joined: Mon Jun 18, 2012 9:45 am

Re: Can't get nrpe to run rrdtraf

Post by mkupec »

Working on this a bit further - since I'm not certain if it's NRPE or RRDTRAF that is causing the problme, I thought I'd isolate it by having NRPE run some other known working nagios pkugin. So I set up a new service on the MRTG/RRDTOOL server to check the switch using check_ping plugin.

In the nrpe.cfg file on the MRTG/RRDTOOL server, I set up the following command:

command[check_arg_ping]=/usr/local/nagios/libexec/check_ping -H $ARG1$ -w $ARG$ -c $ARG$

On the NAGIOS server, I added the following service to one of the switches config file:

define service{
use generic-service
host_name Server-Switch
service_description PING_Local
check_command check_nrpe!check_arg_ping -a 10.1.4.15 200.0,20% 600.0,60%
normal_check_interval 5
retry_check_interval 1
}

Needless to say, the above command doesn't work, I get a similiar error message in the listing for the Server Switch in Nagios, it's listed as an "UNKNOWN" status and when I click on the service PING_Local, the status info is similiar to what check_rrdtraf lists (it's basically the help listing from the plugin - as though you ran check_ping --help)

Somewhere in troubleshooting this, I found that if I do the following in a command window on the MRTG/RRDTRAF server:

NetMon2:/ # /usr/local/nagios/bin/nrpe --help

It displays the help info along with the two security risks (see below). In the second security risk, it's saying that TCP WRAPPERS is not available, however I know I have that set up (see further down):

NRPE - Nagios Remote Plugin Executor
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.13
Last Modified: 11-11-2011
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required

***************************************************************
** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **
** Read the NRPE SECURITY file for more information **
***************************************************************

***************************************************************
** POSSIBLE SECURITY RISK - TCP WRAPPERS ARE NOT AVAILABLE! **
** Read the NRPE SECURITY file for more information **
***************************************************************
........rest of help info cut off so save space .............


Below is how I verified that TCP WRAPPERS is correctly configured.

NetMon2:/ # netstat -an | grep tcp | grep LISTEN
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
NetMon2:/ # netstat -at | grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
NetMon2:/ #


I'm contemplating re-compiling the NRPE agaoin on this box and making sure all the libraries did get inclkuded in the build, other than that, I'm stumped as to why this isn't working.
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Can't get nrpe to run rrdtraf

Post by agriffin »

I would give the recompilation a try. It really should be able to find tcp_wrappers if you're using it. That part really makes me think it's a library issue with your build of NRPE.
Locked