From 9754d84492908f5e02cc16c45955a433028ee66b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 12 Sep 2012 21:31:41 +0200 Subject: [PATCH] Revert "swap plugin: Add the "ReportBytes" option." This reverts commit 25fd1667c186eb871a4b66f9866d6446e41f1bc2. --- src/collectd.conf.in | 4 ---- src/collectd.conf.pod | 17 ----------------- src/swap.c | 41 +++-------------------------------------- 3 files changed, 3 insertions(+), 59 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index e508be7b..21d0eb17 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -818,10 +818,6 @@ FQDNLookup true # # -# -# ReportBytes true -# - # # # Instance "slabinfo" diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index f359e9a0..75f79429 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4031,23 +4031,6 @@ Since the configuration of the C is a little more complicated than other plugins, its documentation has been moved to an own manpage, L. Please see there for details. -=head2 Plugin C - -The C reports the number of bytes currently swapped out and the -amount of swap space available. The precise metrics being exported depends on -your operating system. - -Options: - -=over 4 - -=item B B|B - -When enabled, the I is reported in bytes. When disabled, the default, -I is reported in pages. This option is available under Linux only. - -=back - =head2 Plugin C =over 4 diff --git a/src/swap.c b/src/swap.c index 1a152c90..46ba6652 100644 --- a/src/swap.c +++ b/src/swap.c @@ -1,6 +1,6 @@ /** * collectd - src/swap.c - * Copyright (C) 2005-2012 Florian octo Forster + * Copyright (C) 2005-2009 Florian octo Forster * Copyright (C) 2009 Stefan Völkel * Copyright (C) 2009 Manuel Sanmartin * @@ -68,8 +68,7 @@ #define MAX(x,y) ((x) > (y) ? (x) : (y)) #if KERNEL_LINUX -static derive_t pagesize; -static _Bool report_bytes = 0; +/* No global variables */ /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT @@ -103,16 +102,10 @@ static perfstat_memory_total_t pmemory; # error "No applicable input method." #endif /* HAVE_LIBSTATGRAB */ -static const char *config_keys[] = -{ - "ReportBytes" -}; -static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); - static int swap_init (void) { #if KERNEL_LINUX - pagesize = (derive_t) sysconf (_SC_PAGESIZE); + /* No init stuff */ /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT @@ -291,12 +284,6 @@ static int swap_read (void) sstrerror (errno, errbuf, sizeof (errbuf))); } - if (report_bytes) - { - swap_in *= pagesize; - swap_out *= pagesize; - } - swap_submit ("used", 1024 * swap_used, DS_TYPE_GAUGE); swap_submit ("free", 1024 * swap_free, DS_TYPE_GAUGE); swap_submit ("cached", 1024 * swap_cached, DS_TYPE_GAUGE); @@ -503,30 +490,8 @@ static int swap_read (void) return (0); } /* int swap_read */ -static int swap_config (const char *key, const char *value) -{ - if (strcasecmp ("ReportBytes", key) == 0) - { -#if KERNEL_LINUX - report_bytes = IS_TRUE (value) ? 1 : 0; -#else - WARNING ("swap plugin: The \"ReportBytes\" option is only " - "valid under Linux. The option is going to " - "be ignored."); -#endif - } - else - { - return (-1); - } - - return (0); -} /* int swap_config */ - void module_register (void) { - plugin_register_config ("swap", swap_config, - config_keys, config_keys_num); plugin_register_init ("swap", swap_init); plugin_register_read ("swap", swap_read); } /* void module_register */ -- 2.30.2