| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef ML_CONFIG_H |
| 4 | #define ML_CONFIG_H |
| 5 | |
| 6 | #include "ml_worker.h" |
| 7 | |
| 8 | typedef struct { |
| 9 | int enable_anomaly_detection; |
| 10 | |
| 11 | time_t training_window; // Training window in seconds |
| 12 | time_t min_training_window; // Minimum training window in seconds |
| 13 | size_t max_training_vectors; // Target number of vectors for training |
| 14 | size_t max_samples_to_smooth; // Maximum smoothing window (adaptive) |
| 15 | unsigned train_every; |
| 16 | |
| 17 | unsigned num_models_to_use; |
| 18 | unsigned delete_models_older_than; |
| 19 | |
| 20 | unsigned db_engine_anomaly_rate_every; |
| 21 | |
| 22 | unsigned diff_n; |
| 23 | unsigned lag_n; |
| 24 | unsigned max_kmeans_iters; |
| 25 | |
| 26 | double dimension_anomaly_score_threshold; |
| 27 | |
| 28 | double host_anomaly_rate_threshold; |
| 29 | RRDR_TIME_GROUPING anomaly_detection_grouping_method; |
| 30 | time_t anomaly_detection_query_duration; |
| 31 | |
| 32 | bool stream_anomaly_detection_charts; |
| 33 | |
| 34 | std::string hosts_to_skip; |
| 35 | SIMPLE_PATTERN *sp_host_to_skip; |
| 36 | |
| 37 | std::string charts_to_skip; |
| 38 | SIMPLE_PATTERN *sp_charts_to_skip; |
| 39 | |
| 40 | std::vector<uint32_t> random_nums; |
| 41 | |
| 42 | ND_THREAD *detection_thread; |
| 43 | std::atomic<bool> detection_stop; |
| 44 | |
| 45 | size_t num_worker_threads; |
| 46 | size_t flush_models_batch_size; |
| 47 | |
| 48 | std::vector<ml_worker_t> workers; |
| 49 | std::atomic<bool> training_stop; |
| 50 | |
| 51 | size_t suppression_window; |
| 52 | size_t suppression_threshold; |
| 53 | |
| 54 | bool enable_statistics_charts; |
| 55 | } ml_config_t; |
| 56 | |
| 57 | void ml_config_load(ml_config_t *cfg); |
| 58 | |
| 59 | extern ml_config_t Cfg; |
| 60 | |
| 61 | #endif /* ML_CONFIG_H */ |