1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-22 20:42:03 +01:00

Finished Clickhouse support

This commit is contained in:
Pavel Odintsov 2024-07-13 21:37:31 +03:00
parent 5959583214
commit 77645c168a
3 changed files with 4 additions and 7 deletions

@ -363,6 +363,7 @@ target_link_libraries(fastnetmon influxdb_metrics)
# Clickhouse metrics
if (CLICKHOUSE_SUPPORT)
add_library(clickhouse_metrics STATIC metrics/clickhouse.cpp)
target_link_libraries(clickhouse_metrics ${CLICKHOUSE_LIBRARY_PATH})
target_link_libraries(fastnetmon clickhouse_metrics)
endif()

@ -120,7 +120,7 @@
#include "metrics/influxdb.hpp"
// It's not enabled by default and we enable it only when we have Clickhouse libraries on platform
#ifdef ENABLE_CLICKHOUSE_SUPPORT
#ifdef CLICKHOUSE_SUPPORT
#include "metrics/clickhouse.hpp"
#endif
@ -2003,9 +2003,10 @@ int main(int argc, char** argv) {
service_thread_group.add_thread(new boost::thread(influxdb_push_thread));
}
#ifdef ENABLE_CLICKHOUSE_SUPPORT
#ifdef CLICKHOUSE_SUPPORT
// Clickhouse metrics export therad
if (fastnetmon_global_configuration.clickhouse_metrics) {
logger << log4cpp::Priority::INFO << "Starting Clickhouse metrics export thread";
service_thread_group.add_thread(new boost::thread(clickhouse_push_thread));
}
#endif

@ -906,7 +906,6 @@ void clickhouse_push_thread() {
extern total_speed_counters_t total_counters_ipv6;
extern abstract_subnet_counters_t<subnet_cidr_mask_t, subnet_counter_t> ipv4_network_counters;
extern abstract_subnet_counters_t<subnet_cidr_mask_t, subnet_counter_t> ipv4_network_24_counters;
extern abstract_subnet_counters_t<subnet_ipv6_cidr_mask_t, subnet_counter_t> ipv6_network_counters;
extern abstract_subnet_counters_t<uint32_t, subnet_counter_t> ipv4_host_counters;
@ -985,10 +984,6 @@ void clickhouse_push_thread() {
// Push per subnet counters to ClickHouse
push_network_traffic_counters_to_clickhouse(clickhouse_metrics_client, ipv4_network_counters, "network_metrics");
// Push per /24 subnet counters to Clickhouse
push_network_traffic_counters_to_clickhouse(clickhouse_metrics_client, ipv4_network_24_counters,
"network_24_metrics_ipv4");
push_network_traffic_counters_to_clickhouse(clickhouse_metrics_client, ipv6_network_counters,
"network_metrics_ipv6");