2006-07-09 16:20:10 +02:00
< ? php
2006-07-06 19:06:59 +02:00
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
// Copyright (c) 2004-2006 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.
2006-03-27 05:37:27 +02:00
// 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
2006-07-07 02:45:58 +02:00
$sql_t = 'SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente=' . $id_agente . ' and tagente_estado.estado != 100 order by tagente_modulo.nombre' ;
2006-03-27 05:37:27 +02:00
$result_t = mysql_query ( $sql_t );
if ( mysql_num_rows ( $result_t )) {
2007-03-12 18:58:52 +01:00
echo " <h3> " . $lang_label [ " monitor_listing " ] . " <a href='help/ " . $help_code . " /chap3.php#3323' target='_help' class='help'> <span> " . $lang_label [ " help " ] . " </span></a></h3> " ;
2007-05-18 14:56:05 +02:00
echo " <table width='750' cellpadding=4 cellspacing=4 class='databox'> " ;
2007-05-08 13:24:57 +02:00
echo " <tr><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 > " ;
2006-07-01 03:48:56 +02:00
$color = 0 ;
while ( $row_t = mysql_fetch_array ( $result_t )){
# For evey module in the status table
$est_modulo = $row_t [ " nombre " ];
$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 18:07:29 +02:00
$seconds = time () - $row_t [ " utimestamp " ];
2006-07-01 03:48:56 +02:00
if ( $seconds >= ( $temp_interval * 2 )) // If every interval x 2 secs. we get nothing, there's and alert
$agent_down = 1 ;
2006-03-27 05:37:27 +02:00
else
2006-07-01 03:48:56 +02:00
$agent_down = 0 ;
2006-12-08 17:57:43 +01:00
echo " <tr><td class=' " . $tdcolor . " '> " . $est_tipo . " </td> " ;
echo " <td class=' " . $tdcolor . " '> " . $est_modulo . " </td> " ;
echo " <td class=' " . $tdcolor . " f9'> "
. substr ( $est_description , 0 , 32 ) . " </td> " ;
2006-07-01 03:48:56 +02:00
// echo "<td class='datos'>".$row3["datos"];
if ( $agent_down == 1 )
2006-12-08 17:57:43 +01:00
echo " <td class=' " . $tdcolor . " ' align='center'>
< img src = 'images/b_down.gif' ></ td > " ;
2006-07-01 03:48:56 +02:00
else
if ( $est_estado == 1 )
if ( $est_cambio == 1 )
2006-12-08 17:57:43 +01:00
echo " <td class=' " . $tdcolor . " ' align='center'>
< img src = 'images/b_yellow.gif' ></ td > " ;
2006-07-01 03:48:56 +02:00
else
2006-12-08 17:57:43 +01:00
echo " <td class=' " . $tdcolor . " ' align='center'>
< img src = 'images/b_red.gif' ></ td > " ;
2006-07-01 03:48:56 +02:00
else
2006-12-08 17:57:43 +01:00
echo " <td class=' " . $tdcolor . " ' align='center'>
< img src = 'images/b_green.gif' ></ td > " ;
2006-07-06 19:06:59 +02:00
echo " <td class=' " . $tdcolor . " '> " ;
2006-12-08 17:57:43 +01:00
echo $temp_interval . " </td> " ;
2006-07-07 02:45:58 +02:00
echo " <td class=' " . $tdcolor . " f9'> " ;
2006-12-08 17:57:43 +01:00
if ( $agent_down == 1 ) { // If agent down, it's shown red and bold
echo " <span class='redb'> " ;
}
2007-05-08 13:24:57 +02:00
else {
echo " <span> " ;
}
if ( $row_t [ " timestamp " ] == '0000-00-00 00:00:00' ) {
echo $lang_label [ " never " ];
} else {
echo $row_t [ " timestamp " ];
}
echo " </span></td> " ;
2006-07-01 03:48:56 +02:00
}
2006-03-27 05:37:27 +02:00
}
2007-05-18 14:56:05 +02:00
echo '</table>' ;
2006-03-27 05:37:27 +02:00
}
2006-07-01 03:48:56 +02:00
else
2006-12-08 17:57:43 +01:00
echo " <div class='nf'> " . $lang_label [ " no_monitors " ] . " </div> " ;
2006-03-27 05:37:27 +02:00
}
2007-05-18 14:56:05 +02:00
?>