Zabbix添加nginx监控项

##########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
上一篇:Linux命令集合


下一篇:TextView的升级版———AutoCompleteTextView