diff --git a/html/includes/table/edit-ports.inc.php b/html/includes/table/edit-ports.inc.php
index d4ccba8a5..625ac5e75 100644
--- a/html/includes/table/edit-ports.inc.php
+++ b/html/includes/table/edit-ports.inc.php
@@ -54,17 +54,22 @@ foreach (dbFetchRows($sql, $param) as $port) {
$isportbad = ($port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] != 'down') ? 1 : 0;
$dowecare = ($port['ignore'] == 0 && $port['disabled'] == 0) ? $isportbad : !$isportbad;
$outofsync = $dowecare ? " class='red'" : '';
+ $checked = '';
+ if (get_dev_attrib($device_id, 'ifName_tune:'.$port['ifName']) == "true") {
+ $checked = 'checked';
+ }
$response[] = array(
- 'ifIndex' => $port['ifIndex'],
- 'ifName' => $port['label'],
- 'ifAdminStatus' => $port['ifAdminStatus'],
- 'ifOperStatus' => ''.$port['ifOperStatus'].'',
- 'disabled' => '
- ',
- 'ignore' => '
- ',
- 'ifAlias' => '
'
+ 'ifIndex' => $port['ifIndex'],
+ 'ifName' => $port['label'],
+ 'ifAdminStatus' => $port['ifAdminStatus'],
+ 'ifOperStatus' => ''.$port['ifOperStatus'].'',
+ 'disabled' => '
+ ',
+ 'ignore' => '
+ ',
+ 'port_tune' => '',
+ 'ifAlias' => '
',
);
}//end foreach
diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php
index 37cccb9d2..2e14cbb46 100644
--- a/html/pages/device/edit/ports.inc.php
+++ b/html/pages/device/edit/ports.inc.php
@@ -5,7 +5,7 @@
'>
-
+
@@ -15,6 +15,7 @@
| Oper |
Disable |
Ignore |
+ RRD Tune |
Description |
@@ -23,6 +24,7 @@
diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php
index 784fecfd9..0ab72a57d 100644
--- a/includes/polling/ports.inc.php
+++ b/includes/polling/ports.inc.php
@@ -315,6 +315,7 @@ foreach ($ports as $port) {
}
// Update IF-MIB data
+ $tune_port = false;
foreach ($data_oids as $oid) {
if ($oid == 'ifAlias') {
@@ -334,6 +335,15 @@ foreach ($ports as $port) {
}
}
else if ($port[$oid] != $this_port[$oid]) {
+ $port_tune = get_dev_attrib($device, 'ifName_tune:'.$port['ifName']);
+ $device_tune = get_dev_attrib($device,'device_rrdtool_tune');
+ if ($port_tune == "true" ||
+ ($device_tune == "true" && $port_tune != 'false') ||
+ ($config['rrdtool']['tune'] == "true" && $port_tune != 'false' && $device_tune != 'false')) {
+ if ($oid == 'ifSpeed') {
+ $tune_port = true;
+ }
+ }
$port['update'][$oid] = $this_port[$oid];
log_event($oid.': '.$port[$oid].' -> '.$this_port[$oid], $device, 'interface', $port['port_id']);
if ($debug) {
@@ -477,6 +487,9 @@ foreach ($ports as $port) {
'OUTMULTICASTPKTS' => $this_port['ifOutMulticastPkts'],
);
+ if ($tune_port === true) {
+ rrdtool_tune('port',$rrdfile,$this_port['ifSpeed']);
+ }
rrdtool_update("$rrdfile", $fields);
// End Update IF-MIB
// Update PAgP
diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php
index 3c35cec22..32c2040a1 100644
--- a/includes/rrdtool.inc.php
+++ b/includes/rrdtool.inc.php
@@ -166,7 +166,7 @@ function rrdtool_graph($graph_file, $options) {
function rrdtool($command, $filename, $options) {
global $config, $debug, $rrd_pipes, $console_color;
- if ($config['rrdcached'] && ($config['rrdtool_version'] >= 1.5 || $command != "create")) {
+ if ($config['rrdcached'] && ($config['rrdtool_version'] >= 1.5 || ($command != "create" && $command != 'tune'))) {
if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== false) {
$filename = str_replace($config['rrd_dir'].'/', './'.$config['rrdcached_dir'].'/', $filename);
$filename = str_replace($config['rrd_dir'], './'.$config['rrdcached_dir'].'/', $filename);
@@ -294,3 +294,17 @@ function rrdtool_escape($string, $maxlength=null){
return $result.' ';
}
+
+function rrdtool_tune($type, $filename, $max) {
+ if ($type === 'port') {
+ if ($max < 10000000) {
+ return false;
+ }
+ $max = $max / 8;
+ $fields = array(
+'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS'
+);
+ $options = "--maxium " . implode(":$max --maximum ", $fields). ":$max";
+ rrdtool('tune', $filename, $options);
+ }
+}