1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-23 00:52:00 +01:00

Moved sFlow configuration options to main configuration

This commit is contained in:
Pavel Odintsov 2024-07-16 13:16:10 +03:00
parent e65727c849
commit 8b37e63781
3 changed files with 10 additions and 6 deletions

@ -291,7 +291,6 @@ bool enable_afpacket_collection = false;
bool enable_af_xdp_collection = false;
bool enable_data_collection_from_mirror = false;
bool enable_netmap_collection = false;
bool enable_sflow_collection = false;
bool enable_netflow_collection = false;
bool enable_pcap_collection = false;
@ -774,9 +773,9 @@ bool load_configuration_file() {
if (configuration_map.count("sflow") != 0) {
if (configuration_map["sflow"] == "on") {
enable_sflow_collection = true;
fastnetmon_global_configuration.sflow = true;
} else {
enable_sflow_collection = false;
fastnetmon_global_configuration.sflow = false;
}
}
@ -2041,7 +2040,7 @@ int main(int argc, char** argv) {
}
#endif
if (enable_sflow_collection) {
if (fastnetmon_global_configuration.sflow) {
packet_capture_plugin_thread_group.add_thread(new boost::thread(start_sflow_collection, process_packet));
}

@ -9,6 +9,12 @@
class fastnetmon_configuration_t {
public:
// sFlow
bool sflow{ false };
std::vector<unsigned int> sflow_ports{};
std::string sflow_host{ "0.0.0.0" };
bool sflow_read_packet_length_from_ip_header{ false };
// Clickhouse metrics
bool clickhouse_metrics{ false };
std::string clickhouse_metrics_database{ "fastnetmon" };

@ -110,7 +110,6 @@ extern bool enable_connection_tracking;
extern bool enable_afpacket_collection;
extern bool enable_data_collection_from_mirror;
extern bool enable_netmap_collection;
extern bool enable_sflow_collection;
extern bool enable_netflow_collection;
extern bool enable_pcap_collection;
extern uint64_t incoming_total_flows_speed;
@ -2951,7 +2950,7 @@ bool get_statistics(std::vector<system_counter_t>& system_counters) {
system_counters.push_back(system_counter_t("influxdb_writes_failed", influxdb_writes_failed, metric_type_t::counter,
influxdb_writes_failed_desc));
if (enable_sflow_collection) {
if (fastnetmon_global_configuration.sflow) {
auto sflow_stats = get_sflow_stats();
system_counters.insert(system_counters.end(), sflow_stats.begin(), sflow_stats.end());
}