Hi !
I have added a plugin to collectd configuration, in order to get iptables statistics.
According to the collectd docs, the configuration file should be something like this :
Code
root@home-server:/# cat /etc/collectd/collectd.conf.d/iptables.conf
LoadPlugin iptables
<Plugin "iptables">
Chain "filter" "INPUT"
Chain "filter" "OUTPUT"
</Plugin>
Here are some infos from my iptables :
Code
root@home-server:/# iptables -L -n -v --line-numbers
# Warning: iptables-legacy tables present, use iptables-legacy to see them
Chain INPUT (policy ACCEPT 559 packets, 392K bytes)
num pkts bytes target prot opt in out source destination
1 194M 182G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate ESTABLISHED
2 150K 27M ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
3 0 0 ACCEPT icmp -- * * 192.168.1.0/24 0.0.0.0/0
...
29 316K 56M DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 560K packets, 37M bytes)
num pkts bytes target prot opt in out source destination
1 315M 694G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate ESTABLISHED
2 150K 27M ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
Display More
Restarting the collectd demon is fine :
Code
[2022-01-11 23:42:06] Exiting normally.
[2022-01-11 23:42:06] collectd: Stopping 5 read threads.
[2022-01-11 23:42:06] collectd: Stopping 5 write threads.
[2022-01-11 23:42:06] plugin_load: plugin "cpu" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "df" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "disk" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "interface" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "ipmi" successfully loaded.
[2022-01-11 23:42:06] ipmi plugin: Legacy configuration found! Please update your config file.
[2022-01-11 23:42:06] plugin_load: plugin "iptables" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "load" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "memory" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "rrdcached" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "smart" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "syslog" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "unixsock" successfully loaded.
[2022-01-11 23:42:06] plugin_load: plugin "uptime" successfully loaded.
[2022-01-11 23:42:06] Systemd detected, trying to signal readiness.
[2022-01-11 23:42:06] Initialization complete, entering read-loop.
[2022-01-11 23:42:08] ipmi plugin: sensor_list_add: Ignore sensor ` unspecified (0.0)` of `main`, because it isn't readable! Its type: (0xc, memory).
Display More
Unfortunatly, no data are collected/writen in the data directory (should have some iptables_filter_* directories from what I know
)
Code
root@home-server:/var/lib/rrdcached/db/localhost# ls
total 160
drwxr-xr-x 40 root root 4096 Dec 14 18:58 .
drwxr-xr-x 3 root root 4096 Jul 30 2020 ..
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-0
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-1
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-10
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-11
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-2
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-3
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-4
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-5
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-6
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-7
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-8
drwxr-xr-x 2 root root 4096 Jan 2 21:45 cpu-9
drwxr-xr-x 2 root root 4096 Jan 2 21:45 df-root
drwxr-xr-x 2 root root 4096 Jan 2 21:45 df-srv-dev-disk-by-label-Backups
drwxr-xr-x 2 root root 4096 Jan 2 21:45 df-srv-dev-disk-by-label-Datas
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-md0
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-nvme0n1
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-sda
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-sdb
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-sdc
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-sdd
drwxr-xr-x 2 root root 4096 Jan 2 21:45 disk-sde
drwxr-xr-x 2 root root 4096 Jan 2 21:45 interface-enp1s0f0
drwxr-xr-x 2 root root 4096 Jan 2 21:45 interface-enp1s0f1
drwxr-xr-x 2 root root 4096 Jan 2 21:45 interface-enp35s0
drwxr-xr-x 2 root root 4096 Jan 2 21:45 interface-enp36s0
drwxr-xr-x 2 root root 4096 Jan 2 21:45 interface-lo
drwxr-xr-x 2 root root 4096 Jan 2 21:45 ipmi
drwxr-xr-x 2 root root 4096 Jan 2 21:45 load
drwxr-xr-x 2 root root 4096 Jan 2 21:45 memory
drwxr-xr-x 2 root root 4096 Jan 2 21:45 rrdcached
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-nvme0n1
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-sda
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-sdb
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-sdc
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-sdd
drwxr-xr-x 2 root root 4096 Jan 2 21:45 smart-sde
drwxr-xr-x 2 root root 4096 Jan 2 21:45 uptime
Display More
Does anyone already done this and any idea of what the problem is ?
Thanks