• zabbix 监控iptables


    参看的文章链接忘了。。。。。。

    yum -y install iptstate

    1、脚本位置和内容

    [root@web1 scripts]# pwd
    /etc/zabbix/scripts
    [root@web1 scripts]# cat iptables.sh 
    #!/bin/bash
    function tcp {  
    sudo iptstate --single | grep tcp | wc -l
    }  
    function tcpsyn {  
    sudo iptstate --single | grep SYN | wc -l
    }  
    function tcptimewait {  
    sudo iptstate --single | grep TIME_WAIT | wc -l
    }  
    function tcpestablished {  
    sudo iptstate --single | grep ESTABLISHED | wc -l 
    }  
    function tcpclose {  
    sudo iptstate --single | grep CLOSE | wc -l
    }  
    function udp {  
    sudo iptstate --single | grep udp | wc -l
    }  
    function icmp {  
    sudo iptstate --single | grep icmp | wc -l
    }
    function all {  
    sudo iptstate --single | wc -l  
    }
    # Run the requested function  
    $1
    [root@web1 scripts]# 

    2、visudo

    zabbix  ALL=NOPASSWD: /usr/sbin/iptstate

    3、修改zabbix-agent的配置文件

    #iptables status
    UserParameter=iptstate[*],/etc/zabbix/scripts/iptables.sh $1

    4、web页面配置

    链接:https://pan.baidu.com/s/1Y2X8I3uqun41GD5KyIACHQ 密码:tar2

    5、效果

  • 相关阅读:
    计算两个经纬度之间的距离,单位米
    PHP获取汉字首字母函数
    tp3.2 上传文件及下载文件
    最少知识原则
    单一职责原则
    接口和面向接口编程
    开放-封闭原则
    设计原则
    websrom编译器
    头条笔试题2018后端第二批-用户喜好
  • 原文地址:https://www.cnblogs.com/huangyanqi/p/9585636.html
Copyright © 2020-2023  润新知