zabbix3.2 新增nginx監控(連線數)
阿新 • • 發佈:2019-01-08
nginx端相關操作
在nginx.conf中新增如下內容
#vi nginx.conf
...
location /nginx-status {
stub_status on;
access_log off;
allow 192.168.233.0/24;
deny all;
}
...
檢查修改後的配置檔案
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
重新載入
# nginx -s reload
瀏覽器訪問
zabbix端相關操作
新增監控項
# pwd
/etc/zabbix/zabbix_agentd.d
# vi nginx.conf
UserParameter=nginx.active,curl -s "http://192.168.233.131:8080/nginx-status" | grep 'Active' | awk '{print $NF}'
重啟zabbix agent
# systemctl restart zabbix-agent
安裝zabbix-get
# yum install zabbix-get -y
驗證監控
# zabbix_get -s 192.168.233.131 -p 10050 -k "nginx.active"
1
新增item
新增graphs
壓測一下
ab -c 20 -n 10000000 http://192.168.233.131:8080/
screen