# /application/nginx/sbin/nginx -V
configure arguments: --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-pcre
2、查看
Active connections: 2
server accepts handled requests
50 50 1055
Reading: 0 Writing: 1 Waiting: 1
3、修改zabbix_agent.conf的配置文件
vim /application/zabbix/etc/zabbix_agentd.conf
UnsafeUserParameters=1
Include=/application/zabbix/etc/zabbix_agentd.conf.d/*.conf
4、准备脚本
function writing {
#!/bin/bash
#NGINX状态监控脚本
HOST='status.jql.org'
function ping {
/sbin/pidof nginx | wc -l
}
function active {
/usr/bin/curl "$HOST" 2>/dev/null | grep 'Active' | awk '{print $NF}'
}
function reading {
/usr/bin/curl "$HOST" 2>/dev/null | grep 'Reading' | awk '{print $2}'
}
function writing {
/usr/bin/curl "$HOST" 2>/dev/null | grep 'Writing' | awk '{print $4}'
}
function waiting {
/usr/bin/curl "$HOST" 2>/dev/null | grep 'Waiting' | awk '{print $6}'
}
function accepts {
/usr/bin/curl "$HOST" 2>/dev/null | awk NR==3 | awk '{print $1}'
}
function handled {
/usr/bin/curl "$HOST" 2>/dev/null | awk NR==3 | awk '{print $2}'
}
function requests {
/usr/bin/curl "$HOST" 2>/dev/null | awk NR==3 | awk '{print $3}'
}
$1
5、添加nginx自定义Key的配置文件
vim /application/zabbix/etc/zabbix_agentd.conf.d/nginx_status.conf
UserParameter=nginx.status[*],/application/zabbix/scripts/nginx_status.sh "$1"
6、在Web管理界面添加监控项
7、添加监控图形
8、查看图形
原文地址:http://blog.51cto.com/12098963/2093118