成功最有效的方法就是向有经验的人学习!

zabbix利用自动发现监控IIS站点

最近公司有一个.NET的电商网站,后端使用了IIS,作为运维监控这些IIS的一些性能指标就很有必要了。
首先创建脚本:

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION 
echo {
echo     "data":[
for /F "tokens=* delims= " %%i IN ('typeperf -qx^|find "Web Service"^|find "Current Connections"') DO (
    set j=%%i
    for /F "tokens=1 delims=\" %%k in ("%%i") DO (
    echo         {
    echo             "{#WEB_SERVICE}": "%%k"
    echo         },
    )
)
echo         {
echo             "{#WEB_SERVICE}": "none"
echo         }
echo     ]
echo }

然后在agent端自定义监控项

UserParameter=iis.site.discovery,C:\iis.bat

重启agent服务
在代理服务器上测试是否可以获取到站点名称

[root@zabbix-proxy ~]# /application/zabbix-3.0.3/bin/zabbix_get -s 10.168.204.60 -k iis.site.discovery
{
    "data":[
        {
            "{#WEB_SERVICE}": "Web Service(_Total)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-CN)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend4-8060)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-H5)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(img-guilinmall)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Edeal)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-EdealApi)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-De)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-8050)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(www.guilinfarm.com)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-8000)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-EdealControl)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(UserCenter)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(imgsite)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(AppletAPI)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(CleanCache)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend2-8020)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend3-8030)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(www.guilinclub.com)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-En)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Print)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(www.Ӯƌθ.com)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(guilinmeat)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(PingLun)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(guilinLife-Pc)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-5-8031)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(guilinlife-H5)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-5-8032)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-5-8032)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr#1)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr#2)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(guilinMall)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(backend-5-8032)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr)"
        },
        {
            "{#WEB_SERVICE}": "Web Service(Mall-Fr#1)"
        },
        {
            "{#WEB_SERVICE}": "none"
        }
    ]
}

配置过滤正则表达式,不取"{#WEB_SERVICE}": "none"这一条数据

然后可以在zabbix界面中去定义自动发现模板

监控图表数据

赞(2) 打赏
未经允许不得转载:陈桂林博客 » zabbix利用自动发现监控IIS站点
分享到

大佬们的评论 抢沙发

全新“一站式”建站,高质量、高售后的一条龙服务

微信 抖音 支付宝 百度 头条 快手全平台打通信息流

橙子建站.极速智能建站8折购买虚拟主机

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册