Add option for configure cli_stats_file_path instead hardcoded /tmp/fastnetmon.dat

This commit is contained in:
Pavel Odintsov 2015-09-28 18:26:00 +03:00
parent 4d8d5bfc20
commit 96eb472cd1
2 changed files with 10 additions and 1 deletions

@ -258,6 +258,9 @@ my_hosts_threshold_flows = 3500
# Path to pid file for checking "if another copy of tool is running", it's useful when you run multiple instances of tool
pid_path = /var/run/fastnetmon.pid
# Path to file where we store information for fastnetmon_client
cli_stats_file_path = /tmp/fastnetmon.dat
###
### Client configuration
###

@ -108,6 +108,8 @@
time_t last_call_of_traffic_recalculation;
std::string cli_stats_file_path = "/tmp/fastnetmon.dat";
std::string reporting_server = "heartbeat.fastnetmon.io";
unsigned int stats_thread_sleep_time = 3600;
@ -861,6 +863,10 @@ bool load_configuration_file() {
pid_path = configuration_map["pid_path"];
}
if (configuration_map.count("cli_stats_file_path") != 0) {
cli_stats_file_path = configuration_map["cli_stats_file_path"];
}
if (configuration_map.count("unban_only_if_attack_finished") != 0) {
if (configuration_map["unban_only_if_attack_finished"] == "on") {
unban_only_if_attack_finished = true;
@ -2117,7 +2123,7 @@ void recalculate_speed() {
void print_screen_contents_into_file(std::string screen_data_stats_param) {
std::ofstream screen_data_file;
screen_data_file.open("/tmp/fastnetmon.dat", std::ios::trunc);
screen_data_file.open(cli_stats_file_path.c_str(), std::ios::trunc);
if (screen_data_file.is_open()) {
screen_data_file << screen_data_stats_param;