pandorafms/pandora_console/operation/agentes/estado_monitores.php

127 lines
4.7 KiB
PHP
Raw Normal View History

<?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 globar vars
require_once ("include/config.php");
if (!isset ($id_agente)) {
//This page is included, $id_agente should be passed to it.
audit_db ($config['id_user'], $config['remote_addr'], "HACK Attempt",
"Trying to get to monitor list without id_agent passed");
include ("general/noaccess.php");
exit;
}
// Get all module from agent
$sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.id_agente = %d
AND tagente_modulo.disabled = 0
AND tagente_estado.utimestamp != 0
ORDER BY tagente_modulo.nombre", $id_agente);
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
$modules = get_db_all_rows_sql ($sql);
if (empty ($modules)) {
$modules = array ();
}
$table->width = 750;
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox";
$table->head = array ();
$table->data = array ();
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
$table->head[0] = "X";
$table->head[1] = __('Type');
$table->head[2] = __('Module name');
$table->head[3] = __('Description');
$table->head[4] = __('Status');
$table->head[5] = __('Interval');
$table->head[6] = __('Last contact');
//Since PHP's Zend optimizer references $var2 in case you do $var = $var2, objects get referenced too so we can't do $table = $table_data
$table_data->head = $table->head; //Duplicate table for data modules
$table_data->class = $table->class;
$table_data->data = array ();
$table_data->cellspacing = $table->cellspacing;
$table_data->cellpadding = $table->cellpadding;
$table_data->width = $table->width;
foreach ($modules as $module) {
$data = array ();
if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) {
if ($module["flag"] == 0) {
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module["id_agente_modulo"].'&flag=1&refr=60"><img src="images/target.png" border="0" /></a>';
} else {
$data[0] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module["id_agente_modulo"].'&refr=60"><img src="images/refresh.png" border="0"></a>';
}
} else {
$data[0] = '';
}
$data[1] = '<img src="images/'.show_icon_type ($module["id_tipo_modulo"]).'" border="0">';
$data[2] = substr ($module["nombre"], 0, 25);
$data[3] = substr ($module["descripcion"], 0, 35);
if ($module["estado"] == 1 && $module["cambio"] == 1) {
$data[4] = '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('Change between Green/Red state').'">';
} elseif ($module["estado"] == 1) {
$data[4] = '<img src="images/pixel_red.png" width="40" height="18" title="'.__('At least one monitor fails').'">';
} else {
$data[4] = '<img src="images/pixel_green.png" width="40" height="18" title="'.__('All Monitors OK').'">';
}
if ($module["module_interval"] > 0) {
$data[5] = $module["module_interval"];
} else {
$data[5] = "--";
}
$seconds = time () - $module["utimestamp"];
if ($module["current_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["current_interval"] * 2)) {
$data[6] = '<span class="redb">';
} else {
$data[6] = '<span>';
}
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
$data[6] .= print_timestamp ($module["utimestamp"], true);
$data[6] .= '</span>';
if ($module["estado"] != 100) {
array_push ($table->data, $data);
//Monitor modules go on $table
} else {
array_push ($table_data->data, $data);
//Data modules go on $table_data
}
}
if (empty ($table->data)) {
echo '<div class="nf">'.__('This agent doesn\'t have any active monitors').'</div>';
} else {
echo "<h3>".__('Full list of Monitors')."</h3>";
print_table ($table);
}
if (empty ($table_data->data)) {
echo '<div class="nf">'.__('This agent doesn\'t have any active data modules').'</div>';
} else {
echo "<h3>".__('Full list of Data Modules')."</h3>";
print_table ($table_data);
}
unset ($table);
unset ($table_data);
?>