X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftape.c;h=b13cdbd84e6a18db69ff6f822c9f4bc9a9a3ea69;hb=efe2a48f63ed4042c101f770d64e1c543fea70ad;hp=3697c6333aa8f4d6cfab06b1ec5a3e86fa27bb74;hpb=a82ff6683f0011a498b4fc0947833d2e28925b76;p=collectd.git diff --git a/src/tape.c b/src/tape.c index 3697c633..b13cdbd8 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1,6 +1,6 @@ /** * 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 @@ -20,39 +20,43 @@ * Scott Garrett **/ -#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; @@ -77,7 +81,7 @@ void tape_init (void) 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; @@ -92,8 +96,9 @@ void tape_write (char *host, char *inst, char *val) } +#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, @@ -118,7 +123,7 @@ void tape_submit (char *tape_name, #undef BUFSIZE -void tape_read (void) +static void tape_read (void) { #if defined(HAVE_LIBKSTAT) @@ -140,6 +145,9 @@ void tape_read (void) } #endif /* defined(HAVE_LIBKSTAT) */ } +#else +# define tape_read NULL +#endif /* TAPE_HAVE_READ */ void module_register (void) { @@ -147,4 +155,3 @@ void module_register (void) } #undef MODULE_NAME -#endif /* COLLECT_TAPE */