summaryrefslogtreecommitdiffstats
path: root/health/health_json.c
diff options
context:
space:
mode:
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);