#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <unistd.h>
#include <sys/protosw.h>
#endif /* HAVE_PERFSTAT */
-static _Bool report_relative_load = 0;
+static bool report_relative_load;
static const char *config_keys[] = {"ReportRelative"};
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) ? 1 : 0;
+ report_relative_load = IS_TRUE(value);
#else
WARNING("load plugin: The \"ReportRelative\" configuration "
"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."