mirror of
https://github.com/pavel-odintsov/fastnetmon.git
synced 2024-09-21 02:17:16 +00:00
Moving AF_PACKET plugin to new unified configuration scheme
This commit is contained in:
parent
7be16b0a19
commit
bcb019fdb9
@ -287,7 +287,6 @@ void init_global_ban_settings() {
|
||||
|
||||
bool enable_connection_tracking = true;
|
||||
|
||||
bool enable_afpacket_collection = false;
|
||||
bool enable_af_xdp_collection = false;
|
||||
bool enable_data_collection_from_mirror = false;
|
||||
bool enable_netmap_collection = false;
|
||||
@ -976,10 +975,10 @@ bool load_configuration_file() {
|
||||
}
|
||||
|
||||
if (configuration_map.count("mirror_afpacket") != 0) {
|
||||
enable_afpacket_collection = configuration_map["mirror_afpacket"] == "on";
|
||||
fastnetmon_global_configuration.mirror_afpacket = configuration_map["mirror_afpacket"] == "on";
|
||||
}
|
||||
|
||||
if (enable_afpacket_collection && enable_af_xdp_collection) {
|
||||
if (fastnetmon_global_configuration.mirror_afpacket && enable_af_xdp_collection) {
|
||||
logger << log4cpp::Priority::ERROR << "You cannot use AF_XDP and AF_PACKET in same time, select one";
|
||||
exit(1);
|
||||
}
|
||||
@ -2096,7 +2095,7 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
|
||||
#ifdef FASTNETMON_ENABLE_AFPACKET
|
||||
if (enable_afpacket_collection) {
|
||||
if (fastnetmon_global_configuration.mirror_afpacket) {
|
||||
packet_capture_plugin_thread_group.add_thread(new boost::thread(start_afpacket_collection, process_packet));
|
||||
}
|
||||
#endif
|
||||
|
@ -22,6 +22,13 @@ class fastnetmon_configuration_t {
|
||||
std::string netflow_host{ "0.0.0.0" };
|
||||
unsigned int netflow_sampling_ratio{ 1 };
|
||||
|
||||
// Mirror AF_PACKET
|
||||
bool mirror_afpacket{ false };
|
||||
std::vector<std::string> interfaces{};
|
||||
bool afpacket_strict_cpu_affinity{ false };
|
||||
std::string mirror_af_packet_fanout_mode{ "cpu" };
|
||||
bool af_packet_read_packet_length_from_ip_header{ false };
|
||||
|
||||
// Clickhouse metrics
|
||||
bool clickhouse_metrics{ false };
|
||||
std::string clickhouse_metrics_database{ "fastnetmon" };
|
||||
|
@ -107,7 +107,6 @@ extern uint64_t total_unparsed_packets;
|
||||
extern time_t current_inaccurate_time;
|
||||
extern uint64_t total_unparsed_packets_speed;
|
||||
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_pcap_collection;
|
||||
@ -2961,7 +2960,7 @@ bool get_statistics(std::vector<system_counter_t>& system_counters) {
|
||||
}
|
||||
|
||||
#ifdef FASTNETMON_ENABLE_AFPACKET
|
||||
if (enable_afpacket_collection) {
|
||||
if (fastnetmon_global_configuration.mirror_afpacket) {
|
||||
auto af_packet_counters = get_af_packet_stats();
|
||||
|
||||
system_counters.insert(system_counters.end(), af_packet_counters.begin(), af_packet_counters.end());
|
||||
|
Loading…
Reference in New Issue
Block a user