/**
* 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 */
/*
* 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.
# 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 */
# 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 */
# 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 */
#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 */
}
#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 */
# 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 */
#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 */
/**
* 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 */
#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 */
}
# 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 */
# 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
*/
#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
/**
* 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 */
#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 */
# 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 */
# 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 */
#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 */
#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 */
#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 */
#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 : */
# 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 */
#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 */
#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 */
# 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 */
#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 */
}
#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) */
#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 : */
#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 */