【发布时间】:2020-07-16 14:14:15
【问题描述】:
我在 iptables 中有一系列流量规则,
pkts bytes target prot opt in out source destination
309231 1770353681 ACCEPT all -- * * 192.168.0.10 0.0.0.0/0
146 14940 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1935
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 37686575 packets, 126484725644 bytes)
pkts bytes target prot opt in out source destination
275808 18766166 ACCEPT all -- * * 0.0.0.0/0 192.168.0.10
139 10129 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:1935
我们需要从中统计传入和传出的流量,并将其全部显示在zabbix中。
当我在 Zabbix 中创建项目时,对于第一条规则链,不计算流量
iptables.rule.count[INPUT]
iptables.rule.count[OUTPUT]
对于第二条链,通过港口,一切正常
iptables.rule.traffic[INPUT,1935]
iptables.rule.traffic[OUTPUT,1935]
我做错了什么?
Zabbix 代理配置:iptables.conf
UserParameter=iptables.rule.count[*],sudo iptables -nvxL $1|grep $2|awk '{print $$1}'
UserParameter=iptables.rule.traffic[*],sudo iptables -nvxL $1|grep $2|awk '{print $$2}'
我需要替换正确的密钥,但是哪个?
【问题讨论】: