From 76d5311647aaeaadaa590772415abe6f0fa1f62c Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 25 Jul 2016 20:42:37 -0500 Subject: [PATCH] Update nfs-stats.inc.php to use data_update filter tags in ports.inc.php, and update the phpdoc for rrd_array_filter() --- includes/datastore.inc.php | 7 +- .../polling/applications/nfs-stats.inc.php | 92 +++++++++---------- includes/polling/ports.inc.php | 4 +- 3 files changed, 50 insertions(+), 53 deletions(-) diff --git a/includes/datastore.inc.php b/includes/datastore.inc.php index d6ee62fbcb..756deb7b4f 100644 --- a/includes/datastore.inc.php +++ b/includes/datastore.inc.php @@ -22,8 +22,11 @@ require_once $config['install_dir'] . "/includes/rrdtool.inc.php"; require_once $config['install_dir'] . "/includes/influxdb.inc.php"; -/* - * @return Copy of $arr with all keys beginning with 'rrd_' removed. +/** + * Filter all elements with keys that start with 'rrd_' + * + * @param array $arr input array + * @return array Copy of $arr with all keys beginning with 'rrd_' removed. */ function rrd_array_filter($arr) { diff --git a/includes/polling/applications/nfs-stats.inc.php b/includes/polling/applications/nfs-stats.inc.php index 97a3d9881b..002275c3a1 100644 --- a/includes/polling/applications/nfs-stats.inc.php +++ b/includes/polling/applications/nfs-stats.inc.php @@ -1,55 +1,49 @@ $total, - 'null' => $null, - 'getattr' => $getattr, - 'setattr' => $setattr, - 'lookup' => $lookup, - 'access' => $access, - 'read' => $read, - 'write' => $write, - 'create' => $create, - 'mkdir' => $mkdir, - 'remove' => $remove, - 'rmdir' => $rmdir, - 'rename' => $rename, - 'readdirplus' => $readdirplus, - 'fsstat' => $fsstat, -); + 'total' => $data[0], + 'null' => $data[1], + 'getattr' => $data[2], + 'setattr' => $data[3], + 'lookup' => $data[4], + 'access' => $data[5], + 'read' => $data[6], + 'write' => $data[7], + 'create' => $data[8], + 'mkdir' => $data[9], + 'remove' => $data[10], + 'rmdir' => $data[11], + 'rename' => $data[12], + 'readdirplus' => $data[13], + 'fsstat' => $data[14], +); -rrdtool_update($rrd_filename, $fields); -$tags = array('name' => 'nfsstats', 'app_id' => $app['app_id']); -influx_update($device,'app',$tags,$fields); +$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); +data_update($device, 'app', $tags, $fields); diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index c54fc49d6d..cd140496d3 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -476,7 +476,7 @@ foreach ($ports as $port) { $port_tune = get_dev_attrib($device, 'ifName_tune:'.$port['ifName']); $device_tune = get_dev_attrib($device,'override_rrdtool_tune'); if ($port_tune == "true" || - ($device_tune == "true" && $port_tune != 'false') || + ($device_tune == "true" && $port_tune != 'false') || ($config['rrdtool_tune'] == "true" && $port_tune != 'false' && $device_tune != 'false')) { if ($oid == 'ifSpeed') { $tune_port = true; @@ -646,7 +646,7 @@ foreach ($ports as $port) { $fields['ifInOctets_rate'] = $port['ifInOctets_rate']; $fields['ifOutOctets_rate'] = $port['ifOutOctets_rate']; - influx_update($device,'ports',$tags,$fields); + influx_update($device, 'ports', rrd_array_filter($tags), $fields); // End Update IF-MIB // Update PAgP