Nagios Monitors nginx Status

Source: Internet
Author: User

1. Server and monitored host installation components

Yum Install BC

Compile and install Nrpe (refer to Tutorial: http://2860664.blog.51cto.com/2850664/1559056)

The following are the monitored host settings

2, download the monitoring script check_nginx.sh, and upload to the/usr/local/nagios/libexec directory of the monitored host

: http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=622&cf_id=24

Give script permission to execute

chmod +x/usr/local/nagios/libexec/check_nginx.sh

3, vi/usr/local/nagios/etc/nrpe.cfg add

command[check_nginx]=/usr/local/nagios/libexec/check_nginx.sh-h www.xxx.com -P 80-p /usr/local/ nginx/logs/ -N nginx.pid-s nginx_status-w 15000-c 20000

Where red is the site you want to monitor;

Green for Nginx.pid save path, can be added in nginx.conf:pid/usr/local/nginx/logs/nginx.pid; To set, remember .

4. Test script Run

Cd/usr/local/nagios/libexec

./check_nginx.sh-h Www.xxx.com-P 80-p/usr/local/nginx/logs/-n nginx.pid-s nginx_status-w 15000-c 20000

Ok-nginx is running. 1 requests per second, 1 connections per second (1.00 requests per connection) | ' Reqpsec ' =1 ' conpsec ' =1 ' conpreq ' = 1.00]

The following are monitoring host settings

5, Vi/usr/local/nagios/etc/nagios.cfg add

cfg_file=/usr/local/nagios/etc/objects/nginx.cfg

6, Touch/usr/local/nagios/etc/objects/nginx.cfg

Vi/usr/local/nagios/etc/objects/nginx.cfg (Note To modify the IP on the monitored side) the content is as follows


I'm the split line ************************************.

define host{           use              linux-server           host_name     nginx           alias         nginx           address        Monitored end ip         }define service{        use                        generic-service        host_name              nginx         service_description     check-swap        check_command         check_nrpe!check_swap                }define service{         use                       generic-service        host_name              nginx         service_description     check-load        check_command         check_nrpe!check_load                }define service {        use                       generic-service        host_name              nginx        service_description     check-disk        check_command        check_nrpe!check_sda1                }define service{         use                       generic-service         host_name              nginx       service_description     check-users        check_command        check_nrpe!check_users                }define service{         use                     generic-service         host_name           nginx         service_description  otal_procs         check_command     check_nrpe!check_total_procs}define service{         use                              generic-service          ; name of service template to use         host_name                        nginx         service_description              PING        check_command                    check_ping! 100.0,20%!500.0,60%        }define service{     use                      generic-service    host_name                nginx    service_description     nginx_status     check_command           check_ nrpe!check_nginx!ip!80!/usr/local/nginx/sbin/nginx!nginx.pid!nginx_status!/tmp!15000!20000         notifications_enabled            0        }

I'm also a split line ************************************

Write it here for the time being, and I'll finish it tomorrow.

This article is from the "Linux related sharing" blog, make sure to keep this source http://2860664.blog.51cto.com/2850664/1564000

Nagios Monitors nginx Status

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.