zabbix_server:将下载好的getNginxInfo.py脚本放在/usr/lib/zabbix/externalscripts/。php
cd /usr/lib/zabbix/externalscripts/ chmod +x getNginxInfo.py
而后导入模板,在客户端启动nginx status状态;nginx
vim /usr/local/nginx/conf/nginx.conf server { listen 80; server_name _; root /dev/null; location /nginx-status { # Enable nginx status stub_status on; # I do not need logs access_log off; allow 10.0.0.0/8; allow 127.0.0.1; deny all; } location /phpfpm-status { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; # I do not need logs access_log off; allow 127.0.0.1; allow 10.0.0.0/8; deny all; } } nginx -t && nginx -s reload
获取nginx-status状态页信息,显示以下信息证实nginx-status状态配置完成。vim
curl http://127.0.0.1/nginx-status
Active connections: 11
server accepts handled requests
2645458 2645458 4084739
Reading: 0 Writing: 1 Waiting: 10 curl
坐等zabbix监控出数据。url