summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 89ef5df)
raw | patch | inline | side by side (parent: 89ef5df)
author | octo <octo> | |
Sat, 17 Dec 2005 11:45:44 +0000 (11:45 +0000) | ||
committer | octo <octo> | |
Sat, 17 Dec 2005 11:45:44 +0000 (11:45 +0000) |
14 files changed:
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 | |
src/serial.c | patch | blob | history | |
src/swap.c | patch | blob | history | |
src/tape.c | patch | blob | history | |
src/traffic.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index 6832b5239a1b9bad95d931b5061636e1fa01118c..5252324ad910a58899cf9d8492b8a88dee32946b 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
#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>
#endif /* HAVE_LIBKSTAT */
# 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
};
static int ds_num = 5;
-void cpu_init (void)
+static void cpu_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
return;
}
-void cpu_write (char *host, char *inst, char *val)
+static void cpu_write (char *host, char *inst, char *val)
{
char file[512];
int status;
return;
}
+#else
+# define cpu_read NULL
#endif /* CPU_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, cpu_init,
-#if CPU_HAVE_READ
- cpu_read,
-#else
- NULL,
-#endif
- cpu_write);
+ plugin_register (MODULE_NAME, cpu_init, cpu_read, cpu_write);
}
#undef MODULE_NAME
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 92f1cc5824dc905ebc835e90f2f54d013e9c36d7..6806c3e63c976ab9c7b3f2d091ea91c16f48a184 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
#define MODULE_NAME "cpufreq"
+#if defined(KERNEL_LINUX)
+# define CPUFREQ_HAVE_READ 1
+#else
+# define CPUFREQ_HAVE_READ 0
+#endif
+
static char *cpufreq_file = "cpufreq-%s.rrd";
static char *ds_def[] =
plugin_submit (MODULE_NAME, cpu, buf);
}
+#if CPUFREQ_HAVE_READ
static void cpufreq_read (void)
{
#ifdef KERNEL_LINUX
return;
}
+#else
+#define cpufreq_read NULL
+#endif
#undef BUFSIZE
void module_register (void)
diff --git a/src/disk.c b/src/disk.c
index f6234c22837e6e2642ab515be68d0f0b5097226c..cd876014a8cffe103b291191457537e8e260a313 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
}
#endif /* defined(HAVE_LIBKSTAT) */
} /* static void disk_read (void) */
+#else
+# define disk_read NULL
#endif /* DISK_HAVE_READ */
void module_register (void)
{
plugin_register ("partition", NULL, NULL, partition_write);
- plugin_register (MODULE_NAME, disk_init,
-#if DISK_HAVE_READ
- disk_read,
-#else
- NULL,
-#endif
- disk_write);
+ plugin_register (MODULE_NAME, disk_init, disk_read, disk_write);
}
#undef MODULE_NAME
diff --git a/src/hddtemp.c b/src/hddtemp.c
index f2e8262fd555e83906892546fbe899860a59f07b..cfa7b8ff8fec7f02bcdc1e6f98bc79147b763df2 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
{
plugin_register (MODULE_NAME, hddtemp_init, hddtemp_read, hddtemp_write);
}
+
+#undef MODULE_NAME
diff --git a/src/load.c b/src/load.c
index 2c02d8be0d7890933c35b9d6ebc3d18c889d8f5b..8d0963bcf1285395d4661dae08d77508e4f35229 100644 (file)
--- a/src/load.c
+++ b/src/load.c
};
static int ds_num = 3;
-void load_init (void)
+static void load_init (void)
{
return;
}
-void load_write (char *host, char *inst, char *val)
+static void load_write (char *host, char *inst, char *val)
{
rrd_update_file (host, load_file, val, ds_def, ds_num);
}
#define BUFSIZE 256
-void load_submit (double snum, double mnum, double lnum)
+static void load_submit (double snum, double mnum, double lnum)
{
char buf[BUFSIZE];
#undef BUFSIZE
#if LOAD_HAVE_READ
-void load_read (void)
+static void load_read (void)
{
#if defined(HAVE_GETLOADAVG)
double load[3];
load_submit (snum, mnum, lnum);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define load_read NULL
#endif /* LOAD_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, load_init,
-#if LOAD_HAVE_READ
- load_read,
-#else
- NULL,
-#endif
- load_write);
+ plugin_register (MODULE_NAME, load_init, load_read, load_write);
}
#undef MODULE_NAME
diff --git a/src/memory.c b/src/memory.c
index 6ae35cbbd3aa7f533d2ac66bbc67c5e929dce32e..dd8bd787abbf9b4a9df97c2e922e0bbf67d3f7b7 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
static kstat_t *ksp;
#endif /* HAVE_LIBKSTAT */
-void memory_init (void)
+static void memory_init (void)
{
#ifdef HAVE_LIBKSTAT
/* getpagesize(3C) tells me this does not fail.. */
return;
}
-void memory_write (char *host, char *inst, char *val)
+static void memory_write (char *host, char *inst, char *val)
{
rrd_update_file (host, memory_file, val, ds_def, ds_num);
}
#define BUFSIZE 512
-void memory_submit (long long mem_used, long long mem_buffered,
+static void memory_submit (long long mem_used, long long mem_buffered,
long long mem_cached, long long mem_free)
{
char buf[BUFSIZE];
#undef BUFSIZE
#if MEMORY_HAVE_READ
-void memory_read (void)
+static void memory_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
memory_submit (ios->used, 0LL, ios->cache, ios->free);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define memory_read NULL
#endif /* MEMORY_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, memory_init,
-#if MEMORY_HAVE_READ
- memory_read,
-#else
- NULL,
-#endif
- memory_write);
+ plugin_register (MODULE_NAME, memory_init, memory_read, memory_write);
}
#undef MODULE_NAME
diff --git a/src/nfs.c b/src/nfs.c
index 033311379c22bdf805748160a2d1275336d20688..c9fbd8f56e1c7b11f92ff21520a47a7e340bd5f1 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
/* Possibly TODO: NFSv4 statistics */
-void nfs_init (void)
+static void nfs_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
}
#define BUFSIZE 1024
-void nfs2_procedures_write (char *host, char *inst, char *val)
+static void nfs2_procedures_write (char *host, char *inst, char *val)
{
char filename[BUFSIZE];
nfs2_procedures_ds_num);
}
-void nfs3_procedures_write (char *host, char *inst, char *val)
+static void nfs3_procedures_write (char *host, char *inst, char *val)
{
char filename[BUFSIZE];
nfs3_procedures_ds_num);
}
-void nfs2_procedures_submit (unsigned long long *val, char *inst)
+static void nfs2_procedures_submit (unsigned long long *val, char *inst)
{
char buf[BUFSIZE];
int retval = 0;
plugin_submit ("nfs2_procedures", inst, buf);
}
-void nfs3_procedures_submit (unsigned long long *val, char *inst)
+static void nfs3_procedures_submit (unsigned long long *val, char *inst)
{
char buf[BUFSIZE];
int retval = 0;
}
#if defined(KERNEL_LINUX)
-void nfs_read_stats_file (FILE *fh, char *inst)
+static void nfs_read_stats_file (FILE *fh, char *inst)
{
char buffer[BUFSIZE];
#undef BUFSIZE
#ifdef HAVE_LIBKSTAT
-void nfs2_read_kstat (kstat_t *ksp, char *inst)
+static void nfs2_read_kstat (kstat_t *ksp, char *inst)
{
unsigned long long values[18];
#endif
#if NFS_HAVE_READ
-void nfs_read (void)
+static void nfs_read (void)
{
#if defined(KERNEL_LINUX)
FILE *fh;
nfs2_read_kstat (nfs2_ksp_server, "server");
#endif /* defined(HAVE_LIBKSTAT) */
}
+#else
+# define nfs_read NULL
#endif /* NFS_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, nfs_init,
-#if NFS_HAVE_READ
- nfs_read,
-#else
- NULL,
-#endif
- NULL);
+ 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);
}
diff --git a/src/ping.c b/src/ping.c
index 6a2b9068c5201405ee8114ec160120c808d5724f..bdb8de9652b3a1f8551ba5850cb987b029a7f160 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
};
static int config_keys_num = 1;
-void ping_init (void)
+static void ping_init (void)
{
int i;
return;
}
-int ping_config (char *key, char *value)
+static int ping_config (char *key, char *value)
{
if (strcasecmp (key, "host"))
{
}
}
-void ping_write (char *host, char *inst, char *val)
+static void ping_write (char *host, char *inst, char *val)
{
char file[512];
int status;
}
#define BUFSIZE 256
-void ping_submit (int ping_time, char *host)
+static void ping_submit (int ping_time, char *host)
{
char buf[BUFSIZE];
}
#undef BUFSIZE
-void ping_read (void)
+static void ping_read (void)
{
int ping;
int i;
diff --git a/src/processes.c b/src/processes.c
index e2bda15e41eaffdf7786048b3382b15125379116..d1fe696a9b5558b645646f83b4496e4df831bf9a 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
};
static int ds_num = 6;
-void ps_init (void)
+static void ps_init (void)
{
}
-void ps_write (char *host, char *inst, char *val)
+static void ps_write (char *host, char *inst, char *val)
{
rrd_update_file (host, ps_file, val, ds_def, ds_num);
}
#define BUFSIZE 256
-void ps_submit (unsigned int running,
+static void ps_submit (unsigned int running,
unsigned int sleeping,
unsigned int zombies,
unsigned int stopped,
}
#if PROCESSES_HAVE_READ
-void ps_read (void)
+static void ps_read (void)
{
#ifdef KERNEL_LINUX
unsigned int running, sleeping, zombies, stopped, paging, blocked;
ps_submit (running, sleeping, zombies, stopped, paging, blocked);
#endif /* defined(KERNEL_LINUX) */
}
+#else
+# define ps_read NULL
#endif /* PROCESSES_HAVE_READ */
#undef BUFSIZE
void module_register (void)
{
- plugin_register (MODULE_NAME, ps_init,
-#if PROCESSES_HAVE_READ
- ps_read,
-#else
- NULL,
-#endif
- ps_write);
+ plugin_register (MODULE_NAME, ps_init, ps_read, ps_write);
}
#undef MODULE_NAME
diff --git a/src/sensors.c b/src/sensors.c
index 13139636ce07bb40e75e0566600d3c5aaf6e2237..b6c76f88b862eb102db0d9ef85c54528b42b4ee2 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
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 MODULE_NAME
diff --git a/src/serial.c b/src/serial.c
index 20a51e70d91b549e3bb6898af689d43c0910dca9..a823ecf38a63171a9fb884401e85be792c6e39d2 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
fclose (fh);
#endif /* KERNEL_LINUX */
}
+#else
+# define serial_read NULL
#endif /* SERIAL_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, serial_init,
-#if SERIAL_HAVE_READ
- serial_read,
-#else
- NULL,
-#endif
- serial_write);
+ plugin_register (MODULE_NAME, serial_init, serial_read, serial_write);
}
#undef MODULE_NAME
diff --git a/src/swap.c b/src/swap.c
index eb476a42e4b0206c035cb96a69cdf0769431fab6..9667b583859b55ed7ed3c2e73e5119b8b8ea6162 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
static kstat_t *ksp;
#endif /* KERNEL_SOLARIS */
-static void module_init (void)
+static void swap_init (void)
{
#ifdef KERNEL_SOLARIS
/* getpagesize(3C) tells me this does not fail.. */
return;
}
-static void module_write (char *host, char *inst, char *val)
+static void swap_write (char *host, char *inst, char *val)
{
rrd_update_file (host, swap_file, val, ds_def, ds_num);
}
-static void module_submit (unsigned long long swap_used,
+static void swap_submit (unsigned long long swap_used,
unsigned long long swap_free,
unsigned long long swap_cached,
unsigned long long swap_resv)
}
#if SWAP_HAVE_READ
-static void module_read (void)
+static void swap_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
swap_used = swap_total - (swap_free + swap_cached);
- module_submit (swap_used, swap_free, swap_cached, -1LL);
+ swap_submit (swap_used, swap_free, swap_cached, -1LL);
/* #endif defined(KERNEL_LINUX) */
#elif defined(KERNEL_SOLARIS)
swap_avail = pagesize * (MAX(ai.ani_max - ai.ani_resv, 0) + (availrmem - swapfs_minfree));
/* swap_free = pagesize * (ai.ani_free + (availrmem - swapfs_minfree)); */
- module_submit (swap_alloc, swap_avail, -1LL, swap_resv - swap_alloc);
+ swap_submit (swap_alloc, swap_avail, -1LL, swap_resv - swap_alloc);
/* #endif defined(KERNEL_SOLARIS) */
#elif defined(HAVE_LIBSTATGRAB)
sg_swap_stats *swap;
if ((swap = sg_get_swap_stats ()) != NULL)
- module_submit (swap->used, swap->free, -1LL, -1LL);
+ swap_submit (swap->used, swap->free, -1LL, -1LL);
#endif /* HAVE_LIBSTATGRAB */
}
#else
-# define module_read NULL
+# define swap_read NULL
#endif /* SWAP_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, module_init, module_read, module_write);
+ plugin_register (MODULE_NAME, swap_init, swap_read, swap_write);
}
#undef MODULE_NAME
diff --git a/src/tape.c b/src/tape.c
index c6271de7d99c304cec9cf9ed9233954643e5ff8f..0fc8f2c5281a67414fb16d3ef5b8c054bc4cf25b 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
#undef BUFSIZE
#if TAPE_HAVE_READ
-void tape_read (void)
+static void tape_read (void)
{
#if defined(HAVE_LIBKSTAT)
diff --git a/src/traffic.c b/src/traffic.c
index ab2c8cc2316c37d44c319754c6dc090536764b4b..d3cea5affe9f93a47686f78e30eaa459ddc291a8 100644 (file)
--- a/src/traffic.c
+++ b/src/traffic.c
static int numif = 0;
#endif /* HAVE_LIBKSTAT */
-void traffic_init (void)
+static void traffic_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
#endif /* HAVE_LIBKSTAT */
}
-void traffic_write (char *host, char *inst, char *val)
+static void traffic_write (char *host, char *inst, char *val)
{
char file[512];
int status;
}
#define BUFSIZE 512
-void traffic_submit (char *device,
+static void traffic_submit (char *device,
unsigned long long incoming,
unsigned long long outgoing)
{
#undef BUFSIZE
#if TRAFFIC_HAVE_READ
-void traffic_read (void)
+static void traffic_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;