summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ac8dcf)
raw | patch | inline | side by side (parent: 9ac8dcf)
author | octo <octo> | |
Sat, 17 Dec 2005 12:11:54 +0000 (12:11 +0000) | ||
committer | octo <octo> | |
Sat, 17 Dec 2005 12:11:54 +0000 (12:11 +0000) |
14 files changed:
configure.in | patch | blob | history | |
src/cpu.c | patch | blob | history | |
src/cpufreq.c | patch | blob | history | |
src/disk.c | patch | blob | history | |
src/load.c | patch | blob | history | |
src/memory.c | patch | blob | history | |
src/nfs.c | patch | blob | history | |
src/processes.c | patch | blob | history | |
src/sensors.c | patch | blob | history | |
src/serial.c | patch | blob | history | |
src/swap.c | patch | blob | history | |
src/tape.c | patch | blob | history | |
src/traffic.c | patch | blob | history | |
src/users.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 46bc88343e04423f40d615f2e2e13cab5693aafe..3777f7d84909c3a24d5fe56ccd3e73e5affeaaca 100644 (file)
--- a/configure.in
+++ b/configure.in
]dnl
)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
-
-
-#m4_divert_once([HELP_ENABLE], [
-#collectd modules:])
-#AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
-#AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
-#AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
-#AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
-#AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
-#AC_COLLECTD([load], [disable], [module], [system load statistics])
-#AC_COLLECTD([memory], [disable], [module], [memory statistics])
-#AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
-#AC_COLLECTD([ping], [disable], [module], [ping statistics])
-#AC_COLLECTD([processes], [disable], [module], [processes statistics])
-#AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
-#AC_COLLECTD([serial], [disable], [module], [serial statistics])
-#AC_COLLECTD([swap], [disable], [module], [swap statistics])
-#AC_COLLECTD([tape], [disable], [module], [tape statistics])
-#AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
-#AC_COLLECTD([users], [disable], [module], [user count statistics])
-
-
-
m4_divert_once([HELP_ENABLE], [
collectd features:])
-
AC_COLLECTD([debug], [enable], [feature], [debugging])
AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
m4_divert_once([HELP_ENABLE], [
collectd modules:])
AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
+AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
+AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
+AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
+AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
+AC_COLLECTD([load], [disable], [module], [system load statistics])
+AC_COLLECTD([memory], [disable], [module], [memory statistics])
+AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
+AC_COLLECTD([ping], [disable], [module], [ping statistics])
+AC_COLLECTD([processes], [disable], [module], [processes statistics])
+AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
+AC_COLLECTD([serial], [disable], [module], [serial statistics])
+AC_COLLECTD([swap], [disable], [module], [swap statistics])
+AC_COLLECTD([tape], [disable], [module], [tape statistics])
+AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
+AC_COLLECTD([users], [disable], [module], [user count statistics])
+
+#m4_divert_once([HELP_ENABLE], [
+#collectd modules:])
#AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
#if test "x$enable_cpu" != "xno"
#then
#fi
#AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
-AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
-if test "x$enable_cpufreq" != "xno"
-then
- if test "x$ac_system" = "xLinux"
- then
- enable_cpufreq="yes"
- else
- enable_cpufreq="no"
- fi
-fi
-if test "x$enable_cpufreq" = "xno"
-then
- AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
+#AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
+#if test "x$enable_cpufreq" != "xno"
+#then
+# if test "x$ac_system" = "xLinux"
+# then
+# enable_cpufreq="yes"
+# else
+# enable_cpufreq="no"
+# fi
+#fi
+#if test "x$enable_cpufreq" = "xno"
+#then
+# AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
-AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
-if test "x$enable_disk" != "xno"
-then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
- then
- enable_disk="yes"
- else
- enable_disk="no"
- fi
-fi
-if test "x$enable_disk" = "xno"
-then
- AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
-fi
-AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
+#AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
+#if test "x$enable_disk" != "xno"
+#then
+# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
+# then
+# enable_disk="yes"
+# else
+# enable_disk="no"
+# fi
+#fi
+#if test "x$enable_disk" = "xno"
+#then
+# AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
-AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
-if test "x$enable_hddtemp" = "xno"
-then
- AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
+#AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
+#if test "x$enable_hddtemp" = "xno"
+#then
+# AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
-AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
-if test "x$enable_load" != "xno"
-then
- if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
- then
- enable_load="yes"
- else
- enable_load="no"
- fi
-fi
-if test "x$enable_load" = "xno"
-then
- AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
+#AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
+#if test "x$enable_load" != "xno"
+#then
+# if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
+# then
+# enable_load="yes"
+# else
+# enable_load="no"
+# fi
+#fi
+#if test "x$enable_load" = "xno"
+#then
+# AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
-AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
-if test "x$enable_memory" != "xno"
-then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
- then
- enable_memory="yes"
- else
- enable_memory="no"
- fi
-fi
-if test "x$enable_memory" = "xno"
-then
- AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
+#AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
+#if test "x$enable_memory" != "xno"
+#then
+# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
+# then
+# enable_memory="yes"
+# else
+# enable_memory="no"
+# fi
+#fi
+#if test "x$enable_memory" = "xno"
+#then
+# AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
-AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
-if test "x$enable_nfs" != "xno"
-then
- if test "x$ac_system" = "xLinux"
- then
- enable_nfs="yes"
- else
- enable_nfs="no"
- fi
-fi
-if test "x$enable_nfs" = "xno"
-then
- AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
+#AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
+#if test "x$enable_nfs" != "xno"
+#then
+# if test "x$ac_system" = "xLinux"
+# then
+# enable_nfs="yes"
+# else
+# enable_nfs="no"
+# fi
+#fi
+#if test "x$enable_nfs" = "xno"
+#then
+# AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
-AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
-if test "x$enable_ping" != "xno"
-then
- enable_ping="yes"
-fi
-if test "x$enable_ping" = "xno"
-then
- AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
+#AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
+#if test "x$enable_ping" != "xno"
+#then
+# enable_ping="yes"
+#fi
+#if test "x$enable_ping" = "xno"
+#then
+# AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
-AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
-if test "x$enable_processes" != "xno"
-then
- if test "x$ac_system" = "xLinux"
- then
- enable_processes="yes"
- else
- enable_processes="no"
- fi
-fi
-if test "x$enable_processes" = "xno"
-then
- AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
+#AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
+#if test "x$enable_processes" != "xno"
+#then
+# if test "x$ac_system" = "xLinux"
+# then
+# enable_processes="yes"
+# else
+# enable_processes="no"
+# fi
+#fi
+#if test "x$enable_processes" = "xno"
+#then
+# AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
-#AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
+##AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
-AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
-if test "x$enable_sensors" != "xno"
-then
- if test "x$with_lm_sensors" = "xyes"
- then
- enable_sensors="yes"
- else
- enable_sensors="no"
- fi
-fi
-if test "x$enable_sensors" = "xno"
-then
- AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
+#AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
+#if test "x$enable_sensors" != "xno"
+#then
+# if test "x$with_lm_sensors" = "xyes"
+# then
+# enable_sensors="yes"
+# else
+# enable_sensors="no"
+# fi
+#fi
+#if test "x$enable_sensors" = "xno"
+#then
+# AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
-AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
-if test "x$enable_serial" != "xno"
-then
- if test "x$ac_system" = "xLinux"
- then
- enable_serial="yes"
- else
- enable_serial="no"
- fi
-fi
-if test "x$enable_serial" = "xno"
-then
- AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
+#AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
+#if test "x$enable_serial" != "xno"
+#then
+# if test "x$ac_system" = "xLinux"
+# then
+# enable_serial="yes"
+# else
+# enable_serial="no"
+# fi
+#fi
+#if test "x$enable_serial" = "xno"
+#then
+# AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
-AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
-if test "x$enable_swap" != "xno"
-then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
- then
- enable_swap="yes"
- else
- enable_swap="no"
- fi
-fi
-if test "x$enable_swap" = "xno"
-then
- AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
+#AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
+#if test "x$enable_swap" != "xno"
+#then
+# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
+# then
+# enable_swap="yes"
+# else
+# enable_swap="no"
+# fi
+#fi
+#if test "x$enable_swap" = "xno"
+#then
+# AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
-AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
-if test "x$enable_tape" != "xno"
-then
- if test "x$with_kstat" = "xyes"
- then
- enable_tape="yes"
- else
- enable_tape="no"
- fi
-fi
-if test "x$enable_tape" = "xno"
-then
- AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
+#AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
+#if test "x$enable_tape" != "xno"
+#then
+# if test "x$with_kstat" = "xyes"
+# then
+# enable_tape="yes"
+# else
+# enable_tape="no"
+# fi
+#fi
+#if test "x$enable_tape" = "xno"
+#then
+# AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
-AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
-if test "x$enable_traffic" != "xno"
-then
- if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
- then
- enable_traffic="yes"
- else
- enable_traffic="no"
- fi
-fi
-if test "x$enable_traffic" = "xno"
-then
- AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
-fi
-AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
+#AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
+#if test "x$enable_traffic" != "xno"
+#then
+# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
+# then
+# enable_traffic="yes"
+# else
+# enable_traffic="no"
+# fi
+#fi
+#if test "x$enable_traffic" = "xno"
+#then
+# AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
+#fi
+#AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
-AC_COLLECTD([users], [disable], [module], [user count statistics])
+#AC_COLLECTD([users], [disable], [module], [user count statistics])
AC_OUTPUT(Makefile src/libconfig/Makefile src/libping/Makefile src/Makefile)
diff --git a/src/cpu.c b/src/cpu.c
index 5252324ad910a58899cf9d8492b8a88dee32946b..62e814578cb688d50bb5a857a34899f65bc520c2 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
# include <sys/dkstat.h>
# endif
-#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_SYSCTLBYNAME)
-# define CPU_HAVE_READ 1
-#else
-# define CPU_HAVE_READ 0
-#endif
-
# if !defined(CP_USER) || !defined(CP_NICE) || !defined(CP_SYS) || !defined(CP_INTR) || !defined(CP_IDLE) || !defined(CPUSTATES)
# define CP_USER 0
# define CP_NICE 1
# endif
#endif /* HAVE_SYSCTLBYNAME */
+#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
/* colleague tells me that Sun doesn't sell systems with more than 100 or so CPUs.. */
# define MAX_NUMCPU 256
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if CPU_HAVE_READ
#define BUFSIZE 512
static void cpu_submit (int cpu_num, unsigned long long user,
unsigned long long nice, unsigned long long syst,
}
#undef BUFSIZE
-#if CPU_HAVE_READ
static void cpu_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 6806c3e63c976ab9c7b3f2d091ea91c16f48a184..9d74c57680b22f423659e3d4f27b43bb45a4f251 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if CPUFREQ_HAVE_READ
static void cpufreq_submit (int cpu_num, unsigned long long val)
{
char buf[BUFSIZE];
plugin_submit (MODULE_NAME, cpu, buf);
}
-#if CPUFREQ_HAVE_READ
static void cpufreq_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/disk.c b/src/disk.c
index cd876014a8cffe103b291191457537e8e260a313..e3638f22017d1b768b09127e6e513dd7ce2ce882 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
plugin_submit (MODULE_NAME, disk_name, buf);
}
+#if DISK_HAVE_READ
static void partition_submit (char *part_name,
unsigned long long read_count,
unsigned long long read_bytes,
}
#undef BUFSIZE
-#if DISK_HAVE_READ
static void disk_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/load.c b/src/load.c
index 8d0963bcf1285395d4661dae08d77508e4f35229..913eb538c1d3623022a69caf70d8ff5bf4350a3b 100644 (file)
--- a/src/load.c
+++ b/src/load.c
rrd_update_file (host, load_file, val, ds_def, ds_num);
}
+#if LOAD_HAVE_READ
#define BUFSIZE 256
static void load_submit (double snum, double mnum, double lnum)
{
}
#undef BUFSIZE
-#if LOAD_HAVE_READ
static void load_read (void)
{
#if defined(HAVE_GETLOADAVG)
diff --git a/src/memory.c b/src/memory.c
index dd8bd787abbf9b4a9df97c2e922e0bbf67d3f7b7..3ab19e651c8dc577cfd85bd8b1f87151bff79f56 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
rrd_update_file (host, memory_file, val, ds_def, ds_num);
}
+#if MEMORY_HAVE_READ
#define BUFSIZE 512
static void memory_submit (long long mem_used, long long mem_buffered,
long long mem_cached, long long mem_free)
}
#undef BUFSIZE
-#if MEMORY_HAVE_READ
static void memory_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/nfs.c b/src/nfs.c
index c9fbd8f56e1c7b11f92ff21520a47a7e340bd5f1..1592c911d25ea7e10444ae0b27fc666b0dd38c87 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
nfs3_procedures_ds_num);
}
+#if NFS_HAVE_READ
static void nfs2_procedures_submit (unsigned long long *val, char *inst)
{
char buf[BUFSIZE];
plugin_submit("nfs3_procedures", inst, buf);
}
+#endif /* NFS_HAVE_READ */
#if defined(KERNEL_LINUX)
static void nfs_read_stats_file (FILE *fh, char *inst)
diff --git a/src/processes.c b/src/processes.c
index d1fe696a9b5558b645646f83b4496e4df831bf9a..3a7318907cd13613578d86ae36cf0e83f59c2afe 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
# define PROCESSES_HAVE_READ 0
#endif
+#define BUFSIZE 256
+
static char *ps_file = "processes.rrd";
static char *ds_def[] =
rrd_update_file (host, ps_file, val, ds_def, ds_num);
}
-#define BUFSIZE 256
+#if PROCESSES_HAVE_READ
static void ps_submit (unsigned int running,
unsigned int sleeping,
unsigned int zombies,
plugin_submit (MODULE_NAME, "-", buf);
}
-#if PROCESSES_HAVE_READ
static void ps_read (void)
{
#ifdef KERNEL_LINUX
char buf[BUFSIZE];
char filename[20]; /* need 17 bytes */
- char *fields[256];
+ char *fields[BUFSIZE];
struct dirent *ent;
DIR *proc;
fclose (fh);
- if (strsplit (buf, fields, 256) < 3)
+ if (strsplit (buf, fields, BUFSIZE) < 3)
continue;
switch (fields[2][0])
#else
# define ps_read NULL
#endif /* PROCESSES_HAVE_READ */
-#undef BUFSIZE
void module_register (void)
{
plugin_register (MODULE_NAME, ps_init, ps_read, ps_write);
}
+#undef BUFSIZE
#undef MODULE_NAME
diff --git a/src/sensors.c b/src/sensors.c
index b6c76f88b862eb102db0d9ef85c54528b42b4ee2..75981e84854ce1c4ae8b012169e73b3c7028cdf8 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
# define SENSORS_HAVE_READ 0
#endif
+#define BUFSIZE 512
+
static char *filename_format = "sensors-%s.rrd";
static char *ds_def[] =
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];
@@ -175,9 +177,7 @@ static void sensors_submit (const char *feat_name, const char *chip_prefix, doub
plugin_submit (MODULE_NAME, inst, buf);
}
-#undef BUFSIZE
-#if SENSORS_HAVE_READ
static void sensors_read (void)
{
featurelist_t *feature;
plugin_register (MODULE_NAME, collectd_sensors_init, sensors_read, sensors_write);
}
+#undef BUFSIZE
#undef MODULE_NAME
diff --git a/src/serial.c b/src/serial.c
index a823ecf38a63171a9fb884401e85be792c6e39d2..31b6148e1da6f483ccb3c08934075fe3acfa45ba 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if SERIAL_HAVE_READ
#define BUFSIZE 512
static void serial_submit (char *device,
unsigned long long incoming,
}
#undef BUFSIZE
-#if SERIAL_HAVE_READ
static void serial_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/swap.c b/src/swap.c
index 9667b583859b55ed7ed3c2e73e5119b8b8ea6162..8ffa4536feb695e97ced36fbe0b543cda9c3b8f2 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
rrd_update_file (host, swap_file, val, ds_def, ds_num);
}
+#if SWAP_HAVE_READ
static void swap_submit (unsigned long long swap_used,
unsigned long long swap_free,
unsigned long long swap_cached,
plugin_submit (MODULE_NAME, "-", buffer);
}
-#if SWAP_HAVE_READ
static void swap_read (void)
{
#ifdef KERNEL_LINUX
diff --git a/src/tape.c b/src/tape.c
index 0fc8f2c5281a67414fb16d3ef5b8c054bc4cf25b..4671ed46aa0e7b4b957e30f4ced5e1ebfef626ac 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
}
+#if TAPE_HAVE_READ
#define BUFSIZE 512
static void tape_submit (char *tape_name,
unsigned long long read_count,
#undef BUFSIZE
-#if TAPE_HAVE_READ
static void tape_read (void)
{
diff --git a/src/traffic.c b/src/traffic.c
index d3cea5affe9f93a47686f78e30eaa459ddc291a8..7c852f819dc32cc071b2d56982b28daa45502d19 100644 (file)
--- a/src/traffic.c
+++ b/src/traffic.c
# define TRAFFIC_HAVE_READ 0
#endif
+#define BUFSIZE 512
+
static char *traffic_filename_template = "traffic-%s.rrd";
static char *ds_def[] =
static void traffic_write (char *host, char *inst, char *val)
{
- char file[512];
+ char file[BUFSIZE];
int status;
- status = snprintf (file, 512, traffic_filename_template, inst);
+ status = snprintf (file, BUFSIZE, traffic_filename_template, 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
+#if TRAFFIC_HAVE_READ
static void traffic_submit (char *device,
unsigned long long incoming,
unsigned long long outgoing)
plugin_submit (MODULE_NAME, device, buf);
}
-#undef BUFSIZE
-#if TRAFFIC_HAVE_READ
static void traffic_read (void)
{
#ifdef KERNEL_LINUX
plugin_register (MODULE_NAME, traffic_init, traffic_read, traffic_write);
}
+#undef BUFSIZE
#undef MODULE_NAME
diff --git a/src/users.c b/src/users.c
index e2b741c9393f96b44ec8aa17b5132b249e22b8b8..5fe1b7114fdd54af590316bd549b0223d885a9ba 100644 (file)
--- a/src/users.c
+++ b/src/users.c
return;
} /* static void users_write(char *host, char *inst, char *val) */
+#if USERS_HAVE_READ
/* I don't like this temporary macro definition - well it's used everywhere
else in the collectd-sources, so I will just stick with it... */
#define BUFSIZE 256
} /* static void users_submit(unsigned int users) */
#undef BUFSIZE
-#if USERS_HAVE_READ
static void users_read (void)
{
#if HAVE_GETUTXENT