About Nagios monitoring client installation and configuration via Nrpe

Source: Internet
Author: User
Tags install openssl

Introduction to Environment >>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>
Service side (monitor side): 192.168.100.2--nagios Service +check_nrpe
Client (Monitored): 192.168.100.3--nrpe daemon + detection plug-in

Nagios's process of managing services remotely through Nrpe
1. The Nagios server executes the Check_nrpe plugin installed inside it and tells Check_nrpe to detect which services.
2. Connect the Nrpe on the remote machine via the Ssl,check_nrpe daemon
3. The Nrpe on the monitored side runs various local plugins to detect local service and status (Check_disk,.. etc
4. Finally, the nrpe of the monitored side transmits the results of the detection to the Check_nrpe,check_nrpe of the Nagios server and sends the results to the Nagios status queue.
5. Nagios reads the information in the queue, then displays the results.

NRPE works as shown in the following:

The NRPE consists of a total of two parts:
1, Check_nrpe plug-in, located on the monitoring host
2, NRPE Daemon, running on the remote Linux host (usually is the monitor machine)

When Nagios needs to monitor the service or resource conditions of a remote Linux host:
Nagios runs the Check_nrpe plugin and tells it what to check;
The Check_nrpe plug-in connects to the remote Nrpe daemon in the same way that SSL is used;
NRPE Daemon will run the appropriate Nagios plugin to perform the check;
NRPE Daemon Returns the results of the check to the Check_nrpe plugin, which the plugin submits to nagios for processing.
Note: NRPE daemon requires Nagios plug-ins to be installed on a remote Linux host, otherwise, daemon cannot do any monitoring.

Service side (monitor side) installation process

1, the server needs to install Nagios service First, installation method can click the author of another article, "Linux system Nagios+rrdtool+pnp4nagios monitoring environment of the building"

2, install Nrpe need to rely on, use the Yum command to install.

[Email protected]_server ~]# Yum install gcc make-~]# yum install openssl-devel-y      //CHECK_NR The PD will connect to the remote Nrpe via SSL Daemon

3, Unzip nrpe-2.15.tar.gz, enter its directory, execute the following command.

[Email protected]_server nrpe-2.15]#./configure--with-nrpe-user=nagios    //  You can run Nrpe with the Nagios user, if you do not have this user, you must first create [[email protected]_server nrpe-2.15 make all                               // compile all source code [Email protected]_server nrpe-2.15makeinstall-plugin       // Install Check_nrpe plugin, default to install to/usr/local/nagios/libexec directory

The installation process of the client (the monitored side)

1, install Nrpe need to rely on, use the Yum command to install.

Yum Install GCC  Make-yuminstall openssl-devel-y                     //CHECK_NRPD will be SSL- Connecting the distal Nrpe Daemon

2, unzip the nrpe-2.15.tar.gz, enter its directory, execute the following command:

[Email protected]_client ~]# useradd Nagios//Create Nagios users[[Email Protected]_server nrpe-2.15]#./configure--with-nrpe-user=nagios//you can run Nrpe as a Nagios user[[Email Protected]_client nrpe-2.15]# MakeAll//compile all source code[[Email Protected]_client nrpe-2.15]# Make Install-daemon//Install Nrpe command, install to/usr/local/nagios/bin directory by default[[Email Protected]_client nrpe-2.15]# Make Install-daemon-config//Install the Nrpe configuration file and install it to the/USR/LOCAL/NAGIOS/ETC directory by default

3, modify the Nrpe.cfg configuration file, allow the monitoring side through the Check_nrpe connection Nrpe daemon, by default, only allow this machine, plus the IP on the monitoring side.

allowed_hosts=127.0. 0.1,192.168. 100.2

4, start the Nrpe daemon, you can also add the following command to the boot startup script /etc/rc.local

[Email protected]_client nrpe-2.15]#/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d    // start Nrpe, listen for TCP 5666 ports

5, verify whether the installation and startup success, the server can execute the following command:

192.168. 100.3                 // Displays the version of the monitored end Nrpe 192.168. 100.3 -C check_load   // perform remote detection plug-in via Nrpe

There are 2 points that need special attention here.

(1) The monitored end must have a/usr/local/nagios/libexec/check_load detection script file

(2) The command name that is received by the-C parameter after the Check_nrpe command is defined in the nrpe.cfg of the monitor side, as shown in:

configuration of the service side (monitoring side)

1, define the command, add the definition of Check_nrpe in/usr/local/nagios/etc/objects/commands.cfg, add the following content:

define command{        command_name    Check_nrpe                                      // define command name Check_nrpe, This name is to be used in services.cfg.        Command_line    $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$   // This is the plug-in program that defines the actual run        }

The-c $arg1$ parameter is a detection command passed to Nrpe Daemon, which must be one of the several commands defined in Nrpe.cfg. Use Check_nrpe when defining the monitoring service ! Take this parameter .

2, add the following content in the/usr/local/nagios/etc/nagios.cfg configuration file:

Cfg_file=/etc/nagios/objects/linux.cfg                           // Let Nagios include this configuration file

3, define the host and Check_nrpe to detect the remote command name. Here we can write the host and service in a file, create the/usr/local/nagios/etc/objects/linux.cfg file, write the following content:

define host{use Linux-Server host_name nagios_client//host name on Nagios Web pageAddress192.168.100.3}define service{Use local-service host_name nagios_client service_description cpu_load //Service name on Nagios Web pageCheck_command check_nrpe!check_load Normal_check_interval1                        //Interval of Detection}

4. Restart the Nagios service. Opening the Nagios monitoring Web site, as shown, indicates that the monitored node was added successfully.

About Nagios monitoring client installation and configuration via Nrpe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.