2006-03-27 05:37:27 +02:00
< ? php
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
// Pandora FMS
2006-07-09 16:20:10 +02:00
// ====================================
2008-02-21 16:16:54 +01:00
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
* pandoradb.sql: talert_snmp: Added priority field.
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
and some links.
* header.php: Fixed some user session management.
* logon_ok.php: New design for welcome screen, odometer is over.
* menu.php, godmode/menu.php: Some ACL improvements.
* agent_disk_conf_editor.php: Minor fix in view link.
* configurar_agente.php, agent_manager.php: Added parent combo and better
ACL checks. New remote configuration control for get timestamp info of
config file.
* modify_alert.php: Changes to use new internal Mail alert.
* config.php: Some items moved to config_process. (font, attachment and
default style).
* functions.php: Added form_agent_combo(), form_event_type_combo(),
form_priority() and return_priority() functions.
* functions_db.php: Added smal_event_table() to render a variable table
with latest events (filtered).
* pandora.css. Added pure and priority colors.
* estado_alertas.php: Fixed ACL problems.
* stado_generalagente.php: Graph of modules now represents modules that
has generated events. Old graph is not used anymore. Also display parent.
* estado_grupo.php: Border of boxes is now thicker.
* tactical.php: New screen, almost all code changed. Odometer is not used
anymore, added some new items, like module LAG meter, module sanity, and
other general metrics.
* ver_agente.php: Now renders also event for each agent view. Alert manual
validation generate a new event.
* events.php: New event system. 90% new code. A LOT of new features,
including full screen, coloured (by priority) and filters by six fields.
* snmp_alert.php: Added support for alert priority.
* operation/users/user.php: No longer a user with UM privileges could
see any other user.
* render_view.php: Added fullscreen support for visual maps.
* fgraph.php: Added support for session checking in graphs (at least!).
New graphics for events (some changed it's function like events by group),
and feature added to progress GD implementation.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas S.L, info@artica.es
2008-04-17 17:27:25 +02:00
2006-07-09 16:20:10 +02:00
// 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 global vars
2008-04-17 17:27:25 +02:00
global $config ;
$id_user = $config [ " id_user " ];
2006-03-27 05:37:27 +02:00
2008-01-10 17:40:00 +01:00
if ( comprueba_login () != 0 ) {
require ( " general/noaccess.php " );
exit ;
}
2006-03-27 05:37:27 +02:00
2008-01-10 17:40:00 +01:00
if (( give_acl ( $id_user , 0 , " AR " ) != 1 ) AND ( give_acl ( $id_user , 0 , " AW " ) != 1 )) {
audit_db ( $id_user , $REMOTE_ADDR , " ACL Violation " ,
" Trying to access Agent Management " );
require ( " general/noaccess.php " );
exit ;
}
2006-03-27 05:37:27 +02:00
2008-01-10 17:40:00 +01:00
echo " <h2> " . $lang_label [ " ag_title " ] . " > " ;
echo $lang_label [ " monitor_listing " ] . " </h2> " ;
2008-04-17 17:27:25 +02:00
$ag_freestring = get_parameter ( " ag_freestring " , " " );
$ag_modulename = get_parameter ( " ag_modulename " , " " );
$ag_group = get_parameter ( " ag_group " , - 1 );
$offset = get_parameter ( " offset " , 0 );
2008-06-19 02:24:05 +02:00
$status = get_parameter ( " status " , 0 );
2008-01-10 17:40:00 +01:00
2008-04-17 17:27:25 +02:00
$URL = " index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60 " ;
echo " <form method='post' action=' " ;
if ( $ag_group != - 1 )
2008-06-19 02:24:05 +02:00
$URL .= " &ag_group= " . $ag_group ;
2008-04-17 17:27:25 +02:00
// Module name selector
// This code thanks for an idea from Nikum, nikun_h@hotmail.com
if ( $ag_modulename != " " )
$URL .= " &ag_modulename= " . $ag_modulename ;
// Freestring selector
if ( $ag_freestring != " " )
$URL .= " &ag_freestring= " . $ag_freestring ;
2008-06-19 02:24:05 +02:00
// Status selector
$URL .= " &status= $status " ;
2008-04-17 17:27:25 +02:00
echo $URL ;
// End FORM TAG
echo " '> " ;
2008-01-10 17:40:00 +01:00
echo " <table cellspacing='4' cellpadding='4' width='600' class='databox'> " ;
echo " <tr><td valign='middle'> " . $lang_label [ " group " ] . " </td> " ;
echo " <td valign='middle'> " ;
echo " <select name='ag_group' onChange='javascript:this.form.submit();' class='w130'> " ;
if ( $ag_group > 1 ){
echo " <option value=' " . $ag_group . " '> " . dame_nombre_grupo ( $ag_group ) . " </option> " ;
}
echo " <option value=1> " . dame_nombre_grupo ( 1 ) . " </option> " ;
list_group ( $id_user );
echo " </select> " ;
echo " </td> " ;
2008-06-19 02:24:05 +02:00
echo " <td> " ;
echo lang_string ( " Monitor status " );
echo " <td> " ;
echo " <select name='status'> " ;
if ( $status == - 1 ){
2008-07-17 11:16:30 +02:00
echo " <option value=-1> " . lang_string ( " All " ) . " </option> " ;
echo " <option value=0> " . lang_string ( " Monitors down " ) . " </option> " ;
echo " <option value=1> " . lang_string ( " Monitors up " ) . " </option> " ;
echo " <option value=2> " . lang_string ( " Monitors unknown " ) . " </option> " ;
2008-06-19 02:24:05 +02:00
} elseif ( $status == 0 ){
2008-07-17 11:16:30 +02:00
echo " <option value=0> " . lang_string ( " Monitors down " ) . " </option> " ;
echo " <option value=-1> " . lang_string ( " All " ) . " </option> " ;
echo " <option value=1> " . lang_string ( " Monitors up " ) . " </option> " ;
echo " <option value=2> " . lang_string ( " Monitors unknown " ) . " </option> " ;
2008-07-10 13:58:40 +02:00
} elseif ( $status == 2 ){
2008-07-17 11:16:30 +02:00
echo " <option value=2> " . lang_string ( " Monitors unknown " ) . " </option> " ;
echo " <option value=0> " . lang_string ( " Monitors down " ) . " </option> " ;
echo " <option value=-1> " . lang_string ( " All " ) . " </option> " ;
echo " <option value=1> " . lang_string ( " Monitors up " ) . " </option> " ;
2008-06-19 02:24:05 +02:00
} else {
2008-07-17 11:16:30 +02:00
echo " <option value=1> " . lang_string ( " Monitors up " ) . " </option> " ;
echo " <option value=0> " . lang_string ( " Monitors down " ) . " </option> " ;
echo " <option value=2> " . lang_string ( " Monitors unknown " ) . " </option> " ;
echo " <option value=-1> " . lang_string ( " All " ) . " </option> " ;
2008-06-19 02:24:05 +02:00
}
echo " </select> " ;
2008-01-10 17:40:00 +01:00
echo " </tr> " ;
echo " <tr> " ;
echo " <td valign='middle'> " . $lang_label [ " module_name " ] . " </td> " ;
echo " <td valign='middle'>
< select name = 'ag_modulename' onChange = 'javascript:this.form.submit();' > " ;
if ( isset ( $ag_modulename )){
echo " <option> " . $ag_modulename . " </option> " ;
}
echo " <option> " . $lang_label [ " all " ] . " </option> " ;
$sql = ' SELECT DISTINCT nombre
FROM tagente_modulo
2008-06-19 02:24:05 +02:00
WHERE id_tipo_modulo in ( 2 , 6 , 9 , 18 , 21 , 100 ) ' ;
2008-01-10 17:40:00 +01:00
$result = mysql_query ( $sql );
while ( $row = mysql_fetch_array ( $result )){
echo " <option> " . $row [ '0' ] . " </option> " ;
}
echo " </select> " ;
2008-04-17 17:27:25 +02:00
echo " <td valign='middle'> " ;
echo lang_string ( " Free text " );
2008-06-19 02:24:05 +02:00
echo " <td valign='middle'> " ;
echo " <input type=text name='ag_freestring' size=15 value=' $ag_freestring '> " ;
2008-04-17 17:27:25 +02:00
echo " <td valign='middle'> " ;
echo " <input name='uptbutton' type='submit' class='sub' value=' " . $lang_label [ " show " ] . " ' " ;
echo " </form> " ;
2008-01-10 17:40:00 +01:00
echo " </table> " ;
2008-04-17 17:27:25 +02:00
// Begin Build SQL sentences
2008-07-10 13:58:40 +02:00
$SQL_pre = " SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modulo.nombre, tagente_modulo.descripcion, tagente.id_grupo, tagente.id_agente, tagente_modulo.id_tipo_modulo, tagente_modulo.module_interval, tagente_estado.datos, tagente_estado.utimestamp, tagente_estado.timestamp " ;
2008-04-17 17:27:25 +02:00
$SQL_pre_count = " SELECT count(tagente_modulo.id_agente_modulo) " ;
2008-06-20 14:13:35 +02:00
$SQL = " FROM tagente, tagente_modulo, tagente_estado WHERE tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente.disabled = 0 AND tagente_modulo.id_tipo_modulo in (2, 9, 12, 18, 6, 100) AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo " ;
2008-04-17 17:27:25 +02:00
// Agent group selector
if ( $ag_group > 1 )
$SQL .= " AND tagente.id_grupo = " . $ag_group ;
2008-06-09 19:51:18 +02:00
else {
2008-07-17 08:41:39 +02:00
// User has explicit permission on group 1 ?
$all_group = get_db_sql ( " SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario=' $id_user ' AND id_grupo = 1 " );
if ( $all_group == 0 )
$SQL .= " AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario=' $id_user ') " ;
2008-06-09 19:51:18 +02:00
}
2008-04-17 17:27:25 +02:00
// Module name selector
// This code thanks for an idea from Nikum, nikun_h@hotmail.com
if ( $ag_modulename != " " )
2008-07-17 08:41:39 +02:00
$SQL .= " AND tagente_modulo.nombre = ' $ag_modulename ' " ;
2008-04-17 17:27:25 +02:00
// Freestring selector
if ( $ag_freestring != " " )
2008-07-17 08:41:39 +02:00
$SQL .= " AND ( tagente.nombre LIKE '% " . $ag_freestring . " %' OR tagente_modulo.nombre LIKE '% " . $ag_freestring . " %' OR tagente_modulo.descripcion LIKE '% " . $ag_freestring . " %') " ;
2008-06-19 02:24:05 +02:00
// Status selector
if ( $status == 1 )
2008-07-17 08:41:39 +02:00
$SQL .= " AND tagente_estado.estado = 0 " ;
2008-06-19 02:24:05 +02:00
elseif ( $status == 0 )
2008-07-17 08:41:39 +02:00
$SQL .= " AND tagente_estado.estado = 1 " ;
2008-07-10 13:58:40 +02:00
elseif ( $status == 2 )
$SQL .= " AND (UNIX_TIMESTAMP()-tagente_estado.utimestamp ) > (tagente_estado.current_interval * 2) " ;
2008-06-19 02:24:05 +02:00
// Final order
2008-04-17 17:27:25 +02:00
$SQL .= " ORDER BY tagente.id_grupo, tagente.nombre " ;
// Build final SQL sentences
$SQL_FINAL = $SQL_pre . $SQL ;
$SQL_COUNT = $SQL_pre_count . $SQL ;
$counter = get_db_sql ( $SQL_COUNT );
2008-07-17 08:41:39 +02:00
if ( $counter > $config [ " block_size " ]) {
pagination ( $counter , $URL , $offset );
$SQL_FINAL .= " LIMIT $offset , " . $config [ " block_size " ];
}
if ( $counter > 0 ) {
echo " <table cellpadding='4' cellspacing='4' width='750' class='databox'>
< tr >
< th >
< th > " . $lang_label["agent"] . " </ th >
< th > " . $lang_label["type"] . " </ th >
< th > " . $lang_label["name"] . " </ th >
< th > " . $lang_label["description"] . " </ th >
< th > " . $lang_label["interval"] . " </ th >
< th > " . $lang_label["status"] . " </ th >
< th > " . $lang_label["timestamp"] . " </ th > " ;
$color = 1 ;
$result = mysql_query ( $SQL_FINAL );
while ( $data = mysql_fetch_array ( $result )){ //while there are agents
if ( $color == 1 ){
$tdcolor = " datos " ;
$color = 0 ;
} else {
$tdcolor = " datos2 " ;
$color = 1 ;
}
if ( $data [ 7 ] == 0 ){
$my_interval = give_agentinterval ( $data [ 5 ]);
} else {
$my_interval = $data [ 7 ];
}
if ( $status == 2 ) {
$seconds = time () - $data [ 9 ];
if ( $seconds < ( $my_interval * 2 ))
continue ;
}
echo " <tr><td class=' $tdcolor '> " ;
echo " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente= " . $data [ " id_agente " ] . " &id_agente_modulo= " . $data [ 0 ] . " &flag=1&tab=data&refr=60'> " ;
echo " <img src='images/target.png'></a> " ;
echo " </td><td class=' $tdcolor '> " ;
echo " <strong><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente= " . $data [ 5 ] . " '> " . strtoupper ( substr ( $data [ 1 ], 0 , 21 )) . " </a></strong> " ;
echo " </td><td class=' $tdcolor '> " ;
echo " <img src='images/ " . show_icon_type ( $data [ 6 ]) . " ' border=0></td> " ;
echo " <td class=' $tdcolor '> " . substr ( $data [ 2 ], 0 , 21 ) . " </td> " ;
echo " <td class=' " . $tdcolor . " f9' title=' " . $data [ 3 ] . " '> " . substr ( $data [ 3 ], 0 , 30 ) . " </td> " ;
echo " <td class=' $tdcolor ' align='center' width=25> " ;
echo $my_interval ;
echo " <td class=' $tdcolor ' align='center' width=20> " ;
if ( $data [ 8 ] > 0 ){
echo " <img src='images/pixel_green.png' width=40 height=18 title=' " . lang_string ( " Monitor up " ) . " '> " ;
} else {
echo " <img src='images/pixel_red.png' width=40 height=18 title=' " . lang_string ( " Monitor down " ) . " '> " ;
2008-07-10 13:58:40 +02:00
}
2008-07-17 08:41:39 +02:00
echo " <td class=' " . $tdcolor . " f9'> " ;
$seconds = time () - $data [ 9 ];
if ( $seconds >= ( $my_interval * 2 ))
echo " <span class='redb'> " ;
else
echo " <span> " ;
echo human_time_comparation ( $data [ 10 ]);
echo " </span></td></tr> " ;
}
echo " </table> " ;
2008-01-10 17:40:00 +01:00
} else {
2008-04-17 17:27:25 +02:00
echo " <div class='nf'> " . $lang_label [ " no_monitors_g " ] . " </div> " ;
2008-01-10 17:40:00 +01:00
}
2006-03-27 05:37:27 +02:00
2008-04-17 17:27:25 +02:00
echo " <table width=700 border=0> " ;
echo " <tr> " ;
echo " <td class='f9'> " ;
2008-06-19 02:24:05 +02:00
echo " <img src='images/pixel_green.png' width=40 height=18> " . lang_string ( " Monitor up " ) . " </td> " ;
2008-04-17 17:27:25 +02:00
echo " <td class='f9' " ;
2008-06-19 02:24:05 +02:00
echo " <img src='images/pixel_red.png' width=40 height=18> " . lang_string ( " Monitor down " ) . " </td> " ;
2008-04-17 17:27:25 +02:00
echo " </table> " ;
2007-07-28 20:11:48 +02:00
?>