From: Michael Schenck Date: Tue, 7 Oct 2014 02:40:24 +0000 (-0400) Subject: Added support for the last two additional columns in add-linux-io-time X-Git-Tag: collectd-5.5.0~137^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ac7a3cde14b20bdb12a9ab0a9aad25dae0a23ac3;p=collectd.git Added support for the last two additional columns in add-linux-io-time --- diff --git a/src/disk.c b/src/disk.c index e84e8355..9c8d1e59 100644 --- a/src/disk.c +++ b/src/disk.c @@ -292,6 +292,28 @@ static void submit_in_progress (char const *disk_name, gauge_t in_progress) plugin_dispatch_values (&vl); } +static void submit_io_time (char const *plugin_instance, derive_t io_time, derive_t weighted_time) +{ + value_t values[2]; + value_list_t vl = VALUE_LIST_INIT; + + if (ignorelist_match (ignorelist, plugin_instance) != 0) + return; + + values[0].derive = io_time; + values[1].derive = weighted_time; + + vl.values = values; + vl.values_len = 2; + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "disk", sizeof (vl.plugin)); + sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); + sstrncpy (vl.type, "disk_io_time", sizeof (vl.type)); + + plugin_dispatch_values (&vl); +} + + static counter_t disk_calc_time_incr (counter_t delta_time, counter_t delta_ops) { double interval = CDTIME_T_TO_DOUBLE (plugin_get_interval ()); @@ -560,6 +582,8 @@ static int disk_read (void) derive_t write_merged = 0; derive_t write_time = 0; gauge_t in_progress = NAN; + derive_t io_time = 0; + derive_t weighted_time = 0; int is_disk = 0; diskstats_t *ds, *pre_ds; @@ -643,6 +667,9 @@ static int disk_read (void) write_time = atoll (fields[10+ fieldshift]); in_progress = atof (fields[11 + fieldshift]); + + io_time = atof (fields[12 + fieldshift]); + weighted_time = atof (fields[13 + fieldshift]); } } else @@ -767,6 +794,7 @@ static int disk_read (void) disk_submit (output_name, "disk_merged", read_merged, write_merged); submit_in_progress (output_name, in_progress); + submit_io_time (io_time, weighted_time); } /* if (is_disk) */ /* release udev-based alternate name, if allocated */ diff --git a/src/types.db b/src/types.db index 64137b07..fc75153f 100644 --- a/src/types.db +++ b/src/types.db @@ -37,6 +37,7 @@ disk_octets read:DERIVE:0:U, write:DERIVE:0:U disk_ops_complex value:DERIVE:0:U disk_ops read:DERIVE:0:U, write:DERIVE:0:U disk_time read:DERIVE:0:U, write:DERIVE:0:U +disk_io_time io_time:DERIVE:0:U, weighted_io_time:DERIVE:0:U dns_answer value:DERIVE:0:U dns_notify value:DERIVE:0:U dns_octets queries:DERIVE:0:U, responses:DERIVE:0:U