summaryrefslogtreecommitdiffstats
path: root/health/health_json.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-04-12 16:30:45 +0000
commit105ad30a29266eafedd8ef79bc21218b92415907 (patch)
treeca61c4aec3a3feceef50a88e5d125bbb2621ad3a /health/health_json.c
parentReleasing debian version 1.30.0-1. (diff)
downloadnetdata-105ad30a29266eafedd8ef79bc21218b92415907.tar.xz
netdata-105ad30a29266eafedd8ef79bc21218b92415907.zip
Merging upstream version 1.30.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'health/health_json.c')
-rw-r--r--health/health_json.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/health/health_json.c b/health/health_json.c
index 2a81d1c02..74a384a3b 100644
--- a/health/health_json.c
+++ b/health/health_json.c
@@ -349,6 +349,18 @@ void health_alarms_values2json(RRDHOST *host, BUFFER *wb, int all) {
rrdhost_unlock(host);
}
+static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark)
+{
+ ALARM_ENTRY *ae = host->health_log.alarms;
+
+ while(ae) {
+ if (ae->alarm_id == alarm_id && ae->unique_id > mark &&
+ (ae->new_status != RRDCALC_STATUS_WARNING && ae->new_status != RRDCALC_STATUS_CRITICAL))
+ return 1;
+ ae = ae->next;
+ }
+ return 0;
+}
void health_active_log_alarms_2json(RRDHOST *host, BUFFER *wb) {
netdata_rwlock_rdlock(&host->health_log.alarm_log_rwlock);
@@ -363,6 +375,10 @@ void health_active_log_alarms_2json(RRDHOST *host, BUFFER *wb) {
((ae->new_status == RRDCALC_STATUS_WARNING || ae->new_status == RRDCALC_STATUS_CRITICAL) ||
((ae->old_status == RRDCALC_STATUS_WARNING || ae->old_status == RRDCALC_STATUS_CRITICAL) &&
ae->new_status == RRDCALC_STATUS_REMOVED))) {
+
+ if (have_recent_alarm(host, ae->alarm_id, ae->unique_id))
+ continue;
+
if (likely(count))
buffer_strcat(wb, ",");
health_alarm_entry2json_nolock(wb, ae, host);