Important note for upgrades from older FastNetMon Advanced releases before 2.0.375

Home FastNetMon Advanced Technical Documentation Important note for upgrades from older FastNetMon Advanced releases before 2.0.375
Contents

Starting from FastNetMon Advanced 2.0.375, the old ClickHouse metrics database schema is no longer supported.

If you upgraded FastNetMon Advanced from an older release and ClickHouse metrics export was enabled before the upgrade, we recommend checking that all FastNetMon metrics tables use the current schema documented below. FastNetMon can create all required ClickHouse metrics tables automatically, but it will not automatically replace existing tables created with an older schema.

To inspect the existing ClickHouse tables, run:

clickhouse-client

Then switch to the FastNetMon database:

USE fastnetmon;

List all available tables:

SHOW TABLES;

You can inspect the schema of any table using:

SHOW CREATE TABLE total_metrics;
SHOW CREATE TABLE traffic;

For traffic persistence - traffic table now requires presence of srcMac and dstMac fileds which can be created that way: 

alter table fastnetmon.traffic ADD COLUMN srcMac FixedString(6); 
alter table fastnetmon.traffic ADD COLUMN dstMac FixedString(6);

For metrics you could look for total_metrics, if it doesn't have per protocol fields like tcp_packets/udp_packets - it is an old schema and should be fixed.

If old tables are still present after the upgrade, there are two possible approaches:

  1. Update the existing tables manually so that their schema matches the current FastNetMon schema.
  2. Remove old metrics tables and let FastNetMon create them again automatically with the current schema.

If historical metrics are not required, the simplest option is to stop FastNetMon, remove the old ClickHouse metrics tables, and start FastNetMon again.

sudo systemctl stop fastnetmon
clickhouse-client
USE fastnetmon;

DROP TABLE IF EXISTS total_metrics;
DROP TABLE IF EXISTS total_metrics_ipv4;
DROP TABLE IF EXISTS total_metrics_ipv6;

DROP TABLE IF EXISTS network_metrics;
DROP TABLE IF EXISTS network_24_metrics_ipv4;
DROP TABLE IF EXISTS network_metrics_ipv6;

DROP TABLE IF EXISTS host_metrics;
DROP TABLE IF EXISTS host_metrics_ipv6;

DROP TABLE IF EXISTS host_metrics_ipv4_top;
DROP TABLE IF EXISTS host_metrics_ipv6_top;

DROP TABLE IF EXISTS asn_metrics_ipv4;
DROP TABLE IF EXISTS asn_metrics_ipv6;

DROP TABLE IF EXISTS system_metrics;
DROP TABLE IF EXISTS interface_metrics;
DROP TABLE IF EXISTS total_hostgroup_metrics;

DROP TABLE IF EXISTS flexible_host_metrics_ipv4;
DROP TABLE IF EXISTS flexible_host_metrics_ipv6;
DROP TABLE IF EXISTS flexible_total_hostgroup_metrics;

Then start FastNetMon again:

sudo systemctl start fastnetmon

After FastNetMon starts and exports new metrics, it will recreate all required tables using the current schema.

You can verify that ClickHouse metrics export works as expected using:

sudo fcli show system_counters | grep click

Expected output should include successful writes and no failed writes, for example:

clickhouse_metrics_writes_total                            2044855
clickhouse_metrics_writes_failed                           0

Please note that dropping tables removes all historical metrics stored in them. If you need to preserve historical metrics, create a ClickHouse backup or rename the old tables before removing them.