2009-03-25 Evi Vanoost <vanooste@rcbi.rochester.edu>

* include/functions_db.php: Made get_server_info more informational
	
	* operation/servers/view_server.php: Uses new get_server_info layout
	
	* operation/agentes/tactical.php: Use print_table and get_server_info
	
	* operation/menu.php: Removed incident search
	
	* operation/incidents/incident_search.php: Removed - now sits in incident
	
	* operation/incidents/incident.php: Added more search capabilities
	
	* operation/visual_console/index.php: Relative width and alignment
	
	* operation/visual_console/render_view.php: Small fixes

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1564 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-03-25 18:43:30 +00:00
parent 25d37e260f
commit 02161a60d8
9 changed files with 146 additions and 193 deletions

View File

@ -1,3 +1,21 @@
2009-03-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_db.php: Made get_server_info more informational
* operation/servers/view_server.php: Uses new get_server_info layout
* operation/agentes/tactical.php: Use print_table and get_server_info
* operation/menu.php: Removed incident search
* operation/incidents/incident_search.php: Removed - now sits in incident
* operation/incidents/incident.php: Added more search capabilities
* operation/visual_console/index.php: Relative width and alignment
* operation/visual_console/render_view.php: Small fixes
2009-03-25 Sancho Lerena <slerena@artica.es>
* extras/pandoradb_migrate_v2.x_to_v3.0.sql: Added field missing in

View File

