Don't create a REMOVED alert event after a REMOVED. (#13871)
dont create REMOVED after a REMOVED
Emmanuel Vasilakis committed
Oct 25, 2022 at 11:33 UTC
d7346bcfe453beba3345fe55462992e3b3a41b12
1 file changed
+29
-27
database/rrdcalc.c
+29
-27
@@ -289,33 +289,35 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
289
290
time_t now = now_realtime_sec();
291
292
- ALARM_ENTRY *ae = health_create_alarm_entry(
293
- host,
294
- rc->id,
295
- rc->next_event_id++,
296
- rc->config_hash_id,
297
- now,
298
- rc->name,
299
- rc->rrdset->id,
300
- rc->rrdset->context,
301
- rc->rrdset->family,
302
- rc->classification,
303
- rc->component,
304
- rc->type,
305
- rc->exec,
306
- rc->recipient,
307
- now - rc->last_status_change,
308
- rc->old_value,
309
- rc->value,
310
- rc->status,
311
- RRDCALC_STATUS_REMOVED,
312
- rc->source,
313
- rc->units,
314
- rc->info,
315
- 0,
316
- 0);
317
-
318
- health_alarm_log_add_entry(host, ae);
292
+ if (likely(rc->status != RRDCALC_STATUS_REMOVED)) {
293
+ ALARM_ENTRY *ae = health_create_alarm_entry(
294
+ host,
295
+ rc->id,
296
+ rc->next_event_id++,
297
+ rc->config_hash_id,
298
+ now,
299
+ rc->name,
300
+ rc->rrdset->id,
301
+ rc->rrdset->context,
302
+ rc->rrdset->family,
303
+ rc->classification,
304
+ rc->component,
305
+ rc->type,
306
+ rc->exec,
307
+ rc->recipient,
308
+ now - rc->last_status_change,
309
+ rc->old_value,
310
+ rc->value,
311
+ rc->status,
312
+ RRDCALC_STATUS_REMOVED,
313
+ rc->source,
314
+ rc->units,
315
+ rc->info,
316
+ 0,
317
+ 0);
318
+
319
+ health_alarm_log_add_entry(host, ae);
320
+ }
321
322
debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
323