NRPE Remote Server Installation and Setup
Create Nagios user account on remote server to be monitored:
# useradd nagios # passwd nagios
Download and Install Nagios Plugins:
# mkdir -p /opt/Nagios/Nagios_Plugins
# cd /opt/Nagios/Nagios_PluginsSave file to directory /opt/Nagios
http://www.nagios.org/download/download.php
or download in here nagios-plugin
As of this writing Nagios 3.0.6 (Stable) and Nagios Plugins 1.4.13 (Stable)
Extract Files:
# tar xzf nagios-plugins-1.4.13.tar.gz # cd nagios-plugins-1.4.13
Compile and Configure Nagios Plugins
** You need the openssl-devel package installed to compile plugins with ssl support. **# yum -y install openssl-develInstal Plugins:
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make installThe permissions on the plugin directory and the plugins will need to be changed to nagios user
# chown nagios.nagios /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/libexecPackage xinted is needed
# yum install xinetd
Downlad and Install NRPE Daemon
# mkdir -p /opt/Nagios/Nagios_NRPE
# cd /opt/Nagios/Nagios_NRPESave file to directory /opt/Nagios
download here nrpe
or http://www.nagios.org/download/download.php
As of this writing NRPE 2.12 (Stable)
Extract the Files:
# tar -xzf nrpe-2.12.tar.gz
# cd nrpe-2.12
Compile and Configure NRPE
** You need the openssl-devel package installed to compile NRPE with ssl support. **# yum -y install openssl-develInstall NRPE:
# ./configure General Options: ------------------------- NRPE port: 5666 NRPE user: nagios NRPE group: nagios Nagios user: nagios Nagios group: nagios # make all # make install-plugin # make install-daemon # make install-daemon-config # make install-xinetd
Post NRPE Configuration
Edit Xinetd NRPE entry:Add Nagios Monitoring server to the “only_from” directive
# vi /etc/xinetd.d/nrpe only_from = 127.0.0.1Edit services file entry:
Add entry for nrpe daemon
# vi /etc/services nrpe 5666/tcp # NRPERestart Xinetd and Set to start at boot:
# chkconfig xinetd on # service xinetd restart
Test NRPE Daemon Install
Check NRPE daemon is running and listening on port 5666:# netstat -at |grep nrpeOutput should be:
tcp 0 0 *:nrpe *.* LISTENCheck NRPE daemon is functioning:
# /usr/local/nagios/libexec/check_nrpe -H localhostOutput should be NRPE version:
NRPE v2.12
Open Port 5666 on Firewall
Make sure to open port 5666 on the firewall of the remote server so that the Nagios monitoring server can access the NRPE daemon.Nagios Monitoring Host Server Setup
Downlad and Install NRPE Plugin
# mkdir -p /opt/Nagios/Nagios_NRPE
# cd /opt/Nagios/Nagios_NRPESave file to directory /opt/Nagios
download here nrpe
or
http://www.nagios.org/download/download.php
As of this writing NRPE 2.12 (Stable)
Extract the Files:
# tar -xzf nrpe-2.12.tar.gz
# cd nrpe-2.12
Compile and Configure NRPE
# ./configure # make all # make install-plugin
Test Connection to NRPE daemon on Remote Server
Lets now make sure that the NRPE on our Nagios server can talk to the NRPE daemon on the remote server we want to monitor. Replace “# /usr/local/nagios/libexec/check_nrpe -HNRPE v2.12
Create NRPE Command Definition
A command definition needs to be created in order for the check_nrpe plugin to be used by nagios.# vi /usr/local/nagios/etc/objects/commands.cfgAdd the following:
############################################################################### # NRPE CHECK COMMAND # # Command to use NRPE to check remote host systems ############################################################################### define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
Create Linux Object template
In order to be able to add the remote linux machine to Nagios we need to create an object template file adn add some object definitions.Create new linux-box-remote object template file:
# vi /usr/local/nagios/etc/objects/linux-box-remote.cfgAdd the following and replace the values “host_name” “alias” “address” with the values that match your setup:
** The “host_name” you set for the “define_host” section must match the “host_name” in the “define_service” section **
define host{ name linux-box-remote ; 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 } define host{ use linux-box-remote ; Inherit default values from a template host_name Centos5 ; The name we're giving to this server alias Centos5 ; A longer name for the server address 192.168.0.5 ; IP address of the server } define service{ use generic-service host_name Centos5 service_description CPU Load check_command check_nrpe!check_load } define service{ use generic-service host_name Centos5 service_description Current Users check_command check_nrpe!check_users } define service{ use generic-service host_name Centos5 service_description /dev/hda1 Free Space check_command check_nrpe!check_hda1 } define service{ use generic-service host_name Centos5 service_description Total Processes check_command check_nrpe!check_total_procs } define service{ use generic-service host_name Centos5 service_description Zombie Processes check_command check_nrpe!check_zombie_procs }Activate the linux-box-remote.cfg template:
# vi /usr/local/nagios/etc/nagios.cfgAnd add:
# Definitions for monitoring remote Linux machine cfg_file=/usr/local/nagios/etc/objects/linux-box-remote.cfgVerify Nagios Configuration Files:
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Total Warnings: 0 Total Errors: 0Restart Nagios:
# service nagios restart
sumber :http://www.kernelhardware.org/nagios-nrpe-to-monitor-remote-linux-server/
0 Comments