From: Ivan Kurnosov Date: Sat, 23 Sep 2017 05:32:14 +0000 (+1200) Subject: swap plugin: Added `ReportIO` option X-Git-Tag: collectd-5.8.0~86^2 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=7379d64df50ef5bb6a4eb794732590f7a2cd1a56 swap plugin: Added `ReportIO` option lxc/lxd containers at the moment cannot properly report the swap io (the corresponding /proc/vmstat are not virtualized), so added an option to disable that reporting. Enabled by default. Closes: #2433 --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index f35f3284..4512a875 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -1344,6 +1344,7 @@ # ReportBytes true # ValuesAbsolute true # ValuesPercentage false +# ReportIO true # # @@ -1479,7 +1480,7 @@ # SystemManagementInterrupt true # DigitalTemperatureSensor true # PackageThermalManagement true -# RunningAveragePowerLimit "7" +# RunningAveragePowerLimit "7" # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 63e62efb..f13ffcd9 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4329,11 +4329,11 @@ If enabled, the plugin sends a notification if the replication slave I/O and / or SQL threads are not running. Defaults to B. =item B I - + Enable the collection of wsrep plugin statistics, used in Master-Master replication setups like in MySQL Galera/Percona XtraDB Cluster. User needs only privileges to execute 'SHOW GLOBAL STATUS' - + =item B I Sets the connect timeout for the MySQL client. @@ -5174,7 +5174,7 @@ System (NFS). It counts the number of procedure calls for each procedure, grouped by version and whether the system runs as server or client. It is possibly to omit metrics for a specific NFS version by setting one or -more of the following options to B (all of them default to B). +more of the following options to B (all of them default to B). =over 4 @@ -7525,6 +7525,13 @@ available and free. Defaults to B. This is useful for deploying I in a heterogeneous environment, where swap sizes differ and you want to specify generic thresholds or similar. +=item B B|B + +Enables or disables reporting swap IO. Defaults to B. + +This is useful for the cases when swap IO is not neccessary, is not available, +or is not reliable. + =back =head2 Plugin C @@ -8483,7 +8490,7 @@ will be collected. =item B B|B If I is set to B, the default, then the device name -seen by the guest will be used for reporting metrics. +seen by the guest will be used for reporting metrics. This corresponds to the CtargetE> node in the XML definition of the domain. diff --git a/src/swap.c b/src/swap.c index a5531c24..78f05c5f 100644 --- a/src/swap.c +++ b/src/swap.c @@ -111,6 +111,7 @@ static int pagesize; static _Bool values_absolute = 1; static _Bool values_percentage = 0; +static _Bool report_io = 1; static int swap_config(oconfig_item_t *ci) /* {{{ */ { @@ -136,6 +137,8 @@ static int swap_config(oconfig_item_t *ci) /* {{{ */ cf_util_get_boolean(child, &values_absolute); else if (strcasecmp("ValuesPercentage", child->key) == 0) cf_util_get_boolean(child, &values_percentage); + else if (strcasecmp("ReportIO", child->key) == 0) + cf_util_get_boolean(child, &report_io); else WARNING("swap plugin: Unknown config option: \"%s\"", child->key); } @@ -406,7 +409,8 @@ static int swap_read(void) /* {{{ */ else swap_read_combined(); - swap_read_io(); + if (report_io) + swap_read_io(); return 0; } /* }}} int swap_read */ @@ -726,8 +730,11 @@ static int swap_read(void) /* {{{ */ reserved = (gauge_t)(pmemory.pgsp_rsvd * pagesize); swap_submit_usage(NULL, total - free, free, "reserved", reserved); - swap_submit_derive("in", (derive_t)pmemory.pgspins * pagesize); - swap_submit_derive("out", (derive_t)pmemory.pgspouts * pagesize); + + if (report_io) { + swap_submit_derive("in", (derive_t)pmemory.pgspins * pagesize); + swap_submit_derive("out", (derive_t)pmemory.pgspouts * pagesize); + } return 0; } /* }}} int swap_read */