void history_record(strand_t *s, uint32_t type, uint64_t etime, uint64_t delta) { history_t h = {type, etime, delta}; if (s->hsize >= HISTORY_PER_STRAND) { flush_history(s); } s->history[s->hsize++] = h; }
void child_hist_trapper_main (int i) { int count; queue_history_entry_t entry; void* history_token; zabbix_log( LOG_LEVEL_DEBUG, "In child_trapper_main()"); zabbix_log( LOG_LEVEL_WARNING, "server #%d started [HistTrapper]", i); queue_fd = queue_get_queue_id (i, 1); key_values = metric_register ("trapper_history_values", i); key_skipped = metric_register ("trapper_history_skipped_bytes", i); metric_update (key_skipped, mtr_skipped); DBconnect(ZBX_DB_CONNECT_NORMAL); for (;;) { zbx_setproctitle("Trapper waiting for new history data"); /* First we try to get data from primary queue */ count = trapper_dequeue_history (&entry); if (count) { history_token = NULL; mtr_values += entry.count; metric_update (key_values, mtr_values); for (i = 0; i < entry.count; i++) append_history (entry.server, entry.key, entry.items[i].value, entry.items[i].ts, &history_token); flush_history (&history_token); free (entry.items); } } DBclose(); }