2008-12-03 Raul Mateos <raulofpandora@gmail.com>

* include/functions_db.php: Now if no event, table shows "no event" text.
	Cosmetic table header change.
	* operation/agentes/tactical.php: Solve warning if no servers defined.
	Cosmetic table header change.
	* operation/events/events.php: Change "error" class to "not found" class.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1280 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
raulmateos 2008-12-03 12:41:09 +00:00
parent 6cd25af0f7
commit 9c35f1d841
4 changed files with 142 additions and 109 deletions

View File

@ -1,3 +1,13 @@
2008-12-03 Raul Mateos <raulofpandora@gmail.com>
* include/functions_db.php: Now if no event, table shows "no event" text.
Cosmetic table header change.
* operation/agentes/tactical.php: Solve warning if no servers defined.
Cosmetic table header change.
* operation/events/events.php: Change "error" class to "not found" class.
2008-12-02 Jorge Gonzalez <jorgegonz@artica.es> 2008-12-02 Jorge Gonzalez <jorgegonz@artica.es>
* include/languages/index.pot: Updated Spanish translation. * include/languages/index.pot: Updated Spanish translation.

View File

@ -2125,11 +2125,18 @@ function show_alert_row_mini ($id_combined_alert) {
*/ */
function smal_event_table ($filter = "", $limit = 10, $width = 440) { function smal_event_table ($filter = "", $limit = 10, $width = 440) {
global $config; global $config;
$sql = sprintf ("SELECT * FROM tevento %s
ORDER BY timestamp DESC LIMIT %d",
$filter, $limit);
$result = get_db_all_rows_sql ($sql);
$sql = sprintf ("SELECT * FROM tevento %s ORDER BY timestamp DESC LIMIT %d",$filter,$limit); if ($result === false) {
$result = array ();
echo '<div class="nf">'.__('No events').'</div>';
} else {
echo "<table cellpadding='4' cellspacing='4' width='$width' border=0 class='databox'>"; echo "<table cellpadding='4' cellspacing='4' width='$width' border=0 class='databox'>";
echo "<tr>"; echo "<tr>";
echo "<th colspan=6>".__('Latest events')."</th>"; echo "<th colspan='6' style='background-color:#799E48'>".__('Latest events')."</th>";
echo "<tr>"; echo "<tr>";
echo "<th class='datos3 f9'>".__('St')."</th>"; echo "<th class='datos3 f9'>".__('St')."</th>";
echo "<th class='datos3 f9'>".__('Type')."</th>"; echo "<th class='datos3 f9'>".__('Type')."</th>";
@ -2137,9 +2144,7 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
echo "<th class='datos3 f9'>".__('Agent name')."</th>"; echo "<th class='datos3 f9'>".__('Agent name')."</th>";
echo "<th class='datos3 f9'>".__('User ID')."</th>"; echo "<th class='datos3 f9'>".__('User ID')."</th>";
echo "<th class='datos3 f9'>".__('Timestamp')."</th>"; echo "<th class='datos3 f9'>".__('Timestamp')."</th>";
$result = get_db_all_rows_sql ($sql);
if($result === false)
$result = array();
foreach ($result as $event) { foreach ($result as $event) {
$id_grupo = $event["id_grupo"]; $id_grupo = $event["id_grupo"];
if (! give_acl ($config["id_user"], $id_grupo, "AR")) { if (! give_acl ($config["id_user"], $id_grupo, "AR")) {
@ -2150,12 +2155,14 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
$tdclass = get_priority_class ($event["criticity"]); $tdclass = get_priority_class ($event["criticity"]);
$criticity_label = get_priority_name ($event["criticity"]); $criticity_label = get_priority_name ($event["criticity"]);
/* Colored box */ /* Colored box */
echo "<tr><td class='$tdclass' title='$criticity_label' align='center'>"; echo "<tr>";
echo "<td class='$tdclass' title='$criticity_label' align='center'>";
if ($event["estado"] == 0) { if ($event["estado"] == 0) {
echo "<img src='images/pixel_red.png' width=20 height=20>"; echo "<img src='images/pixel_red.png' width=20 height=20>";
} else { } else {
echo "<img src='images/pixel_green.png' width=20 height=20>"; echo "<img src='images/pixel_green.png' width=20 height=20>";
} }
echo "</td>";
/* Event type */ /* Event type */
echo "<td class='".$tdclass."' title='".$event["event_type"]."'>"; echo "<td class='".$tdclass."' title='".$event["event_type"]."'>";
switch ($event["event_type"]) { switch ($event["event_type"]) {
@ -2184,13 +2191,14 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
echo "<img src='images/network.png'>"; echo "<img src='images/network.png'>";
break; break;
} }
echo "</td>";
// Event description // Event description
echo "<td class='".$tdclass."f9' title='".$event["evento"]."'>"; echo "<td class='".$tdclass."f9' title='".$event["evento"]."'>";
echo substr ($event["evento"],0,45); echo substr ($event["evento"],0,45);
if (strlen ($event["evento"]) > 45) { if (strlen ($event["evento"]) > 45) {
echo ".."; echo "..";
} }
echo "</td>";
if ($event["id_agente"] > 0) { if ($event["id_agente"] > 0) {
// Agent name // Agent name
$agent_name = dame_nombre_agente ($event["id_agente"]); $agent_name = dame_nombre_agente ($event["id_agente"]);
@ -2199,13 +2207,14 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
if (strlen ($agent_name) > 14) if (strlen ($agent_name) > 14)
echo ".."; echo "..";
echo "</b></a>"; echo "</b></a>";
echo "</td>";
// for System or SNMP generated alerts // for System or SNMP generated alerts
} else { } else {
if ($event["event_type"] == "system") { if ($event["event_type"] == "system") {
echo "<td class='$tdclass'>".__('System'); echo "<td class='$tdclass'>".__('System')."</td>";
} else { } else {
echo "<td class='$tdclass'>".__('Alert')."SNMP"; echo "<td class='$tdclass'>".__('Alert')."SNMP</td>";
} }
} }
@ -2214,11 +2223,15 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
if ($event["estado"] != 0) { if ($event["estado"] != 0) {
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$event["id_usuario"]."'>".substr ($event["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real ($event["id_usuario"])."</span></a></a>"; echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$event["id_usuario"]."'>".substr ($event["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real ($event["id_usuario"])."</span></a></a>";
} }
echo "</td>";
// Timestamp // Timestamp
echo "<td class='".$tdclass."f9' title='".$event["timestamp"]."'>"; echo "<td class='".$tdclass."f9' title='".$event["timestamp"]."'>";
echo human_time_comparation ($event["timestamp"]); echo human_time_comparation ($event["timestamp"]);
echo "</td>";
echo "</tr>";
} }
echo "</table>"; echo "</table>";
}
} }

View File

@ -1,14 +1,14 @@
<?php <?php
// Pandora FMS - The Flexible Monitoring System // Pandora FMS - the Flexible Monitoring System
// ============================================ // ============================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com // Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas, info@artica.es // Please see http://pandora.sourceforge.net for full contribution list
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU Lesser General Public License (LGPL)
// as published by the Free Software Foundation; either version 2 // as published by the Free Software Foundation for version 2.
// of the License, or (at your option) any later version. //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -203,15 +203,25 @@ echo '<div style="width: 450px; float:left;" id="rightcolumn">';
// Server information // Server information
echo '<table class="databox" cellpadding="4" cellspacing="4" style="width:100%;">';
echo '<thead><tr><th colspan="4">'.__('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').pandora_help ("serverlag", true).'</th></tr></thead><tbody>';
$serverinfo = get_server_info (); $serverinfo = get_server_info ();
$total_modules = get_agentmodule_count (); $total_modules = get_agentmodule_count ();
$cells = array (); $cells = array ();
foreach ($serverinfo as $server_id => $server_info) { 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').pandora_help ("serverlag", true).'</th>
</tr></thead><tbody>';
foreach ($serverinfo as $server_id => $server_info) {
$data = array (); $data = array ();
$data[0] = $server_info["name"]; $data[0] = $server_info["name"];
@ -232,9 +242,9 @@ foreach ($serverinfo as $server_id => $server_info) {
$data[3] = $server_info["lag"]." / ".$server_info["module_lag"]; $data[3] = $server_info["lag"]." / ".$server_info["module_lag"];
array_push ($cells, $data); array_push ($cells, $data);
} }
foreach ($cells as $key => $row) { foreach ($cells as $key => $row) {
//Switch class around //Switch class around
$class = (($key % 2) ? "datos2" : "datos"); $class = (($key % 2) ? "datos2" : "datos");
echo '<tr> echo '<tr>
@ -243,9 +253,9 @@ foreach ($cells as $key => $row) {
<td class="'.$class.'" style="text-align:center;">'.$row[2].'</td> <td class="'.$class.'" style="text-align:center;">'.$row[2].'</td>
<td class="'.$class.'" style="text-align:right;">'.$row[3].'</td> <td class="'.$class.'" style="text-align:right;">'.$row[3].'</td>
</tr>'; </tr>';
}
echo '</tbody></table>';
} }
echo '</tbody></table>';
smal_event_table ("", 10, 450); smal_event_table ("", 10, 450);
echo '</div>'; echo '</div>';

View File

@ -388,7 +388,7 @@ if (!empty ($table->data)) {
} }
echo '</div></form>'; echo '</div></form>';
} else { } else {
echo '<div class="error">'.__('No events').'</div>'; echo '<div class="nf">'.__('No events').'</div>';
} }
unset ($table); unset ($table);