X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fswap.c;h=78f05c5f968971ac961c3637935e6aaa7f55108c;hp=a5531c24e86247532ca68323cc1200818e9eebc2;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=c99e3a4d169ada9299c73e20662d17debdc32e1f 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 */