2008-12-24 Raul Mateos <raulofpandora@gmail.com>
* index.php: Updated build, again due to the use of the new custom ID. * reporting/fgraph2.php: Test for ezcomponents. * operation/events/event_statistics.php: Use of fgraph2 if test var is set in the URL. It uses ezComponents, that need to be installed. This shows a 3D chart. Probably not will be used, but it's an idea about how to improve graphs in pandora. To test, just add &test to the event_statistics URL. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1308 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
53c93edf64
commit
c463b65c29
|
@ -1,3 +1,15 @@
|
|||
2008-12-24 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* index.php: Updated build, again due to the use of the new custom ID.
|
||||
|
||||
* reporting/fgraph2.php: New file, test for ezcomponents.
|
||||
|
||||
* operation/events/event_statistics.php: Use of fgraph2 if test var is
|
||||
set in the URL. It uses ezComponents, that need to be installed.
|
||||
This shows a 3D chart. Probably not will be used, but it's an idea
|
||||
about how to improve graphs in pandora. To test, just add &test to the
|
||||
event_statistics URL.
|
||||
|
||||
2008-12-23 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* index.php: Cleaned up some old stuff and fixed the order of GET/POST
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
|
||||
// Pandora FMS uses Pear Image::Graph code
|
||||
|
||||
$build_version="PC081221";
|
||||
$build_version="PC081224";
|
||||
$pandora_version="v2.1-dev";
|
||||
global $build_version;
|
||||
global $pandora_version;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
|
@ -36,11 +35,18 @@ echo "<table width=95%>";
|
|||
echo "<tr><td valign='top'>";
|
||||
echo "<h3>".__('Event graph')."</h3>";
|
||||
echo '<img src="reporting/fgraph.php?tipo=total_events&width=300&height=200" border=0>';
|
||||
echo "<td valign='top'>";
|
||||
echo "</td><td valign='top'>";
|
||||
echo "<h3>".__('Event graph by user')."</h3>";
|
||||
echo '<img src="reporting/fgraph.php?tipo=user_events&width=300&height=200" border=0>';
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
if (isset($_GET["test"])){
|
||||
echo "<h3>".__('Event graph by group')."</h3>";
|
||||
echo '<img src="reporting/fgraph2.php?tipo=group_events&width=300&height=200" border=0>';
|
||||
echo "</td><td>";
|
||||
}
|
||||
echo "<h3>".__('Event graph by group')."</h3>";
|
||||
echo '<img src="reporting/fgraph.php?tipo=group_events&width=300&height=200" border=0>';
|
||||
echo '</td></tr>';
|
||||
echo "</table>";
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License (LGPL)
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require_once ('../include/config.php');
|
||||
require_once ($config["homedir"].'/include/functions.php');
|
||||
require_once ($config["homedir"].'/include/functions_db.php');
|
||||
require 'ezc/Base/ezc_bootstrap.php';
|
||||
|
||||
class customPalette extends ezcGraphPalette
|
||||
{
|
||||
protected $dataSetColor = array(
|
||||
'#8866ff',
|
||||
'#a613ca',
|
||||
'#b923da',
|
||||
'#dd33cf',
|
||||
'#66aaff',
|
||||
'#54a6aa',
|
||||
'#d3474a',
|
||||
'#ff9900',
|
||||
'#49aa00',
|
||||
'#55bb34',
|
||||
'#119900',
|
||||
'#b3474a',
|
||||
'#ffbb99',
|
||||
'#cf9930',
|
||||
'#c5bb34',
|
||||
'#ecd9df',
|
||||
'#dd1f4a',
|
||||
);
|
||||
protected $dataSetSymbol = array(
|
||||
ezcGraph::BULLET,
|
||||
);
|
||||
protected $fontName = '';
|
||||
protected $fontColor = '#000000';
|
||||
}
|
||||
|
||||
if ($_GET["tipo"]= "group_events") {
|
||||
grafico_eventos_grupo();
|
||||
}
|
||||
|
||||
function grafico_eventos_grupo () {
|
||||
global $config;
|
||||
$data = array();
|
||||
$legend = array();
|
||||
//This will give the distinct id_agente, give the id_grupo that goes
|
||||
//with it and then the number of times it occured. GROUP BY statement
|
||||
//is required if both DISTINCT() and COUNT() are in the statement
|
||||
$sql = "SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count FROM tevento WHERE 1=1 GROUP BY id_agente ORDER BY count DESC";
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data[] = $row["count"];
|
||||
if ($row["id_agente"] == 0) {
|
||||
//System event
|
||||
$legend[] = "SYSTEM";
|
||||
} else {
|
||||
//Other events
|
||||
$legend[] = substr (get_agent_name ($row["id_agente"], "lower"), 0, 15);
|
||||
}
|
||||
$comb = array_combine ($legend, $data);
|
||||
}
|
||||
|
||||
$max_items = 6; //Maximum items on the piegraph
|
||||
while (count($data) > $max_items) {
|
||||
//Pops an element off the array until the array is small enough
|
||||
array_pop ($data);
|
||||
}
|
||||
$chart = new ezcGraphPieChart();
|
||||
$chart->renderer = new ezcGraphRenderer3d();
|
||||
$chart->driver = new ezcGraphGdDriver();
|
||||
$chart->palette = new customPalette();
|
||||
$chart->options->label = '%2$d (%3$.1f%%) ';
|
||||
$chart->legend->landscapeSize = .05;
|
||||
$chart->options->font = 'FreeSans.ttf';
|
||||
$chart->options->percentThreshold = 0.01;
|
||||
$chart->legend = true;
|
||||
$chart->legend->position = ezcGraph::RIGHT;
|
||||
$chart->data['datos'] = new ezcGraphArrayDataSet($comb);
|
||||
$chart->data['datos']->highlight = true;
|
||||
$chart->data['datos']->highlight['SYSTEM'] = false;
|
||||
$chart->renderToOutput( 300, 200 );
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue