2008-07-08 Sancho Lerena <slerena@artica.es>
* operation/reporting/graph_viewer.php: Added controls to view in the new combined graphic mode (lines), and to change size to three pre- defined sizes. * reporting/fgraph.php: Stacked mode support was missing by unknown reason. Reactivated. Added a mode to view combined graphs in "wired" mode (lines only). * godmode/agentes/modificar_agente.php: Disabled agents was not shown, so was unable to activate again. Fixed. * godmode/reporting/graph_builder.php: Added support for line mode. Disabled agents don't shown in combo. Some other minor fixes. Changed to show the name of the module, instead of description. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@942 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e46ed7d89b
commit
dae75937fb
|
@ -1,5 +1,20 @@
|
||||||
2008-07-08 Sancho Lerena <slerena@artica.es>
|
2008-07-08 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* operation/reporting/graph_viewer.php: Added controls to view in the
|
||||||
|
new combined graphic mode (lines), and to change size to three pre-
|
||||||
|
defined sizes.
|
||||||
|
|
||||||
|
* reporting/fgraph.php: Stacked mode support was missing by unknown
|
||||||
|
reason. Reactivated. Added a mode to view combined graphs in "wired"
|
||||||
|
mode (lines only).
|
||||||
|
|
||||||
|
* godmode/agentes/modificar_agente.php: Disabled agents was not shown,
|
||||||
|
so was unable to activate again. Fixed.
|
||||||
|
|
||||||
|
* godmode/reporting/graph_builder.php: Added support for line mode.
|
||||||
|
Disabled agents don't shown in combo. Some other minor fixes. Changed
|
||||||
|
to show the name of the module, instead of description.
|
||||||
|
|
||||||
* include/config.php: Deleted. This file should not be included in SVN
|
* include/config.php: Deleted. This file should not be included in SVN
|
||||||
|
|
||||||
* images/so_aix.png: New icon for AIX systems.
|
* images/so_aix.png: New icon for AIX systems.
|
||||||
|
|
|
@ -160,24 +160,24 @@ echo "</td></table>";
|
||||||
if ($search != ""){
|
if ($search != ""){
|
||||||
$search_sql = " AND nombre LIKE '%$search%' ";
|
$search_sql = " AND nombre LIKE '%$search%' ";
|
||||||
} else {
|
} else {
|
||||||
$search_sql = "";
|
$search_sql = " 1 = 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show only selected groups
|
// Show only selected groups
|
||||||
if ($ag_group > 1){
|
if ($ag_group > 1){
|
||||||
$sql1="SELECT * FROM tagente WHERE id_grupo=$ag_group
|
$sql1="SELECT * FROM tagente WHERE id_grupo = $ag_group
|
||||||
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
|
AND $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group
|
||||||
AND disabled = 0 $search_sql ORDER BY nombre";
|
AND $search_sql ORDER BY nombre";
|
||||||
} else {
|
} else {
|
||||||
// Is admin user ??
|
// Is admin user ??
|
||||||
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
|
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
|
||||||
$sql1 = "SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
$sql1 = "SELECT * FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo";
|
||||||
} else {
|
} else {
|
||||||
$sql1="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
|
$sql1="SELECT * FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
|
||||||
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,10 +211,17 @@ if (mysql_num_rows($result)){
|
||||||
}
|
}
|
||||||
if (give_acl($id_user, $id_grupo, "AW")==1){
|
if (give_acl($id_user, $id_grupo, "AW")==1){
|
||||||
// Agent name
|
// Agent name
|
||||||
echo "<tr><td class='$tdcolor'>
|
echo "<tr><td class='$tdcolor'>";
|
||||||
<b><a href='index.php?sec=gagente&
|
if ($row["disabled"] == 1){
|
||||||
|
echo "<i>";
|
||||||
|
}
|
||||||
|
echo "<b><a href='index.php?sec=gagente&
|
||||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||||
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b></td>";
|
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b>";
|
||||||
|
if ($row["disabled"] == 1){
|
||||||
|
echo "<i>";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
|
||||||
echo "<td align='center' class='$tdcolor'>";
|
echo "<td align='center' class='$tdcolor'>";
|
||||||
// Has remote configuration ?
|
// Has remote configuration ?
|
||||||
|
|
|
@ -282,7 +282,7 @@ echo "</b>";
|
||||||
// Show combo with agents
|
// Show combo with agents
|
||||||
echo "<td class='datos' colspan=2>";
|
echo "<td class='datos' colspan=2>";
|
||||||
|
|
||||||
print_select_from_sql ('SELECT id_agente, nombre FROM tagente ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
|
print_select_from_sql ('SELECT id_agente, nombre FROM tagente WHERE disabled = 0 ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
|
||||||
if (isset($chunkdata))
|
if (isset($chunkdata))
|
||||||
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
||||||
|
|
||||||
|
@ -427,15 +427,13 @@ echo "<tr>";
|
||||||
echo "<td class='datos2'>";
|
echo "<td class='datos2'>";
|
||||||
echo "<b>".lang_string ("Stacked")."</b></td>";
|
echo "<b>".lang_string ("Stacked")."</b></td>";
|
||||||
echo "<td class='datos2'>";
|
echo "<td class='datos2'>";
|
||||||
echo "<select name='stacked'>";
|
|
||||||
if ($stacked == 1){
|
|
||||||
echo "<option value=1>Yes</option>";
|
$stackeds[0] = lang_string ('Area');
|
||||||
echo "<option value=0>No</option>";
|
$stackeds[1] = lang_string ('Stacked area');
|
||||||
} else {
|
$stackeds[2] = lang_string ('Line');
|
||||||
echo "<option value=0>No</option>";
|
print_select ($stackeds, 'stacked', $stacked, '', '', 0);
|
||||||
echo "<option value=1>Yes</option>";
|
echo "</td>";
|
||||||
}
|
|
||||||
echo "</select></td>";
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -452,6 +450,8 @@ if ($alerts == 1){
|
||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
echo "</tr></table>";
|
echo "</tr></table>";
|
||||||
echo "<table width='500px'>";
|
echo "<table width='500px'>";
|
||||||
echo "<tr><td align='right'><input type=submit name='update_agent' class='sub upd' value='".$lang_label["add"]."/".$lang_label["redraw"]."'>";
|
echo "<tr><td align='right'><input type=submit name='update_agent' class='sub upd' value='".$lang_label["add"]."/".$lang_label["redraw"]."'>";
|
||||||
|
@ -535,11 +535,7 @@ function agent_changed () {
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#id_module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
$('#id_module').append ($('<option></option>').attr ('value', 0).text ("--"));
|
||||||
jQuery.each (data, function (i, val) {
|
jQuery.each (data, function (i, val) {
|
||||||
if (val['descripcion'] == "") {
|
s = html_entity_decode (val['nombre']);
|
||||||
s = html_entity_decode (val['nombre']);
|
|
||||||
} else {
|
|
||||||
s = html_entity_decode (val['descripcion']);
|
|
||||||
}
|
|
||||||
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
|
||||||
});
|
});
|
||||||
$('#id_module').fadeIn ('normal');
|
$('#id_module').fadeIn ('normal');
|
||||||
|
|
|
@ -58,7 +58,24 @@ if (isset($_GET["view_graph"])){
|
||||||
$id_user = $row["id_user"];
|
$id_user = $row["id_user"];
|
||||||
$private = $row["private"];
|
$private = $row["private"];
|
||||||
$width = $row["width"];
|
$width = $row["width"];
|
||||||
$height = $row["height"];
|
$height = $row["height"];
|
||||||
|
$zoom = (int) get_parameter ('zoom', 0);
|
||||||
|
if ($zoom > 0){
|
||||||
|
switch ($zoom){
|
||||||
|
case 1:
|
||||||
|
$width = 500;
|
||||||
|
$height = 210;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$width = 650;
|
||||||
|
$height = 310;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$width = 770;
|
||||||
|
$height = 400;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$period = (int) get_parameter ('period');
|
$period = (int) get_parameter ('period');
|
||||||
if (! $period)
|
if (! $period)
|
||||||
$period = $row["period"];
|
$period = $row["period"];
|
||||||
|
@ -66,6 +83,10 @@ if (isset($_GET["view_graph"])){
|
||||||
$period = 3600 * $period;
|
$period = 3600 * $period;
|
||||||
$events = $row["events"];
|
$events = $row["events"];
|
||||||
$description = $row["description"];
|
$description = $row["description"];
|
||||||
|
$stacked = (int) get_parameter ('stacked');
|
||||||
|
if (! $stacked)
|
||||||
|
$stacked = $row["stacked"];
|
||||||
|
|
||||||
$name = $row["name"];
|
$name = $row["name"];
|
||||||
if (($row["private"]==1) && ($row["id_user"] != $id_user)){
|
if (($row["private"]==1) && ($row["id_user"] != $id_user)){
|
||||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access to a custom graph not allowed");
|
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access to a custom graph not allowed");
|
||||||
|
@ -91,13 +112,15 @@ if (isset($_GET["view_graph"])){
|
||||||
}
|
}
|
||||||
echo "<h2>".$lang_label["reporting"]." > ";
|
echo "<h2>".$lang_label["reporting"]." > ";
|
||||||
echo $lang_label["combined_image"]."</h2>";
|
echo $lang_label["combined_image"]."</h2>";
|
||||||
echo "<table class='databox_frame'>";
|
echo "<table class='databox_frame' cellpadding=0 cellspacing=0>";
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
echo "<img src='reporting/fgraph.php?tipo=combined&height=$height&width=$width&id=$modules&period=$period&weight_l=$weights' border=1 alt=''>";
|
echo "<img
|
||||||
|
src='reporting/fgraph.php?tipo=combined&height=$height&width=$width&id=$modules&period=$period&weight_l=$weights&stacked=$stacked'
|
||||||
|
border=1 alt=''>";
|
||||||
echo "</td></tr></table>";
|
echo "</td></tr></table>";
|
||||||
$period_label = human_time_description ($period);
|
$period_label = human_time_description ($period);
|
||||||
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'>";
|
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'>";
|
||||||
echo "<table class='databox_frame'>";
|
echo "<table class='databox_frame' cellpadding=4 cellspacing=4>";
|
||||||
echo "<tr><td class='datos'>";
|
echo "<tr><td class='datos'>";
|
||||||
echo "<b>".lang_string ('period')."</b>";
|
echo "<b>".lang_string ('period')."</b>";
|
||||||
echo "<td class='datos'>";
|
echo "<td class='datos'>";
|
||||||
|
@ -114,13 +137,30 @@ if (isset($_GET["view_graph"])){
|
||||||
$periods[4320] = lang_string ('six_months');
|
$periods[4320] = lang_string ('six_months');
|
||||||
print_select ($periods, 'period', intval ($period / 3600), '', '', 0);
|
print_select ($periods, 'period', intval ($period / 3600), '', '', 0);
|
||||||
echo "<td class='datos'>";
|
echo "<td class='datos'>";
|
||||||
|
$stackeds = array ();
|
||||||
|
$stackeds[0] = lang_string ('Area');
|
||||||
|
$stackeds[1] = lang_string ('Stacked area');
|
||||||
|
$stackeds[2] = lang_string ('Line');
|
||||||
|
|
||||||
|
print_select ($stackeds, 'stacked', $stacked , '', '', 0);
|
||||||
|
echo "<td class='datos'>";
|
||||||
|
|
||||||
|
$zooms = array();
|
||||||
|
$zooms[0] = lang_string ('Graph defined');
|
||||||
|
$zooms[1] = lang_string ('Zoom x1');
|
||||||
|
$zooms[2] = lang_string ('Zoom x2');
|
||||||
|
$zooms[3] = lang_string ('Zoom x3');
|
||||||
|
|
||||||
|
print_select ($zooms, 'zoom', $zoom , '', '', 0);
|
||||||
|
echo "<td class='datos'>";
|
||||||
|
|
||||||
echo "<input type=submit value='".$lang_label["update"]."' class='sub upd'>";
|
echo "<input type=submit value='".$lang_label["update"]."' class='sub upd'>";
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "<h2>".$lang_label["reporting"]." > ";
|
echo "<h2>" . lang_string ("reporting") . " > ";
|
||||||
echo $lang_label["custom_graph_viewer"]."</h2>";
|
echo lang_string ("custom_graph_viewer") . "</h2>";
|
||||||
|
|
||||||
$color=1;
|
$color=1;
|
||||||
$sql="SELECT * FROM tgraph";
|
$sql="SELECT * FROM tgraph";
|
||||||
|
|
|
@ -253,7 +253,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
||||||
|
|
||||||
if ($pure == 0){
|
if ($pure == 0){
|
||||||
$Font =& $Graph->addNew('font', $config['fontpath']);
|
$Font =& $Graph->addNew('font', $config['fontpath']);
|
||||||
$Font->setSize(6);
|
$Font->setSize(7);
|
||||||
$Graph->setFont($Font);
|
$Graph->setFont($Font);
|
||||||
$Graph->add(
|
$Graph->add(
|
||||||
Image_Graph::vertical(
|
Image_Graph::vertical(
|
||||||
|
@ -274,7 +274,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
||||||
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
||||||
} else {
|
} else {
|
||||||
$Font =& $Graph->addNew('font', $config['fontpath']);
|
$Font =& $Graph->addNew('font', $config['fontpath']);
|
||||||
$Font->setSize(6);
|
$Font->setSize(7);
|
||||||
$Graph->setFont($Font);
|
$Graph->setFont($Font);
|
||||||
$Graph->add(
|
$Graph->add(
|
||||||
Image_Graph::vertical(
|
Image_Graph::vertical(
|
||||||
|
@ -335,14 +335,40 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
||||||
|
|
||||||
|
|
||||||
// create the 1st plot as smoothed area chart using the 1st dataset
|
// create the 1st plot as smoothed area chart using the 1st dataset
|
||||||
if ($stacked == 0) {
|
if ($stacked == 0) {
|
||||||
// Non-stacked
|
|
||||||
$Plot =& $Plotarea->addNew('area', array(&$dataset));
|
// Non-stacked
|
||||||
} else {
|
$Plot =& $Plotarea->addNew('area', array(&$dataset));
|
||||||
// Stacked (> 2.0)
|
|
||||||
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array(&$dataset, 'stacked'));
|
} elseif ($stacked == 1) {
|
||||||
|
|
||||||
|
// Stacked (> 2.0)
|
||||||
|
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array(&$dataset, 'stacked'));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$color_array[0] = "red";
|
||||||
|
$color_array[1] = "blue";
|
||||||
|
$color_array[2] = "green";
|
||||||
|
$color_array[3] = 'yellow'; // yellow
|
||||||
|
$color_array[4] = '#FF5FDF'; // pink
|
||||||
|
$color_array[5] = 'orange'; // orange
|
||||||
|
$color_array[6] = '#FE00DA'; // magenta
|
||||||
|
$color_array[7] = '#00E2FF'; // cyan
|
||||||
|
$color_array[8] = '#000000'; // Black
|
||||||
|
|
||||||
|
// Single lines, new in 2.0 (Jul08)
|
||||||
|
for ($i = 0; $i < $module_number; $i++){
|
||||||
|
$Plot =& $Plotarea->addNew('line', array(&$dataset[$i]));
|
||||||
|
$Plot->setLineColor($color_array[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Color management
|
||||||
|
if ($stacked != 2){
|
||||||
|
$Plot->setLineColor('gray@0.4');
|
||||||
}
|
}
|
||||||
$Plot->setLineColor('gray@0.4');
|
|
||||||
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
|
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
|
||||||
// $AxisX->Hide();
|
// $AxisX->Hide();
|
||||||
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
|
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
|
||||||
|
|
Loading…
Reference in New Issue