} else if (strcasecmp(key, "Normalization") == 0) {
int normalize_tmp = atoi(value);
if (normalize_tmp < 0 || normalize_tmp > 2) {
- WARNING("barometer: collectd_barometer_config: invalid normalization: %d",
- normalize_tmp);
+ ERROR("barometer: collectd_barometer_config: invalid normalization: %d",
+ normalize_tmp);
return 1;
}
config_normalize = normalize_tmp;
/* default to the global interval set before loading this plugin */
plugin_ctx_t ctx = {
- .interval = cf_get_default_interval(), .name = strdup(name),
+ .interval = cf_get_default_interval(),
+ .name = strdup(name),
};
if (ctx.name == NULL)
return ENOMEM;
/* Hm, no complex plugin found. Dispatch the values one by one */
for (int i = 0, ret = 0; i < ci->children_num; i++) {
if (ci->children[i].children == NULL) {
- ret = dispatch_value_plugin(name, ci->children + i);
- if (ret != 0)
+ oconfig_item_t *child = ci->children + i;
+ ret = dispatch_value_plugin(name, child);
+ if (ret != 0) {
+ ERROR("Plugin %s failed to handle option %s, return code: %i", name,
+ child->key, ret);
return ret;
+ }
} else {
WARNING("There is a `%s' block within the "
"configuration for the %s plugin. "
return 0;
}
- temp = realloc(dst->children,
- sizeof(oconfig_item_t) *
- (dst->children_num + src->children_num - 1));
+ temp =
+ realloc(dst->children, sizeof(oconfig_item_t) *
+ (dst->children_num + src->children_num - 1));
if (temp == NULL) {
ERROR("configfile: realloc failed.");
return -1;
if ((src == NULL) || (src->children_num == 0))
return 0;
- temp =
- realloc(dst->children,
- sizeof(oconfig_item_t) * (dst->children_num + src->children_num));
+ temp = realloc(dst->children, sizeof(oconfig_item_t) *
+ (dst->children_num + src->children_num));
if (temp == NULL) {
ERROR("configfile: realloc failed.");
return -1;
return root;
} /* oconfig_item_t *cf_read_generic */
-/* #endif HAVE_WORDEXP_H */
+ /* #endif HAVE_WORDEXP_H */
#else /* if !HAVE_WORDEXP_H */
static oconfig_item_t *cf_read_generic(const char *path, const char *pattern,
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static int load_config(const char *key, const char *value) {
- if (strcasecmp(key, "ReportRelative") == 0)
+ if (strcasecmp(key, "ReportRelative") == 0) {
#ifdef _SC_NPROCESSORS_ONLN
report_relative_load = IS_TRUE(value);
#else
"is not available, because I can't determine the "
"number of CPUS on this system. Sorry.");
#endif
+ return 0;
+ }
return -1;
}
static void load_submit(gauge_t snum, gauge_t mnum, gauge_t lnum) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum},
+ {.gauge = snum},
+ {.gauge = mnum},
+ {.gauge = lnum},
};
vl.values = values;
else {
WARNING("load: getloadavg failed: %s", STRERRNO);
}
-/* #endif HAVE_GETLOADAVG */
+ /* #endif HAVE_GETLOADAVG */
#elif defined(KERNEL_LINUX)
gauge_t snum, mnum, lnum;
lnum = atof(fields[2]);
load_submit(snum, mnum, lnum);
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBSTATGRAB
gauge_t snum, mnum, lnum;
mnum = ls->min5;
lnum = ls->min15;
load_submit(snum, mnum, lnum);
-/* #endif HAVE_LIBSTATGRAB */
+ /* #endif HAVE_LIBSTATGRAB */
#elif HAVE_PERFSTAT
gauge_t snum, mnum, lnum;
mnum = (float)cputotal.loadavg[1] / (float)(1 << SBITS);
lnum = (float)cputotal.loadavg[2] / (float)(1 << SBITS);
load_submit(snum, mnum, lnum);
-/* #endif HAVE_PERFSTAT */
+ /* #endif HAVE_PERFSTAT */
#else
#error "No applicable input method."
log_level = parse_log_severity(value);
if (log_level < 0) {
log_level = LOG_INFO;
- ERROR("logfile: invalid loglevel [%s] defaulting to 'info'", value);
- return 1;
+ WARNING("logfile: invalid loglevel [%s] defaulting to 'info'", value);
+ return 0;
}
} else if (0 == strcasecmp(key, "File")) {
sfree(log_file);
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
/* NOTE ON THE NEW NAMING SCHEMA:
derive_t uncompressed, derive_t compressed) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = uncompressed}, {.derive = compressed},
+ {.derive = uncompressed},
+ {.derive = compressed},
};
vl.values = values;
/* callback = */ openvpn_read,
/* interval = */ 0,
&(user_data_t){
- .data = instance, .free_func = openvpn_free,
+ .data = instance,
+ .free_func = openvpn_free,
});
if (status == EINVAL) {
- WARNING("openvpn plugin: status filename \"%s\" "
- "already used, please choose a "
- "different one.",
- status_name);
+ ERROR("openvpn plugin: status filename \"%s\" "
+ "already used, please choose a "
+ "different one.",
+ status_name);
return -1;
}
static int notif_severity;
static const char *config_keys[] = {
- "LogLevel", "NotifyLevel",
+ "LogLevel",
+ "NotifyLevel",
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
} else if (strcasecmp(key, "NotifyLevel") == 0) {
notif_severity = parse_notif_severity(value);
if (notif_severity < 0)
- return 1;
+ ERROR("syslog: invalid notification severity [%s]", value);
+ return 1;
}
return 0;
tmp = atoi(value);
if (tmp < 0) {
- WARNING("ted plugin: Invalid retry count: %i", tmp);
+ ERROR("ted plugin: Invalid retry count: %i", tmp);
return 1;
}
conf_retries = tmp;