From f22f4b12a662a87abe507bb29374462892a07b4e Mon Sep 17 00:00:00 2001
From: Adam Amstrong
Date: Thu, 12 Jan 2012 12:51:21 +0000
Subject: [PATCH] acsw change, and improve debugging for rrdtool graphing
git-svn-id: http://www.observium.org/svn/observer/trunk@2816 61d68cd4-352d-0410-923a-c4978735b2b8
---
html/graph.php | 41 +++++++++++++++-
html/includes/graphs/graph.inc.php | 58 +++++------------------
html/pages/graphs.inc.php | 18 +++++++
includes/discovery/processors/ios.inc.php | 2 +-
includes/rrdtool.inc.php | 27 +++++++----
includes/static-config.php | 8 ++--
6 files changed, 93 insertions(+), 61 deletions(-)
diff --git a/html/graph.php b/html/graph.php
index 97e91d86f..dfa1d1f03 100755
--- a/html/graph.php
+++ b/html/graph.php
@@ -1,5 +1,44 @@
\ No newline at end of file
+?>
diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php
index eecde75f7..f7c4ec916 100644
--- a/html/includes/graphs/graph.inc.php
+++ b/html/includes/graphs/graph.inc.php
@@ -1,33 +1,5 @@
[A-Za-z0-9]+)_(?P.+)/', mres($_GET['type']), $graphtype);
$type = $graphtype['type'];
@@ -113,20 +74,17 @@ function graph_error($string)
imagedestroy($im);
exit();
}
-
}
if ($error_msg) {
graph_error($graph_error);
} elseif (!$auth) {
-
if ($width < 200)
{
graph_error("No Auth");
} else {
graph_error("No Authorisation");
}
-
} else {
#$rrd_options .= " HRULE:0#999999";
if ($no_file)
@@ -137,15 +95,21 @@ if ($error_msg) {
} else {
graph_error("Missing RRD Datafile");
}
+ } elseif($command_only) {
+ echo("");
+ echo("
RRDTool Command
");
+ echo("rrdtool graph $graphfile $rrd_options");
+ echo("");
+ $return = rrdtool_graph($graphfile, $rrd_options);
+ echo("
");
+ echo("
RRDTool Output
$return");
+ unlink($graphfile);
+ echo("
");
} else {
if ($rrd_options)
{
-
- #rrdtool_graph($filename, $options)
-
rrdtool_graph($graphfile, $rrd_options);
-
- if ($debug) { echo("".$rrd_cmd."
"); }
+ if ($debug) { echo($rrd_cmd); }
if (is_file($graphfile))
{
if (!$debug)
diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php
index ef114ebf2..6b1ff37f0 100644
--- a/html/pages/graphs.inc.php
+++ b/html/pages/graphs.inc.php
@@ -89,6 +89,17 @@ if (!$auth)
echo(generate_link("Hide Legend",$vars, array('page' => "graphs", 'legend' => "no")));
}
+ echo('');
+
+ if ($vars['showcommand'] == "yes")
+ {
+ echo(generate_link("Hide RRD Command",$vars, array('page' => "graphs", 'showcommand' => NULL)));
+ } else {
+ echo(generate_link("Show RRD Command",$vars, array('page' => "graphs", 'showcommand' => "yes")));
+ }
+
+ echo('
');
+
print_optionbar_end();
echo generate_graph_js_state($graph_array);
@@ -96,6 +107,13 @@ if (!$auth)
echo('');
echo(generate_graph_tag($graph_array));
echo("
");
+
+ if($vars['showcommand'])
+ {
+ $_GET = $graph_array;
+ $command_only = 1;
+ include("includes/graphs/graph.inc.php");
+ }
}
?>
diff --git a/includes/discovery/processors/ios.inc.php b/includes/discovery/processors/ios.inc.php
index d7389290e..0b999c18e 100755
--- a/includes/discovery/processors/ios.inc.php
+++ b/includes/discovery/processors/ios.inc.php
@@ -1,6 +1,6 @@
");
if ($debug) { echo("graph $graph_file $options"); }
echo("
");
- echo "command returned $return_value\n";
+ echo "command returned $return_value ($data)\n";
echo("
");
}
+ return $data;
+ } else {
+ return 0;
}
}
diff --git a/includes/static-config.php b/includes/static-config.php
index 1210384a5..21b94bd83 100644
--- a/includes/static-config.php
+++ b/includes/static-config.php
@@ -162,7 +162,7 @@ $config['os'][$os]['over'][2]['text'] = "Memory Usage";
$config['os'][$os]['icon'] = "cisco";
$os = "acsw";
-$config['os'][$os]['group'] = "cisco";
+#$config['os'][$os]['group'] = "cisco";
$config['os'][$os]['text'] = "Cisco ACE";
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['type'] = "network";
@@ -492,11 +492,11 @@ $os = "powerware";
$config['os'][$os]['text'] = "Powerware UPS";
$config['os'][$os]['type'] = "power";
$config['os'][$os]['icon'] = "eaton";
-$config['os'][$os]['over'][0]['graph'] = "device_voltages";
-$config['os'][$os]['over'][0]['text'] = "Voltages";
+$config['os'][$os]['over'][0]['graph'] = "device_voltage";
+$config['os'][$os]['over'][0]['text'] = "Voltage";
$config['os'][$os]['over'][1]['graph'] = "device_current";
$config['os'][$os]['over'][1]['text'] = "Current";
-$config['os'][$os]['over'][2]['graph'] = "device_frequencies";
+$config['os'][$os]['over'][2]['graph'] = "device_frequency";
$config['os'][$os]['over'][2]['text'] = "Frequencies";
$os = "deltaups";