##########Nginx配置##########
#查看是否安装nginx状态模块
nginx -V
#--with-http_stub_status_module
#修改配置文件
vim /etc/nginx/nginx.cnf
...
location / {
stub_status on;
...
nginx -t
nginx -s reload
#获取active活动连接数
curl -s http://localhost/nginx-status | awk 'NR==1{print $NF}'
##########Zabbix-agent配置##########
cat > /etc/zabbix/zabbix_agentd.d/nginx_active.conf <<aa
UserParameter=nginx.active, /usr/bin/curl -s http://localhost/nginx-status |awk 'NR==1{print \$NF}'
aa
systemctl restart zabbix-agent
#测试server端能否获取值
yum -y install zabbix-get
zabbix_get -s localhost -k nginx.active
Zabbix添加nginx监控项
最新推荐文章于 2024-04-21 19:28:36 发布