nginx啓動 中止 重啓等 管理腳本

nagios 監控nginx 返回狀態插件 如502 504
網絡用法的naigos監控nginx主要是根據nginx,status提供的鏈接數據來設置報警值的。對NGINX 出現502,504狀態報警不足
我這裏提供另個方法,
使用方法
cd /usr/local/nagios/libexec
wgethttp://www.9ai9.net/download/shell/qhappy_check_nginx.sh
chmod 755 qhappy_check_nginx.sh
vim /usr/local/nagios/etc/object/command.cfg
添加如下內容
  1. #qhappy_check_nginx
    php

  2. define command{
    linux

  3.   command_name qhappy_check_nginx
    ios

  4.   command_line $USER1$/qhappy_check_nginx.sh --url $ARG1$  --host $ARG2$
    nginx

  5. }web

複製代碼


定義的主機裏添加
  1. define service{
    shell

  2.                use                             generic-service
    vim

  3.                host_name                       zy_web_01
    服務器

  4.                notifications_enabled           1
    網絡

  5.                service_description             Nginx_Status
    app

  6.                check_command                   qhappy_check_nginx!http://174.36.186.59/index.php!www.9ai9.net!

  7.                }

複製代碼

如下是用法說明
./qhappy_check_nginx.sh --help
A This Program is a plug  of nagios to monitor WebServer , special for Nginx!
This Program base on  WebServer's respond status report an emergencyIt usefull on nginx repond 502 and 504 status2011, Qhappy (http://www.9ai9.net/)lxy1234@163.com
How to use Eg 1
./qhappy_check_nginx.sh --urlhttp://www.9ai9.net/index.php
How to use Eg 2
./qhappy_check_nginx.sh --hostwww.9ai9.net--urlhttp://174.36.186.59/index.phpwww.9ai9.net
Pleace 174.36.186.69 replace of you site and IP!nginx返回502 504 和不能鏈接web服務器報告CRASHINGnginx返回200 報告正常 OK其餘返回結果報 WARNING
相關文章
相關標籤/搜索