pkglib_LTLIBRARIES += serial.la
serial_la_SOURCES = serial.c serial.h
serial_la_LDFLAGS = -module -avoid-version
+serial_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" serial.la
collectd_DEPENDENCIES += serial.la
endif
pkglib_LTLIBRARIES += swap.la
swap_la_SOURCES = swap.c swap.h
swap_la_LDFLAGS = -module -avoid-version
+swap_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" swap.la
collectd_DEPENDENCIES += swap.la
endif
pkglib_LTLIBRARIES += tape.la
tape_la_SOURCES = tape.c tape.h
tape_la_LDFLAGS = -module -avoid-version
+tape_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" tape.la
collectd_DEPENDENCIES += tape.la
endif
pkglib_LTLIBRARIES += traffic.la
traffic_la_SOURCES = traffic.c traffic.h
traffic_la_LDFLAGS = -module -avoid-version
+traffic_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" traffic.la
collectd_DEPENDENCIES += traffic.la
endif
* Florian octo Forster <octo at verplant.org>
**/
-#include "serial.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_SERIAL
#define MODULE_NAME "serial"
-#include "plugin.h"
-#include "common.h"
+#if defined(KERNEL_LINUX)
+# define SERIAL_HAVE_READ 1
+#else
+# define SERIAL_HAVE_READ 0
+#endif
static char *serial_filename_template = "serial-%s.rrd";
};
static int ds_num = 2;
-void serial_init (void)
+static void serial_init (void)
{
+ return;
}
-void serial_write (char *host, char *inst, char *val)
+static void serial_write (char *host, char *inst, char *val)
{
char file[512];
int status;
}
#define BUFSIZE 512
-void serial_submit (char *device,
+static void serial_submit (char *device,
unsigned long long incoming,
unsigned long long outgoing)
{
}
#undef BUFSIZE
-void serial_read (void)
+#if SERIAL_HAVE_READ
+static void serial_read (void)
{
#ifdef KERNEL_LINUX
{
int have_rx = 0, have_tx = 0;
+ /* stupid compiler:
+ * serial.c:87: warning: 'incoming' may be used uninitialized in this function
+ * serial.c:87: warning: 'outgoing' may be used uninitialized in this function
+ */
+ incoming = 0ULL;
+ outgoing = 0ULL;
+
numfields = strsplit (buffer, fields, 16);
if (numfields < 6)
fclose (fh);
#endif /* KERNEL_LINUX */
}
+#endif /* SERIAL_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, serial_init, serial_read, serial_write);
+ plugin_register (MODULE_NAME, serial_init,
+#if SERIAL_HAVE_READ
+ serial_read,
+#else
+ NULL,
+#endif
+ serial_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_SERIAL */
* Florian octo Forster <octo at verplant.org>
**/
-#include "swap.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_SWAP
#define MODULE_NAME "swap"
+#if defined(KERNEL_LINUX) || defined(KERNEL_SOLARIS) || defined(HAVE_LIBSTATGRAB)
+# define SWAP_HAVE_READ 1
+#else
+# define SWAP_HAVE_READ 0
+#endif
+
#ifdef KERNEL_SOLARIS
#include <sys/swap.h>
#endif /* KERNEL_SOLARIS */
-#include "plugin.h"
-#include "common.h"
-
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
static kstat_t *ksp;
#endif /* KERNEL_SOLARIS */
-void module_init (void)
+static void module_init (void)
{
#ifdef KERNEL_SOLARIS
/* getpagesize(3C) tells me this does not fail.. */
return;
}
-void module_write (char *host, char *inst, char *val)
+static void module_write (char *host, char *inst, char *val)
{
rrd_update_file (host, swap_file, val, ds_def, ds_num);
}
-void module_submit (unsigned long long swap_used,
+static void module_submit (unsigned long long swap_used,
unsigned long long swap_free,
unsigned long long swap_cached,
unsigned long long swap_resv)
plugin_submit (MODULE_NAME, "-", buffer);
}
-void module_read (void)
+#if SWAP_HAVE_READ
+static void module_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
module_submit (swap->used, swap->free, -1LL, -1LL);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define module_read NULL
+#endif /* SWAP_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_SWAP */
* Scott Garrett <sgarrett at technomancer.com>
**/
-#include "tape.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_TAPE
#define MODULE_NAME "tape"
-#include "plugin.h"
-#include "common.h"
-
#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 */
+# define TAPE_HAVE_READ 1
+#else
+# define TAPE_HAVE_READ 0
+#endif
static char *tape_filename_template = "tape-%s.rrd";
};
static int tape_ds_num = 8;
-void tape_init (void)
+#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 void tape_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
return;
}
-void tape_write (char *host, char *inst, char *val)
+static void tape_write (char *host, char *inst, char *val)
{
char file[512];
int status;
#define BUFSIZE 512
-void tape_submit (char *tape_name,
+static void tape_submit (char *tape_name,
unsigned long long read_count,
unsigned long long read_merged,
unsigned long long read_bytes,
#undef BUFSIZE
+#if TAPE_HAVE_READ
void tape_read (void)
{
}
#endif /* defined(HAVE_LIBKSTAT) */
}
+#else
+# define tape_read NULL
+#endif /* TAPE_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_TAPE */
* Florian octo Forster <octo at verplant.org>
**/
-#include "traffic.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_TRAFFIC
#define MODULE_NAME "traffic"
-#include "plugin.h"
-#include "common.h"
-
-#ifdef HAVE_LIBKSTAT
-#define MAX_NUMIF 256
-extern kstat_ctl_t *kc;
-static kstat_t *ksp[MAX_NUMIF];
-static int numif = 0;
-#endif /* HAVE_LIBKSTAT */
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_LIBSTATGRAB)
+# define TRAFFIC_HAVE_READ 1
+#else
+# define TRAFFIC_HAVE_READ 0
+#endif
static char *traffic_filename_template = "traffic-%s.rrd";
};
static int ds_num = 2;
+#ifdef HAVE_LIBKSTAT
+#define MAX_NUMIF 256
+extern kstat_ctl_t *kc;
+static kstat_t *ksp[MAX_NUMIF];
+static int numif = 0;
+#endif /* HAVE_LIBKSTAT */
+
void traffic_init (void)
{
#ifdef HAVE_LIBKSTAT
}
#undef BUFSIZE
+#if TRAFFIC_HAVE_READ
void traffic_read (void)
{
#ifdef KERNEL_LINUX
traffic_submit (ios[i].interface_name, ios[i].rx, ios[i].tx);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+#define traffic_read NULL
+#endif /* TRAFFIC_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_TRAFFIC */
* Sebastian Harl <sh at tokkee.org>
**/
+#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "users.h"
#if HAVE_UTMPX_H
# include <utmpx.h>
#define MODULE_NAME "users"
+#if HAVE_GETUTXENT || HAVE_GETUTENT
+# define USERS_HAVE_READ 1
+#else
+# define USERS_HAVE_READ 0
+#endif
+
static char *rrd_file = "users.rrd";
static char *ds_def[] =
{
} /* static void users_submit(unsigned int users) */
#undef BUFSIZE
+#if USERS_HAVE_READ
static void users_read (void)
{
#if HAVE_GETUTXENT
return;
} /* static void users_read(void) */
+#else
+# define users_read NULL
+#endif /* USERS_HAVE_READ */
void module_register (void)
{