Nagios Remote host monitoring

Source: Internet
Author: User
As mentioned above, Nagios can only monitor local resources by default, but it cannot monitor remote server resources. now I want to learn about nrpe with you, nagios uses nrpe to monitor remote host survival, disk space, load, process count, ip connection, and so on. 1. Introduction to nrpe principles...

 

As mentioned above, Nagios can only monitor local resources by default, but it cannot monitor remote server resources. now I want to learn about nrpe with you, nagios uses nrpe to monitor remote host survival, disk space, load, process count, ip connection, and so on.

1. Introduction to nrpe principles

Implementation of Nagios: Nagios adopts distributed-centralized management mode. Install the main nagios program on the Nagios server and the nagios agent on the monitored host. Monitors the host status through communication between the main nagios program and the nagios agent program.

There are two ways to work between the main program and the proxy program. one is the main program-> Active-> proxy program; the other is the main program-> passive-> proxy program; as the name suggests, it is divided by One Direction to the other side to propose communication requirements.

II. Functions and significance of NRPE

I have understood the working relationship between the Nagios service-Command-plug-in. Therefore, it is clear that the basic Nagios service cannot monitor the status of the remote system, the basic Nagios monitoring service can only be used for local system monitoring and remote host connectivity monitoring. To enable the Nagios monitoring server to remotely obtain information on the system of the monitored host, it must rely on the NRPE core extension plug-in program, which serves as the intermediate proxy program, assume a man-in-the-middle role that receives a request from The Nagios monitoring server and obtains the specified information on the remote host system.

 

III. main work modes of NRPE

As mentioned above, to monitor the remote system of Nagios, you must first install the native core extension plug-in program in addition to the Nagios-plugins plug-in program on the monitored remote host, the NRPE runs as a daemon on the monitored remote host system. the specified NRPE listening port is opened to listen to all monitoring requests sent by the Nagios monitoring server. In addition, on the Nagios monitoring server, you must install the Nagios-plugins plug-in and the NRPE core extension plug-in. The only difference is that the Nagios monitoring server does not need to run NRPE as a daemon, because it generally does not need to be monitored by others but to monitor others. for the Nagios monitoring server, it only needs to use the Nagio-plugins plug-in program and the NRPE extension plug-in program.

 

 

4. install the Nagios-plugins agent on the monitored host

 

$ Useradd nagios # Add a nagios user

$ Tar-zxvf nagios-plugins-1.4.10.tar.gz

$ Nagios-plugins-1.4.10 cd

$./Configure -- prefix =/usr/local/nagios

$ Make; make install

$ Chown-R nagios: nagios/usr/local/nagios/

 

5. install the NRPE service on the monitored host

 

$ Tar-zxvf nrpe-2.9.tar.gz

$ Nrpe-2.9 cd

$./Configure

$ Make all

$ Make install-plugin; make install-daemon-config;

6. configure and run NRPE on the monitored host

Configure the main configuration file/usr/local/nagios/etc/NRPE. cfg for nrpe

 

Here are some key settings.

-------------------------------------------------------

Pid_file =/var/run/nrpe. pid

Set the PID file that NRPE runs, which is set by default and does not need to be changed.

Server_port = 5666

This is the system Port occupied by the NRPE daemon.

# Server_address = 0.0.0.0

Server_address = 192.168.1.9 # This is the IP address of the controlled end.

Sets the network interface for the system to listen to NRPE. Generally, a specific IP address is set. if you want multiple NICs, use commas (,) to separate multiple IP addresses. To listen to all network interfaces of the system, you can use "0.0.0.0" to indicate the special addresses of all network interfaces, but you cannot use the wildcard "*".

Nrpe_user = nagios

Nrpe_group = nagios

Set the host user of the NRPE.

Allowed_hosts = 192.168.1.12 # This is the IP address of the monitoring server.

Here is the IP address of the host that allows NRPE interaction with the local machine, that is, the address of the Nagios monitoring server. if you want to specify multiple Nagios servers, use a comma ", to separate multiple IP addresses.

 

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 above is the default extension plug-in command of NRPE, which is crucial. When the monitored host runs the NRPE daemon, it also runs the NRPE extension commands defined in the NRPE configuration file. We can see that these extension commands have already specified the command name, plug-in path, and Option parameters. The format is as follows:

Command [NRPE command name] = plug-in path/plug-in option 1 parameter 1 option 2 parameter 2...

Note: to specify the service that the monitored host needs to be monitored, you must configure the NRPE command and run it in the NRPE daemon. If no NRPE command is configured, the Nagios monitoring server cannot monitor it.

Add NRPE run to system startup script

Www.2cto.com

Echo "/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d ">/etc/rc. d/rc. local

 

7. install the NRPE core extension on the Nagios monitoring server

Compared with the detected host, the NRPE installation on the Nagios monitoring server is relatively simple, and it mainly monitors others rather than others, therefore, it does not need to run NRPE as a daemon, as long as it has the extension plug-in function of NRPE.

 

Tar-zxvf nrpe-2.9.tar.gz

Cd nrpe-2.9

./Configure

Make all

Make install-plugin

Nagios only needs the extension plug-in function of NRPE, so you can install NRPE on The Nagios monitoring server. The next step is to configure the NRPE extension plug-in command on the Nagios monitoring server so that the Nagios monitoring server can define the nrpe command and thus define the "remote system monitoring service ".

 

Author Zhou Bo

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.