summaryrefslogtreecommitdiffstats
path: root/src/health
diff options
context:
space:
mode:
Diffstat (limited to 'src/health')
-rw-r--r--src/health/health_event_loop.c11
-rw-r--r--src/health/rrdvar.c4
-rw-r--r--src/health/rrdvar.h2
3 files changed, 10 insertions, 7 deletions
diff --git a/src/health/health_event_loop.c b/src/health/health_event_loop.c
index b50812f2a..04d70e11f 100644
--- a/src/health/health_event_loop.c
+++ b/src/health/health_event_loop.c
@@ -75,10 +75,13 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
time_t needed = now + rc->config.before + rc->config.after;
if(needed + update_every < first || needed - update_every > last) {
- netdata_log_debug(D_HEALTH
- , "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu)."
- , rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) needed, (unsigned long) first
- , (unsigned long) last);
+ netdata_log_debug(D_HEALTH,
+ "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu).",
+ rrdcalc_chart_name(rc),
+ rrdcalc_name(rc),
+ (unsigned long) needed,
+ (unsigned long) first,
+ (unsigned long) last);
return 0;
}
}
diff --git a/src/health/rrdvar.c b/src/health/rrdvar.c
index 4e28e62a3..75cb9739b 100644
--- a/src/health/rrdvar.c
+++ b/src/health/rrdvar.c
@@ -107,7 +107,7 @@ void rrdvar_host_variable_set(RRDHOST *host, const RRDVAR_ACQUIRED *rva, NETDATA
// CUSTOM CHART VARIABLES
const RRDVAR_ACQUIRED *rrdvar_chart_variable_add_and_acquire(RRDSET *st, const char *name) {
- if(unlikely(!st->rrdvars)) return NULL;
+ if(unlikely(!st || !st->rrdvars)) return NULL;
STRING *name_string = rrdvar_name_to_string(name);
const RRDVAR_ACQUIRED *rs = rrdvar_add_and_acquire(st->rrdvars, name_string, NAN);
@@ -116,7 +116,7 @@ const RRDVAR_ACQUIRED *rrdvar_chart_variable_add_and_acquire(RRDSET *st, const c
}
void rrdvar_chart_variable_set(RRDSET *st, const RRDVAR_ACQUIRED *rva, NETDATA_DOUBLE value) {
- if(unlikely(!st->rrdvars || !rva)) return;
+ if(unlikely(!st || !st->rrdvars || !rva)) return;
RRDVAR *rv = dictionary_acquired_item_value((const DICTIONARY_ITEM *)rva);
if(rv->value != value) {
diff --git a/src/health/rrdvar.h b/src/health/rrdvar.h
index 31530589d..3297984cb 100644
--- a/src/health/rrdvar.h
+++ b/src/health/rrdvar.h
@@ -19,7 +19,7 @@ void rrdvar_host_variable_set(RRDHOST *host, const RRDVAR_ACQUIRED *rva, NETDATA
int rrdvar_walkthrough_read(DICTIONARY *dict, int (*callback)(const DICTIONARY_ITEM *item, void *rrdvar, void *data), void *data);
#define rrdvar_host_variable_release(host, rva) rrdvar_release((host)->rrdvars, rva)
-#define rrdvar_chart_variable_release(st, rva) rrdvar_release((st)->rrdvars, rva)
+#define rrdvar_chart_variable_release(st, rva) do { if(st) rrdvar_release((st)->rrdvars, rva); } while(0)
void rrdvar_release(DICTIONARY *dict, const RRDVAR_ACQUIRED *rva);
NETDATA_DOUBLE rrdvar2number(const RRDVAR_ACQUIRED *rva);