首先不好意思,最近几天由于公司极个人的有点忙,所以就没有及时做监控nginx的模版,今天闲下来,把PNP模版做出来了,感官上还好,由于我把 serveraccepts 、handled、requests 都做到了 PNP模版里,可能他们的图会占用的图比较多,如果你只想把 ActiveConn、reading、writing、waiting 图绘出来,可以把 serveraccepts 、handled、requests 注视掉。
1.首先添加check_nginx.sh 监控
nginx $> wget www.nginxs.com/download/check_nginx.sh nginx $> mv check_nginx.sh /usr/local/nagios/libexec/ nginx $> vim /usr/local/nagios/etc/objects nginx $> vim commands.cfg
# 添加: define command{ command_name check_nginx command_line $USER1$/check_nginx.sh -u $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$ }
2.添加监控服务
nginx $> vim /usr/local/nagios/etc/service/services.cfg
#添加: define service{ use local-service,srv-pnp host_name nginxs service_description nginx_status check_command check_nginx!www.nginxs.com!/!4000!5000 }
3.添加 pnp4nagios 模版
nginx $> wget http://www.nginxs.com/download/check_nginx.php.gz nginx $> tar zxvf check_nginx.php.gz nginx $> mv check_nginx.php /usr/local/pnp4nagios/share/templates/
4.重启加载 nagios 服务
nginx $> /etc/init.d/nagios relod
5.看图:
本文转自Deidara 51CTO博客,原文链接:http://blog.51cto.com/deidara/432232,如需转载请自行联系原作者