zabbix监控nginx
zabbix 监控nginx
可用性
进程是否存在?
zabbix_get -s 192.168.200.5 -k proc.num[nginx]
端口是否监听?
服务是否正常?
zabbix_get -s 192.168.200.5 -k net.tcp.service[http,,80]
可用性是否正常远远不够
我们也需要了解nginx当前的性能指标(需要nginx --with-http_stub_status_module模块支持)
1.当前连接数?
在agent端
mkdir /etc/zabbix/scripts
cd !$
彭瑶github的脚本
wget https://raw.githubusercontent.com/pengyao/zabbix-1/master/scripts/zabbix_nginx_check.sh --no-check-certificate
cd /etc/zabbix/zabbix_agentd.d
touch nginx.conf
vim nginx.conf
UserParameter=custom.nginx.status[*],/etc/zabbix/scripts/zabbix_nginx_check.sh $1
/etc/zabbix/zabbix_agent restart
2.每秒钟处理多少连接?
custom.nginx.status[handled_connections]
3.每秒钟处理多少请求?
custom.nginx.status[handled_requests]
4.当前连接数?
custom.nginx.status[active_connections]
在客户端操作如下
[root@lb_3 scripts]# pwd
/etc/zabbix/scripts
[root@lb_3 scripts]# cat nginx.conf
UserParameter=custom.nginx.status[*],/etc/zabbix/scripts/zabbix_nginx_check.sh $1
[root@lb_3 scripts]#wget https://raw.githubusercontent.com/pengyao/zabbix-1/master/scripts/zabbix_nginx_check.sh --no-check-certificate
[root@lb_3 scripts]/etc/init.d/zabbix_agent restart
宏的生效顺序
host->Template->global
彭瑶github的脚本
wget https://raw.githubusercontent.com/pengyao/zabbix-1/master/scripts/zabbix_nginx_check.sh --no-check-certificate
注意:在服务端的item设置是store value设置为Delta(speed per second)时,拿不到数据,不知道为什么,只能设置为Delta(simple change)
浙公网安备 33010602011771号