How does Nagios 3.0 monitor Linux servers?

Source: Internet
Author: User

NagiosThe process of monitoring a Linux server is as follows:

Client Configuration:

User Creation:

Useradd nagios can modify the shell of this account in/etc/password to/sbin/nologin)

Passwd nagios

Install plug-ins:

 
 
  1. tar zxvf nagios-plugins-1.4.11.tar.gz  
  2.  
  3. cd nagios-plugins-1.4.11  
  4.  
  5. ./configure--prefix=/usr/local/nagios --enable-redhat-pthread-workaround  
  6.  
  7. make all  
  8.  
  9. make install 

Modify permissions:

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

Install the Nrpe service:

 
 
  1. Tar zxvf nrpe-2.8.1.tar.gz
  2.  
  3. Cd nrpe-2.8.1
  4.  
  5. ./Configure-prefix =/usr/local/nagios [./configure -- enable-ssl -- enable-command-args]
  6.  
  7. Make all (Compilation)
  8.  
  9. Make install-plugin install plug-in)
  10.  
  11. Make install-daemon install nrpe daemon)
  12.  
  13. Make install-daemon-config install the configuration file)
  14.  
  15. Make install-xinetd install the xinetd script file)

Add Server IP Address:

Vi/etc/xinetd. d/nrpe

Only_from = 127.0.0.1 192.168.0.108

Add nrpe service:

Vi/etc/services

Nrpe 5666/tcp # nrpe

Restart the Xinetd service:

Service xinetd restart

Check whether the Nrpe service is enabled:

Netstat-ant | grep 5666

Test whether Nrpe works properly:

/Usr/local/nagios/libexec/check_nrpe-H localhost

NRPE v2.8.1 indicates that it is normal to connect nrpe daemon locally with check_nrpe)

Server Configuration:

A. Copy the localhost. cfg template file to monitor 192.168.112.101:

Cp/usr/local/nagios/etc/localhost. cfg/usr/local/nagios/etc/192.168.112.101.cfg

Vi 192.168.112.101.cfg

Modify the host name, IP address, and alias of the Configuration)

B. Add 192.168.112.101.cfg to the main configuration file of nagios:

Vi/usr/local/nagios/etc/nagios. cfg

Export _file =/usr/local/nagios/etc/objects/192.168.112.101.cfg

C. Verify that the configuration file is correct and restart:

/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/object/nagios. cfg

Service nagios restart (restart nagios to make the configuration take effect)

D. Check the naigios monitoring page and find that the host has been added normally.

It is not required to add monitoring services to the server ):

Add the check_nrpe function to the Command. cfg file:

 
 
  1. vi /usr/local/nagios/etc/commands.cfg  
  2.  
  3. define command{  
  4.  
  5.   command_name check_nrpe  
  6.  
  7.   command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$  
  8.  
  9.   } 

Note:: The $ ARG1 $ parameter after-c is the detection command sent to nrpe daemon. It should be used when check_nrpe is used in services. cfg! With this parameter.

Additional knowledge points:

Vi/usr/local/nagios/etc/nrpe. cfg

Find the following content:

 
 
  1. # The following examples use hardcoded command arguments...  
  2.  
  3. command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10  
  4.  
  5. command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20  
  6.  
  7. command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1  
  8.  
  9. command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z  
  10.  
  11. command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 

[] Is the command name, that is, the-c parameter of check_nrpe can be connected to, = followed by the actually executed plug-in program commands. the format of commands defined in cfg is very similar, but it is written in a line. that is to say, check_users is the abbreviation of/usr/local/nagios/libexec/check_users-w 5-c 10 after the equal sign.

We can easily know that the commands defined in the above five lines are the number of login users, cpu load, hda1 capacity, zombie processes, and the total number of processes. usage :. /check_load -- help, because-c can only be followed by nrpe. the command defined in cfg, that is, we can only use the Five Commands defined above.

For other nagios configurations, please read:

Install and configure nagios, modify Apache configuration, configure initial Nagios 3.0 installation, monitor Windows servers, and solve ten Nagios faults

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.