summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a905d39)
raw | patch | inline | side by side (parent: a905d39)
author | Florian Forster <octo@huhu.verplant.org> | |
Mon, 2 Jul 2007 13:46:31 +0000 (15:46 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Mon, 2 Jul 2007 13:46:31 +0000 (15:46 +0200) |
30 files changed:
diff --git a/src/apache.c b/src/apache.c
index 573a116a215bdeabc0e52feb8e1ca44c11970687..2365d1ff15f344f53f8992129fa87dab96880da9 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
/**
* collectd - src/apache.c
- * Copyright (C) 2006 Florian octo Forster
+ * Copyright (C) 2006,2007 Florian octo Forster
* Copyright (C) 2007 Florent EppO Monbillard
*
* This program is free software; you can redistribute it and/or modify it
#include "plugin.h"
#include "configfile.h"
-#if HAVE_LIBCURL && HAVE_CURL_CURL_H
-# define APACHE_HAVE_READ 1
-# include <curl/curl.h>
-#else
-# define APACHE_HAVE_READ 0
-#endif
+#include <curl/curl.h>
-#if APACHE_HAVE_READ
static char *url = NULL;
static char *user = NULL;
static char *pass = NULL;
return (0);
} /* int apache_read */
-#endif /* APACHE_HAVE_READ */
void module_register (void)
{
-#if APACHE_HAVE_READ
plugin_register_config ("apache", config,
config_keys, config_keys_num);
plugin_register_init ("apache", init);
plugin_register_read ("apache", apache_read);
-#endif
} /* void module_register */
diff --git a/src/apcups.c b/src/apcups.c
index 75de03e82a82072c27a990f77804c2c1ca5a7fc2..62c7a3c404844dcc1b8f9d66d2bdf72c7b75c32d 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
/*
* collectd - src/apcups.c
+ * Copyright (C) 2007 Florian octo Forster
* Copyright (C) 2006 Anthony Gialluca <tonyabg at charter.net>
* Copyright (C) 2000-2004 Kern Sibbald
* Copyright (C) 1996-99 Andre M. Hedrick <andre at suse.com>
*
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General
* Public License as published by the Free Software Foundation.
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index e13bdc8acd8abd8670b637271e6b4252082b460f..2726ad2efdb6fc550e05163814e4c2f9c2d49557 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
# include <IOKit/IOTypes.h>
#endif
-#if HAVE_IOKIT_IOKITLIB_H
-# define IOKIT_HAVE_READ 1
-#else
-# define IOKIT_HAVE_READ 0
-#endif
-
-#if HAVE_IOKIT_IOKITLIB_H
static mach_port_t io_master_port = MACH_PORT_NULL;
-#endif
-#if IOKIT_HAVE_READ
static int as_init (void)
{
kern_return_t status;
return (0);
} /* int as_read */
-#endif /* IOKIT_HAVE_READ */
void module_register (void)
{
-#if IOKIT_HAVE_READ
plugin_register_init ("apple_sensors", as_init);
plugin_register_read ("apple_sensors", as_read);
-#endif /* IOKIT_HAVE_READ */
} /* void module_register */
diff --git a/src/battery.c b/src/battery.c
index 952c56c071f854e0c3fbbc3d12ba7866f2c420bc..2e27e60e4bcdce4b0be7452a943ce2d398636f60 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
# include <IOKit/ps/IOPSKeys.h>
#endif
-#if HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H || KERNEL_LINUX
-# define BATTERY_HAVE_READ 1
-#else
-# define BATTERY_HAVE_READ 0
+#if !HAVE_IOKIT_IOKITLIB_H && !HAVE_IOKIT_PS_IOPOWERSOURCES_H && !KERNEL_LINUX
+# error "No applicable input method."
#endif
#define INVALID_VALUE 47841.29
-#if BATTERY_HAVE_READ
#if HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H
/* No global variables */
/* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */
return (0);
}
-#endif /* BATTERY_HAVE_READ */
void module_register (void)
{
-#if BATTERY_HAVE_READ
plugin_register_init ("battery", battery_init);
plugin_register_read ("battery", battery_read);
-#endif /* BATTERY_HAVE_READ */
} /* void module_register */
diff --git a/src/cpu.c b/src/cpu.c
index cbdde1ec8d24ee5d205ed60f413d3b8466e24e89..ba0c1b1a2880db85195a77b6bf67c7a82edc5dc6 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
# endif
#endif /* HAVE_SYSCTLBYNAME */
-#if defined(PROCESSOR_CPU_LOAD_INFO) || defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_SYSCTLBYNAME)
-# define CPU_HAVE_READ 1
-#else
-# define CPU_HAVE_READ 0
+#if !PROCESSOR_CPU_LOAD_INFO && !KERNEL_LINUX && !HAVE_LIBKSTAT && !HAVE_SYSCTLBYNAME
+# error "No applicable input method."
#endif
-#if CPU_HAVE_READ
#ifdef PROCESSOR_CPU_LOAD_INFO
static mach_port_t port_host;
static processor_port_array_t cpu_list;
return (0);
}
-#endif /* CPU_HAVE_READ */
void module_register (void)
{
-#if CPU_HAVE_READ
plugin_register_init ("cpu", init);
plugin_register_read ("cpu", cpu_read);
-#endif /* CPU_HAVE_READ */
} /* void module_register */
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 7a5c8fdf43079d68b1dc0352a5133f8bd5a75143..b1037c38bc25abbe8702059bfba8a1dc3177c998 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
-
-#if CPUFREQ_HAVE_READ
-#ifdef KERNEL_LINUX
static int num_cpu = 0;
-#endif
static int cpufreq_init (void)
{
-#ifdef KERNEL_LINUX
int status;
char filename[256];
if (num_cpu == 0)
plugin_unregister_read ("cpufreq");
-#endif /* defined(KERNEL_LINUX) */
return (0);
} /* int cpufreq_init */
static int cpufreq_read (void)
{
-#ifdef KERNEL_LINUX
int status;
unsigned long long val;
int i = 0;
cpufreq_submit (i, val);
}
-#endif /* defined(KERNEL_LINUX) */
return (0);
} /* int cpufreq_read */
-#endif /* CPUFREQ_HAVE_READ */
-#undef BUFSIZE
void module_register (void)
{
-#if CPUFREQ_HAVE_READ
plugin_register_init ("cpufreq", cpufreq_init);
plugin_register_read ("cpufreq", cpufreq_read);
-#endif /* CPUFREQ_HAVE_READ */
}
diff --git a/src/df.c b/src/df.c
index 433f4e2cf7116fad666f6065e2ea223aa0df1c8c..0f357d8ded8671e7ced051c4b0b01c17760653cd 100644 (file)
--- a/src/df.c
+++ b/src/df.c
#include "utils_mount.h"
#include "utils_ignorelist.h"
-#if HAVE_STATFS || HAVE_STATVFS
-# define DF_HAVE_READ 1
-#else
-# define DF_HAVE_READ 0
-#endif
-
#if HAVE_STATVFS
# if HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
# endif
# define STATANYFS statfs
# define BLOCKSIZE(s) (s).f_bsize
+#else
+# error "No applicable input method."
#endif
-#if DF_HAVE_READ
static const char *config_keys[] =
{
"Device",
return (0);
} /* int df_read */
-#endif /* DF_HAVE_READ */
void module_register (void)
{
-#if DF_HAVE_READ
plugin_register_config ("df", df_config,
config_keys, config_keys_num);
plugin_register_init ("df", df_init);
plugin_register_read ("df", df_read);
-#endif
} /* void module_register */
diff --git a/src/disk.c b/src/disk.c
index 38c161f58d6b0009fb61f9ddc3d01ec397a01dbe..490da07ae56098e2e438a835e8e4a72b1c9c110d 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
# define UINT_MAX 4294967295U
#endif
-#if HAVE_IOKIT_IOKITLIB_H || KERNEL_LINUX || HAVE_LIBKSTAT
-# define DISK_HAVE_READ 1
-#else
-# define DISK_HAVE_READ 0
-#endif
-
-#if DISK_HAVE_READ
#if HAVE_IOKIT_IOKITLIB_H
static mach_port_t io_master_port = MACH_PORT_NULL;
/* #endif HAVE_IOKIT_IOKITLIB_H */
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMDISK];
static int numdisk = 0;
-#endif /* HAVE_LIBKSTAT */
+/* #endif HAVE_LIBKSTAT */
+
+#else
+# error "No applicable input method."
+#endif
static int disk_init (void)
{
return (0);
} /* int disk_read */
-#endif /* DISK_HAVE_READ */
void module_register (void)
{
-#if DISK_HAVE_READ
plugin_register_init ("disk", disk_init);
plugin_register_read ("disk", disk_read);
-#endif /* DISK_HAVE_READ */
} /* void module_register */
diff --git a/src/dns.c b/src/dns.c
index 7ce7aad932e977c0e8db96b7eb06daaaf58b4919..2cbd0c37dd321e1b133ddfbfc8e38bb502bb31b8 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
#include "plugin.h"
#include "configfile.h"
-#if HAVE_LIBPCAP && HAVE_LIBPTHREAD
-# include "utils_dns.h"
-# include <pthread.h>
-# include <pcap.h>
-# include <poll.h>
-# define DNS_HAVE_READ 1
-#else
-# define DNS_HAVE_READ 0
-#endif
+#include "utils_dns.h"
+#include <pthread.h>
+#include <pcap.h>
+#include <poll.h>
/*
* Private data types
*/
-#if DNS_HAVE_READ
struct counter_list_s
{
unsigned int key;
struct counter_list_s *next;
};
typedef struct counter_list_s counter_list_t;
-#endif
/*
* Private variables
*/
-#if DNS_HAVE_READ
static const char *config_keys[] =
{
"Interface",
static pthread_mutex_t qtype_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t opcode_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t rcode_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif /* DNS_HAVE_READ */
/*
* Private functions
*/
-#if DNS_HAVE_READ
static counter_list_t *counter_list_search (counter_list_t **list, unsigned int key)
{
counter_list_t *entry;
return (0);
} /* int dns_read */
-#endif
void module_register (void)
{
-#if DNS_HAVE_READ
plugin_register_config ("dns", dns_config, config_keys, config_keys_num);
plugin_register_init ("dns", dns_init);
plugin_register_read ("dns", dns_read);
-#endif
} /* void module_register */
diff --git a/src/entropy.c b/src/entropy.c
index 7e903953bc10a55dad0f01d17fe231e37d8f4496..5f9eb530caf33bf95e364199312f310d2e0fe8d8 100644 (file)
--- a/src/entropy.c
+++ b/src/entropy.c
/**
* collectd - src/entropy.c
- * Copyright (C) 2005,2006 Florian octo Forster
+ * Copyright (C) 2007 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
#include "common.h"
#include "plugin.h"
-#if KERNEL_LINUX
-# define ENTROPY_HAVE_READ 1
-#else
-# define ENTROPY_HAVE_READ 0
+#if !KERNEL_LINUX
+# error "No applicable input method."
#endif
#define ENTROPY_FILE "/proc/sys/kernel/random/entropy_avail"
-#if ENTROPY_HAVE_READ
static void entropy_submit (double entropy)
{
value_t values[1];
static int entropy_read (void)
{
-#if KERNEL_LINUX
double entropy;
FILE *fh;
char buffer[64];
if (entropy > 0.0)
entropy_submit (entropy);
-#endif /* KERNEL_LINUX */
return (0);
}
-#endif /* ENTROPY_HAVE_READ */
void module_register (void)
{
-#if ENTROPY_HAVE_READ
plugin_register_read ("entropy", entropy_read);
-#endif
} /* void module_register */
diff --git a/src/hddtemp.c b/src/hddtemp.c
index d60481e35663313c34b05abd6c4aedabf82f652d..b994fab3774cd3f8f67c98af020967017b18ad64 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
#include "plugin.h"
#include "configfile.h"
-#if HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H \
- && HAVE_NETINET_TCP_H && HAVE_LIBGEN_H
# include <netdb.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <libgen.h> /* for basename */
-# define HDDTEMP_HAVE_READ 1
-#else
-# define HDDTEMP_HAVE_READ 0
-#endif
#if HAVE_LINUX_MAJOR_H
# include <linux/major.h>
#define HDDTEMP_DEF_HOST "127.0.0.1"
#define HDDTEMP_DEF_PORT "7634"
-#if HDDTEMP_HAVE_READ
static const char *config_keys[] =
{
"Host",
return (0);
} /* int hddtemp_read */
-#endif /* HDDTEMP_HAVE_READ */
/* module_register
Register collectd plugin. */
void module_register (void)
{
-#if HDDTEMP_HAVE_READ
plugin_register_config ("hddtemp", hddtemp_config,
config_keys, config_keys_num);
plugin_register_init ("hddtemp", hddtemp_init);
plugin_register_read ("hddtemp", hddtemp_read);
-#endif /* HDDTEMP_HAVE_READ */
}
diff --git a/src/interface.c b/src/interface.c
index 52b2ddf0866f07f10abbfb8fb13a16a13b60e7c5..741ff764bd576f4ee45f5ea2d5ffb0cea14c8477 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
# endif /* !COLLECT_GETIFADDRS */
#endif /* KERNEL_LINUX */
-#if HAVE_GETIFADDRS || KERNEL_LINUX || HAVE_LIBKSTAT || HAVE_LIBSTATGRAB
-# define INTERFACE_HAVE_READ 1
-#else
-# define INTERFACE_HAVE_READ 0
+#if !HAVE_GETIFADDRS && !KERNEL_LINUX && !HAVE_LIBKSTAT && !HAVE_LIBSTATGRAB
+# error "No applicable input method."
#endif
/*
#if HAVE_LIBKSTAT
static int interface_init (void)
{
-#if HAVE_LIBKSTAT
kstat_t *ksp_chain;
unsigned long long val;
continue;
ksp[numif++] = ksp_chain;
}
-#endif /* HAVE_LIBKSTAT */
return (0);
} /* int interface_init */
return (1 - if_list_action);
} /* int check_ignore_if */
-#if INTERFACE_HAVE_READ
static void if_submit (const char *dev, const char *type,
unsigned long long rx,
unsigned long long tx)
return (0);
} /* int interface_read */
-#endif /* INTERFACE_HAVE_READ */
void module_register (void)
{
#if HAVE_LIBKSTAT
plugin_register_init ("interface", interface_init);
#endif
-#if INTERFACE_HAVE_READ
plugin_register_read ("interface", interface_read);
-#endif
} /* void module_register */
diff --git a/src/iptables.c b/src/iptables.c
index 8dc571095fa9387e8504666fe8dfd9b58855e999..5fa1f4086a8aa23dd5bfff14e289f0e80845d65c 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
# include <libiptc/libiptc.h>
#endif
-#if HAVE_LIBIPTC_LIBIPTC_H
-# define IPTABLES_HAVE_READ 1
-#else
-# define IPTABLES_HAVE_READ 0
-#endif
-
-#define MODULE_NAME "iptables"
-#define BUFSIZE 512
-
/*
* (Module-)Global variables
*/
-/*
- * Removed packet count for now, should have config option if you want to save
- * them Although other collectd models don't seem to care much for options
- * eitherway for what to log
- */
-#if IPTABLES_HAVE_READ
/*
* Config format should be `Chain table chainname',
* e. g. `Chain mangle incoming'
return (0);
} /* int iptables_config */
-#endif /* IPTABLES_HAVE_READ */
-#if IPTABLES_HAVE_READ
/* This needs to return `int' for IPT_MATCH_ITERATE to work. */
static int submit_match (const struct ipt_entry_match *match,
const struct ipt_entry *entry,
return (0);
} /* int iptables_shutdown */
-#endif /* IPTABLES_HAVE_READ */
void module_register (void)
{
-#if IPTABLES_HAVE_READ
plugin_register_config ("iptables", iptables_config,
config_keys, config_keys_num);
plugin_register_read ("iptables", iptables_read);
plugin_register_shutdown ("iptables", iptables_shutdown);
-#endif
} /* void module_register */
-#undef BUFSIZE
-#undef MODULE_NAME
-
/*
* vim:shiftwidth=4:softtabstop=4:tabstop=8
*/
diff --git a/src/irq.c b/src/irq.c
index 1c7b5aec90eebfbe09d12f46a8ca3c3da29a1c31..b6b8c4c6a92ea91121d58706845b7c8b5a3437b2 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
#include "plugin.h"
#include "configfile.h"
-#if KERNEL_LINUX
-# define IRQ_HAVE_READ 1
-#else
-# define IRQ_HAVE_READ 0
+#if !KERNEL_LINUX
+# error "No applicable input method."
#endif
#define BUFSIZE 128
/*
* (Module-)Global variables
*/
-#if IRQ_HAVE_READ
static const char *config_keys[] =
{
"Irq",
static int irq_read (void)
{
-#if KERNEL_LINUX
-
#undef BUFSIZE
#define BUFSIZE 256
irq_submit (irq, irq_value);
}
fclose (fh);
-#endif /* KERNEL_LINUX */
return (0);
} /* int irq_read */
-#endif /* IRQ_HAVE_READ */
void module_register (void)
{
-#if IRQ_HAVE_READ
plugin_register_config ("irq", irq_config,
config_keys, config_keys_num);
plugin_register_read ("irq", irq_read);
-#endif /* IRQ_HAVE_READ */
} /* void module_register */
#undef BUFSIZE
diff --git a/src/load.c b/src/load.c
index 22872f04f2be88489bc0e207b293dbd0e9600c4a..c9f130b7864609bf31b68aad4dfc4b4508a7e2e6 100644 (file)
--- a/src/load.c
+++ b/src/load.c
/**
* collectd - src/load.c
- * Copyright (C) 2005,2006 Florian octo Forster
+ * Copyright (C) 2005-2007 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
#include "common.h"
#include "plugin.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>
#endif
#endif
#endif /* defined(HAVE_GETLOADAVG) */
-#if LOAD_HAVE_READ
static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum)
{
value_t values[3];
lnum = ls->min15;
load_submit (snum, mnum, lnum);
-#endif /* HAVE_LIBSTATGRAB */
+/* #endif HAVE_LIBSTATGRAB */
+
+#else
+# error "No applicable input method."
+#endif
return (0);
}
-#endif /* LOAD_HAVE_READ */
void module_register (void)
{
-#if LOAD_HAVE_READ
plugin_register_read ("load", load_read);
-#endif
} /* void module_register */
diff --git a/src/mbmon.c b/src/mbmon.c
index 68a0985044acdfeaf672b0107dbd94ae59ac88e9..c3909d5791d257480f47cf12284e3f6390ec5783 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
#include "plugin.h"
#include "configfile.h"
-#if HAVE_NETDB_H && HAVE_SYS_SOCKET_H && HAVE_NETINET_IN_H && HAVE_NETINET_TCP_H
-# include <netdb.h>
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# define MBMON_HAVE_READ 1
-#else
-# define MBMON_HAVE_READ 0
-#endif
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
#define MBMON_DEF_HOST "127.0.0.1"
#define MBMON_DEF_PORT "411" /* the default for Debian */
};
static int config_keys_num = 2;
-#if MBMON_HAVE_READ
static char *mbmon_host = NULL;
static char *mbmon_port = NULL;
return (0);
} /* void mbmon_read */
-#endif /* MBMON_HAVE_READ */
/* module_register
Register collectd plugin. */
void module_register (void)
{
-#if MBMON_HAVE_READ
plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num);
plugin_register_read ("mbmon", mbmon_read);
-#endif /* MBMON_HAVE_READ */
} /* void module_register */
diff --git a/src/memory.c b/src/memory.c
index cb7e68823481e0ff6637bd9cc3cf0dc58e04253d..47b3cb31a77377aa31362cc4bce187905158eef1 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
# include <mach/vm_statistics.h>
#endif
-#if defined (HOST_VM_INFO) || HAVE_SYSCTLBYNAME || KERNEL_LINUX || HAVE_LIBKSTAT
-# define MEMORY_HAVE_READ 1
-#else
-# define MEMORY_HAVE_READ 0
-#endif
-
/* vm_statistics_data_t */
#if defined(HOST_VM_INFO)
static mach_port_t port_host;
#elif HAVE_LIBKSTAT
static int pagesize;
static kstat_t *ksp;
-#endif /* HAVE_LIBKSTAT */
+/* #endif HAVE_LIBKSTAT */
+
+#else
+# error "No applicable input method."
+#endif
-#if MEMORY_HAVE_READ
static int memory_init (void)
{
#if defined(HOST_VM_INFO)
return (0);
}
-#endif /* MEMORY_HAVE_READ */
void module_register (void)
{
-#if MEMORY_HAVE_READ
plugin_register_init ("memory", memory_init);
plugin_register_read ("memory", memory_read);
-#endif /* MEMORY_HAVE_READ */
} /* void module_register */
diff --git a/src/multimeter.c b/src/multimeter.c
index 21a21447043c84e6896b478c37c0b3a03d09f661..11ca42c1f6fd1dcda1c7dacb57754f7b33f8c8e7 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
# include <termios.h>
# include <sys/ioctl.h>
# include <math.h>
-# define MULTIMETER_HAVE_READ 1
#else
-# define MULTIMETER_HAVE_READ 0
-# error "multimeter cannot read!"
+# error "No applicable input method."
#endif
-#if MULTIMETER_HAVE_READ
static int fd = -1;
static int multimeter_timeval_sub (struct timeval *tv1, struct timeval *tv2,
}
return (0);
}
+
#define LINE_LENGTH 14
static int multimeter_read_value(double *value)
{
return (0);
}
-#endif /* MULTIMETER_HAVE_READ */
void module_register (void)
{
-#if MULTIMETER_HAVE_READ
plugin_register_init ("multimeter", multimeter_init);
plugin_register_read ("multimeter", multimeter_read);
plugin_register_shutdown ("multimeter", multimeter_shutdown);
-#endif /* MULTIMETER_HAVE_READ */
} /* void module_register */
diff --git a/src/mysql.c b/src/mysql.c
index fccaedbdc891eb42a7aceaec38dc468370f54ba7..d4728531027be022e8ad9d6a57994a06711785d8 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
#include <mysql/mysql.h>
#endif
-#if COLLECT_LIBMYSQL
-# define MYSQL_HAVE_READ 1
-#else
-# define MYSQL_HAVE_READ 0
-#endif
-
/* TODO: Understand `Select_*' and possibly do that stuff as well.. */
-#if MYSQL_HAVE_READ
static const char *config_keys[] =
{
"Host",
return (0);
} /* int mysql_read */
-#endif /* MYSQL_HAVE_READ */
void module_register (void)
{
-#if MYSQL_HAVE_READ
plugin_register_config ("mysql", config, config_keys, config_keys_num);
plugin_register_read ("mysql", mysql_read);
-#endif /* MYSQL_HAVE_READ */
} /* void module_register */
diff --git a/src/nfs.c b/src/nfs.c
index 299d63b9e4b98e56363770eb7003850ea3621f87..77c7f48f92e3aee3be927e4b34be9c1fa89b01d7 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
#include "common.h"
#include "plugin.h"
-/* #if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) */
-#if KERNEL_LINUX
-# define NFS_HAVE_READ 1
-#else
-# define NFS_HAVE_READ 0
+#if !KERNEL_LINUX
+# error "No applicable input method."
#endif
/*
21 commit
*/
-#if NFS_HAVE_READ
static const char *nfs2_procedures_names[] =
{
"null",
}
} /* void nfs_procedures_submit */
-#if KERNEL_LINUX
static void nfs_read_stats_file (FILE *fh, char *inst)
{
char buffer[BUFSIZE];
}
} /* while (fgets (buffer, BUFSIZE, fh) != NULL) */
} /* void nfs_read_stats_file */
-#endif /* defined(KERNEL_LINUX) */
#undef BUFSIZE
#if HAVE_LIBKSTAT && 0
static int nfs_read (void)
{
-#if KERNEL_LINUX
FILE *fh;
if ((fh = fopen ("/proc/net/rpc/nfs", "r")) != NULL)
fclose (fh);
}
-/* #endif defined(KERNEL_LINUX) */
-
-#elif HAVE_LIBKSTAT && 0
+#if HAVE_LIBKSTAT && 0
if (nfs2_ksp_client != NULL)
nfs2_read_kstat (nfs2_ksp_client, "client");
if (nfs2_ksp_server != NULL)
return (0);
}
-#endif /* NFS_HAVE_READ */
void module_register (void)
{
-#if NFS_HAVE_READ
plugin_register_read ("nfs", nfs_read);
-#endif
} /* void module_register */
diff --git a/src/ntpd.c b/src/ntpd.c
index 1c97e69ad721c834c93f41b8e6407a65e6d1f3cb..8328a9c81edd3a12589470a71306c3ad666c6134 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
#include "plugin.h"
#include "configfile.h"
-#if HAVE_SYS_SOCKET_H
-# define NTPD_HAVE_READ 1
-#else
-# define NTPD_HAVE_READ 0
-#endif
-
#if HAVE_STDINT_H
# include <stdint.h>
#endif
};
static int config_keys_num = 2;
-#if NTPD_HAVE_READ
# define NTPD_DEFAULT_HOST "localhost"
# define NTPD_DEFAULT_PORT "123"
static int sock_descr = -1;
return (0);
} /* int ntpd_read */
-#endif /* NTPD_HAVE_READ */
void module_register (void)
{
-#if NTPD_HAVE_READ
plugin_register_config ("ntpd", ntpd_config,
config_keys, config_keys_num);
plugin_register_read ("ntpd", ntpd_read);
-#endif /* NTPD_HAVE_READ */
} /* void module_register */
diff --git a/src/nut.c b/src/nut.c
index 6af12b82def97c8e065cc93dbc0aea7f42faf624..bde5d820168ed97da000993290ee4c4281e50530 100644 (file)
--- a/src/nut.c
+++ b/src/nut.c
#if HAVE_UPSCLIENT_H
# include <upsclient.h>
-# define NUT_HAVE_READ 1
-#else
-# define NUT_HAVE_READ 0
#endif
-#if NUT_HAVE_READ
struct nut_ups_s;
typedef struct nut_ups_s nut_ups_t;
struct nut_ups_s
return (0);
} /* int nut_shutdown */
-#endif /* NUT_HAVE_READ */
void module_register (void)
{
-#if NUT_HAVE_READ
plugin_register_config ("nut", nut_config, config_keys, config_keys_num);
plugin_register_read ("nut", nut_read);
plugin_register_shutdown ("nut", nut_shutdown);
-#endif
} /* void module_register */
/* vim: set sw=2 ts=8 sts=2 tw=78 : */
diff --git a/src/processes.c b/src/processes.c
index ff4012660dff3888c5cb28cfa75107da3c7ed8cf..29492ac2ff6347bb0427249056907ca947fa01d1 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
# ifndef CONFIG_HZ
# define CONFIG_HZ 100
# endif
-#endif /* KERNEL_LINUX */
-
-#define MODULE_NAME "processes"
+/* #endif KERNEL_LINUX */
-#if HAVE_THREAD_INFO || KERNEL_LINUX
-# define PROCESSES_HAVE_READ 1
#else
-# define PROCESSES_HAVE_READ 0
+# error "No applicable input method."
#endif
#define BUFSIZE 256
-#if PROCESSES_HAVE_READ
-#if HAVE_THREAD_INFO | KERNEL_LINUX
static const char *config_keys[] =
{
"Process",
NULL
};
static int config_keys_num = 1;
-#endif
typedef struct procstat_entry_s
{
struct procstat_entry_s *instances;
} procstat_t;
-#if HAVE_THREAD_INFO | KERNEL_LINUX
static procstat_t *list_head_g = NULL;
-#endif
#if HAVE_THREAD_INFO
static mach_port_t port_host_self;
static long pagesize_g;
#endif /* KERNEL_LINUX */
-#if HAVE_THREAD_INFO | KERNEL_LINUX
static void ps_list_register (const char *name)
{
procstat_t *new;
return (0);
}
-#endif /* HAVE_THREAD_INFO | KERNEL_LINUX */
static int ps_init (void)
{
return (0);
} /* int ps_read */
-#endif /* PROCESSES_HAVE_READ */
void module_register (void)
{
-#if PROCESSES_HAVE_READ
-#if HAVE_THREAD_INFO | KERNEL_LINUX
plugin_register_config ("processes", ps_config,
config_keys, config_keys_num);
-#endif
plugin_register_init ("processes", ps_init);
plugin_register_read ("processes", ps_read);
-#endif /* PROCESSES_HAVE_READ */
} /* void module_register */
diff --git a/src/sensors.c b/src/sensors.c
index e1bc7aafc2100ef2341b990ed7ad9352e2783c30..3e1d4f9aa6ba9d78997c4574b679670de2b5b9e3 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
#if defined(HAVE_SENSORS_SENSORS_H)
# include <sensors/sensors.h>
-#else
-# undef HAVE_LIBSENSORS
#endif
-#if defined(HAVE_LIBSENSORS)
-# define SENSORS_HAVE_READ 1
-#else
-# define SENSORS_HAVE_READ 0
-#endif
-
-#if SENSORS_HAVE_READ
#define SENSOR_TYPE_VOLTAGE 0
#define SENSOR_TYPE_FANSPEED 1
#define SENSOR_TYPE_TEMPERATURE 2
return (0);
} /* int sensors_read */
-#endif /* SENSORS_HAVE_READ */
void module_register (void)
{
-#if SENSORS_HAVE_READ
plugin_register_config ("sensors", sensors_config,
config_keys, config_keys_num);
plugin_register_read ("sensors", sensors_read);
plugin_register_shutdown ("sensors", sensors_shutdown);
-#endif
} /* void module_register */
diff --git a/src/serial.c b/src/serial.c
index dd063bb53bd9a9707ae5bf2ea74cb9d5b4da03f5..9cfe1dd471b6ee1e195781617512a4ee16dd5d05 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
#include "common.h"
#include "plugin.h"
-#if defined(KERNEL_LINUX)
-# define SERIAL_HAVE_READ 1
-#else
-# define SERIAL_HAVE_READ 0
+#if !KERNEL_LINUX
+# error "No applicable input method."
#endif
-#if SERIAL_HAVE_READ
static void serial_submit (const char *type_instance,
counter_t rx, counter_t tx)
{
static int serial_read (void)
{
-#ifdef KERNEL_LINUX
FILE *fh;
char buffer[1024];
fclose (fh);
return (0);
-#endif /* KERNEL_LINUX */
} /* int serial_read */
-#endif /* SERIAL_HAVE_READ */
void module_register (void)
{
-#if SERIAL_HAVE_READ
plugin_register_read ("serial", serial_read);
-#endif /* SERIAL_HAVE_READ */
} /* void module_register */
diff --git a/src/swap.c b/src/swap.c
index 3018cb9e754460fca13aeaa524349d4f9e517e3a..4a414b70d21805890fa3abdc38f9cfa059224311 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
# include <kvm.h>
#endif
-#if KERNEL_LINUX || HAVE_LIBKSTAT || defined(VM_SWAPUSAGE) || HAVE_LIBKVM || HAVE_LIBSTATGRAB
-# define SWAP_HAVE_READ 1
-#else
-# define SWAP_HAVE_READ 0
-#endif
-
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#if SWAP_HAVE_READ
#if KERNEL_LINUX
/* No global variables */
/* #endif KERNEL_LINUX */
#elif HAVE_LIBSTATGRAB
/* No global variables */
+/* #endif HAVE_LIBSTATGRAB */
+
+#else
+# error "No applicable input method."
#endif /* HAVE_LIBSTATGRAB */
static int swap_init (void)
return (0);
} /* int swap_read */
-#endif /* SWAP_HAVE_READ */
void module_register (void)
{
-#if SWAP_HAVE_READ
plugin_register_init ("swap", swap_init);
plugin_register_read ("swap", swap_read);
-#endif /* SWAP_HAVE_READ */
} /* void module_register */
diff --git a/src/tape.c b/src/tape.c
index 5e01f0d8a963876549c47e56f3337b0b72888829..465688ed5cf2a470df3430fed859c44f2b9f83e6 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
#include "common.h"
#include "plugin.h"
-#if defined(HAVE_LIBKSTAT)
-# define TAPE_HAVE_READ 1
-#else
-# define TAPE_HAVE_READ 0
+#if !HAVE_LIBKSTAT
+# error "No applicable input method."
#endif
-#if TAPE_HAVE_READ
-#if defined(HAVE_LIBKSTAT)
#define MAX_NUMTAPE 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMTAPE];
static int numtape = 0;
-#endif /* HAVE_LIBKSTAT */
static int tape_init (void)
{
-#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
numtape = 0;
continue;
ksp[numtape++] = ksp_chain;
}
-#endif
return (0);
-}
+} /* int tape_init */
static void tape_submit (const char *plugin_instance,
const char *type,
static int tape_read (void)
{
-#if defined(HAVE_LIBKSTAT)
-# if HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_NWRITES && HAVE_KSTAT_IO_T_WTIME
-# define KIO_ROCTETS reads
-# define KIO_WOCTETS writes
-# define KIO_ROPS nreads
-# define KIO_WOPS nwrites
-# define KIO_RTIME rtime
-# define KIO_WTIME wtime
-# elif HAVE_KSTAT_IO_T_NWRITTEN && HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_WTIME
-# define KIO_ROCTETS nread
-# define KIO_WOCTETS nwritten
-# define KIO_ROPS reads
-# define KIO_WOPS writes
-# define KIO_RTIME rtime
-# define KIO_WTIME wtime
-# else
-# error "kstat_io_t does not have the required members"
-# endif
+#if HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_NWRITES && HAVE_KSTAT_IO_T_WTIME
+# define KIO_ROCTETS reads
+# define KIO_WOCTETS writes
+# define KIO_ROPS nreads
+# define KIO_WOPS nwrites
+# define KIO_RTIME rtime
+# define KIO_WTIME wtime
+#elif HAVE_KSTAT_IO_T_NWRITTEN && HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_WTIME
+# define KIO_ROCTETS nread
+# define KIO_WOCTETS nwritten
+# define KIO_ROPS reads
+# define KIO_WOPS writes
+# define KIO_RTIME rtime
+# define KIO_WTIME wtime
+#else
+# error "kstat_io_t does not have the required members"
+#endif
static kstat_io_t kio;
int i;
kio.KIO_RTIME, kio.KIO_WTIME);
}
}
-#endif /* defined(HAVE_LIBKSTAT) */
return (0);
}
-#endif /* TAPE_HAVE_READ */
void module_register (void)
{
-#if TAPE_HAVE_READ
plugin_register_init ("tape", tape_init);
plugin_register_read ("tape", tape_read);
-#endif /* TAPE_HAVE_READ */
}
diff --git a/src/users.c b/src/users.c
index 7df06c2baa41fe382ab536a25b7e2468dabf8b12..afe26e1e27fc27a3d155b135b56d3571290bcd46 100644 (file)
--- a/src/users.c
+++ b/src/users.c
#if HAVE_UTMPX_H
# include <utmpx.h>
-#else /* !HAVE_UTMPX_H */
-# if HAVE_UTMP_H
-# include <utmp.h>
-# endif /* HAVE_UTMP_H */
-#endif /* HAVE_UTMPX_H */
+/* #endif HAVE_UTMPX_H */
-#define MODULE_NAME "users"
+#elif HAVE_UTMP_H
+# include <utmp.h>
+/* #endif HAVE_UTMP_H */
-#if HAVE_GETUTXENT || HAVE_GETUTENT
-# define USERS_HAVE_READ 1
#else
-# define USERS_HAVE_READ 0
+# error "No applicable input method."
#endif
-#if USERS_HAVE_READ
static void users_submit (gauge_t value)
{
value_t values[1];
endutent();
users_submit (users);
-#endif /* HAVE_GETUTENT */
+/* #endif HAVE_GETUTENT */
+
+#else
+# error "No applicable input method."
+#endif
return (0);
} /* int users_read */
-#endif /* USERS_HAVE_READ */
void module_register (void)
{
-#if USERS_HAVE_READ
plugin_register_read ("users", users_read);
-#endif
} /* void module_register(void) */
diff --git a/src/vserver.c b/src/vserver.c
index 8d524e77c982869f47828e17525adee078dbd934..7b83c6174a830a0da933f4bd0c90f1c1180b67a3 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
#define BUFSIZE 512
-#define MODULE_NAME "vserver"
#define PROCDIR "/proc/virtual"
-#if defined(KERNEL_LINUX)
-# define VSERVER_HAVE_READ 1
-#else
-# define VSERVER_HAVE_READ 0
-#endif /* defined(KERNEL_LINUX) */
+#if !KERNEL_LINUX
+# error "No applicable input method."
+#endif
-#if VSERVER_HAVE_READ
static int pagesize = 0;
static int vserver_init (void)
return (0);
} /* int vserver_read */
-#endif /* VSERVER_HAVE_READ */
void module_register (void)
{
-#if VSERVER_HAVE_READ
plugin_register_init ("vserver", vserver_init);
plugin_register_read ("vserver", vserver_read);
-#endif /* VSERVER_HAVE_READ */
} /* void module_register(void) */
/* vim: set ts=4 sw=4 noexpandtab : */
diff --git a/src/wireless.c b/src/wireless.c
index 81c968e8d9b4e462a57129b6c37cb7fdd05e303d..09df407070c01d5b7503c75238d088290055d636 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
#include "common.h"
#include "plugin.h"
-#if defined(KERNEL_LINUX)
-# define WIRELESS_HAVE_READ 1
-#else
-# define WIRELESS_HAVE_READ 0
+#if !KERNEL_LINUX
+# error "No applicable input method."
#endif
#define WIRELESS_PROC_FILE "/proc/net/wireless"
-#if WIRELESS_HAVE_READ
#if 0
static double wireless_dbm_to_watt (double dbm)
{
return (0);
} /* int wireless_read */
-#endif /* WIRELESS_HAVE_READ */
void module_register (void)
{
-#if WIRELESS_HAVE_READ
plugin_register_read ("wireless", wireless_read);
-#endif /* WIRELESS_HAVE_READ */
} /* void module_register */