How to keep traffic counters during restart of FastNetMon

When you issue a sudo fcli commit command, you restart FastNetMon. It leads to a complete drop of all information accumulated by FastNetMon, and you may notice a drop on graphs in Grafana when such events happen.

Before using this capability, you need to have subsystems which handle such logic:

sudo fcli set main keep_traffic_counters_during_restart true
sudo fcli commit

We offer an option which can be used to avoid traffic drops during restart, and you can enable it this way from fcli:

sudo fcli set save_traffic_counters

After that, FastNetMon will create traffic dumps in the cache folder:

sudo ls -l /var/cache/fastnetmon/
total 35872
-rw-rw-rw- 1 root root  2192900 Sep  9 20:39 speed_counters_local_ipv4_hosts.dat
-rw-rw-rw- 1 root root     3456 Sep  9 20:39 speed_counters_local_ipv4_networks.dat
-rw-rw-rw- 1 root root      569 Sep  9 20:39 speed_counters_local_ipv6_hosts.dat
-rw-rw-rw- 1 root root      569 Sep  9 20:39 speed_counters_local_ipv6_networks.dat
-rw-rw-rw- 1 root root     8145 Sep  9 20:39 speed_counters_total_hostgroups.dat
-rw-rw-rw- 1 root root     1620 Sep  9 20:39 speed_counters_total_ipv4.dat
-rw-rw-rw- 1 root root     1531 Sep  9 20:39 speed_counters_total_ipv6.dat

And then you can apply a commit command, which will not lead to drops on graphs:

sudo fcli commit

You may confirm that it happened successfully using these log entries:

cat /var/log/fastnetmon/fastnetmon.log|grep 'Start loading'
2022-09-09 19:54:26,584 [INFO] Start loading local IPv4 hosts  traffic counters from disk
2022-09-09 19:54:26,630 [INFO] Start loading local IPv4 networks traffic counters from disk
2022-09-09 19:54:26,630 [INFO] Start loading local IPv6 hosts  traffic counters from disk
2022-09-09 19:54:26,630 [INFO] Start loading local IPv6 networks traffic counters from disk
2022-09-09 19:54:26,630 [INFO] Start loading total hostgroup traffic counters from disk
2022-09-09 19:54:26,631 [INFO] Start loading total IPv4 traffic counters from disk
2022-09-09 19:54:26,631 [INFO] Start loading total IPv6 traffic counters from disk
2022-09-09 20:39:37,933 [INFO] Start loading local IPv4 hosts  traffic counters from disk
2022-09-09 20:39:37,983 [INFO] Start loading local IPv4 networks traffic counters from disk
2022-09-09 20:39:37,983 [INFO] Start loading local IPv6 hosts  traffic counters from disk
2022-09-09 20:39:37,983 [INFO] Start loading local IPv6 networks traffic counters from disk
2022-09-09 20:39:37,983 [INFO] Start loading total hostgroup traffic counters from disk
2022-09-09 20:39:37,984 [INFO] Start loading total IPv4 traffic counters from disk
2022-09-09 20:39:37,984 [INFO] Start loading total IPv6 traffic counters from disk

In the current version, FastNetMon can save / load traffic for the following types of counters:

  • Total traffic
  • Per network IPv4, per network /24 IPv4, IPv6
  • Per host IPv4, IPv6 traffic
  • Total hostgroups traffic
  • Per ASN traffic

In case of really large networks time required to save/load all counters may be significant, and you will benefit from an NVME/SSD-based storage system to speed up this process.