diff options
Diffstat (limited to '')
-rw-r--r-- | src/health/health_log.c (renamed from health/health_log.c) | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/health/health_log.c b/src/health/health_log.c index fd124ce80..b04f8f248 100644 --- a/health/health_log.c +++ b/src/health/health_log.c @@ -10,6 +10,8 @@ inline void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae) { void health_log_alert_transition_with_trace(RRDHOST *host, ALARM_ENTRY *ae, int line, const char *file, const char *function) { + if(!host || !ae) return; + ND_LOG_STACK lgs[] = { ND_LOG_FIELD_UUID(NDF_MESSAGE_ID, &health_alert_transition_msgid), ND_LOG_FIELD_STR(NDF_NIDL_NODE, host->hostname), @@ -86,31 +88,31 @@ void health_log_alert_transition_with_trace(RRDHOST *host, ALARM_ENTRY *ae, int inline ALARM_ENTRY* health_create_alarm_entry( RRDHOST *host, - uint32_t alarm_id, - uint32_t alarm_event_id, - const uuid_t config_hash_id, + RRDCALC *rc, time_t when, - STRING *name, - STRING *chart, - STRING *chart_context, - STRING *chart_name, - STRING *class, - STRING *component, - STRING *type, - STRING *exec, - STRING *recipient, time_t duration, NETDATA_DOUBLE old_value, NETDATA_DOUBLE new_value, RRDCALC_STATUS old_status, RRDCALC_STATUS new_status, - STRING *source, - STRING *units, - STRING *summary, - STRING *info, int delay, HEALTH_ENTRY_FLAGS flags ) { + uint32_t alarm_id = rc->id; + uint32_t alarm_event_id = rc->next_event_id++; + STRING *name = rc->config.name; + STRING *chart = rc->rrdset->id; + STRING *chart_context = rc->rrdset->context; + STRING *chart_name = rc->rrdset->name; + STRING *class = rc->config.classification; + STRING *component = rc->config.component; + STRING *type = rc->config.type; + STRING *exec = rc->config.exec; + STRING *recipient = rc->config.recipient; + STRING *source = rc->config.source; + STRING *units = rc->config.units; + STRING *summary = rc->summary; + STRING *info = rc->info; if (duration < 0) duration = 0; @@ -123,7 +125,7 @@ inline ALARM_ENTRY* health_create_alarm_entry( ae->chart_context = string_dup(chart_context); ae->chart_name = string_dup(chart_name); - uuid_copy(ae->config_hash_id, *((uuid_t *) config_hash_id)); + uuid_copy(ae->config_hash_id, rc->config.hash_id); uuid_generate_random(ae->transition_id); ae->global_id = now_realtime_usec(); |