nagios 监控 nginx

简介:
check_nginx

http://www.monitoringexchange.org/cgi-bin/jump.cgi?ID=3089&view=File1;d=1

Output example

user@host: ~ $ ./check_nginx.sh -H localhost -P 80 -p /var/run -n nginx.pid -s nginx_status -o /tmp -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 ]
user@host: ~ $ ./check_nginx.sh -H localhost -P 80 -p /var/run -n nginx.pid -s nginx_status -o /tmp -w 15000 -c 20000
OK - nginx is running. 13722 requests per second, 13725 connections per second (1.00 requests per connection) | 'reqpsec'=13722 'conpsec'=13725 'conpreq'=1.00 ]
user@host: ~ $ ./check_nginx.sh -H localhost -P 80 -p /var/run -n nginx.pid -s nginx_status -o /tmp -w 10000 -c 15000
WARNING - nginx is running. 12462 requests per second, 12448 connections per second (1.00 requests per connection) | 'reqpsec'=12462 'conpsec'=12448 'conpreq'=1.00
user@host: ~ $ ./check_nginx.sh -H localhost -P 80 -p /var/run -n nginx.pid -s nginx_status -o /tmp -w 5000 -c 10000
CRITICAL - nginx is running. 14241 requests per second, 14253 connections per second (1.00 requests per connection) | 'reqpsec'=14241 'conpsec'=14253 'conpreq'=1.00

#check_nginx.sh -H localhost -P 80 -p /var/run -n nginx.pid 
  -s nginx_statut -o /tmp [-w INT] [-c INT] [-S] [-N]

  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
  -o/--output-directory)
      Specifies where to write the tmp-file that the check creates.
      Default is: /tmp
  -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


commands.cfg 
define command{
        command_name    check_nginxstatus
        command_line    $USER1$/check_nginx -H $ARG1$ -P $ARG2$ -p $ARG3$ -n $ARG4$ -o $ARG5$ -w $ARG6$ -c $ARG7$
        }


server

define service{
        use                             generic-service  
        host_name                       linuxtone
        service_description             nginx
        check_command                   check_nginxstatus!ip!80!/usr/local/webserver/nginx!nginx.pid!nginx_status!/tmp!15000!20000
        notifications_enabled           0
        }

很容易看明白。呵呵



本文转自守住每一天51CTO博客,原文链接:http://blog.51cto.com/liuyu/161216,如需转载请自行联系原作者

相关文章
|
运维 监控 应用服务中间件
【运维知识进阶篇】zabbix5.0稳定版详解3(监控Nginx+PHP服务状态信息)(二)
【运维知识进阶篇】zabbix5.0稳定版详解3(监控Nginx+PHP服务状态信息)(二)
445 0
|
消息中间件 NoSQL Kafka
基于Kafka的nginx日志收集分析与监控平台(3)
基于Kafka的nginx日志收集分析与监控平台(3)
|
消息中间件 监控 Kafka
基于Kafka的nginx日志收集分析与监控平台(2)
基于Kafka的nginx日志收集分析与监控平台(2)
|
消息中间件 负载均衡 应用服务中间件
基于Kafka的nginx日志收集分析与监控平台(1)
基于Kafka的nginx日志收集分析与监控平台(1)
|
监控 应用服务中间件 BI
如何使用 Zabbix 监控 Nginx?
如何使用 Zabbix 监控 Nginx?
607 6
|
监控 数据可视化 应用服务中间件
吹爆,Nginx 可视化!配置监控一条龙
nginx-gui这个东西真的要吹一波,太好用了,而且源码公开。对于我这样一个作为Linux菜鸟的Java开发来说,这个可视化配置工具简直是福音!
|
运维 监控 PHP
【运维知识进阶篇】zabbix5.0稳定版详解3(监控Nginx+PHP服务状态信息)(三)
【运维知识进阶篇】zabbix5.0稳定版详解3(监控Nginx+PHP服务状态信息)(三)
352 0
|
Web App开发 应用服务中间件 nginx
|
应用服务中间件 Linux 网络安全
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
1048 87
|
8月前
|
编解码 应用服务中间件 Linux
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
680 1