diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2021-02-11 14:26:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 14:26:57 +0200 |
commit | b4b6e75dd7bd89253c935bf6cf0539e42ccda7ec (patch) | |
tree | d99dba763376bb98cd9933ae3560111ce4e0ca04 | |
parent | f1a62106ca0a0dd5c08286edfa7e73dbcc28602b (diff) |
Allow the REMOVED status to be sent if a previous status was WARN/CRIT (#10533)
-rw-r--r-- | health/health_json.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/health/health_json.c b/health/health_json.c index d068b54270..7b5a1e3cb4 100644 --- a/health/health_json.c +++ b/health/health_json.c @@ -352,14 +352,15 @@ void health_active_log_alarms_2json(RRDHOST *host, BUFFER *wb) { unsigned int count = 0; ALARM_ENTRY *ae; for(ae = host->health_log.alarms; ae && count < max ; ae = ae->next) { - - if(likely(!((ae->new_status == RRDCALC_STATUS_WARNING || ae->new_status == RRDCALC_STATUS_CRITICAL) - && !ae->updated_by_id))) - continue; - - if(likely(count)) buffer_strcat(wb, ","); + if (!ae->updated_by_id && + ((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 (likely(count)) + buffer_strcat(wb, ","); health_alarm_entry2json_nolock(wb, ae, host); - count++; + count++; + } } buffer_strcat(wb, "]"); |