merge collectd graphs into general graphing system (needs a bit more work to function with "graph browser")

git-svn-id: http://www.observium.org/svn/observer/trunk@2415 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-04 22:16:34 +00:00
parent 697e0d5b09
commit 05ac210d90
2 changed files with 16 additions and 22 deletions

View File

@@ -16,24 +16,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if($_GET['debug']) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
ini_set('allow_url_fopen', 0);
ini_set('error_reporting', E_ALL);
}
include("../includes/defaults.inc.php");
include("../config.php");
include("../includes/functions.php");
include("includes/functions.inc.php");
require('includes/collectd/config.php');
require('includes/collectd/functions.php');
require('includes/collectd/definitions.php');
include("includes/authenticate.inc.php");
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
function makeTextBlock($text, $fontfile, $fontsize, $width) {
// TODO: handle explicit line-break!
@@ -131,7 +116,8 @@ function error400($title, $msg) {
}
// Process input arguments
$host = read_var('host', $_GET, null);
#$host = read_var('host', $_GET, null);
$host = $device['hostname'];
if (is_null($host))
return error400("?/?-?/?", "Missing host name");
else if (!is_string($host))
@@ -139,7 +125,7 @@ else if (!is_string($host))
else if (strlen($host) == 0)
return error400("?/?-?/?", "Host name may not be blank");
$plugin = read_var('plugin', $_GET, null);
$plugin = read_var('c_plugin', $_GET, null);
if (is_null($plugin))
return error400($host.'/?-?/?', "Missing plugin name");
else if (!is_string($plugin))
@@ -147,11 +133,11 @@ else if (!is_string($plugin))
else if (strlen($plugin) == 0)
return error400($host.'/?-?/?', "Plugin name may not be blank");
$pinst = read_var('plugin_instance', $_GET, '');
$pinst = read_var('c_plugin_instance', $_GET, '');
if (!is_string($pinst))
return error400($host.'/'.$plugin.'-?/?', "Plugin instance name must be a string");
$type = read_var('type', $_GET, '');
$type = read_var('c_type', $_GET, '');
if (is_null($type))
return error400($host.'/'.$plugin.(strlen($pinst) ? '-'.$pinst : '').'/?', "Missing type name");
else if (!is_string($type))
@@ -159,7 +145,7 @@ else if (!is_string($type))
else if (strlen($type) == 0)
return error400($host.'/'.$plugin.(strlen($pinst) ? '-'.$pinst : '').'/?', "Type name may not be blank");
$tinst = read_var('type_instance', $_GET, '');
$tinst = read_var('c_type_instance', $_GET, '');
$graph_identifier = $host.'/'.$plugin.(strlen($pinst) ? '-'.$pinst : '').'/'.$type.(strlen($tinst) ? '-'.$tinst : '-*');

View File

@@ -74,8 +74,6 @@ print_optionbar_end();
if ($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); }
foreach ($typeinstances as &$tinst) {
$i++;
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
@@ -89,6 +87,16 @@ print_optionbar_end();
}
echo("</div>");
$graph_array['type'] = "device_collectd";
$graph_array['id'] = $device['device_id'];
$graph_array['c_plugin'] = $_GET['opta'];
$graph_array['c_plugin_instance'] = $instance;
$graph_array['c_type'] = $type;
$graph_array['c_type_instance'] = $tinst;
include("includes/print-quadgraphs.inc.php");
$daily_traffic = "collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=215&height=100";
$daily_traffic .= $args;
$daily_url = "collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=400&height=150";