1
0
Fork 0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-06-09 05:16:17 +02:00

Removed configuration option enable_subnet_counters and enabled it by default. We've removed it from fastnetmon_client, please use InfluxDB integraration instead

This commit is contained in:
Pavel Odintsov 2022-08-03 22:45:37 +01:00
parent 32e20bd99e
commit db8c9ab7fd
3 changed files with 6 additions and 32 deletions

View File

@ -35,10 +35,6 @@ ban_time = 1900
# If the attack is still active, check each run of the unban watchdog
unban_only_if_attack_finished = on
# enable per subnet speed meters
# For each subnet, list track speed in bps and pps for both directions
enable_subnet_counters = off
# list of all your networks in CIDR format
networks_list_path = /etc/networks_list

View File

@ -195,9 +195,6 @@ bool monitor_local_ip_addresses = true;
// Enable monitoring for OpenVZ VPS IP addresses by reading their list from kernel
bool monitor_openvz_vps_ip_addresses = false;
// Trigger for enable or disable traffic counting for whole subnets
bool enable_subnet_counters = false;
// We will announce whole subnet instead single IP with BGP if this flag enabled
bool exabgp_announce_whole_subnet = false;
@ -767,10 +764,6 @@ bool load_configuration_file() {
exabgp_announce_host = configuration_map["exabgp_announce_host"] == "on" ? true : false;
}
if (configuration_map.count("enable_subnet_counters") != 0) {
enable_subnet_counters = configuration_map["enable_subnet_counters"] == "on" ? true : false;
}
// Graphite
if (configuration_map.count("graphite") != 0) {
graphite_enabled = configuration_map["graphite"] == "on" ? true : false;

View File

@ -124,7 +124,6 @@ extern unsigned int number_of_packets_for_pcap_attack_dump;
extern patricia_tree_t *lookup_tree_ipv4, *whitelist_tree_ipv4;
extern patricia_tree_t *lookup_tree_ipv6, *whitelist_tree_ipv6;
extern std::map<uint32_t, std::vector<simple_packet_t>> ban_list_details;
extern bool enable_subnet_counters;
extern ban_settings_t global_ban_settings;
extern bool exabgp_enabled;
extern bool exabgp_flow_spec_announces;
@ -1809,11 +1808,6 @@ void traffic_draw_ipv6_program() {
output_buffer << std::endl;
if (enable_subnet_counters) {
output_buffer << std::endl << "Subnet load:" << std::endl;
output_buffer << print_subnet_ipv6_load() << "\n";
}
// Print screen contents into file
print_screen_contents_into_file(output_buffer.str(), cli_stats_ipv6_file_path);
}
@ -1924,11 +1918,6 @@ void traffic_draw_ipv4_program() {
output_buffer << print_ddos_attack_details();
}
if (enable_subnet_counters) {
output_buffer << std::endl << "Subnet load:" << std::endl;
output_buffer << print_subnet_ipv4_load() << "\n";
}
// Print screen contents into file
print_screen_contents_into_file(output_buffer.str(), cli_stats_file_path);
@ -2196,11 +2185,9 @@ void recalculate_speed() {
uint64_t incoming_total_flows = 0;
uint64_t outgoing_total_flows = 0;
if (enable_subnet_counters) {
ipv4_network_counters.recalculate_speed(speed_calc_period,
(double)average_calculation_amount, nullptr);
ipv4_network_counters.recalculate_speed(speed_calc_period,
(double)average_calculation_amount, nullptr);
}
for (map_of_vector_counters_t::iterator itr = SubnetVectorMap.begin(); itr != SubnetVectorMap.end(); ++itr) {
for (vector_of_counters::iterator vector_itr = itr->second.begin(); vector_itr != itr->second.end(); ++vector_itr) {
@ -2293,10 +2280,8 @@ void recalculate_speed() {
}
// Calculate IPv6 per network traffic
if (enable_subnet_counters) {
ipv6_subnet_counters.recalculate_speed(speed_calc_period, (double)average_calculation_amount,
speed_callback_subnet_ipv6);
}
ipv6_subnet_counters.recalculate_speed(speed_calc_period, (double)average_calculation_amount,
speed_callback_subnet_ipv6);
// Recalculate traffic for hosts
ipv6_host_counters.recalculate_speed(speed_calc_period, (double)average_calculation_amount, speed_callback_ipv6);
@ -2653,7 +2638,7 @@ void process_packet(simple_packet_t& current_packet) {
__sync_fetch_and_add(&total_ipv6_packets, 1);
#endif
if (enable_subnet_counters) {
{
std::lock_guard<std::mutex> lock_guard(ipv6_subnet_counters.counter_map_mutex);
// We will create keys for new subnet here on demand
@ -2727,7 +2712,7 @@ void process_packet(simple_packet_t& current_packet) {
subnet_in_host_byte_order = ntohl(current_subnet.subnet_address);
}
if (enable_subnet_counters && (current_packet.packet_direction == OUTGOING or current_packet.packet_direction == INCOMING)) {
if (current_packet.packet_direction == OUTGOING or current_packet.packet_direction == INCOMING) {
std::lock_guard<std::mutex> lock_guard(ipv4_network_counters.counter_map_mutex);
// We will create keys for new subnet here on demand