Don't show alarms for charts without data (#10804)
Vladimir Kobal committed
Mar 18, 2021 at 21:53 UTC
477f26fd7ba73e2c60a71d0240df111e616b294a
5 files changed
+7
-4
backends/backends.c
+1
-1
@@ -206,7 +206,7 @@ inline int backends_can_send_rrdset(BACKEND_OPTIONS backend_options, RRDSET *st)
206
}
207
}
208
209
- if(unlikely(!rrdset_is_available_for_backends(st))) {
209
+ if(unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
210
debug(D_BACKEND, "BACKEND: not sending chart '%s' of host '%s', because it is not available for backends.", st->id, host->hostname);
211
return 0;
212
}
database/rrd.h
+1
-1
@@ -1063,7 +1063,7 @@ extern void rrdset_isnot_obsolete(RRDSET *st);
1063
1064
// checks if the RRDSET should be offered to viewers
1065
#define rrdset_is_available_for_viewers(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_HIDDEN) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions && (st)->rrd_memory_mode != RRD_MEMORY_MODE_NONE)
1066
-#define rrdset_is_available_for_backends(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions)
1066
+#define rrdset_is_available_for_exporting_and_alarms(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions)
1067
#define rrdset_is_archived(st) (rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions)
1068
1069
// get the total duration in seconds of the round robin database
exporting/check_filters.c
+1
-1
@@ -64,7 +64,7 @@ int rrdset_is_exportable(struct instance *instance, RRDSET *st)
64
}
65
}
66
67
- if(unlikely(!rrdset_is_available_for_backends(st))) {
67
+ if(unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
68
debug(D_BACKEND, "BACKEND: not sending chart '%s' of host '%s', because it is not available for backends.", st->id, host->hostname);
69
return 0;
70
}
exporting/prometheus/prometheus.c
+1
-1
@@ -37,7 +37,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st)
37
}
38
}
39
40
- if (unlikely(!rrdset_is_available_for_backends(st))) {
40
+ if (unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
41
debug(
42
D_BACKEND,
43
"EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.",
health/health_json.c
+3
@@ -298,6 +298,9 @@ static void health_alarms2json_fill_alarms(RRDHOST *host, BUFFER *wb, int all, v
298
if(unlikely(!rc->rrdset || !rc->rrdset->last_collected_time.tv_sec))
299
continue;
300
301
+ if (unlikely(!rrdset_is_available_for_exporting_and_alarms(rc->rrdset)))
302
+ continue;
303
+
304
if(likely(!all && !(rc->status == RRDCALC_STATUS_WARNING || rc->status == RRDCALC_STATUS_CRITICAL)))
305
continue;
306