summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2021-04-28 23:32:43 +0000
committerGitHub <noreply@github.com>2021-04-28 23:32:43 +0000
commite1b409efd10491b281e39f5637a08fb7b542866d (patch)
treebf3484d717d1410fd526250a2c7847277839b456 /database
parent6ec39d20ccb48f90b8e801dd91f51ab9141b941a (diff)
Add `charts` to templates (#11054)
Add new entities to Netdata templates.
Diffstat (limited to 'database')
-rw-r--r--database/rrdcalctemplate.c8
-rw-r--r--database/rrdcalctemplate.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/database/rrdcalctemplate.c b/database/rrdcalctemplate.c
index 007b8c5d6a..5060313ec0 100644
--- a/database/rrdcalctemplate.c
+++ b/database/rrdcalctemplate.c
@@ -45,6 +45,11 @@ static int rrdcalctemplate_is_there_label_restriction(RRDCALCTEMPLATE *rt, RRDH
}
static inline int rrdcalctemplate_test_additional_restriction(RRDCALCTEMPLATE *rt, RRDSET *st) {
+ if (rt->charts_pattern &&
+ !(simple_pattern_matches(rt->charts_pattern, st->id) ||
+ simple_pattern_matches(rt->charts_pattern, st->name)))
+ return 0;
+
if (rt->family_pattern && !simple_pattern_matches(rt->family_pattern, st->family))
return 0;
@@ -111,6 +116,9 @@ inline void rrdcalctemplate_free(RRDCALCTEMPLATE *rt) {
freez(rt->module_match);
simple_pattern_free(rt->module_pattern);
+ freez(rt->charts_match);
+ simple_pattern_free(rt->charts_pattern);
+
freez(rt->name);
freez(rt->exec);
freez(rt->recipient);
diff --git a/database/rrdcalctemplate.h b/database/rrdcalctemplate.h
index 64c201c8c0..65114da6af 100644
--- a/database/rrdcalctemplate.h
+++ b/database/rrdcalctemplate.h
@@ -31,6 +31,9 @@ struct rrdcalctemplate {
char *module_match;
SIMPLE_PATTERN *module_pattern;
+ char *charts_match;
+ SIMPLE_PATTERN *charts_pattern;
+
char *source; // the source of this alarm
char *units; // the units of the alarm
char *info; // a short description of the alarm