如何安装cacti监控nginx插件
By admin
- One minute read - 182 wordsScripts and templates for nginx.
Nginx –
Provide graphing nginx clients statistics (active, reading, writing, waiting) and nginx socket statistics (accepts, handled, requests). It’s a formal devision used only for graphs usability.
For use do next steps:
Enable nginx http_stub_status_module at configure stage (if requared).
Enable stub status. Add to nginx.conf (in any server context):
location /nginx_status {
stub_status on;
disable access_log if requared
access_log off;
#allow XX.YY.AA.ZZ;
#allow YY.ZZ.JJ.CC;
#deny all;
}
Restart nginx.
3.
cp get_nginx_clients_status.pl /scripts/
cp get_nginx_socket_status.pl /scripts/
chmod 0755 /scripts/get_nginx_socket_status.pl
chmod 0755 /scripts/get_nginx_clients_status.pl
- Check that it’s work. Run
get_nginx_clients_status.pl http://nginx.server.tld/nginx_status
and see that returned the same string:
nginx_accepts:113869 nginx_handled:113869 nginx_requests:122594
Import to cacti cacti_graph_template_nginx_clients_stat.xml and cacti_graph_template_nginx_sockets_stat.xml.
Add nginx graphs to your hosts.
P.S. Sorry for my english
Attachments:cacti-nginx.tar.gz [5.15 KiB]
官方地址: http://forums.cacti.net/about26458.html 注意:nginx_sockets这个模板如果只有图,但没有数据的话,可能是 perl脚本问题,手动调整一下就可以了.
说明:如果” no (LWP::UserAgent not found)”错误,请参考解决办法:
下面来安装php-fpm监控插件 默认情况下此功能未开启,编辑php-fpm.conf文件,开启pm.status_path = phpfpm-status 选项,退出保存!
get_php_fpm_status.pl copy to ../scripts directory
cacti_graph_template_php-fpm_pool_status.xml import to cactiScript check url http://server:port/phpfpm-status
[shell]location /phpfpm-status {
allow 10.0.1.58;
deny all;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}[/shell]
Thanks for .xml and idea for Alexander Moskalenko
http://forum.nginx.org/read.php?25,167900,167900#msg-167900
Attachments:(php5.2.X)cacti-phpfpmstatus.zip [3.58 KiB] Attachments:[php5.3.x]get_php_fpm_status.pl [1.29 KiB]
官方地址: