NRPE: Unable to read out put

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
qsteel
Posts: 31
Joined: Thu Oct 07, 2010 2:32 am

NRPE: Unable to read out put

Post by qsteel »

Hi, had emailed [email protected] on the 10th of Feb 2011 regarding an issue where i am not able to get output for a linux server.
Have not recieved any update from them yet.
Here is the issue that am having and have added the screenshots as well

.......................
I am trying to monitor the drives on a Linux server.
Am able to receive the put puts for CPU usage memory etc but not able to get the drive space information which is the most important one.
Please find the screenshot
The output that I receive are received from the NRPE plugin itself right, then why is it that it gives an error
NRPE: unable to read out for only few of the services like Disk space?

After searching online Read some where that Nagios-plugins intalaation using yum placed plugins files in some different location then desired by NRPE.
So manually installed the plugin @ cd /usr/src

Now the error message changed from Unable to read output to Check the Remote server for error message

Could you please help me on this
You do not have the required permissions to view the files attached to this post.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: NRPE: Unable to read out put

Post by mguthrie »

Sorry we missed your emails, for some reason they got filtered into our spam box.

What distro is the remote machine, and what was your installation method for nrpe? (yum, source, rpm, or apt)

From what I'm seeing in the screenshots, this looks like it could be a problem with the command definitions (or arguments). Depending on your installation method for nrpe, there are some predefined commands that seem to have worked out of the box, while there are some others that may need some tweaking. On your remote machine, can you locate your nrpe config file(s). Typically these are in the /etc/nagios or /etc/nagios/nrpe. Compare the predefined nrpe commands in those config files with the check command coming from your Nagios server. If you could show us both the commands being run from the Nagios server as well as the command definitions for NRPE on the remote machine we should be able to find the issue.
qsteel
Posts: 31
Joined: Thu Oct 07, 2010 2:32 am

Re: NRPE: Unable to read out put

Post by qsteel »

PLease find the comments i recieved frrom our LINUX admin

............................
The below is the startup of nrpe service from the xinet.d

Code: Select all

[root@qportal xinetd.d]# pwd
/etc/xinetd.d
[root@qportal xinetd.d]# cat nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor) service nrpe {
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 127.0.0.1 10.2.160.111
}
Find below the nrpe.cfg

Code: Select all

#############################################################################
# Sample NRPE Config File 
# Written by: Ethan Galstad ([email protected])
# 
# Last Modified: 11-23-2007
#
# NOTES:
# This is a sample configuration file for the NRPE daemon.  It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################


# LOG FACILITY
# The syslog facility that should be used for logging purposes.

log_facility=daemon



# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.

pid_file=/var/run/nrpe.pid



# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

server_port=5666



# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

#server_address=127.0.0.1



# NRPE USER
# This determines the effective user that the NRPE daemon should run as.  
# You can either supply a username or a UID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_user=nagios



# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.  
# You can either supply a group name or a GID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_group=nagios



# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames 
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address.  I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

allowed_hosts=127.0.0.1
 


# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.  
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! *** 
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments

dont_blame_nrpe=1



# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario: 
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing 
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don't give
# random users write access to that directory or its contents!

# command_prefix=/usr/bin/sudo 



# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on

debug=0



# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.

command_timeout=60



# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.

connection_timeout=300



# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness

#allow_weak_random_seed=1



# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.

#include=<somefile.cfg>



# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).

#include_dir=<somedirectory>
include_dir=/usr/local/nagios/etc/nrpe



# COMMAND DEFINITIONS
# Command definitions that this daemon will run.  Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on!  The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory.  Also note that you will have to modify the definitions below
# to match the argument format the plugins expect.  Remember, these are
# examples only!


# The following examples use hardcoded command arguments...

#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
#command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
#command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
#command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
#command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 


# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for 
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'.  This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

What is it that you want from the Nagios server.. could you please guide me on that part

Regards
Jeff
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: NRPE: Unable to read out put

Post by mguthrie »

What is it that you want from the Nagios server.. could you please guide me on that part
Can you show us the service definitions from the Nagios server for this host? Access the Core Config Manager->Services, and select the "Download" icon for one of the services for this particular host. That will give us the configuration file for all of the services for this host. My guess is that it's either a typo or syntax issue with the check command being sent from the Nagios server.

Also, whatever you had setup for NRPE in screenshot 1 that you sent was actually working, I think some of the commands just needs to be tweaked. I'd go back to that configuration, then we can test from there.
qsteel
Posts: 31
Joined: Thu Oct 07, 2010 2:32 am

