config_set_boolean("health", "enabled", 0);
default_health_enabled = 0;
}
-
- char pathname[FILENAME_MAX + 1];
- snprintfz(pathname, FILENAME_MAX, "%s/health", netdata_configured_varlib_dir);
- if(mkdir(pathname, 0770) == -1 && errno != EEXIST)
- fatal("Cannot create directory '%s'.", pathname);
}
// ----------------------------------------------------------------------------
log_date(stderr);
va_start( args, fmt );
- if(debug_flags) fprintf(stderr, "%s: INFO: (%04lu@%-10.10s:%-15.15s): ", program_name, line, file, function);
- else fprintf(stderr, "%s: INFO: ", program_name);
+ if(debug_flags) fprintf(stderr, "%s: INFO : (%04lu@%-10.10s:%-15.15s): ", program_name, line, file, function);
+ else fprintf(stderr, "%s: INFO : ", program_name);
vfprintf( stderr, fmt, args );
va_end( args );
RRD_MEMORY_MODE memory_mode,
int health_enabled) {
- debug(D_RRDHOST, "Adding host '%s' with guid '%s'", hostname, guid);
+ debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid);
RRDHOST *host = callocz(1, sizeof(RRDHOST));
long n = config_get_number("health", "in memory max health log entries", host->health_log.max);
if(n < 10) {
- error("Health configuration has invalid max log entries %ld. Using default %u", n, host->health_log.max);
+ error("Host '%s': health configuration has invalid max log entries %ld. Using default %u", host->hostname, n, host->health_log.max);
config_set_number("health", "in memory max health log entries", (long)host->health_log.max);
}
else
if(host->rrd_memory_mode == RRD_MEMORY_MODE_MAP || host->rrd_memory_mode == RRD_MEMORY_MODE_SAVE) {
int r = mkdir(host->cache_dir, 0775);
if(r != 0 && errno != EEXIST)
- error("Cannot create directory '%s'", host->cache_dir);
+ error("Host '%s': cannot create directory '%s'", host->hostname, host->cache_dir);
}
snprintfz(filename, FILENAME_MAX, "%s/%s", netdata_configured_varlib_dir, host->machine_guid);
if(host->health_enabled) {
int r = mkdir(host->varlib_dir, 0775);
if(r != 0 && errno != EEXIST)
- error("Cannot create directory '%s'", host->varlib_dir);
+ error("Host '%s': cannot create directory '%s'", host->hostname, host->varlib_dir);
}
+ snprintfz(filename, FILENAME_MAX, "%s/health", host->varlib_dir);
+ int r = mkdir(filename, 0775);
+ if(r != 0 && errno != EEXIST)
+ error("Host '%s': cannot create directory '%s'", host->hostname, filename);
+
snprintfz(filename, FILENAME_MAX, "%s/health/health-log.db", host->varlib_dir);
host->health_log_filename = strdupz(filename);
}
if(rrdhost_index_add(host) != host)
- fatal("Cannot add host '%s' to index. It already exists.", hostname);
+ fatal("Host '%s': cannot add host to index. It already exists.", hostname);
rrd_unlock();
- debug(D_RRDHOST, "Added host '%s' with guid '%s'", host->hostname, host->machine_guid);
+ debug(D_RRDHOST, "Host '%s', added with guid '%s'", host->hostname, host->machine_guid);
return host;
}