Nagios installation and configuration in RHEL

Source: Internet
Author: User
Install Apache on the server first. Download the following software from http://www.nagios.org: nagios-3.2.3.tar.gznagios-plugins-1.4.15.tar.gznrpe-2.12.tar.gz install NagiosCore # Switch to root user su-l # Add na

Install Apache on the server first.

Download the following software from http://www.nagios.org:

  • Nagios-3.2.3.tar.gz
  • Nagios-plugins-1.4.15.tar.gz
  • Nrpe-2.12.tar.gz

Install Nagios Core

 
 
  1. # Switch to the root user
  2. Su-l
  3. # Add a nagios user
  4. Useradd-m nagios
  5. Passwd nagios
  6. # Create a nagcmd group to allow users to execute commands on the web.
  7. Groupadd nagcmd
  8. Usermod-a-G nagcmd nagios
  9. Usermod-a-G nagcmd apache
  10. Tar xzvf nagios-3.2.3.tar.gz
  11. Cd nagios-3.2.3
  12. ./Configure -- with-command-group = nagcmd
  13. Make all
  14. Make install
  15. Make install-init
  16. Make install-config
  17. Make install-commandmode

   

After configure is complete, the following prompt is displayed:

 
 
  1. General Options:  
  2. -------------------------  
  3.        Nagios executable:  nagios  
  4.        Nagios user/group:  nagios,nagios  
  5.       Command user/group:  nagios,nagcmd  
  6.            Embedded Perl:  no  
  7.             Event Broker:  yes  
  8.        Install ${prefix}:  /usr/local/nagios  
  9.                Lock file:  ${prefix}/var/nagios.lock  
  10.   Check result directory:  ${prefix}/var/spool/checkresults  
  11.           Init directory:  /etc/rc.d/init.d  
  12.  Apache conf.d directory:  /etc/httpd/conf.d  
  13.             Mail program:  /bin/mail  
  14.                  Host OS:  linux-gnu  
  15.   
  16. Web Interface Options:  
  17. ------------------------  
  18.                 HTML URL:  http://localhost/nagios/  
  19.                  CGI URL:  http://localhost/nagios/cgi-bin/  
  20. Traceroute (used by WAP):  /bin/traceroute  

Configuration file directory/usr/local/nagios/etc

Modify the email address in/usr/local/nagios/etc/objects/contacts. cfgNagios@xxx.edu.cn. This mailbox is configured with a filter rule to forward all emailsXxx@139.com

Copy the fragment in/root/nagios-3.2.3/sample-config/httpd. conf to/usr/local/apache2/conf/httpd. conf.

Add a nagiosadmin user

/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Install Nagios Plugins

 
 
  1. tar xzvf nagios-plugins-1.4.15.tar.gz  
  2. cd nagios-plugins-1.4.15  
  3.   
  4. ./configure --with-nagios-user=nagios --with-nagios-group=nagios  
  5.   
  6. make  
  7.   
  8. make install  

Command installed in the/usr/local/nagios/libexec/directory

Start Nagios

 
 
  1. Chkconfig -- add nagios # add nagios to the service
  2. Chkconfig nagios on # enable this service
  3. Chkconfig -- list nagios # view service startup status
  4. # Check whether the script is correct
  5. /Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg
  6. Service nagios start

Access http: // ip/nagios/

Install NRPE

Install Nagios Plugins first. If the agent is installed on the monitored host, add a nagios user first.

 
 
  1. tar xzvf nrpe-2.12.tar.gz  
  2. cd nrpe-2.12  
  3.   
  4. ./configure  
  5. make all  
  6.   
  7. make install-plugin  


Install NRPE Daemon

NRPE Daemon port 5666

Follow the previous steps to install NRPE

 
 
  1. make install-daemon  
  2. make install-daemon-config  
  3.   
  4. make install-xinetd  


After the installation is complete, the configuration file of NRPE is in/usr/local/nagios/etc/nrpe. cfg.

Edit/etc/xinetd. d/nrpe

Only_from = 127.0.0.1 # Only one IP address can be added here

Edit/etc/services and add

nrpe 5666/tcp # NRPE

Restart the xinetd service

service xinetd restart

Run the following command to check whether the service is started properly

Netstat-at | grep nrpe # The following prompt should appear:Tcp 0 0 *: nrpe *: * LISTEN

Test the NRPE Deamon Service

# Test the Local Machine/Usr/local/nagios/libexec/check_nrpe-H localhost # Remote Test/Usr/local/nagios/libexec/check_nrpe-H 202.195.160.46 # Normal displayNRPE v2.12

Edit/usr/local/nagios/etc/objects/commands. cfg on the monitoring host and add the following command.

 
 
  1. define command{  
  2.         command_name  check_nrpe  
  3.         command_line  $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$  


Restart the Nagios service of the monitoring host

service nagios restart
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.