diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-05-22 14:14:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-22 14:14:25 +0300 |
commit | 10cad04d2d50261dae32b93bd5a5f2dfac5ceb5c (patch) | |
tree | 3b496c27faa377f87de8f71a491bf0d97f0b76c2 /database/rrdcalc.c | |
parent | 128fe427622d43dd2e1397bf37b1536a30779d71 (diff) |
Use chart labels to filter alerts (#14982)
* use chart labels to filter alerts
* add entry to readme
* support chart_label=val val2 val3
* docs updates
* more docs
* use rc not rt
Diffstat (limited to 'database/rrdcalc.c')
-rw-r--r-- | database/rrdcalc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/database/rrdcalc.c b/database/rrdcalc.c index 3ee8719c07..948ebe8a55 100644 --- a/database/rrdcalc.c +++ b/database/rrdcalc.c @@ -369,6 +369,10 @@ static inline bool rrdcalc_check_if_it_matches_rrdset(RRDCALC *rc, RRDSET *st) { st->rrdhost->rrdlabels, rc->host_labels_pattern, '=', NULL)) return false; + if (st->rrdlabels && rc->chart_labels_pattern && !rrdlabels_match_simple_pattern_parsed( + st->rrdlabels, rc->chart_labels_pattern, '=', NULL)) + return false; + return true; } @@ -605,11 +609,13 @@ static void rrdcalc_free_internals(RRDCALC *rc) { string_freez(rc->host_labels); string_freez(rc->module_match); string_freez(rc->plugin_match); + string_freez(rc->chart_labels); simple_pattern_free(rc->foreach_dimension_pattern); simple_pattern_free(rc->host_labels_pattern); simple_pattern_free(rc->module_pattern); simple_pattern_free(rc->plugin_pattern); + simple_pattern_free(rc->chart_labels_pattern); } static void rrdcalc_rrdhost_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, void *rrdcalc, void *rrdhost __maybe_unused) { |