pandorafms/pandora_console/operation/agentes/estado_monitores.php

124 lines
5.1 KiB
PHP
Raw Normal View History

<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas S.L, info@artica.es
// Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com
// 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; either version 2
// of the License, or (at your option) any later version.
// 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 globar vars
require("include/config.php");
if (comprueba_login() == 0) {
// $id_agente can be obtained as global variable or GET param.
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
}
// Get all module from agent
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre';
$result_t=mysql_query($sql_t);
if (mysql_num_rows ($result_t)) {
echo "<h3>".$lang_label["monitor_listing"]."</h3>";
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
echo "<tr><th>X</th>";
echo "<th>".$lang_label["type"]."</th>
<th>".$lang_label["module_name"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["interval"]."</th>
<th>".$lang_label["last_contact"]."</th>";
$color=0;
while ($row_t=mysql_fetch_array($result_t)){
# For evey module in the status table
$est_modulo = substr($row_t["nombre"],0,25);
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
$est_description = $row_t["descripcion"];
$est_timestamp = $row_t["timestamp"];
$est_estado = $row_t["estado"];
$est_datos = $row_t["datos"];
$est_cambio = $row_t["cambio"];
$est_interval = $row_t["module_interval"];
if (($est_interval != $intervalo) && ($est_interval > 0)) {
$temp_interval = $est_interval;
} else {
$temp_interval = $intervalo;
}
if ($est_estado <>100){ # si no es un modulo de tipo datos
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
2007-03-28 Sancho Lerena <slerena@artica.es> * tip.css, pandora.css: Some updates to fix render in tooltips and datos3 background color. * config.php: Version update. * operation/menu.php: Added reporting suboption: Custom Graph Builder. * operation/reporting/graph_builder.php: New custom and combined graphic generator that uses new function from fgraph graphic_combined_module(). * reporting/fgraph.php: new function graphic_combined_module() to generate combined graphs. Needs to finish implementation to show alerts and evetns (most work done). Function grafico_db_agentes_purge() now uses Pear Graph instead jpgraph. * operation/agents/exportdata.php: Now uses indexes and improve the overall speed. * operation/agents/estado_grupo.php: Rewritten version, much more fast than previous. * operation/events/events.php: Fixed code to mass delete/update and added some audit control points. * pandora_db.php: audit_db() now uses utimestamp. event_insert() now uses utimestamp. Added function give_agent_id_from_module_id(). * operation/agents/estado_ultimopaquete.php: Now render in red timestamp for "outdated" data. Fixes some minor problems with module groups and interval rendering. * operation/agents/estado_monitores.php: now uses utimestamp. * operation/agents/ver_agente.php: Uses lang_label labels for some texts. Fixed image bug. * operation/servers/view_server.php: Added version of server and some cosmetic adjustments. * godmode/db/db_main.php: Applied new graphic. * godmode/agentes/module_manager.php: Now sort by modulegroup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@405 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-03-28 18:07:29 +02:00
$seconds = time() - $row_t["utimestamp"];
if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
$agent_down = 1;
else
$agent_down = 0;
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
echo "<tr><td class='".$tdcolor."'>";
2008-04-03 Sancho Lerena <slerena@gmail.com> * pandoradb_data.sql: IA to prediction in description. * pandoradb.sql: Added priority to alert and custom recovery fields. * include/styles/tip.css, include/styles/pandora.css: New styles for tooltip info (combined and alerts) and some changes in frames for agent management / view. * include/functions_db.php: Added check_server_status() function to check from console server status. If in 15 minutes there is no updated keepalive from any server, they will be marked as down. And function return down. This function is now called on each page. Added funtions to display alert status in a tooltip. * include/languages/language_en.php: More strings. * include/functions.php: Added several funtions to simplify alert report. * operation/agentes/estado_alertas.php: Updated. Shows also combined alerts and give a lot of information in different tooltips. * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL. * operation/agentes/estado_monitores.php: now is possible to force a module refresh from main view. * operation/agentes/ver_agente.php: Tab has been upgraded. * images/mod_data.png, images/mod_data_inc.png images/mod_proc.png images/mod_keepalive.png images/mod_string.png: Added new type icons and updated old ones. * general/header.php: Global check for servers and autorefresh control. * godmode/agentes/alert_manager.php: New alert management for combined alerts, visualization, etc. * godmode/agentes/configurar_agente.php: Included new alert management. * godmode/agentes/alert_manager_editor.php: New alert management editor. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-04-03 17:43:34 +02:00
if (($row_t["id_modulo"] != 1) AND ($row_t["id_tipo_modulo"] < 100)) {
if ($row_t["flag"] == 0){
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente& id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&flag=1& tab=main&refr=60'><img src='images/target.png' border='0'></a>";
} else {
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&tab=main&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
echo "<td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
echo "<td class='".$tdcolor."f9'>"
.substr($est_description,0,35)."</td>";
echo "<td class='".$tdcolor."' align='center'>";
if ($est_estado == 1){
if ($est_cambio == 1)
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".$lang_label["yellow_light"]."'>";
else
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
} else
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
echo "<td align='center' class='".$tdcolor."'>";
if ($temp_interval != $intervalo)
echo $temp_interval."</td>";
else
echo "--";
echo "<td class='".$tdcolor."f9'>";
if ($agent_down == 1) { // If agent down, it's shown red and bold
echo "<span class='redb'>";
}
else {
echo "<span>";
}
if ($row_t["timestamp"]=='0000-00-00 00:00:00') {
echo $lang_label["never"];
} else {
echo human_time_comparation($row_t["timestamp"]);
}
echo "</span></td>";
}
}
echo '</table>';
} else {
echo "<div class='nf'>".$lang_label["no_monitors"]."</div>";
}
}
?>