on the remote host? i need to install nagios there? i found some things on google about nrpe but don't quite understand what it is or for.
Main Topics
Browse All TopicsHow can I use nagios to check for disk space on a remote machine?
I'm running 3RC2 on Fedora 8. Been looking around and not getting too far.
I have hosts setup and disk checks...but I discovered that it is actually checking the local system, not the remote. Here is the command:
define service{
use local-service ; Name of service template to use
host_name myserver
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
define service{
use local-service ; Name of service template to use
host_name myserver
service_description boot
check_command check_local_disk!20%!10%!/
}
and so on for /usr /var etc...
in the commands.cfg, i have this for the command line:
# 'check_local_disk' command definition
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
I understand it's checking the local drive...need to check space on the remote drives.
Other remote checks like cpu, http are working fine remotely.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
NRPE is a remote monitoring utility for Nagios...
"The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. The main reason for doing this is to allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines. Since these public resources are not usually exposed to external machines, an agent like NRPE must be installed on the remote Linux/Unix machines."
Instructions are below
Good Luck
M
In order to use the NRPE addon, you'll need to perform some tasks on both the monitoring host and the remote Linux/Unix host that the NRPE daemon is installed on. I'll cover both of these tasks separately.
1. Remote Host Setup
These instructions should be completed on the remote Linux/Unix host that the NRPE daemon will be installed on. You'll be installing the Nagios plugins and the NRPE daemon...
i. Create Account Information
Become the root user.
# su -
Create a new nagios user account and give it a password.
# /usr/sbin/useradd nagios
# passwd nagios
ii. Install the Nagios Plugins
Create a directory for storing the downloads.
# mkdir ~/downloads
# cd ~/downloads
Download the source code tarball of the Nagios plugins (visit http://www.nagios.org/down
# wget http://osdn.dl.sourceforge
Extract the Nagios plugins source code tarball.
# tar xzf nagios-plugins-1.4.6.tar.g
# cd nagios-plugins-1.4.6
Compile and install the plugins.
# ./configure
# make
# make install
The permissions on the plugin directory and the plugins will need to be fixed at this point, so run the following commands.
# chown nagios.nagios /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/libexec
iii. Install the NRPE daemon
Download the source code tarball of the NRPE addon (visit http://www.nagios.org/down
# cd ~/downloads
# wget http://osdn.dl.sourceforge
Extract the NRPE source code tarball.
# tar xzf nrpe-2.8.tar.gz
# cd nrpe-2.8
Compile the NRPE addon.
# ./configure
# make all
Install the NRPE plugin (for testing), daemon, and sample daemon config file.
# make install-plugin
# make install-daemon
# make install-daemon-config
Install the NRPE daemon as a service under xinetd.
# make install-xinetd
Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.
only_from = 127.0.0.1 <nagios_ip_address>
Add the following entry for the NRPE daemon to the /etc/services file.
nrpe 5666/tcp # NRPE
Restart the xinetd service.
# service xinetd restart
iv. Test the NRPE daemon locally
Its time to see if things are working properly...
Make sure the nrpe daemon is running under xinetd.
# netstat -at | grep nrpe
The output out this command should show something like this:
tcp 0 0 *:nrpe *:* LISTEN
If it does, great! If it doesn't, make sure of the following:
You added the nrpe entry to your /etc/services file
The only_from directive in the /etc/xinetd.d/nrpe file contains an entry for "127.0.0.1"
xinetd is installed and started
Check the system log files for references about xinetd or nrpe and fix any problems that are reported
Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.
# /usr/local/nagios/libexec/
You should get a string back that tells you what version of NRPE is installed, like this:
NRPE v2.8
v. Open firewall rules
Make sure that the local firewall on the machine will allow the NRPE daemon to be accessed from remote servers.
To do this, run the following iptables command. Note that the RH-Firewall-1-INPUT chain name is Fedora-specific, so it will be different on other Linux distributions.
# iptables -I RH-Firewall-1-INPUT -p tcp -m tcp dport 5666 -j ACCEPT
Save the new iptables rule so it will survive machine reboots.
# service iptables save
2. Monitoring Host Setup
On the monitoring host (the machine that runs Nagios), you'll need to do just a few things:
Install the check_nrpe plugin
Create a Nagios command definition for using the check_nrpe plugin
Create Nagios host and service definitions for monitoring the remote host
These instructions assume that you have already installed Nagios on this machine according to the quickstart installation guide. The configuration examples that are given reference templates that are defined in the sample localhost.cfg and commands.cfg files that get installed if you follow the quickstart.
i. Install the check_nrpe plugin
Become the root user. You may have to use sudo -s on Ubuntu and other distros.
# su -
Create a directory for storing the downloads.
# mkdir ~/downloads
# cd ~/downloads
Download the source code tarball of the NRPE addon (visit http://www.nagios.org/down
# wget http://osdn.dl.sourceforge
Extract the NRPE source code tarball.
# tar xzf nrpe-2.8.tar.gz
# cd nrpe-2.8
Compile the NRPE addon.
# ./configure
# make all
Install the NRPE plugin.
# make install-plugin
ii. Test communication with the NRPE daemon
Make sure the check_nrpe plugin can talk to the NRPE daemon on the remote host. Replace "192.168.0.1" in the command below with the IP address of the remote host that has NRPE installed.
# /usr/local/nagios/libexec/
You should get a string back that tells you what version of NRPE is installed on the remote host, like this:
NRPE v2.8
If the plugin returns a timeout error, check the following:
Make sure there isn't a firewall between the remote host and the monitoring server that is blocking communication
Make sure that the NRPE daemon is installed properly under xinetd
Make sure the remote host doesn't have local (iptables) firewall rules that prevent the monitoring server from talking to the NRPE daemon
iii. Create a command definition
You'll need to create a command definition in one of your Nagios object configuration files in order to use the check_nrpe plugin. Open the sample commands.cfg file for editing...
# vi /usr/local/nagios/etc/comm
and add the following definition to the file:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
You are now ready to start adding services that should be monitored on the remote machine to the Nagios configuration...
iv. Create host and service definitions
You'll need to create some object definitions in order to monitor the remote Linux/Unix machine. These definitions can be placed in their own file or added to an already exiting object configuration file.
First, its best practice to create a new template for each different type of host you'll be monitoring. Let's create a new template for linux boxes.
define host{
name linux-box ; Name of this template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A TEMPLATE
}
Notice that the linux-box template definition is inheriting default values from the generic-host template, which is defined in the sample localhost.cfg file that gets installed when you follow the Nagios quickstart installation guide.
Next, define a new host for the remote Linux/Unix box that references the newly created linux-box host template.
define host{
use linux-box ; Inherit default values from a template
host_name remotehost ; The name we're giving to this server
alias Fedora Core 6 ; A longer name for the server
address 192.168.0.1 ; IP address of the server
}
Next, define some services for monitoring the remote Linux/Unix box. These example service definitions will use the sample commands that have been defined in the nrpe.cfg file on the remote host.
The following service will monitor the CPU load on the remote host. The "check_load" argument that is passed to the check_nrpe command definition tells the NRPE daemon to run the "check_load" command as defined in the nrpe.cfg file.
define service{
use generic-service
host_name remotehost
service_description CPU Load
check_command check_nrpe!check_load
}
The following service will monitor the the number of currently logged in users on the remote host.
define service{
use generic-service
host_name remotehost
service_description Current Users
check_command check_nrpe!check_users
}
The following service will monitor the free drive space on /dev/hda1 on the remote host.
define service{
use generic-service
host_name remotehost
service_description /dev/hda1 Free Space
check_command check_nrpe!check_hda1
}
The following service will monitor the total number of processes on the remote host.
define service{
use generic-service
host_name remotehost
service_description Total Processes
check_command check_nrpe!check_total_pro
}
The following service will monitor the number of zombie processes on the remote host.
define service{
use generic-service
host_name remotehost
service_description Zombie Processes
check_command check_nrpe!check_zombie_pr
}
Those are the basic service definitions for monitoring the remote host.
v. Restart Nagios
At this point you've installed the check_nrpe plugin and addon host and service definitions for monitoring the remote Linux/Unix machine. Now its time to make those changes live...
Verify your Nagios configuration files.
# /usr/local/nagios/bin/nagi
If there are errors, fix them. If everything is fine, restart Nagios.
# service nagios restart
That's it! You should see the host and service definitions you created in the Nagios web interface. In a few minutes Nagios should have the current status information for the remote Linux/Unix machine.
Business Accounts
Answer for Membership
by: malcolm_logan_ukPosted on 2008-02-13 at 08:20:24ID: 20885460
On the remotehost - that is the one you want to check...
.cfg
ocal/nagio s/libexec/ check_disk -w 20 -c 10 -p /dev/sda1
cts/server s/remotese rver.cfg
/usr/local/nagios/etc/nrpe
command[check_sda1]=/usr/l
On the nagios host in the object file...
/usr/local/nagios/etc/obje
define service{
use generic-service
host_name remoteserver
service_description /dev/sda1 Free Space
check_command check_nrpe!check_sda1
}
Hope that helps - if you need anything more just ask.
M