const char *guid,
const char *os,
int update_every,
- int entries,
+ long entries,
RRD_MEMORY_MODE memory_mode,
int health_enabled,
int rrdpush_enabled,
RRDHOST *host = callocz(1, sizeof(RRDHOST));
- host->rrd_update_every = update_every;
- host->rrd_history_entries = entries;
+ host->rrd_update_every = (update_every > 0)?update_every:1;
+ host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries);
host->rrd_memory_mode = memory_mode;
host->health_enabled = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled;
host->rrdpush_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key);
", os %s"
", update every %d"
", memory mode %s"
- ", history entries %d"
+ ", history entries %ld"
", streaming %s"
" (to '%s' with api key '%s')"
", health %s"
, const char *guid
, const char *os
, int update_every
- , int history
+ , long history
, RRD_MEMORY_MODE mode
, int health_enabled
, int rrdpush_enabled
error("Host '%s' has an update frequency of %d seconds, but the wanted one is %d seconds.", host->hostname, host->rrd_update_every, update_every);
if(host->rrd_history_entries != history)
- error("Host '%s' has history of %d entries, but the wanted one is %d entries.", host->hostname, host->rrd_history_entries, history);
+ error("Host '%s' has history of %ld entries, but the wanted one is %ld entries.", host->hostname, host->rrd_history_entries, history);
if(host->rrd_memory_mode != mode)
error("Host '%s' has memory mode '%s', but the wanted one is '%s'.", host->hostname, rrd_memory_mode_name(host->rrd_memory_mode), rrd_memory_mode_name(mode));