zabbix3.2 添加nginx监控(连接数)

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

浏览器访问
zabbix3.2 添加nginx监控(连接数)

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
zabbix3.2 添加nginx监控(连接数)

添加graphs
zabbix3.2 添加nginx监控(连接数)

压测一下

ab -c 20 -n 10000000 http://192.168.233.131:8080/

zabbix3.2 添加nginx监控(连接数)

screen
zabbix3.2 添加nginx监控(连接数)

上一篇:centos7.3 zabbix3.2 安装server端


下一篇:一个numpy搭建神经网络