summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96cf2cc)
raw | patch | inline | side by side (parent: 96cf2cc)
author | octo <octo> | |
Sat, 17 Dec 2005 10:56:39 +0000 (10:56 +0000) | ||
committer | octo <octo> | |
Sat, 17 Dec 2005 10:56:39 +0000 (10:56 +0000) |
src/Makefile.am | patch | blob | history | |
src/cpu.c | patch | blob | history | |
src/cpufreq.c | patch | blob | history | |
src/disk.c | patch | blob | history | |
src/hddtemp.c | patch | blob | history | |
src/load.c | patch | blob | history | |
src/memory.c | patch | blob | history | |
src/nfs.c | patch | blob | history | |
src/ping.c | patch | blob | history | |
src/processes.c | patch | blob | history | |
src/sensors.c | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 11e34a9fe1af9a39799415f11843c06739d3c1bb..3252aec3147148e5d08bf25a2213e7d9242ba17e 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += cpu.la
cpu_la_SOURCES = cpu.c cpu.h
cpu_la_LDFLAGS = -module -avoid-version
+cpu_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" cpu.la
collectd_DEPENDENCIES += cpu.la
endif
pkglib_LTLIBRARIES += cpufreq.la
cpufreq_la_SOURCES = cpufreq.c cpufreq.h
cpufreq_la_LDFLAGS = -module -avoid-version
+cpufreq_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" cpufreq.la
collectd_DEPENDENCIES += cpufreq.la
endif
pkglib_LTLIBRARIES += disk.la
disk_la_SOURCES = disk.c disk.h
disk_la_LDFLAGS = -module -avoid-version
+disk_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" disk.la
collectd_DEPENDENCIES += disk.la
endif
pkglib_LTLIBRARIES += hddtemp.la
hddtemp_la_SOURCES = hddtemp.c hddtemp.h
hddtemp_la_LDFLAGS = -module -avoid-version
+hddtemp_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" hddtemp.la
collectd_DEPENDENCIES += hddtemp.la
endif
pkglib_LTLIBRARIES += load.la
load_la_SOURCES = load.c load.h
load_la_LDFLAGS = -module -avoid-version
+load_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" load.la
collectd_DEPENDENCIES += load.la
endif
pkglib_LTLIBRARIES += memory.la
memory_la_SOURCES = memory.c memory.h
memory_la_LDFLAGS = -module -avoid-version
+memory_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" memory.la
collectd_DEPENDENCIES += memory.la
endif
pkglib_LTLIBRARIES += nfs.la
nfs_la_SOURCES = nfs.c nfs.h
nfs_la_LDFLAGS = -module -avoid-version
+nfs_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" nfs.la
collectd_DEPENDENCIES += nfs.la
endif
ping_la_LDFLAGS = -module -avoid-version
ping_la_LIBADD = libping/libping.la
ping_la_DEPENDENCIES = libping/libping.la
+ping_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" ping.la
collectd_DEPENDENCIES += ping.la
endif
pkglib_LTLIBRARIES += processes.la
processes_la_SOURCES = processes.c processes.h
processes_la_LDFLAGS = -module -avoid-version
+processes_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" processes.la
collectd_DEPENDENCIES += processes.la
endif
if BUILD_MODULE_SENSORS
pkglib_LTLIBRARIES += sensors.la
sensors_la_SOURCES = sensors.c sensors.h
-sensors_la_LDFLAGS = -module -avoid-version -lsensors
+sensors_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LM_SENSORS
+sensors_la_LDFLAGS += -lsensors
+endif
sensors_la_LIBADD = -lsensors
+sensors_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" sensors.la
collectd_DEPENDENCIES += sensors.la
endif
diff --git a/src/cpu.c b/src/cpu.c
index 67db5bcc4d7b2f8d8ab5a10d8e885ff771879051..6832b5239a1b9bad95d931b5061636e1fa01118c 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
**/
#include "collectd.h"
-#include "plugin.h"
#include "common.h"
+#include "plugin.h"
+
+#define MODULE_NAME "cpu"
+
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_SYSCTLBYNAME)
+# define CPU_HAVE_READ 1
+#else
+# define CPU_HAVE_READ 0
+#endif
#ifdef HAVE_LIBKSTAT
# include <sys/sysinfo.h>
static int numcpu;
#endif /* HAVE_SYSCTLBYNAME */
-#define MODULE_NAME "cpu"
-
static char *cpu_filename = "cpu-%s.rrd";
static char *ds_def[] =
}
#undef BUFSIZE
+#if CPU_HAVE_READ
static void cpu_read (void)
{
#ifdef KERNEL_LINUX
}
/* #endif defined(HAVE_LIBKSTAT) */
-#elif defined (HAVE_SYSCTLBYNAME)
+#elif defined(HAVE_SYSCTLBYNAME)
long cpuinfo[CPUSTATES];
size_t cpuinfo_size;
return;
}
+#endif /* CPU_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, cpu_init, cpu_read, cpu_write);
+ plugin_register (MODULE_NAME, cpu_init,
+#if CPU_HAVE_READ
+ cpu_read,
+#else
+ NULL,
+#endif
+ cpu_write);
}
#undef MODULE_NAME
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 001ccec2c580972f9aad03a8a702c1d289624415..92f1cc5824dc905ebc835e90f2f54d013e9c36d7 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
* Peter Holik <peter at holik.at>
**/
-#include "cpufreq.h"
-
-/*
- * Originally written by Peter Holik
- */
-
-#if COLLECT_CPUFREQ
-#define MODULE_NAME "cpufreq"
-
-#include "plugin.h"
+#include "collectd.h"
#include "common.h"
+#include "plugin.h"
-static int num_cpu = 0;
+#define MODULE_NAME "cpufreq"
static char *cpufreq_file = "cpufreq-%s.rrd";
};
static int ds_num = 1;
+#ifdef KERNEL_LINUX
+static int num_cpu = 0;
+#endif
+
#define BUFSIZE 256
-void cpufreq_init (void)
+static void cpufreq_init (void)
{
+#ifdef KERNEL_LINUX
int status;
char filename[BUFSIZE];
}
syslog (LOG_INFO, MODULE_NAME" found %d cpu(s)", num_cpu);
+#endif /* defined(KERNEL_LINUX) */
+
+ return;
}
-void cpufreq_write (char *host, char *inst, char *val)
+static void cpufreq_write (char *host, char *inst, char *val)
{
int status;
char file[BUFSIZE];
rrd_update_file (host, file, val, ds_def, ds_num);
}
-void cpufreq_submit (int cpu_num, unsigned long long val)
+static void cpufreq_submit (int cpu_num, unsigned long long val)
{
char buf[BUFSIZE];
char cpu[16];
plugin_submit (MODULE_NAME, cpu, buf);
}
-void cpufreq_read (void)
+static void cpufreq_read (void)
{
+#ifdef KERNEL_LINUX
int status;
unsigned long long val;
int i = 0;
cpufreq_submit (i, val);
}
+#endif /* defined(KERNEL_LINUX) */
+
+ return;
}
#undef BUFSIZE
}
#undef MODULE_NAME
-#endif /* COLLECT_CPUFREQ */
diff --git a/src/disk.c b/src/disk.c
index dc0232d4e8af39ba132ce0ed26c9faba74a2caca..f6234c22837e6e2642ab515be68d0f0b5097226c 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "disk.h"
-
-#if COLLECT_DISK
-#define MODULE_NAME "disk"
-
-#include "plugin.h"
+#include "collectd.h"
#include "common.h"
+#include "plugin.h"
-#ifdef KERNEL_LINUX
-typedef struct diskstats
-{
- char *name;
-
- unsigned int read_sectors;
- unsigned int write_sectors;
-
- unsigned long long read_bytes;
- unsigned long long write_bytes;
-
- struct diskstats *next;
-} diskstats_t;
-
-static diskstats_t *disklist;
-/* KERNEL_LINUX */
+#define MODULE_NAME "disk"
-#elif defined(HAVE_LIBKSTAT)
-#define MAX_NUMDISK 256
-extern kstat_ctl_t *kc;
-static kstat_t *ksp[MAX_NUMDISK];
-static int numdisk = 0;
-#endif /* HAVE_LIBKSTAT */
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
+# define DISK_HAVE_READ 1
+#else
+# define DISK_HAVE_READ 0
+#endif
static char *disk_filename_template = "disk-%s.rrd";
static char *part_filename_template = "partition-%s.rrd";
};
static int part_ds_num = 4;
-void disk_init (void)
+#ifdef KERNEL_LINUX
+typedef struct diskstats
+{
+ char *name;
+
+ unsigned int read_sectors;
+ unsigned int write_sectors;
+
+ unsigned long long read_bytes;
+ unsigned long long write_bytes;
+
+ struct diskstats *next;
+} diskstats_t;
+
+static diskstats_t *disklist;
+/* #endif defined(KERNEL_LINUX) */
+
+#elif defined(HAVE_LIBKSTAT)
+#define MAX_NUMDISK 256
+extern kstat_ctl_t *kc;
+static kstat_t *ksp[MAX_NUMDISK];
+static int numdisk = 0;
+#endif /* HAVE_LIBKSTAT */
+
+static void disk_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
return;
}
-void disk_write (char *host, char *inst, char *val)
+static void disk_write (char *host, char *inst, char *val)
{
char file[512];
int status;
rrd_update_file (host, file, val, disk_ds_def, disk_ds_num);
}
-void partition_write (char *host, char *inst, char *val)
+static void partition_write (char *host, char *inst, char *val)
{
char file[512];
int status;
}
#define BUFSIZE 512
-void disk_submit (char *disk_name,
+static void disk_submit (char *disk_name,
unsigned long long read_count,
unsigned long long read_merged,
unsigned long long read_bytes,
plugin_submit (MODULE_NAME, disk_name, buf);
}
-void partition_submit (char *part_name,
+static void partition_submit (char *part_name,
unsigned long long read_count,
unsigned long long read_bytes,
unsigned long long write_count,
}
#undef BUFSIZE
-void disk_read (void)
+#if DISK_HAVE_READ
+static void disk_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
kio.writes,kio.nwritten);
}
#endif /* defined(HAVE_LIBKSTAT) */
-}
+} /* static void disk_read (void) */
+#endif /* DISK_HAVE_READ */
void module_register (void)
{
plugin_register ("partition", NULL, NULL, partition_write);
- plugin_register (MODULE_NAME, disk_init, disk_read, disk_write);
+ plugin_register (MODULE_NAME, disk_init,
+#if DISK_HAVE_READ
+ disk_read,
+#else
+ NULL,
+#endif
+ disk_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_DISK */
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 64bd3008d161d25350c4fd6bca0b5986a207ce88..f2e8262fd555e83906892546fbe899860a59f07b 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "hddtemp.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_HDDTEMP
#define MODULE_NAME "hddtemp"
-#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-#include <stdlib.h>
-#include <string.h>
#include <libgen.h> /* for basename */
-#include "plugin.h"
-#include "common.h"
-
/* LOCALHOST_ADDR
The ip address 127.0.0.1, as a 32 bit. */
#define LOCALHOST_ADDR 0x7F000001
static hddname_t *first_hddname = NULL;
-/* hddtemp_query_daemon
- Connect to the hddtemp daemon and receive data.
-
- Parameters:
- buffer: the buffer where we put the received ascii string.
- buffer_size: size of the buffer
-
- Return value:
- >= 0 if ok, < 0 otherwise.
-
- Example of possible strings, as received from daemon:
-
- |/dev/hda|ST340014A|36|C|
- |/dev/hda|ST380011A|46|C||/dev/hdd|ST340016A|SLP|*|
-
- FIXME: we need to create a new socket each time. Is there another way? */
-
+/*
+ * NAME
+ * hddtemp_query_daemon
+ *
+ * DESCRIPTION
+ * Connect to the hddtemp daemon and receive data.
+ *
+ * ARGUMENTS:
+ * `buffer' The buffer where we put the received ascii string.
+ * `buffer_size' Size of the buffer
+ *
+ * RETURN VALUE:
+ * >= 0 if ok, < 0 otherwise.
+ *
+ * NOTES:
+ * Example of possible strings, as received from daemon:
+ * |/dev/hda|ST340014A|36|C|
+ * |/dev/hda|ST380011A|46|C||/dev/hdd|ST340016A|SLP|*|
+ *
+ * FIXME:
+ * we need to create a new socket each time. Is there another way?
+ */
static int hddtemp_query_daemon (char *buffer, int buffer_size)
{
int sock;
{
plugin_register (MODULE_NAME, hddtemp_init, hddtemp_read, hddtemp_write);
}
-
-#endif /* COLLECT_HDDTEMP */
diff --git a/src/load.c b/src/load.c
index d082816aee1a2598d8167819ba21f203c57e132a..2c02d8be0d7890933c35b9d6ebc3d18c889d8f5b 100644 (file)
--- a/src/load.c
+++ b/src/load.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "load.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_LOAD
#define MODULE_NAME "load"
-#include "plugin.h"
-#include "common.h"
+#if defined(HAVE_GETLOADAVG) || defined(KERNEL_LINUX) || defined(HAVE_LIBSTATGRAB)
+# define LOAD_HAVE_READ 1
+#else
+# define LOAD_HAVE_READ 0
+#endif
#ifdef HAVE_SYS_LOADAVG_H
#include <sys/loadavg.h>
}
#undef BUFSIZE
+#if LOAD_HAVE_READ
void load_read (void)
{
#if defined(HAVE_GETLOADAVG)
load_submit (snum, mnum, lnum);
#endif /* HAVE_LIBSTATGRAB */
}
+#endif /* LOAD_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, load_init, load_read, load_write);
+ plugin_register (MODULE_NAME, load_init,
+#if LOAD_HAVE_READ
+ load_read,
+#else
+ NULL,
+#endif
+ load_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_LOAD */
diff --git a/src/memory.c b/src/memory.c
index f7924456a3736a56b8ba88e64f10e8812fa05b0d..6ae35cbbd3aa7f533d2ac66bbc67c5e929dce32e 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "memory.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_MEMORY
-#define MODULE_NAME "memory"
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
+# define MEMORY_HAVE_READ 1
+#else
+# define MEMORY_HAVE_READ 0
+#endif
-#include "plugin.h"
-#include "common.h"
+#define MODULE_NAME "memory"
static char *memory_file = "memory.rrd";
}
#undef BUFSIZE
+#if MEMORY_HAVE_READ
void memory_read (void)
{
#ifdef KERNEL_LINUX
memory_submit (ios->used, 0LL, ios->cache, ios->free);
#endif /* HAVE_LIBSTATGRAB */
}
+#endif /* MEMORY_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, memory_init, memory_read, memory_write);
+ plugin_register (MODULE_NAME, memory_init,
+#if MEMORY_HAVE_READ
+ memory_read,
+#else
+ NULL,
+#endif
+ memory_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_MEMORY */
diff --git a/src/nfs.c b/src/nfs.c
index 3321630ae991ab6dc9427865eccd3bb9b92eb3ca..033311379c22bdf805748160a2d1275336d20688 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "nfs.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_NFS
#define MODULE_NAME "nfs"
-#include "plugin.h"
-#include "common.h"
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
+# define NFS_HAVE_READ 1
+#else
+# define NFS_HAVE_READ 0
+#endif
static char *nfs2_procedures_file = "nfs2_procedures-%s.rrd";
static char *nfs3_procedures_file = "nfs3_procedures-%s.rrd";
}
#endif
+#if NFS_HAVE_READ
void nfs_read (void)
{
#if defined(KERNEL_LINUX)
nfs2_read_kstat (nfs2_ksp_server, "server");
#endif /* defined(HAVE_LIBKSTAT) */
}
+#endif /* NFS_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, nfs_init, nfs_read, NULL);
- plugin_register ("nfs2_procedures", NULL, NULL, nfs2_procedures_write);
- plugin_register ("nfs3_procedures", NULL, NULL, nfs3_procedures_write);
+ plugin_register (MODULE_NAME, nfs_init,
+#if NFS_HAVE_READ
+ nfs_read,
+#else
+ NULL,
+#endif
+ NULL);
+ plugin_register ("nfs2_procedures", NULL, NULL, nfs2_procedures_write);
+ plugin_register ("nfs3_procedures", NULL, NULL, nfs3_procedures_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_LOAD */
diff --git a/src/ping.c b/src/ping.c
index e6456f8c9ef66593b364edde4a91df2327b978dc..6a2b9068c5201405ee8114ec160120c808d5724f 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "ping.h"
-
-#if COLLECT_PING
-#define MODULE_NAME "ping"
-
-#include "plugin.h"
+#include "collectd.h"
#include "common.h"
+#include "plugin.h"
#include "configfile.h"
+#define MODULE_NAME "ping"
+
#include <netinet/in.h>
#include "libping/ping.h"
+#define MAX_PINGHOSTS 32
+
extern char *pinghosts[MAX_PINGHOSTS];
extern int num_pinghosts;
static int pingerrors[MAX_PINGHOSTS];
}
#undef MODULE_NAME
-#endif /* COLLECT_PING */
diff --git a/src/processes.c b/src/processes.c
index 821472bd95e34ae3620a42afa5091b5fb68fe6bb..e2bda15e41eaffdf7786048b3382b15125379116 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "processes.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_PROCESSES
#define MODULE_NAME "processes"
-#include "common.h"
-#include "plugin.h"
+#ifdef KERNEL_LINUX
+# define PROCESSES_HAVE_READ 1
+#else
+# define PROCESSES_HAVE_READ 0
+#endif
static char *ps_file = "processes.rrd";
plugin_submit (MODULE_NAME, "-", buf);
}
+#if PROCESSES_HAVE_READ
void ps_read (void)
{
#ifdef KERNEL_LINUX
ps_submit (running, sleeping, zombies, stopped, paging, blocked);
#endif /* defined(KERNEL_LINUX) */
}
+#endif /* PROCESSES_HAVE_READ */
#undef BUFSIZE
void module_register (void)
{
- plugin_register (MODULE_NAME, ps_init, ps_read, ps_write);
+ plugin_register (MODULE_NAME, ps_init,
+#if PROCESSES_HAVE_READ
+ ps_read,
+#else
+ NULL,
+#endif
+ ps_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_PROCESSES */
diff --git a/src/sensors.c b/src/sensors.c
index 270ba035cfdfbbdf350fc00da36fa0b0eca5bfec..13139636ce07bb40e75e0566600d3c5aaf6e2237 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "sensors.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_SENSORS
#define MODULE_NAME "sensors"
-#include <sensors/sensors.h>
-
-#include "plugin.h"
-#include "common.h"
-
-typedef struct featurelist
-{
- const sensors_chip_name *chip;
- const sensors_feature_data *data;
- struct featurelist *next;
-} featurelist_t;
+#if defined(HAVE_SENSORS_SENSORS_H)
+# include <sensors/sensors.h>
+#else
+# undef HAVE_LIBSENSORS
+#endif
-featurelist_t *first_feature = NULL;
+#if defined(HAVE_LIBSENSORS)
+# define SENSORS_HAVE_READ 1
+#else
+# define SENSORS_HAVE_READ 0
+#endif
static char *filename_format = "sensors-%s.rrd";
};
static int ds_num = 1;
-void collectd_sensors_init (void)
+#ifdef HAVE_LIBSENSORS
+typedef struct featurelist
+{
+ const sensors_chip_name *chip;
+ const sensors_feature_data *data;
+ struct featurelist *next;
+} featurelist_t;
+
+featurelist_t *first_feature = NULL;
+#endif /* defined (HAVE_LIBSENSORS) */
+
+static void collectd_sensors_init (void)
{
+#ifdef HAVE_LIBSENSORS
FILE *fh;
featurelist_t *last_feature = NULL;
featurelist_t *new_feature;
if (first_feature == NULL)
sensors_cleanup ();
+#endif /* defined(HAVE_LIBSENSORS) */
+
+ return;
}
-void sensors_write (char *host, char *inst, char *val)
+#define BUFSIZE 512
+static void sensors_write (char *host, char *inst, char *val)
{
- char file[512];
+ char file[BUFSIZE];
int status;
- status = snprintf (file, 512, filename_format, inst);
+ status = snprintf (file, BUFSIZE, filename_format, inst);
if (status < 1)
return;
- else if (status >= 512)
+ else if (status >= BUFSIZE)
return;
rrd_update_file (host, file, val, ds_def, ds_num);
}
-#define BUFSIZE 512
-void sensors_submit (const char *feat_name, const char *chip_prefix, double value)
+static void sensors_submit (const char *feat_name, const char *chip_prefix, double value)
{
char buf[BUFSIZE];
char inst[BUFSIZE];
@@ -163,7 +177,8 @@ void sensors_submit (const char *feat_name, const char *chip_prefix, double valu
}
#undef BUFSIZE
-void sensors_read (void)
+#if SENSORS_HAVE_READ
+static void sensors_read (void)
{
featurelist_t *feature;
double value;
sensors_submit (feature->data->name, feature->chip->prefix, value);
}
}
+#endif /* SENSORS_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, collectd_sensors_init, sensors_read,
+ plugin_register (MODULE_NAME, collectd_sensors_init,
+#if SENSORS_HAVE_READ
+ sensors_read,
+#else
+ NULL,
+#endif
sensors_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_SENSORS */