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