Re: NRPE: Unable to read out put

Post by qsteel »

Hi ,

Please find below the config file for the service / Disk Usage.

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:	      2011-02-16 09:47:37
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
	host_name			QPortal-7891
	service_description		/ Disk Usage
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_disk!-a '-w 20% -c 10% -p /'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		/tmp Disk Usage
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_disk!-a '-w 20% -c 10% -p /tmp'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		/usr Disk Usage
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_disk!-a '-w 20% -c 10% -p /usr'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		Apache Web Server
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_init_service!-a 'httpd'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		CPU Stats
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_cpu_stats!-a '-w 85 -c 95'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		Memory Usage
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_mem!-a '-w 15 -c 5'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

define service {
	host_name			QPortal-7891
	service_description		Ping
	use				xiwizard_linuxserver_ping_service
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	contacts			haris,jeff
	_xiwizard			linux-server
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

Thanks & Regards
Jeff
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: NRPE: Unable to read out put

Post by mguthrie »

Your service checks and arguments on your Nagios server have to match up with the defined commands on the remote machine.

It looks like your actual config definitions on the remote machine are stored in the:
include_dir=/usr/local/nagios/etc/nrpe


On your Nagios server, if your service definition looks like this:

Code: Select all

check_command         check_nrpe!check_disk!-a '-w 20% -c 10% -p /tmp'        ; note that all of the arguments are in single quotes, making 1 ARG
The remote machine needs the command to be defined like this:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$          ;  ready to receive a single argument
Not this:

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$    ; this is set up to receive 3 ARGs

Without seeing all of your command definitions in that include directory, I can't give you the exact definitions, but I'm pretty sure this is the issue. You can set up the arguments in whatever way works best for you, as long as they match on both the remote machine and the server.
qsteel
Posts: 31
Joined: Thu Oct 07, 2010 2:32 am

Re: NRPE: Unable to read out put

Post by qsteel »

Okay now this is what i went and checked on the remote server
pls find below

Code: Select all

root@qportal nrpe]# cat common.cfg

### GENERIC SERVICES ###
command[check_init_service]=/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 $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$

Found here that the remote server has specifed a single Argument for the check service.

now how do i make sure what is the check command specified on the Nagios,

By the way i went to the path /usr/local/nagios/libexec and found check_nrpe but was not able to open it to view th config.

Guess we are almost getting there... and I really hope we do :)

Pls tell me what i need to do

THanks & Regards
Jeff
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: NRPE: Unable to read out put

Post by tonyyarusso »

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$ command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$
There should be a line break between these two command definitions.
By the way i went to the path /usr/local/nagios/libexec and found check_nrpe but was not able to open it to view th config.
/usr/local/nagios/libexec/check_nrpe is the plugin binary, not a configuration file. The items like the nrpe/common.cfg file you found are the NRPE config (which has multiple parts).
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: NRPE: Unable to read out put

Post by mguthrie »

Ok from here, lets do some testing.

On your nagios server, change to your plugins directory and run a basic nrpe check on the remote machine:

Code: Select all

cd /usr/local/nagios/libexec
./check_nrpe -H <remoteHostAddress>
NRPE v2.12                                                  ;; Should return this if NRPE is running correctly
I noticed that you mentioned installing NRPE two different ways on your system to get it to work. You need to make sure the nrpe.cfg file(s) that you're working with are actually matching the service that's running. Depending on how you installed the agent, these files can be in more than one place. Refer to the documentation you used to install the agent to find the file locations of NRPE's config files.

If NRPE is up and running correctly, you can verify the syntax of your checks from the command line:
./check_nrpe -H 192.168.5.65 -c check_disk -a '-w 20% -c 10% -p /tmp'

Modify the check command depending on how many arguments the agent is expecting. Right now the above command is sending 1 argument in a single string.
qsteel
Posts: 31
Joined: Thu Oct 07, 2010 2:32 am

Re: NRPE: Unable to read out put

Post by qsteel »

Hi sorry for the late reply..

here is the output I got from the Nagios

[root@localhost ~]# cd /usr/local/nagios/libexec
[root@localhost libexec]# ./check_nrpe -H 10.2.0.9
NRPE v2.12

Which I believe means that the NRPE is Running and working on the Nagios Server right?

I did not understand the latter part of your reply.

Could you please tell me what exactly i need to do.

And i wanted to know is there any way the support team could take this as a ticket and connect remotely to sort out this issue.
Had mailed the support team but ended up in trouble shootin the issue on the Forum itself

A remote session would be gr8 to sort this out...

Thanks & regards
Jeff
Locked