freez(buf);
- if(!max_unique_id) max_unique_id = (uint32_t)time(NULL);
- if(!max_alarm_id) max_alarm_id = (uint32_t)time(NULL);
+ if(!max_unique_id) max_unique_id = (uint32_t)now_realtime_sec();
+ if(!max_alarm_id) max_alarm_id = (uint32_t)now_realtime_sec();
host->health_log.next_log_id = max_unique_id + 1;
host->health_log.next_alarm_id = max_alarm_id + 1;
static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) {
debug(D_HEALTH, "Health linking alarm '%s.%s' to chart '%s' of host '%s'", rc->chart?rc->chart:"NOCHART", rc->name, st->id, st->rrdhost->hostname);
- rc->last_status_change = time(NULL);
+ rc->last_status_change = now_realtime_sec();
rc->rrdset = st;
rc->rrdset_next = st->alarms;
if(!rc->units) rc->units = strdupz(st->units);
{
- time_t now = time(NULL);
+ time_t now = now_realtime_sec();
health_alarm_log(st->rrdhost, rc->id, rc->next_event_id++, now, rc->name, rc->rrdset->id, rc->rrdset->family, rc->exec, rc->recipient, now - rc->last_status_change, rc->old_value, rc->value, rc->status, RRDCALC_STATUS_UNINITIALIZED, rc->source, rc->units, rc->info, 0);
}
}
}
{
- time_t now = time(NULL);
+ time_t now = now_realtime_sec();
health_alarm_log(st->rrdhost, rc->id, rc->next_event_id++, now, rc->name, rc->rrdset->id, rc->rrdset->family, rc->exec, rc->recipient, now - rc->last_status_change, rc->old_value, rc->value, rc->status, RRDCALC_STATUS_REMOVED, rc->source, rc->units, rc->info, 0);
}
host->hostname,
(host->health_log.next_log_id > 0)?(host->health_log.next_log_id - 1):0,
health_enabled?"true":"false",
- (unsigned long)time(NULL));
+ (unsigned long)now_realtime_sec());
RRDCALC *rc;
for(i = 0, rc = host->alarms; rc ; rc = rc->next) {
);
ae->flags |= HEALTH_ENTRY_FLAG_EXEC_RUN;
- ae->exec_run_timestamp = time(NULL);
+ ae->exec_run_timestamp = now_realtime_sec();
debug(D_HEALTH, "executing command '%s'", command_to_run);
FILE *fp = mypopen(command_to_run, &command_pid);
static inline void health_alarm_log_process(RRDHOST *host) {
static uint32_t stop_at_id = 0;
uint32_t first_waiting = (host->health_log.alarms)?host->health_log.alarms->unique_id:0;
- time_t now = time(NULL);
+ time_t now = now_realtime_sec();
pthread_rwlock_rdlock(&host->health_log.alarm_log_rwlock);
debug(D_HEALTH, "Health monitoring iteration no %u started", loop);
int oldstate, runnable = 0;
- time_t now = time(NULL);
+ time_t now = now_realtime_sec();
time_t next_run = now + min_run_every;
RRDCALC *rc;
if(unlikely(netdata_exit))
break;
- now = time(NULL);
+ now = now_realtime_sec();
if(now < next_run) {
debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration in %d secs",
loop, (int) (next_run - now));