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

 

yum -y install iptstate

 

[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、效果

zabbix 监控iptables

 

相关文章:

  • 2021-05-07
猜你喜欢
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-09-14
  • 2021-09-26
相关资源
相似解决方案