@ -2628,32 +2628,51 @@ function get_server_info ($id_server = -1) {
$return = array ();
foreach ($result as $server) {
if ($server["network_server"] == 1) {
if ($server['network_server'] == 1) {
$server["img"] = print_image ("images/network.png", true, array ("title" => __('Network Server')));
$server["type"] = "network";
$id_modulo = 2;
} elseif ($server["data_server"] == 1) {
} elseif ($server['data_server'] == 1) {
$server["img"] = print_image ("images/data.png", true, array ("title" => __('Data Server')));
$server["type"] = "data";
$id_modulo = 1;
} elseif ($server["plugin_server"] == 1) {
$server["type"] = "plugin";
$id_modulo = 4;
} elseif ($server["wmi_server"] == 1) {
$server["type"] = "wmi";
$id_modulo = 6;
} elseif ($server["recon_server"] == 1) {
$server["type"] = "recon";
$id_modulo = 0;
} elseif ($server["snmp_server"] == 1) {
} elseif ($server['snmp_server'] == 1) {
$server["img"] = print_image ("images/snmp.png", true, array ("title" => __('SNMP Server')));
$server["type"] = "snmp";
$id_modulo = 0;
} elseif ($server["prediction_server"] == 1) {
} elseif ($server['recon_server'] == 1) {
$server["img"] = print_image ("images/recon.png", true, array ("title" => __('Recon Server')));
$server["type"] = "recon";
$id_modulo = 0;
} elseif ($server['export_server'] == 1) {
$server["img"] = print_image ("images/database_refresh.png", true, array ("title" => __('Export Server')));
$server["type"] = "export";
$id_modulo = 0;
} elseif ($server['wmi_server'] == 1) {
$server["img"] = print_image ("images/wmi.png", true, array ("title" => __('WMI Server')));
$server["type"] = "wmi";
$id_modulo = 6;
} elseif ($server['prediction_server'] == 1) {
$server["img"] = print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server')));
$server["type"] = "prediction";
$id_modulo = 5;
} elseif ($server['plugin_server'] == 1) {
$server["img"] = print_image ("images/plugin.png", true, array ("title" => __('Plugin Server')));
$server["type"] = "plugin";
$id_modulo = 4;
} else {
$server["img"] = '';
$server["type"] = "unknown";
$id_modulo = 0;
}
if ($server['master'] == 1) {
$server["img"] .= print_image ("images/master.png", true, array ("title" => __('Master Server')));
}
if ($server['checksum'] == 1){
$server["img"] .= print_image ("images/binary.png", true, array ("title" => __('MD5 Check')));
}
if (empty ($modules_info[$server["id_server"]])) {
$server["modules"] = 0;
} else {
@ -2686,25 +2705,30 @@ function get_server_info ($id_server = -1) {
if (!empty ($result["module_lag"])) {
$server["module_lag"] = $result["module_lag"];
}
$server["load"] = round ($server["modules"] / $server["modules_total"] * 100);
} else {
switch ($server["type"]) {
case "recon":
$server["name"] = '<a href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server_detail&amp;server_id='.$server["id_server"].'">'.$server["name"].'</a>';
//Get recon taks info
$tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
if (empty ($tasks)) {
$tasks = array ();
}
//Jobs running on this recon server
//Total jobs running on this recon server
$server["modules"] = count ($tasks);
//Total recon jobs (all servers)
$server["modules_total"] = $recon_total;
$server["load"] = round ($server["modules"] / $server["modules_total"] * 100);
//Lag (take average active time of all active tasks)
$server["module_lag"] = 0;
$lags = array ();
foreach ($tasks as $task) {
if ($task["status"] > 0 && $task["status"] <= 100) {
$lags[] = $time - $task["utimestamp"];
//Module lag is actually the number of jobs that is currently running
$server["module_lag"]++;
}
}
if (count ($lags) > 0) {
@ -2715,6 +2739,10 @@ function get_server_info ($id_server = -1) {
break;
}
}
$server["lag_txt"] = ($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"];
if ($server["modules_total"] > 0) {
$server["load"] = round ($server["modules"] / $server["modules_total"] * 100);
}
//Push the raw data on the return stack
$return[$server["id_server"]] = $server;

View File

@ -155,60 +155,56 @@ echo '<div style="width: 570px; float:left;" id="rightcolumn">';
// Server information
$serverinfo = get_server_info ();
$total_modules = get_agent_modules_count ();
$cells = array ();
if ($serverinfo) {
echo '<table class="databox" cellpadding="4" cellspacing="4" style="width:100%;">';
echo '<thead>
<tr>
<th colspan="4" style="background-color:#799E48">'.__('Tactical server information').'</th>
</tr>';
echo '<tr>
<th style="font-weight:none;">'.__('Name').'</th>
<th style="font-weight:none;">'.__('Status').'</th>
<th style="font-weight:none;">'.__('Load').'</th>
<th style="font-weight:none;">'.__('Lag').print_help_icon ("serverlag", true).'</th>
</tr></thead><tbody>';
foreach ($serverinfo as $server_id => $server_info) {
$data = array ();
$data[0] = $server_info["name"];
if ($server_info["status"] == 0){
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
$data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20));
}
if ($server_info["modules"] > 0 && $total_modules > 0) {
$percent = $server_info["modules"] / ($total_modules / 100);
} else {
$percent = 0;
}
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$percent."&height=20&width=80",
true, array ("title" => $server_info["modules"]." ".__('of')." ".$total_modules));
$data[3] = $server_info["lag"]." / ".$server_info["module_lag"];
array_push ($cells, $data);
}
foreach ($cells as $key => $row) {
//Switch class around
$class = (($key % 2) ? "datos2" : "datos");
echo '<tr>
<td class="'.$class.'">'.$row[0].'</td>
<td class="'.$class.'" style="text-align:center;">'.$row[1].'</td>
<td class="'.$class.'" style="text-align:center;">'.$row[2].'</td>
<td class="'.$class.'" style="text-align:right;">'.$row[3].'</td>
</tr>';
}
echo '</tbody></table>';
} else {
echo '<div class="nf">'.__('There are no servers configured into the database').'</div>';
if ($serverinfo === false) {
$serverinfo = array ();
}
$table->class = "databox";
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = "100%";
$table->title = __('Tactical server information');
$table->titlestyle = "background-color:#799E48;";
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Status');
$table->head[2] = __('Load');
$table->head[3] = __('Lag').' '.print_help_icon ("serverlag", true);
$table->align[1] = 'center';
$table->align[2] = 'center';
$table->align[3] = 'right';
$table->data = array ();
foreach ($serverinfo as $server) {
$data = array ();
$data[0] = $server["name"];
if ($server["status"] == 0){
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
$data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20));
}
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80",
true, array ("title" => $server["lag_txt"]));
$data[3] = $server["lag_txt"];
array_push ($table->data, $data);
}
if (!empty ($table->data)) {
print_table ($table);
} else {
echo '<div class="nf">'.__('There are no servers configured in the database').'</div>';
}
unset ($table);
print_events_table ("", 10, 570);
echo '</div>';

View File

@ -128,15 +128,15 @@ if ($texto != "")
$filter .= sprintf (" AND (titulo LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $texto, $texto);
$usuario = (string) get_parameter ("usuario", "All");
if ($usuario != "All")
if ($usuario != "")
$filter .= sprintf (" AND id_usuario = '%s'", $usuario);
$estado = (int) get_parameter ("estado", -1);
if ($estado != -1) //-1 = All
if ($estado > 0) //-1 = All
$filter .= sprintf (" AND estado = %d", $estado);
$grupo = (int) get_parameter ("grupo", 1);
if ($grupo != 1) {
if ($grupo > 1) {
$filter .= sprintf (" AND id_grupo = %d", $grupo);
if (give_acl ($config['id_user'], $grupo, "IM") == 0) {
audit_db ($config["id_user"],$config["remote_addr"],"ACL Forbidden","User tried to read incidents from group without access");
@ -172,21 +172,19 @@ echo '<h2>'.__('Incident management').' &gt; '.__('Manage incidents').'</h2>
<td valign="middle"><h3>'.__('Filter').'</h3>';
$fields = get_incidents_status ();
$fields[-1] = __('All incidents');
print_select ($fields, "estado", $estado, 'javascript:this.form.submit();', '', '', false, false, false, 'w155');
print_select ($fields, "estado", $estado, 'javascript:this.form.submit();', __('All incidents'), -1, false, false, false, 'w155');
//Legend
echo '</td><td valign="middle"><noscript>';
print_submit_button (__('Show'), 'submit-estado', false, array ("class" => "sub"));
echo '</noscript></td><td rowspan="5" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Status').'</h3>';
echo '</noscript></td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Status').'</h3>';
foreach (get_incidents_status () as $id => $str) {
print_incidents_status_img ($id);
echo ' - ' . $str . '<br />';
}
echo '</td><td rowspan="5" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Priority').'</h3>';
echo '</td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Priority').'</h3>';
foreach (get_incidents_priorities () as $id => $str) {
print_incidents_priority_img ($id);
echo ' - ' . $str . '<br />';
@ -195,25 +193,25 @@ foreach (get_incidents_priorities () as $id => $str) {
echo '</td></tr><tr><td>';
$fields = get_incidents_priorities ();
$fields[-1] = __('All priorities');
print_select ($fields, "prioridad", $prioridad, 'javascript:this.form.submit();', '','',false,false,false,'w155');
print_select ($fields, "prioridad", $prioridad, 'javascript:this.form.submit();', __('All priorities'), -1,false,false,false,'w155');
echo '</td><td valign="middle"><noscript>';
print_submit_button (__('Show'), 'submit-prioridad', false, array ("class" => "sub"));
echo '</noscript></td></tr><tr><td>';
echo '</td></tr><tr><td>';
print_select ($groups, "grupo", $grupo, 'javascript:this.form.submit();','','',false,false,false,'w155');
print_select (get_users_info (), "usuario", $usuario, 'javascript:this.form.submit();', __('All users'), "", false, false, false, "w155");
echo '</td><td valign="middle"><noscript>';
print_submit_button (__('Show'), 'submit-grupo', false, array ("class" => "sub"));
echo '</noscript>';
echo '</td></tr><tr><td>';
print_select ($groups, "grupo", $grupo, 'javascript:this.form.submit();', '', '',false,false,false,'w155');
// Pass search parameters for possible future filter searching by user
print_input_hidden ("usuario", $usuario);
print_input_hidden ("texto", $texto);
echo '</td></tr><tr><td>';
echo "</td></tr></table></form>";
print_input_text ('texto', $texto, '', 45);
echo '&nbsp;';
print_input_image ("submit", "images/zoom.png", __('Search'), 'padding:0;', false, array ("alt" => __('Search')));
echo "</td></tr></table>";
echo '</form>';
if ($count < 1) {
echo '<div class="nf">'.__('No incidents match your search filter').'</div><br />';
@ -240,7 +238,7 @@ if ($count < 1) {
echo '<br />';
// Show headers
$table->width = 750;
$table->width = "100%";
$table->class = "databox";
$table->cellpadding = 4;
$table->cellspacing = 4;

View File

@ -1,51 +0,0 @@
<?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 General Public License
// 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.
// Load global vars
require_once ("include/config.php");
check_login ();
if (give_acl ($config['id_user'], 0, "IR") != 1) {
audit_db($config['id_user'],$config["remote_addr"], "ACL Violation","Trying to access incident search");
require ("general/noaccess.php");
exit;
}
echo "<h2>".__('Incident management')." &gt; ".__('Please select a search criterion')."</h2>";
echo '<div style="width:650px;"><div style="float:right;"><img src="images/pulpo_lupa.png" class="bot" align="left"></div>
<div style="float:left;"><form name="busqueda" method="post" action="index.php?sec=incidencias&sec2=operation/incidents/incident">
<table width="500px" cellpadding="4" cellspacing="4" class="databox">
<tr><td class="datos">'.__('Created by:').'</td><td class="datos">';
print_select (get_users_info (), "usuario", "All", '', __('All'), "All", false, false, false, "w120");
echo '</td></tr><tr><td class="datos2">'.__('Search text').': (*)</td>
<td class="datos2">';
print_input_text ('texto', '', '', 45);
echo '</td></tr><tr>
<td class="datos" colspan="2"><i>'.__('(*) The text search will look for all words entered as a substring in the title and description of each incident').'
</i></td></tr><tr><td align="right" colspan="2">';
print_submit_button (__('Search'), 'uptbutton', false, 'class="sub search"');
echo '</td></tr></table></form></div></div>';
?>

View File

@ -102,9 +102,7 @@ if (give_acl ($config['id_user'], 0, "IR") == 1) {
$menu["incidencias"]["refr"] = 60;
$menu["incidencias"]["id"] = "oper-incidents";
$sub = array ();
$sub["operation/incidents/incident_search"]["text"] = __('Search incidents');
$sub = array ();
$sub["operation/incidents/incident_statistics"]["text"] = __('Statistics');
$menu["incidencias"]["sub"] = $sub;

View File

@ -62,12 +62,8 @@ $table->data = array ();
foreach ($servers as $server) {
$data = array ();
if ($server["recon_server"] == 1) {
$data[0] = '<b><a href="index.php?sec=estado_server&amp;sec2=operation/servers/view_server_detail&amp;server_id='.$server["id_server"].'">'.$server["name"].'</a></b>';
} else {
$data[0] = "<b>".$server['name']."</b>";
}
$data[0] = "<b>".$server['name']."</b>";
if ($server['status'] == 0) {
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
@ -75,41 +71,10 @@ foreach ($servers as $server) {
}
// Load
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true);
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", true, array ("title" => $server["lag_txt"]));
$data[3] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
$data[4] = '<span style="white-space:nowrap;">'.($server["lag"] == 0 ? '-' : human_time_description_raw ($server["lag"])) . " / ". $server["module_lag"].'</span>';
$data[5] = '<span style="white-space:nowrap;">';
if ($server['network_server'] == 1) {
$data[5] .= print_image ("images/network.png", true, array ("title" => __('Network Server')));
}
if ($server['data_server'] == 1) {
$data[5] .= print_image ("images/data.png", true, array ("title" => __('Data Server')));
}
if ($server['snmp_server'] == 1) {
$data[5] .= print_image ("images/snmp.png", true, array ("title" => __('SNMP Server')));
}
if ($server['recon_server'] == 1) {
$data[5] .= print_image ("images/recon.png", true, array ("title" => __('Recon Server')));
}
if ($server['export_server'] == 1) {
$data[5] .= print_image ("images/database_refresh.png", true, array ("title" => __('Export Server')));
}
if ($server['wmi_server'] == 1) {
$data[5] .= print_image ("images/wmi.png", true, array ("title" => __('WMI Server')));
}
if ($server['prediction_server'] == 1) {
$data[5] .= print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server')));
}
if ($server['plugin_server'] == 1) {
$data[5] .= print_image ("images/plugin.png", true, array ("title" => __('Plugin Server')));
}
if ($server['master'] == 1) {
$data[5] .= print_image ("images/master.png", true, array ("title" => __('Master Server')));
}
if ($server['checksum'] == 1){
$data[5] .= print_image ("images/binary.png", true, array ("title" => __('MD5 Check')));
}
$data[5] .= '</span>';
$data[4] = '<span style="white-space:nowrap;">'.$server["lag_txt"].'</span>';
$data[5] = '<span style="white-space:nowrap;">'.$server["img"].'</span>';
$data[6] = $server['version'];
$data[7] = print_timestamp ($server['keepalive'], true);

View File

@ -24,13 +24,14 @@ echo "<h2>".__('Visual console')." &gt; ".__('Summary')."</h2>";
require_once ('include/functions_visual_map.php');
$layouts = get_user_layouts ();
$table->width = 500;
$table->width = "70%";
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Group');
$table->head[2] = __('Elements');
$table->align = array ();
$table->align[1] = 'center';
$table->align[2] = 'center';
foreach ($layouts as $layout) {

View File

@ -67,20 +67,20 @@ if ($config["pure"] == 0) {
}
if (give_acl ($config["id_user"], $id_group, "AW"))
echo "<a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout=$id_layout'><img src='images/setup.png' title='".__("Setup")."'></a>";
echo '<a href="index.php?sec=greporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$id_layout.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
echo '</h1>';
print_pandora_visual_map ($id_layout);
$values = array ();
$values[5] = "5 ". __('seconds');
$values[30] = "30 ". __('seconds');
$values[60] = "1 ". __('minutes');
$values[120] = "2 ". __('minutes');
$values[300] = "5 ". __('minutes');
$values[600] = "10 ". __('minutes');
$values[1800] = "30 ". __('minutes');
$values[5] = human_time_description_raw (5);
$values[30] = human_time_description_raw (30);
$values[60] = human_time_description_raw (60);
$values[120] = human_time_description_raw (120);
$values[300] = human_time_description_raw (300);
$values[600] = human_time_description_raw (600);
$values[1800] = human_time_description_raw (1800);
$table->width = 500;
$table->data = array ();