diff --git a/src/tape.c b/src/tape.c
index 3697c6333aa8f4d6cfab06b1ec5a3e86fa27bb74..b13cdbd84e6a18db69ff6f822c9f4bc9a9a3ea69 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
/**
* collectd - src/tape.c
- * Copyright (C) 2005 Scott Garrett
+ * Copyright (C) 2005,2006 Scott Garrett
*
* 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
* 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";
/* 104857600 == 100 MB */
static char *tape_ds_def[] =
{
- "DS:rcount:COUNTER:25:0:U",
- "DS:rmerged:COUNTER:25:0:U",
- "DS:rbytes:COUNTER:25:0:U",
- "DS:rtime:COUNTER:25:0:U",
- "DS:wcount:COUNTER:25:0:U",
- "DS:wmerged:COUNTER:25:0:U",
- "DS:wbytes:COUNTER:25:0:U",
- "DS:wtime:COUNTER:25:0:U",
+ "DS:rcount:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:rmerged:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:rbytes:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:rtime:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:wcount:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:wmerged:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:wbytes:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:wtime:COUNTER:"COLLECTD_HEARTBEAT":0:U",
NULL
};
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;
}
+#if TAPE_HAVE_READ
#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
-void tape_read (void)
+static void tape_read (void)
{
#if defined(HAVE_LIBKSTAT)
}
#endif /* defined(HAVE_LIBKSTAT) */
}
+#else
+# define tape_read NULL
+#endif /* TAPE_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_TAPE */