Detailed nagios installation records

Source: Internet
Author: User
Tags cgi web

1. Nagios has the following features:

1. network service monitoring (including SMTP, POP3, HTTP, NNTP, and PING)

2. server resource monitoring (CPU load, disk usage, etc)

3. You can easily customize the service monitoring plug-in you need.

4. Parallel service monitoring

5. Support for parent host rules and distributed

6. When a host or service fails, the administrator can be reminded by email or SMS.

7. Support event definitions during failures, which can solve some problems first

8. Automatic Log rollback

9. Support for redundant host monitoring

10 you can view the current network status, notifications, fault logs, and other information on the Web interface.

Ii. Nagios Installation Process

Installing Nagios includes Nagios Core and Nagios Plugins. Nagios Core is only a Daemon and is responsible for scheduling. The real detection operation is still implemented through Nagios Plugins.

1) install Nagios Core

Download and decompress

 
 
  1. wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz  
  2.  
  3. tar zxf nagios-3.2.0.tar.gz  
  4.  
  5. cd nagios-3.2.0 

Add nagios users and groups

Useradd-m-s/bin/bash nagios groupadd nagios usermod-G nagios

Because the CGI Web monitoring panel is used, we need to add a nagcmd group for CGI to execute related commands.

Groupadd nagcmd usermod-a-G nagcmd nagios usermod-a-G nagcmd www

Configure compilation and Installation

./Configure -- with-command-group = nagcmd -- with-htmurl =/-- with-cgiurl =/cgi-bin make all make install-init make install-commandmode make install-config

Add startup Service

Rc-update add nagios default

Start Nagios

/Etc/init. d/nagios start

2) install Nagios Plugins

 
 
  1. wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz  
  2.  
  3. tar zxf nagios-plugins-1.4.14.tar.gz  
  4.  
  5. cd nagios-plugins-1.4.14  
  6.  
  7. ./configure --with-cgiurl=/cgi-bin make && make install  
  8.  
  9. [#page_#] 

3. Configure the Web Monitoring Panel

To host the CGI of the monitoring panel, the pure Nginx family should choose Nginx. Create a site configuration file:

 
 
  1. server {  
  2.  
  3. listen 80;  
  4.  
  5. server_name nagios.local;  
  6.  
  7. access_log /work/www/logs/nagios.access.log main;  
  8.  
  9. error_log /work/www/logs/nagios.error.log;  
  10.  
  11. location / {  
  12.  
  13. root /usr/local/nagios/share;  
  14.  
  15. index index.html index.htm index.php;  
  16.  
  17. }  
  18.  
  19. location ~ .php$ {  
  20.  
  21. root /usr/local/nagios/share;  
  22.  
  23. fastcgi_index index.php;  
  24.  
  25. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
  26.  
  27. include fastcgi_params;  
  28.  
  29. fastcgi_pass unix:/tmp/php-fpm.sock;  
  30.  
  31. }  
  32.  
  33. location /cgi-bin/images {  
  34.  
  35. alias /usr/local/nagios/share/images;  
  36.  
  37. }  
  38.  
  39. location /cgi-bin/stylesheets {  
  40.  
  41. alias /usr/local/nagios/share/stylesheets;  
  42.  
  43. }  
  44.  
  45. location /cgi-bin {  
  46.  
  47. alias /usr/local/nagios/sbin;  
  48.  
  49. }  
  50.  
  51. location ~ .cgi$ {  
  52.  
  53. root /usr/local/nagios/sbin;  
  54.  
  55. rewrite ^/cgi-bin/(.*).cgi /.cgi break;  
  56.  
  57. fastcgi_index index.cgi;  
  58.  
  59. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
  60.  
  61. include nginx_fcgi_params;  
  62.  
  63. fastcgi_read_timeout 5m;  
  64.  
  65. fastcgi_pass unix:/var/run/nginx-fcgi.sock;  
  66.  
  67. }  
  68.  
  69. }  
  70.  

Modify configuration file

Open/usr/local/nagios/etc/cgi. cfg and modify use_authentication:

 
 
  1.  use_authentication=0 
  2.  

Remove User Authentication and restart nagios.

Open/usr/local/nagios/share/config. inc. php and run the following command:

 
 
  1. $cfg['cgi_base_url']='/nagios/cgi-bin';  
  2.  

Change to (according to your actual situation ):

 
 
  1. $cfg['cgi_base_url']='/cgi-bin';  
  2.  

Access monitoring panel

 
 
  1. http://nagios.local/  
  2.  

Build complete!

Nagios is successfully installed here. If you do not understand nagios, you can read: nagios monitoring network server and network service concepts and teach you how to perform initial configuration installation for Nagios 3.0.

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.