Build a monitoring system based on Nagios--monitoring remote Linux servers

Source: Internet
Author: User

The previous article describes how to install Nagios Core, an article to share with you how to incorporate a remote Linux server into your monitoring scope.

Part I: Installing Nagios plugins and Nrpe on remote Linux

Step one: Download the setup program for Nagios plugins and Nrep extensions

[Plain]View PlainCopy
    1. CD Downloads
    2. wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz

To access http://www.nagios.org/download/addons/, click NRPE, click the Download URL in the pop-up page to download it.

Step Two: Create a user

[Plain]View PlainCopy
    1. /usr/sbin/useradd Nagios

Step three: Install Nagios Plugins

[Plain]View PlainCopy
    1. Tar XF nagios-plugins-2.0.tar.gz
    2. CD nagios-plugins-2.0
    3. Export LDFLAGS=-LDL
    4. Sudo-s

./configure--with-nagios-user=nagios--with-nagios-group=nagios--enable-redhat-pthread-workaroundmake && Make install
Chown Nagios.nagios/usr/local/nagios<chown-r nagios.nagios/usr/local/nagios/libexec/

Fourth Step: Install Nrpe

[Plain]View PlainCopy
    1. Tar XF nrpe-2.15.tar.gz
    2. CD nrpe-2.15
    3. ./configure
    4. Make all
    5. Make Install-plugins
    6. Make Install-daemon
    7. Make Install-daemon-config
    8. Make install-xinetd

Fifth step: Set Nrpe as Daemon (via as part of XINETD)

  • Open the/etc/xinetd.d/nrpe file and add the IP address of the server that is responsible for monitoring to the ONLY_FROM directive. Multiple IP addresses should be separated by a space;
  • Edit/usr/local/nagios/etc/nrpe.cfg, after the allowd_hosts instruction, add the IP address of the monitoring server, the address is separated by commas;
  • Modify the/etc/services file to add a line at the end of the file:[plain] view plain copy
    1. Nrpe 5666/tcp # Nrpe
  • Start service [plain] view plain copy
    1. Service xinetd Restart
  • Verify that the Nrpe port is currently listening on [plain] view plain copy
    1. Netstat-at | grep Nrpe
    2. TCP 0 0 *:nrpe *:* LISTEN
  • Confirm that the Nrpe is normal [plain] view plain copy
    1. /usr/local/nagios/libexec/check_nrpe-h localhost

Sixth Step: Modify/usr/local/nagios/etc/nrpe.cfg

The commands defined in this file determine what the server can monitor, that is, the actual monitoring is performed by the program specified in the command in this file. Like what:

Command[check_users]=/usr/local/nagios/libexec/check_users-w 5-c 10command[check_load]=/usr/local/nagios/libexec /check_load-w 15,10,5-c 30,25,20

Before adding to this file, it is a good idea to actually execute this command at the command line:

/usr/local/nagios/libexec/check_disk-w 20%-C 10%-p/dev/sda1

Part II: Increase the configuration of the remote server on the monitoring server

First step: Download the NRPE extension and install

[Plain]View PlainCopy
    1. Tar XF nrpe-2.15.tar.gz
    2. CD nrpe-2.15
    3. ./configure
    4. Make all
    5. Make Install-plugins

Confirm if Nrpe can be linked to a remote server

/usr/local/nagios/libexec/check_nrpe-h [remote server IP]

Step Two: Add HOST and Service configuration for the remote monitoring server

As long as you increase the monitoring of the computer, you need to increase these two parts!

Both configurations can be divided into two files, or they can be placed in a file. I copied the/usr/local/nagios/etc/objects/localhost.cfg here and named it for Remotehost.cfg.

Change the host_name and alias in the host block to the name and alias of the corresponding remote server, and change the address to the IP of the remote server.

The definition of Host_group can be deleted, and the name of the remote server is added to the Host_group block in Localhost.cfg, which is written behind localhost, separated by commas.

In all of the following services definitions, change the host so that it is available.

In/usr/local/nagios/etc/nagios.cfg, add a cfg_file instruction to add the newly created file name to the back.

Step Three: Restart Nagios

[Plain]View PlainCopy
    1. /etc/init.d/nagios start

Build a monitoring system based on Nagios--monitoring remote Linux servers

Related Article

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.