您的位置:首页 > 运维架构 > Nginx

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

2017-02-03 16:44 489 查看

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/[/code] 


screen

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: