zoukankan      html  css  js  c++  java
  • Zabbix自定义监控网站服务是否能够正常响应

    
    监测tcp连接数文件名:
    /etc/zabbix/zabbix_agentd.conf.d/count_tcp.conf
    UserParameter=count.tcp,netstat -s|grep "connections established"|awk '{print$1}'
    客户端检验自定义key是否正常:zabbix_agentd -t count.tcp


    监测服务器服务是否正常
    /etc/zabbix/script/check_server.sh  设置运行权限(注意一定要给zabbix用户加上运行权限)

    #!/bin/bash

    #set -x

    function Check_One()
    {
            local run_times=3
            local fail_times=0
            while [ $run_times -gt 0 ]
            do
                    #local ret=$(curl -I -m 3 -o /dev/null -s -w %{http_code} $1)
                    #if [ $ret != "200" -a $ret != "300"  ]
                    local ret=$(curl -s $1)
                    if [[ $ret != '{"head":"ok"}' ]]
                    then
                            fail_times=`expr $fail_times + 1`
                    fi
                    run_times=`expr $run_times - 1`
            done

            if [ $fail_times -ge 2 ]
            then
                    return 0
            else
                    return 1
            fi
    }


    HOSTS_DIR=/Users/dev-fan/erlang

    printf $?


    check_server.conf内容:
    UserParameter=check.server[*],/etc/zabbix/script/check_server.sh $1

    zabbix_agentd -t check.server[8080]
  • 相关阅读:
    索引
    convert 时间转换
    SQL中的case when then else end用法
    SVN安装图解
    dos 命令
    阿里云服务器相关知识
    mvc知识应用
    MVC分页
    mvc系统过滤器
    .net 接口
  • 原文地址:https://www.cnblogs.com/ggzone/p/5094516.html
Copyright © 2011-2022 走看看