Nagios监控Nginx_status

下面是一些注意的地方–
1、关于nginx.pid
–在nginx.conf一定要加上,如:pid    /usr/local/nginx/logs/nginx.pid
2、如果出现以下提示.
–UNKNOWN – Local copy/copies of nginx_status is empty.
–可能就是在你的nginx.conf没有配置状态监控,如
server
{
listen  80;
server_name  IP | 域名;
location /nginx_status {
stub_status on;

allow ip;
access_log   off;
}
}
3.需要更改check_nginx 一个地方:
把hostname=”localhost”改为:你需要监控的主机ip。
如:hostname=”10.1.1.178″

command.cfg

#####################check_nginx#########################
define command{
command_name    check_nginx
command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -P $ARG1$ -p $ARG2$ -n $ARG3$ -s $ARG4$ -w $ARG5$ -c $ARG6$
}

Options:
-H/–hostname)
Defines the hostname. Default is: localhost
-P/–port)
Defines the port. Default is: 80
-p/–path-pid)
Path where nginx’s pid file is being stored. You might need
to alter this path according to your distribution. Default
is: /var/run
-n/–name_pid)
Name of the pid file. Default is: nginx.pid
-N/–no-pid-check)
Turn this on, if you don’t want to check for a pid file
whether nginx is running, e.g. when you’re checking a
remote server. Default is: off
-s/–status-page)
Name of the server’s status page defined in the location
directive of your nginx configuration. Default is:
nginx_status
-S/–secure)
In case your server is only reachable via SSL, use this
this switch to use HTTPS instead of HTTP. Default is: off
-w/–warning)
Sets a warning level for requests per second. Default is: off
-c/–critical)
Sets a critical level for requests per second. Default is:
off

services.cfg

define service{
use                                   generic-service,srv-pnp         ; Name of service template to use
host_name                       manage-178
service_description         Nginx_status
check_command             check_nrpe!check_nginx!80!/usr/local/nginx/logs!nginx.pid!nginx_status!15000!20000
}

即可监控nginx_status并且画图

image

此条目发表在Nagios分类目录。将固定链接加入收藏夹。