/**
* collectd - src/sensors.c
- * Copyright (C) 2005 Florian octo Forster
+ * Copyright (C) 2005,2006 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
# define SENSORS_HAVE_READ 0
#endif
+#define BUFSIZE 512
+
static char *filename_format = "sensors-%s.rrd";
static char *ds_def[] =
{
- "DS:value:GAUGE:25:U:U",
+ "DS:value:GAUGE:"COLLECTD_HEARTBEAT":U:U",
NULL
};
static int ds_num = 1;
return;
}
-#define BUFSIZE 512
static void sensors_write (char *host, char *inst, char *val)
{
char file[BUFSIZE];
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if SENSORS_HAVE_READ
static void sensors_submit (const char *feat_name, const char *chip_prefix, double value)
{
char buf[BUFSIZE];
plugin_submit (MODULE_NAME, inst, buf);
}
-#undef BUFSIZE
-#if SENSORS_HAVE_READ
static void sensors_read (void)
{
featurelist_t *feature;
sensors_submit (feature->data->name, feature->chip->prefix, value);
}
}
+#else
+# define sensors_read NULL
#endif /* SENSORS_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, collectd_sensors_init,
-#if SENSORS_HAVE_READ
- sensors_read,
-#else
- NULL,
-#endif
- sensors_write);
+ plugin_register (MODULE_NAME, collectd_sensors_init, sensors_read, sensors_write);
}
+#undef BUFSIZE
#undef MODULE_NAME