毕业设计之zabbix之nginx状态监控
监控脚本:
[root@webone.quan.bbs ~]$vim /usr/local/zabbix/script/ngx_status.sh
#!/bin/bash
#
#********************************************************************
#Author: betterman
#QQ: 1602604658
#Date: 2020-03-03
#FileName: ngx_status.sh
#URL: https://www.cnblogs.com/betterquan/
#Description: The test script
#Copyright (C): 2020 All rights reserved
#********************************************************************
#
IPADDR='127.0.0.1'
function ngx_up {
/sbin/pidof nginx | wc -l
}
function ngx_active(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null |grep "^Active connections" |awk '{print $3}'
}
function ngx_accepts(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '3p' |cut -d" " -f2
}
function ngx_handled(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '3p' |cut -d" " -f2
}
function ngx_requests(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '3p' |cut -d" " -f2
}
function ngx_reading(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '4p' |cut -d" " -f2
}
function ngx_writing(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '4p' |cut -d" " -f4
}
function ngx_waiting(){
/usr/bin/curl $IPADDR/ngx_status 2>/dev/null | sed -n '4p' |cut -d" " -f6
}
$1
建立模板
建立应用集
建立监控项:
创建监控项记得加入到应用集里面
添加触发器:
waiting连接太多
nginx挂掉:
建立数据图形
结果