-
-
+
+
'.dynamic_override_config('text','override_Unixagent_port', $device).'
+
';
diff --git a/html/pages/settings/external.inc.php b/html/pages/settings/external.inc.php
index 5459ed67e..b5b4661cd 100644
--- a/html/pages/settings/external.inc.php
+++ b/html/pages/settings/external.inc.php
@@ -34,6 +34,17 @@ $unixagent_conf = array(
),
);
+$rrdtool_conf = array(
+ array('name' => 'rrdtool',
+ 'descr' => 'Path to rrdtool binary',
+ 'type' => 'text',
+ ),
+ array('name' => 'rrdtool.tune',
+ 'descr' => 'Tune all rrd port files to use max values',
+ 'type' => 'checkbox',
+ ),
+);
+
echo '
diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php
index 0ab72a57d..d0301bff5 100644
--- a/includes/polling/ports.inc.php
+++ b/includes/polling/ports.inc.php
@@ -336,7 +336,7 @@ 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');
+ $device_tune = get_dev_attrib($device,'override_rrdtool_tune');
if ($port_tune == "true" ||
($device_tune == "true" && $port_tune != 'false') ||
($config['rrdtool']['tune'] == "true" && $port_tune != 'false' && $device_tune != 'false')) {
diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php
index 32c2040a1..b319bf80f 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" && $command != 'tune'))) {
+ 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);
@@ -304,7 +304,7 @@ function rrdtool_tune($type, $filename, $max) {
$fields = array(
'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS'
);
- $options = "--maxium " . implode(":$max --maximum ", $fields). ":$max";
+ $options = "--maximum " . implode(":$max --maximum ", $fields). ":$max";
rrdtool('tune', $filename, $options);
}
}
diff --git a/scripts/tune_port.php b/scripts/tune_port.php
new file mode 100755
index 000000000..061817283
--- /dev/null
+++ b/scripts/tune_port.php
@@ -0,0 +1,34 @@
+#!/usr/bin/env php
+ Device(s) to match\n";
+ echo "-p Port(s) to match using ifName\n";
+ echo "\n";
+
+}
+
+echo "TEST $hosts and $ports\n";
+$debug=1;
+
+foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` WHERE `hostname` LIKE ?", array('%'.$hosts.'%')) as $device) {
+ echo "Found hostname " . $device['hostname'].".......\n";
+ foreach (dbFetchRows("SELECT `ifIndex`,`ifName`,`ifSpeed` FROM `ports` WHERE `ifName` LIKE ? AND `device_id` = ?", array('%'.$ports.'%',$device['device_id'])) as $port) {
+ echo "Tuning port " . $port['ifName'].".......\n";
+ $host_rrd = $config['rrd_dir'].'/'.$device['hostname'];
+ $rrdfile = $host_rrd.'/port-'.safename($port['ifIndex'].'.rrd');
+ rrdtool_tune('port',$rrdfile,$port['ifSpeed']);
+ }
+}
+
diff --git a/sql-schema/077.sql b/sql-schema/077.sql
new file mode 100644
index 000000000..30bbf95fb
--- /dev/null
+++ b/sql-schema/077.sql
@@ -0,0 +1 @@
+INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('rrdtool','/usr/bin/rrdtool','/usr/bin/rrdtool','Path to rrdtool','external',0,'rrdtool',0,'0','0'), ('rrdtool.tune','false','false','Auto tune maximum value for rrd port files','external',0,'rrdtool',0,'0','0');