毕业设计之zabbix之nginx状态监控

监控脚本:

[[email protected] ~]$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 127.0.0.1/ngx_status 2>/dev/null |grep "^Active" |awk '{print $3}'
}

function ngx_accepts(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '3p' |awk '{print $1}'
}

function ngx_handled(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '3p' |awk '{print $2}'
}

function ngx_requests(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '3p' |awk '{print $3}'
}

function ngx_reading(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '4p' |awk '{print $2}'
}

function ngx_writing(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '4p' |awk '{print $4}'
}

function ngx_waiting(){
/usr/bin/curl 127.0.0.1/ngx_status 2>/dev/null | sed -n '4p' |awk '{print $6}'
}

$1

建立模板

 建立应用集

建立监控项:

创建监控项记得加入到应用集里面

添加触发器:

waiting连接太多

nginx挂掉:

建立数据图形

结果

猜你喜欢

转载自www.cnblogs.com/betterquan/p/12404701.html