Page 1 of 1

monitoring with NRPE

Posted: Tue Mar 19, 2013 8:50 pm
by jtorre08
Using RHEL 6.1 OS. Downloaded NRPE (linux-nrpe-agent.tar.gz) from Nagios site to remote monitered server. Trying to use NRPE to monitor a remote server; most if not all NRPE remote commands come back as "not defined" or "could not parse arguments". I've found only on remote command that works, "check_procs".

Re: monitoring with NRPE

Posted: Wed Mar 20, 2013 9:12 am
by slansing
Can you show us an example of the a command that is failing, along with the consoles full output?

check_procs most likely works because it does not require any arguments to return a value, it can, but by default it will just output all of the processes running on the system. But we do know from this that the NRPE agent is reachable by Nagios.

Re: monitoring with NRPE

Posted: Wed Mar 20, 2013 9:12 am
by abrist
Which remote commands have you tried? The linux-server-agent from the XI wizard should have the following check commands in the file "common.cfg":

Code: Select all

### GENERIC SERVICES ###
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$

### YUM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$

Re: monitoring with NRPE

Posted: Wed Mar 20, 2013 5:42 pm
by jtorre08
slansing wrote:Can you show us an example of the a command that is failing, along with the consoles full output?

check_procs most likely works because it does not require any arguments to return a value, it can, but by default it will just output all of the processes running on the system. But we do know from this that the NRPE agent is reachable by Nagios.

Below are examples of some commands that are failing, along with the consoles full output. I show commands ran from NagiosXI server (generated by wizard) and command line command ran on remote monitored server.

Example:1
--nagiosXI server:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c check_users
OUTPUT:
Usage:check_users -w -c

--remote monitored servere (myserver): tested iin both /opt/nagios-3.2.2/libexec/ and /opt/nagios/libexec/
./check_users -w 5 -c 10
USERS OK - 4 users currently logged in |users=4;5;10;0

Example:2
--nagiosXI server:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c 5.0,4.0,3.0 10.0,6.0,4.0
OUTPUT: NRPE: Command '5.0,4.0,3.0' not defined

--remote monitored servere (myserver): tested iin both /opt/nagios-3.2.2/libexec/ and /opt/nagios/libexec/
./check_load -w 15,10,5 -c 30,25,20
OK - load average: 0.27, 0.23, 0.17|load1=0.270;15.000;30.000;0; load5=0.230;10.000;25.000;0; load15=0.170;5.000;20.000;0;

Example:3 (THIS ONE WORKS)
--nagiosXI server:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c check_procs
OUTPUT: PROCS OK: 298 processes

--remote monitored servere (myserver): tested iin both /opt/nagios-3.2.2/libexec/ and /opt/nagios/libexec/
./check_procs
PROCS OK: 296 processes

Re: monitoring with NRPE

Posted: Wed Mar 20, 2013 5:53 pm
by jtorre08
Can not find /locate file "common.cfg" on server.
Some of the remote commands I have tried are:
check_apt check_dns check_mailq check_swap check_breeze check_ifoperstatus check_mem.pl check_by_ssh check_ntp_time check_time
check_clamd check_cluster check_fping check_nagios check_dhcp check_ftp check_users check_dig check_ping check_disk check_http check_load check_nrpe check_ssh check_procs

Re: monitoring with NRPE

Posted: Thu Mar 21, 2013 6:59 am
by scottwilkerson
jtorre08 wrote:Can not find /locate file "common.cfg" on server.
It should be in /usr/local/nagios/etc/nrpe/

Re: monitoring with NRPE

Posted: Sat Mar 23, 2013 1:22 pm
by jtorre08
scottwilkerson wrote:
jtorre08 wrote:Can not find /locate file "common.cfg" on server.
It should be in /usr/local/nagios/etc/nrpe/

Found file "common.cfg" in remote monitored server; Yes it has the same exact commands as listed in your 1st response posting. File does not exist on Nagiosxi server.

Re: monitoring with NRPE

Posted: Mon Mar 25, 2013 9:25 am
by abrist
jtorre08 wrote: Example:1
--nagiosXI server:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c check_users
OUTPUT:
Usage:check_users -w -c
This command expects warning and critical passed to it. You will need to add the warning and critical thresholds to the check in XI for $ARG2$:

Code: Select all

$ARG2$: -a '-w 5 -c 10'
Example:2
--nagiosXI server:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c 5.0,4.0,3.0 10.0,6.0,4.0
OUTPUT: NRPE: Command '5.0,4.0,3.0' not defined
This command is missing the actual command name. Try:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_nrpe -H myserver-t 30 -c check_load 
$ARG2$:  -a '-w 15,10,5 -c 30,25,20'   

Re: monitoring with NRPE

Posted: Mon Mar 25, 2013 9:39 am
by lmiltchev
Yes, the "common.cfg" must be on the client machine. Open it, and see what commands you have defined there. For example, you might have:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
From the nagios server, you can use this command by running:

Code: Select all

cd /usr/local/nagios/libexec/
./check_nrpe -H <client_IP> -t 30 -c check_users -a '-w 2 -c 5'
Build your other checks in a similar way. You can view usage by running the plugin with the "-h" flag, for example:

Code: Select all

./check_users -h
check_users v1.4.16 (nagios-plugins 1.4.16)
Copyright (c) 1999 Ethan Galstad
Copyright (c) 2000-2007 Nagios Plugin Development Team
        <[email protected]>

This plugin checks the number of users currently logged in on the local
system and generates an error if the number exceeds the thresholds specified.


Usage:
check_users -w <users> -c <users>

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 -w, --warning=INTEGER
    Set WARNING status if more than INTEGER users are logged in
 -c, --critical=INTEGER
    Set CRITICAL status if more than INTEGER users are logged in
Is there a command, that is defined in the "common.cfg" file on the client, but you are not able to setup a check in XI with it?