栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

zabbix监控nginx状态页面

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zabbix监控nginx状态页面

//脚本
[root@slave ~]# cd /scripts/
[root@slave scripts]# ls
notify.sh   Waiting.sh
Reading.sh  Writing.sh
[root@slave scripts]# cat Reading.sh 
#/bin/bash

if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $2}'` -ne 0 ]
then
        echo "0"
else
        echo "1"
fi
[root@slave scripts]# cat Writing.sh 
#/bin/bash

if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $4}'` -ne 0 ]
then
        echo "0"
else
        echo "1"
fi
[root@slave scripts]# cat Waiting.sh 
#/bin/bash


//nginx配置
[root@slave scripts]# vim /usr/local/nginx/conf/nginx.conf

if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $2}'` -ne 0 ]
then
        echo "0"
else
        echo "1"
fi
[root@slave scripts]# 

        location /status {
            stub_status;
            allow 192.168.72.131;
            deny all;
        }
[root@slave scripts]# nginx -s reload

配置监控项



配置触发器


[root@master etc]# curl -s 192.168.72.138/status
Active connections: 1 
server accepts handled requests
 1635 1635 122 
Reading: 0 Writing: 1 Waiting: 0 
[root@master etc]# 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/396011.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号