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