2006-03-27 05:37:27 +02:00
< ? php
2019-02-21 13:21:05 +01:00
/**
* Extension to manage a list of gateways and the node address where they should
* point to .
*
* @ category Extensions
* @ package Pandora FMS
* @ subpackage Community
* @ version 1.0 . 0
* @ license See below
*
* ______ ___ _______ _______ ________
* | __ \ .-----.--.--.--| |.-----.----.-----. | ___ | | | __ |
* | __ /| _ | | _ || _ | _ | _ | | ___ | | __ |
* | ___ | | ___ . _ | __ | __ | _____ || _____ | __ | | ___ . _ | | ___ | | __ | _ | __ | _______ |
*
* ============================================================================
* Copyright ( c ) 2005 - 2019 Artica Soluciones Tecnologicas
* Please see http :// pandorafms . org 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 .
* ============================================================================
*/
2008-08-22 20:07:32 +02:00
2010-03-02 20:25:51 +01:00
global $config ;
2019-01-30 16:18:44 +01:00
require_once 'include/functions_gis.php' ;
require_once $config [ 'homedir' ] . '/include/functions_agents.php' ;
require_once $config [ 'homedir' ] . '/include/functions_groups.php' ;
require_once $config [ 'homedir' ] . '/include/functions_modules.php' ;
require_once $config [ 'homedir' ] . '/include/functions_users.php' ;
enterprise_include_once ( 'include/functions_metaconsole.php' );
2008-12-10 21:15:38 +01:00
2011-04-13 18:11:02 +02:00
ui_require_javascript_file ( 'openlayers.pandora' );
2019-05-29 11:21:57 +02:00
ui_require_css_file ( 'agent_view' );
2010-02-10 11:16:51 +01:00
2019-01-30 16:18:44 +01:00
enterprise_include_once ( 'operation/agentes/ver_agente.php' );
check_login ();
if ( is_ajax ()) {
$get_agent_json = ( bool ) get_parameter ( 'get_agent_json' );
$get_agent_modules_json = ( bool ) get_parameter ( 'get_agent_modules_json' );
$get_agent_status_tooltip = ( bool ) get_parameter ( 'get_agent_status_tooltip' );
$get_agents_group_json = ( bool ) get_parameter ( 'get_agents_group_json' );
$get_modules_group_json = ( bool ) get_parameter ( 'get_modules_group_json' );
$get_modules_group_value_name_json = ( bool ) get_parameter ( 'get_modules_group_value_name_json' );
$get_agent_modules_json_for_multiple_agents = ( bool ) get_parameter ( 'get_agent_modules_json_for_multiple_agents' );
$get_agent_modules_alerts_json_for_multiple_agents = ( bool ) get_parameter ( 'get_agent_modules_alerts_json_for_multiple_agents' );
$get_agent_modules_multiple_alerts_json_for_multiple_agents = ( bool ) get_parameter ( 'get_agent_modules_multiple_alerts_json_for_multiple_agents' );
$get_agents_json_for_multiple_modules = ( bool ) get_parameter ( 'get_agents_json_for_multiple_modules' );
$get_agent_modules_json_for_multiple_agents_id = ( bool ) get_parameter ( 'get_agent_modules_json_for_multiple_agents_id' );
$get_agentmodule_status_tooltip = ( bool ) get_parameter ( 'get_agentmodule_status_tooltip' );
$get_group_status_tooltip = ( bool ) get_parameter ( 'get_group_status_tooltip' );
$get_agent_id = ( bool ) get_parameter ( 'get_agent_id' );
$get_agents_source_json = ( bool ) get_parameter ( 'get_agents_source_json' );
$cluster_mode = ( bool ) get_parameter ( 'cluster_mode' , 0 );
$agent_alias = get_parameter ( 'alias' , '' );
$agents_inserted = get_parameter ( 'agents_inserted' , []);
$id_group = ( int ) get_parameter ( 'id_group' );
2019-06-03 13:04:49 +02:00
$refresh_contact = get_parameter ( 'refresh_contact' , 0 );
if ( $refresh_contact ) {
$id_agente = get_parameter ( 'id_agente' , 0 );
if ( $id_agente > 0 ) {
2019-11-15 13:07:23 +01:00
$last_contact = agents_get_next_contact_time_left ( $id_agente );
2019-06-03 13:04:49 +02:00
$progress = agents_get_next_contact ( $id_agente );
2019-06-03 13:11:00 +02:00
if ( $progress < 0 || $progress > 100 ) {
$progress = 100 ;
}
2019-06-03 13:04:49 +02:00
echo json_encode (
[
'progress' => $progress ,
2019-06-03 13:11:00 +02:00
'last_contact' => $last_contact ,
2019-06-03 13:04:49 +02:00
]
);
}
return ;
}
2019-01-30 16:18:44 +01:00
if ( $get_agents_group_json ) {
$id_group = ( int ) get_parameter ( 'id_group' );
2019-02-21 13:21:05 +01:00
$recursion = ( bool ) get_parameter ( 'recursion' );
2019-01-30 16:18:44 +01:00
$id_os = get_parameter ( 'id_os' , '' );
$agent_name = get_parameter ( 'name' , '' );
$privilege = ( string ) get_parameter ( 'privilege' , 'AR' );
2019-02-21 13:21:05 +01:00
// Is is possible add keys prefix to avoid auto sorting in js object conversion.
2019-01-30 16:18:44 +01:00
$keys_prefix = ( string ) get_parameter ( 'keys_prefix' , '' );
$status_agents = ( int ) get_parameter ( 'status_agents' , AGENT_STATUS_ALL );
2019-02-21 13:21:05 +01:00
// Build filter.
2019-01-30 16:18:44 +01:00
$filter = [];
if ( ! empty ( $id_os )) {
$filter [ 'id_os' ] = $id_os ;
}
if ( ! empty ( $agent_name )) {
$filter [ 'nombre' ] = '%' . $agent_name . '%' ;
}
if ( ! empty ( $agent_alias )) {
$filter [ 'alias' ] = '%' . $agent_alias . '%' ;
}
$filter [ 'status' ] = $status_agents ;
if ( $cluster_mode ) {
$agent_id_os = db_get_all_rows_sql ( 'select id_os from tconfig_os where id_os != 100' );
foreach ( $agent_id_os as $key => $value ) {
$agent_id_os_array [] = $agent_id_os [ $key ][ 'id_os' ];
}
$filter [ 'id_os' ] = $agent_id_os_array ;
if ( $agents_inserted [ 0 ] != '' ) {
$agents_id_list = '' ;
foreach ( $agents_inserted as $elem ) {
if ( $elem === end ( $agents_inserted )) {
$agents_id_list .= $elem ;
} else {
$agents_id_list .= $elem . ',' ;
}
}
$agent_id_agente = db_get_all_rows_sql ( 'select id_agente from tagente where id_agente not in (' . $agents_id_list . ')' );
foreach ( $agent_id_agente as $key => $value ) {
$agent_id_agente_array [] = $agent_id_agente [ $key ][ 'id_agente' ];
}
$filter [ 'id_agente' ] = $agent_id_agente_array ;
}
}
2019-02-21 13:21:05 +01:00
// Perform search.
$agents = agents_get_group_agents (
$id_group ,
$filter ,
'lower' ,
false ,
$recursion ,
false ,
'|' ,
$cluster_mode
);
2019-01-30 16:18:44 +01:00
if ( empty ( $agents )) {
$agents = [];
}
2019-02-21 13:21:05 +01:00
// Add keys prefix.
2019-01-30 16:18:44 +01:00
if ( $keys_prefix !== '' ) {
$i = 0 ;
foreach ( $agents as $k => $v ) {
$agents [ $keys_prefix . $i ] = [
'id_agente' => $k ,
'alias' => io_safe_output ( $v ),
];
unset ( $agents [ $k ]);
$i ++ ;
}
}
echo json_encode ( $agents );
return ;
}
if ( $get_modules_group_json ) {
$id_group = ( int ) get_parameter ( 'id_module_group' , 0 );
$id_agents = get_parameter ( 'id_agents' );
$selection = get_parameter ( 'selection' );
select_modules_for_agent_group ( $id_group , $id_agents , $selection );
}
if ( $get_modules_group_value_name_json ) {
$id_agents = get_parameter ( 'id_agents' );
$selection = get_parameter ( 'selection' );
2019-02-21 13:21:05 +01:00
// No filter by module group.
2019-01-30 16:18:44 +01:00
$modules = select_modules_for_agent_group ( 0 , $id_agents , $selection , false , true );
echo json_encode ( $modules );
return ;
}
if ( $get_agent_json ) {
$id_agent = ( int ) get_parameter ( 'id_agent' );
$agent = db_get_row ( 'tagente' , 'id_agente' , $id_agent );
echo json_encode ( $agent );
return ;
}
if ( $get_agent_modules_json_for_multiple_agents_id ) {
$idAgents = get_parameter ( 'id_agent' );
$modules = db_get_all_rows_sql (
'
2013-05-29 13:08:28 +02:00
SELECT nombre , id_agente_modulo
FROM tagente_modulo
2019-01-30 16:18:44 +01:00
WHERE id_agente IN ( '.implode(' , ', $idAgents).' ) '
);
$return = [];
foreach ( $modules as $module ) {
$return [ $module [ 'id_agente_modulo' ]] = io_safe_output ( $module [ 'nombre' ]);
}
echo json_encode ( $return );
return ;
}
if ( $get_agents_json_for_multiple_modules ) {
$nameModules = get_parameter ( 'module_name' );
$selection_mode = get_parameter ( 'selection_mode' , 'common' ) == 'all' ;
$status_modulo = ( int ) get_parameter ( 'status_module' , - 1 );
2019-02-19 13:05:31 +01:00
$tags_selected = ( array ) get_parameter ( 'tags' , []);
2019-01-30 16:18:44 +01:00
$names = select_agents_for_module_group (
$nameModules ,
$selection_mode ,
2019-02-19 13:05:31 +01:00
[
'status' => $status_modulo ,
'tags' => $tags_selected ,
],
2019-01-30 16:18:44 +01:00
'AW'
);
echo json_encode ( $names );
return ;
}
if ( $get_agent_modules_alerts_json_for_multiple_agents ) {
$idAgents = ( array ) get_parameter ( 'id_agent' );
$templates = ( array ) get_parameter ( 'templates' );
$selection_mode = get_parameter ( 'selection_mode' , 'common' );
$sql = ' SELECT DISTINCT ( nombre )
2017-01-12 15:51:59 +01:00
FROM tagente_modulo t1 , talert_template_modules t2
WHERE t2 . id_agent_module = t1 . id_agente_modulo
AND delete_pending = 0
2019-01-30 16:18:44 +01:00
AND id_alert_template IN ( '.implode(' , ', $templates).' )
AND id_agente IN ( '.implode(' , ', $idAgents).' ) ' ;
if ( $selection_mode == 'common' ) {
$sql .= ' AND (
2017-01-12 15:51:59 +01:00
SELECT count ( nombre )
FROM tagente_modulo t3 , talert_template_modules t4
WHERE t4 . id_agent_module = t3 . id_agente_modulo
AND delete_pending = 0 AND t1 . nombre = t3 . nombre
2019-01-30 16:18:44 +01:00
AND id_agente IN ( '.implode(' , ', $idAgents).' )
AND id_alert_template IN ( '.implode(' , ', $templates).' )) = ( '.count($idAgents).' ) ' ;
}
$sql .= ' ORDER BY t1.nombre' ;
$nameModules = db_get_all_rows_sql ( $sql );
if ( $nameModules == false ) {
$nameModules = [];
}
$result = [];
foreach ( $nameModules as $nameModule ) {
$result [] = io_safe_output ( $nameModule [ 'nombre' ]);
}
echo json_encode ( $result );
return ;
}
if ( $get_agent_modules_multiple_alerts_json_for_multiple_agents ) {
$idAgents = get_parameter ( 'id_agent' );
$id_template = get_parameter ( 'template' );
$selection_mode = get_parameter ( 'selection_mode' , 'common' );
$sql = ' SELECT DISTINCT ( nombre )
2015-07-17 10:02:11 +02:00
FROM tagente_modulo t1 , talert_template_modules t2
WHERE t2 . id_agent_module = t1 . id_agente_modulo
AND delete_pending = 0
AND id_alert_template = '.$id_template.'
2019-01-30 16:18:44 +01:00
AND id_agente IN ( '.implode(' , ', $idAgents).' ) ' ;
if ( $selection_mode == 'common' ) {
$sql .= ' AND (
2015-07-17 10:02:11 +02:00
SELECT count ( nombre )
FROM tagente_modulo t3 , talert_template_modules t4
WHERE t4 . id_agent_module = t3 . id_agente_modulo
AND delete_pending = 0 AND t1 . nombre = t3 . nombre
2019-01-30 16:18:44 +01:00
AND id_agente IN ( '.implode(' , ', $idAgents).' )
AND id_alert_template = '.$id_template.' ) = ( '.count($idAgents).' ) ' ;
}
$sql .= ' ORDER BY t1.nombre' ;
$nameModules = db_get_all_rows_sql ( $sql );
if ( $nameModules == false ) {
$nameModules = [];
}
$result = [];
foreach ( $nameModules as $nameModule ) {
$result [] = io_safe_output ( $nameModule [ 'nombre' ]);
}
echo json_encode ( $result );
return ;
}
if ( $get_agent_modules_json_for_multiple_agents ) {
$idAgents = ( array ) get_parameter ( 'id_agent' );
$tags = get_parameter ( 'tags' , null );
$module_types_excluded = get_parameter ( 'module_types_excluded' , []);
$module_name = ( string ) get_parameter ( 'name' );
$selection_mode = get_parameter ( 'selection_mode' , 'common' );
$serialized = get_parameter ( 'serialized' , '' );
$id_server = ( int ) get_parameter ( 'id_server' , 0 );
$status_modulo = ( int ) get_parameter ( 'status_module' , - 1 );
$metaconsole_server_name = null ;
if ( ! empty ( $id_server )) {
$metaconsole_server_name = db_get_value (
'server_name' ,
'tmetaconsole_setup' ,
'id' ,
$id_server
);
}
if ( empty ( $idAgents [ 0 ])) {
echo json_encode ([]);
return ;
}
$filter = '1 = 1' ;
$all = ( string ) get_parameter ( 'all' , 'all' );
switch ( $all ) {
default :
case 'all' :
$filter .= ' AND 1 = 1' ;
break ;
case 'enabled' :
$filter .= ' AND t1.disabled = 0' ;
break ;
}
if ( ! empty ( $module_types_excluded ) && is_array ( $module_types_excluded )) {
$filter .= ' AND t1.id_tipo_modulo NOT IN (' . implode ( $module_types_excluded ) . ')' ;
}
if ( ! empty ( $module_name )) {
2019-02-21 13:21:05 +01:00
$filter .= " AND t1.nombre COLLATE utf8_general_ci LIKE '% " . $module_name . " %' " ;
2019-01-30 16:18:44 +01:00
}
2019-02-21 13:21:05 +01:00
// Status selector.
2019-01-30 16:18:44 +01:00
if ( $status_modulo == AGENT_MODULE_STATUS_NORMAL ) {
2019-02-21 13:21:05 +01:00
// Normal.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 0 AND utimestamp > 0 )
2018-03-02 12:55:03 +01:00
OR ( t1 . id_tipo_modulo IN ( 21 , 22 , 23 , 100 )) ' ;
2019-01-30 16:18:44 +01:00
} else if ( $status_modulo == AGENT_MODULE_STATUS_CRITICAL_BAD ) {
2019-02-21 13:21:05 +01:00
// Critical.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 1 AND utimestamp > 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_WARNING ) {
2019-02-21 13:21:05 +01:00
// Warning.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 2 AND utimestamp > 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_NOT_NORMAL ) {
2019-02-21 13:21:05 +01:00
// Not normal.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado <> 0)' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_UNKNOWN ) {
2019-02-21 13:21:05 +01:00
// Unknown.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 3 AND utimestamp <> 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_NOT_INIT ) {
2019-02-21 13:21:05 +01:00
// Not init.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' utimestamp = 0 )
2016-11-22 14:58:12 +01:00
AND t1 . id_tipo_modulo NOT IN ( 21 , 22 , 23 , 100 ) ' ;
2019-01-30 16:18:44 +01:00
}
if ( $status_modulo != - 1 ) {
$filter .= ' AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where ' . $sql_conditions ;
}
$sql_tags_join = '' ;
$where_tags = '' ;
if ( tags_has_user_acl_tags ( $config [ 'id_user' ])) {
$where_tags = tags_get_acl_tags (
$config [ 'id_user' ],
$id_groups ,
'AR' ,
'module_condition' ,
'AND' ,
'tagente_modulo' ,
false ,
[],
true
);
$sql_tags_join = ' INNER JOIN tagente ON tagente . id_agente = t1 . id_agente
2018-12-07 11:20:15 +01:00
INNER JOIN ttag_module ON ttag_module . id_agente_modulo = t1 . id_agente_modulo
2019-01-30 16:18:44 +01:00
LEFT JOIN tagent_secondary_group tasg ON tagente . id_agente = tasg . id_agent ' ;
}
if ( is_metaconsole ()) {
$result = [];
$nameModules = [];
$temp = [];
$first = true ;
$temp_element = [];
$counter = 0 ;
$first_elements = [];
$array_mapped = array_map (
function ( $item ) use ( $metaconsole_server_name ) {
if ( empty ( $metaconsole_server_name )) {
if ( strstr ( $item , '|@_@|' )) {
$row = explode ( '|@_@|' , $item );
} else {
$row = explode ( '|' , $item );
}
$server_name = array_shift ( $row );
$id_agent = array_shift ( $row );
} else {
$server_name = $metaconsole_server_name ;
$id_agent = $item ;
}
return [
'server_name' => $server_name ,
'id_agent' => $id_agent ,
];
},
$idAgents
);
$array_reduced = array_reduce (
$array_mapped ,
function ( $carry , $item ) {
if ( ! isset ( $carry [ $item [ 'server_name' ]])) {
$carry [ $item [ 'server_name' ]] = [];
}
$carry [ $item [ 'server_name' ]][] = $item [ 'id_agent' ];
return $carry ;
},
[]
);
$last_modules_set = [];
foreach ( $array_reduced as $server_name => $id_agents ) {
// Metaconsole db connection
2019-02-21 13:21:05 +01:00
// $server_name can be the server id (ugly hack, I know).
2019-01-30 16:18:44 +01:00
if ( is_numeric ( $server_name )) {
$connection = metaconsole_get_connection_by_id ( $server_name );
} else {
$connection = metaconsole_get_connection ( $server_name );
}
if ( metaconsole_load_external_db ( $connection ) != NOERR ) {
continue ;
}
2019-02-21 13:21:05 +01:00
// Get agent's modules.
2019-01-30 16:18:44 +01:00
$sql = sprintf (
' SELECT t1 . id_agente , t1 . id_agente_modulo , t1 . nombre
2018-11-22 10:39:48 +01:00
FROM tagente_modulo t1 % s
WHERE % s % s
2015-07-17 10:02:11 +02:00
AND t1 . delete_pending = 0
AND t1 . id_agente IN ( % s )
AND (
SELECT COUNT ( nombre )
FROM tagente_modulo t2
WHERE t2 . delete_pending = 0
AND t1 . nombre = t2 . nombre
AND t2 . id_agente IN ( % s )) = ( % d ) ' ,
2019-01-30 16:18:44 +01:00
$sql_tags_join ,
$filter ,
$where_tags ,
implode ( ',' , $id_agents ),
implode ( ',' , $id_agents ),
count ( $id_agents )
);
$modules = db_get_all_rows_sql ( $sql );
if ( empty ( $modules )) {
$modules = [];
}
$modules_aux = [];
foreach ( $modules as $key => $module ) {
2019-02-21 13:21:05 +01:00
// Don't change this order, is used in the serialization.
2019-01-30 16:18:44 +01:00
$module_data = [
'id_module' => $module [ 'id_agente_modulo' ],
'id_agent' => $module [ 'id_agente' ],
'server_name' => $server_name ,
];
if ( ! isset ( $modules_aux [ $module [ 'nombre' ]])) {
$modules_aux [ $module [ 'nombre' ]] = [];
}
$modules_aux [ $module [ 'nombre' ]][] = $module_data ;
}
$modules = $modules_aux ;
2019-02-21 13:21:05 +01:00
// Build the next array using the common values.
2019-01-30 16:18:44 +01:00
if ( ! empty ( $last_modules_set )) {
$modules = array_intersect_key ( $modules , $last_modules_set );
array_walk (
$modules ,
function ( & $module_data , $module_name ) use ( $last_modules_set ) {
$module_data = array_merge ( $module_data , $last_modules_set [ $module_name ]);
}
);
}
$last_modules_set = $modules ;
2019-02-21 13:21:05 +01:00
// Restore db connection.
2019-01-30 16:18:44 +01:00
metaconsole_restore_db ();
}
$result = [];
foreach ( $last_modules_set as $module_name => $module_data ) {
$value = ui_print_truncate_text ( io_safe_output ( $module_name ), 'module_medium' , false , true );
$module_data_processed = array_map (
function ( $item ) {
return implode ( '|' , $item );
},
$module_data
);
$key = implode ( ';' , $module_data_processed );
$result [ $key ] = $value ;
}
asort ( $result );
} else {
if ( $idAgents [ 0 ] < 0 ) {
if ( $selection_mode == 'common' ) {
$sql_agent_total = 'SELECT count(*) FROM tagente WHERE disabled=0' ;
$agent_total = db_get_value_sql ( $sql_agent_total );
$sql = sprintf (
" SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1
2018-11-22 10:39:48 +01:00
JOIN ( SELECT COUNT ( * ) AS num_names , nombre FROM tagente_modulo
WHERE disabled = 0 AND delete_pending = 0 GROUP BY nombre ) AS tj
ON tj . num_names = $agent_total AND tj . nombre = t1 . nombre % s % s " ,
2019-01-30 16:18:44 +01:00
$sql_tags_join ,
( empty ( $where_tags )) ? '' : " WHERE 1=1 $where_tags "
);
} else {
$sql = sprintf (
'SELECT t1.nombre, t1.id_agente_modulo FROM tagente_modulo t1 %s %s' ,
$sql_tags_join ,
( empty ( $where_tags )) ? '' : " WHERE 1=1 $where_tags "
);
}
} else {
$sql = sprintf (
' SELECT DISTINCT t1 . nombre , t1 . id_agente_modulo FROM tagente_modulo t1
2018-12-07 11:20:15 +01:00
INNER JOIN tagente_estado t2 ON t1 . id_agente_modulo = t2 . id_agente_modulo
% s WHERE % s AND t1 . delete_pending = 0
2019-01-30 16:18:44 +01:00
AND t1 . id_agente IN ( '.implode(' , ', $idAgents).' )
2018-12-07 11:20:15 +01:00
% s % s ' ,
2019-01-30 16:18:44 +01:00
$sql_tags_join ,
$filter ,
' AND t2.datos NOT LIKE "%image%"' ,
$where_tags
);
if ( $selection_mode == 'common' ) {
$sql .= ' AND (
2017-03-07 16:30:40 +01:00
SELECT count ( nombre )
FROM tagente_modulo t2
WHERE t2 . delete_pending = 0
AND t1 . nombre = t2 . nombre
2019-01-30 16:18:44 +01:00
AND t2 . id_agente IN ( '.implode(' , ', $idAgents).' )) = ( '.count($idAgents).' ) ' ;
} else if ( $selection_mode == 'unknown' ) {
$sql .= 'AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = 3 OR estado = 4)' ;
}
}
$sql .= ' ORDER BY nombre' ;
$nameModules = db_get_all_rows_sql ( $sql );
if ( $tags != null ) {
if (( count ( $tags ) >= 1 ) && ( $tags [ 0 ] != '' ) && ( $tags [ 0 ] != - 1 )) {
$implode_tags = implode ( ',' , $tags );
$tag_modules = db_get_all_rows_sql ( 'SELECT DISTINCT id_agente_modulo FROM ttag_module WHERE id_tag IN (' . $implode_tags . ')' );
if ( $tag_modules ) {
$final_modules = [];
foreach ( $nameModules as $key => $module ) {
$in_array = false ;
foreach ( $tag_modules as $t_module ) {
if ( $module [ 'id_agente_modulo' ] == $t_module [ 'id_agente_modulo' ]) {
$in_array = true ;
}
}
if ( $in_array ) {
$final_modules [] = $module ;
}
}
$nameModules = $final_modules ;
} else {
$nameModules = [];
}
}
}
if ( $nameModules == false ) {
$nameModules = [];
}
$result = [];
foreach ( $nameModules as $nameModule ) {
if ( empty ( $serialized )) {
$result [ io_safe_output ( $nameModule [ 'nombre' ])] = ui_print_truncate_text (
io_safe_output ( $nameModule [ 'nombre' ]),
'module_medium' ,
false ,
true
);
} else {
$result [ io_safe_output ( $nameModule [ 'nombre' ]) . '$*$' . implode ( '|' , $idAgents )] = ui_print_truncate_text ( io_safe_output ( $nameModule [ 'nombre' ]), 'module_medium' , false , true );
}
}
}
echo json_encode ( $result );
return ;
}
if ( $get_agent_modules_json ) {
$id_agent = ( int ) get_parameter ( 'id_agent' );
2019-02-21 13:21:05 +01:00
// Use -1 as not received.
2019-01-30 16:18:44 +01:00
$disabled = ( int ) get_parameter ( 'disabled' , - 1 );
$delete_pending = ( int ) get_parameter ( 'delete_pending' , - 1 );
2019-02-21 13:21:05 +01:00
// Use 0 as not received.
2019-01-30 16:18:44 +01:00
$id_tipo_modulo = ( int ) get_parameter ( 'id_tipo_modulo' , 0 );
$status_modulo = ( int ) get_parameter ( 'status_module' , - 1 );
$tags = ( array ) get_parameter ( 'tags' , []);
2019-02-21 13:21:05 +01:00
// Filter.
2019-01-30 16:18:44 +01:00
$filter = [];
if ( $disabled !== - 1 ) {
$filter [ 'disabled' ] = $disabled ;
}
if ( $delete_pending !== - 1 ) {
$filter [ 'delete_pending' ] = $delete_pending ;
}
if ( ! empty ( $id_tipo_modulo )) {
$filter [ 'id_tipo_modulo' ] = $id_tipo_modulo ;
}
if ( empty ( $filter )) {
$filter = false ;
}
2019-02-21 13:21:05 +01:00
$get_only_string_modules = get_parameter (
'get_only_string_modules' ,
false
);
2019-01-30 16:18:44 +01:00
if ( $get_only_string_modules ) {
2020-02-13 09:55:49 +01:00
$filter [ 'tagente_modulo.id_tipo_modulo IN' ] = '(17,23,3,10,33,36)' ;
2019-01-30 16:18:44 +01:00
}
2019-02-21 13:21:05 +01:00
// Status selector.
2019-01-30 16:18:44 +01:00
if ( $status_modulo == AGENT_MODULE_STATUS_NORMAL ) {
2019-02-21 13:21:05 +01:00
// Normal.
$sql_conditions .= ' estado = 0 AND utimestamp > 0 )
2016-11-22 14:58:12 +01:00
OR ( tagente_modulo . id_tipo_modulo IN ( 21 , 22 , 23 , 100 )) ' ;
2019-01-30 16:18:44 +01:00
} else if ( $status_modulo == AGENT_MODULE_STATUS_CRITICAL_BAD ) {
2019-02-21 13:21:05 +01:00
// Critical.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 1 AND utimestamp > 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_WARNING ) {
2019-02-21 13:21:05 +01:00
// Warning.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 2 AND utimestamp > 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_NOT_NORMAL ) {
2019-02-21 13:21:05 +01:00
// Not normal.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado <> 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_UNKNOWN ) {
2019-02-21 13:21:05 +01:00
// Unknown.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' estado = 3 AND utimestamp <> 0 )' ;
} else if ( $status_modulo == AGENT_MODULE_STATUS_NOT_INIT ) {
2019-02-21 13:21:05 +01:00
// Not init.
2019-01-30 16:18:44 +01:00
$sql_conditions .= ' utimestamp = 0 )
2016-11-22 14:58:12 +01:00
AND tagente_modulo . id_tipo_modulo NOT IN ( 21 , 22 , 23 , 100 ) ' ;
2019-01-30 16:18:44 +01:00
}
if ( $status_modulo != - 1 ) {
$filter [ 'tagente_modulo.id_agente_modulo IN' ] = ' (SELECT id_agente_modulo FROM tagente_estado where ' . $sql_conditions ;
}
$get_id_and_name = ( bool ) get_parameter ( 'get_id_and_name' );
$get_distinct_name = ( bool ) get_parameter ( 'get_distinct_name' );
2019-02-21 13:21:05 +01:00
// Fields.
2019-01-30 16:18:44 +01:00
$fields = '*' ;
if ( $get_id_and_name ) {
$fields = [
'id_agente_modulo' ,
'nombre' ,
];
}
if ( $get_distinct_name ) {
$fields = [ 'DISTINCT(tagente_modulo.nombre)' ];
}
$indexed = ( bool ) get_parameter ( 'indexed' , true );
$agentName = ( string ) get_parameter ( 'agent_name' , null );
$server_name = ( string ) get_parameter ( 'server_name' , null );
$server_id = ( int ) get_parameter ( 'server_id' , 0 );
2019-02-21 13:21:05 +01:00
// This will force to get local modules although metaconsole is active,
// by default get all modules from all nodes.
2019-01-30 16:18:44 +01:00
$force_local_modules = ( int ) get_parameter ( 'force_local_modules' , 0 );
if ( $agentName != null ) {
$search = [];
$search [ 'alias' ] = io_safe_output ( $agentName );
} else {
$search = false ;
}
$force_tags = ! empty ( $tags );
if ( $force_tags ) {
$filter [ 'ttag_module.id_tag IN ' ] = '(' . implode ( ',' , $tags ) . ')' ;
}
if ( is_metaconsole () && ! $force_local_modules ) {
if ( enterprise_include_once ( 'include/functions_metaconsole.php' ) !== ENTERPRISE_NOT_HOOK ) {
$connection = metaconsole_get_connection ( $server_name );
if ( $server_id > 0 ) {
$connection = metaconsole_get_connection_by_id ( $server_id );
}
if ( metaconsole_load_external_db ( $connection ) == NOERR ) {
2019-02-21 13:21:05 +01:00
// Get all agents if no agent was given.
2019-01-30 16:18:44 +01:00
if ( $id_agent == 0 ) {
$id_agent = array_keys (
agents_get_group_agents (
array_keys ( users_get_groups ()),
$search ,
'none'
)
);
}
$agent_modules = agents_get_modules ( $id_agent , $fields , $filter , $indexed , true , $force_tags );
}
2019-02-21 13:21:05 +01:00
// Restore db connection.
2019-01-30 16:18:44 +01:00
metaconsole_restore_db ();
}
} else {
2019-02-21 13:21:05 +01:00
// Get all agents if no agent was given.
2019-01-30 16:18:44 +01:00
if ( $id_agent == 0 ) {
$id_agent = array_keys (
agents_get_group_agents (
array_keys ( users_get_groups ()),
$search ,
'none'
)
);
}
$agent_modules = agents_get_modules ( $id_agent , $fields , $filter , $indexed , true , $force_tags );
}
if ( empty ( $agent_modules )) {
$agent_modules = [];
}
foreach ( $agent_modules as $key => $module ) {
$agent_modules [ $key ][ 'nombre' ] = io_safe_output ( $module [ 'nombre' ]);
}
$get_order_json = ( bool ) get_parameter ( 'get_order_json' , false );
if ( $get_order_json ) {
$new_elements = [];
$index = 0 ;
foreach ( $agent_modules as $key => $module ) {
$new_elements [ $index ][ 'id_agente_modulo' ] = $module [ 'id_agente_modulo' ];
$new_elements [ $index ][ 'nombre' ] = io_safe_output ( $module [ 'nombre' ]);
$index ++ ;
}
$agent_modules = $new_elements ;
}
echo json_encode ( $agent_modules );
return ;
}
if ( $get_agent_status_tooltip ) {
$id_agent = ( int ) get_parameter ( 'id_agent' );
$metaconsole = ( bool ) get_parameter ( 'metaconsole' , false );
$id_server = ( int ) get_parameter ( 'id_server' , 0 );
2019-02-21 13:21:05 +01:00
// Metaconsole.
2019-01-30 16:18:44 +01:00
$server = null ;
if ( $metaconsole ) {
$filter = [];
if ( ! empty ( $id_agent )) {
$filter [ 'id_tagente' ] = $id_agent ;
}
if ( ! empty ( $id_server )) {
$filter [ 'id_tmetaconsole_setup' ] = $id_server ;
}
$agent = db_get_row_filter ( 'tmetaconsole_agent' , $filter );
} else {
$agent = db_get_row ( 'tagente' , 'id_agente' , $id_agent );
}
if ( $agent === false ) {
return ;
}
echo '<h3>' . $agent [ 'nombre' ] . '</h3>' ;
echo '<strong>' . __ ( 'Main IP' ) . ':</strong> ' . $agent [ 'direccion' ] . '<br />' ;
echo '<strong>' . __ ( 'Group' ) . ':</strong> ' ;
$hack_metaconsole = '' ;
if ( $metaconsole ) {
$hack_metaconsole = '../../' ;
}
echo html_print_image ( $hack_metaconsole . 'images/groups_small/' . groups_get_icon ( $agent [ 'id_grupo' ]) . '.png' , true );
echo groups_get_name ( $agent [ 'id_grupo' ]) . '<br />' ;
echo '<strong>' . __ ( 'Last contact' ) . ':</strong> ' . human_time_comparation ( $agent [ 'ultimo_contacto' ]) . '<br />' ;
echo '<strong>' . __ ( 'Last remote contact' ) . ':</strong> ' . human_time_comparation ( $agent [ 'ultimo_contacto_remoto' ]) . '<br />' ;
if ( ! $metaconsole ) {
2019-02-21 13:21:05 +01:00
// Fix : Only show agents with module with tags of user profile.
2019-01-30 16:18:44 +01:00
$_user_tags = tags_get_user_tags ( $config [ 'id_user' ], 'RR' );
$_sql_post = '' ;
if ( is_array ( $_user_tags ) && ! empty ( $_user_tags )) {
$_tags = implode ( ',' , array_keys ( $_user_tags ));
$_sql_post .= ' AND tagente_modulo.id_agente_modulo IN (SELECT a.id_agente_modulo FROM tagente_modulo a, ttag_module b WHERE a.id_agente_modulo=b.id_agente_modulo AND b.id_tag IN (' . $_tags . ')) ' ;
}
$sql = sprintf (
' SELECT tagente_modulo . descripcion ,
2015-04-21 14:01:10 +02:00
tagente_modulo . nombre
FROM tagente_estado , tagente_modulo
WHERE tagente_modulo . id_agente = % d
AND tagente_estado . id_agente_modulo = tagente_modulo . id_agente_modulo
AND tagente_modulo . disabled = 0
2019-01-30 16:18:44 +01:00
AND tagente_estado . estado = 1 ' ,
$id_agent
);
$sql .= $_sql_post ;
$bad_modules = db_get_all_rows_sql ( $sql );
$sql = sprintf (
' SELECT COUNT ( * )
2015-04-21 14:01:10 +02:00
FROM tagente_modulo
WHERE id_agente = % d
2019-01-30 16:18:44 +01:00
AND disabled = 0 ' ,
$id_agent
);
$total_modules = db_get_sql ( $sql );
if ( $bad_modules === false ) {
$size_bad_modules = 0 ;
} else {
2019-02-21 13:21:05 +01:00
$size_bad_modules = count ( $bad_modules );
2019-01-30 16:18:44 +01:00
}
2019-02-21 13:21:05 +01:00
// Modules down.
2019-01-30 16:18:44 +01:00
if ( $size_bad_modules > 0 ) {
echo '<strong>' . __ ( 'Monitors down' ) . ':</strong> ' . $size_bad_modules . ' / ' . $total_modules ;
echo '<ul>' ;
foreach ( $bad_modules as $module ) {
echo '<li>' ;
echo ui_print_truncate_text ( $module [ 'nombre' ], 'module_small' );
echo '</li>' ;
}
echo '</ul>' ;
}
2019-02-21 13:21:05 +01:00
// Alerts (if present).
2019-01-30 16:18:44 +01:00
$sql = sprintf (
' SELECT COUNT ( talert_template_modules . id )
2015-04-21 14:01:10 +02:00
FROM talert_template_modules , tagente_modulo , tagente
WHERE tagente . id_agente = % d
AND tagente . disabled = 0
AND tagente . id_agente = tagente_modulo . id_agente
AND tagente_modulo . disabled = 0
AND tagente_modulo . id_agente_modulo = talert_template_modules . id_agent_module
AND talert_template_modules . times_fired > 0 ' ,
2019-01-30 16:18:44 +01:00
$id_agent
);
$alert_modules = ( int ) db_get_sql ( $sql );
if ( $alert_modules > 0 ) {
$sql = sprintf (
' SELECT tagente_modulo . nombre , talert_template_modules . last_fired
2015-04-21 14:01:10 +02:00
FROM talert_template_modules , tagente_modulo , tagente
WHERE tagente . id_agente = % d
AND tagente . disabled = 0
AND tagente . id_agente = tagente_modulo . id_agente
AND tagente_modulo . disabled = 0
AND tagente_modulo . id_agente_modulo = talert_template_modules . id_agent_module
AND talert_template_modules . times_fired > 0 ' ,
2019-01-30 16:18:44 +01:00
$id_agent
);
$alerts = db_get_all_rows_sql ( $sql );
echo '<strong>' . __ ( 'Alerts fired' ) . ':</strong>' ;
echo '<ul>' ;
foreach ( $alerts as $alert_item ) {
echo '<li>' ;
echo ui_print_truncate_text ( $alert_item [ 'nombre' ]) . ' -> ' ;
echo human_time_comparation ( $alert_item [ 'last_fired' ]);
echo '</li>' ;
}
echo '</ul>' ;
}
}
return ;
}
if ( $get_agentmodule_status_tooltip ) {
$id_module = ( int ) get_parameter ( 'id_module' );
$metaconsole = ( bool ) get_parameter ( 'metaconsole' );
$id_server = ( int ) get_parameter ( 'id_server' );
if ( $metaconsole ) {
$server = db_get_row ( 'tmetaconsole_setup' , 'id' , $id_server );
if ( metaconsole_connect ( $server ) != NOERR ) {
return ;
}
}
$module = db_get_row ( 'tagente_modulo' , 'id_agente_modulo' , $id_module );
echo '<h3>' ;
echo html_print_image ( 'images/brick.png' , true ) . ' ' ;
echo ui_print_truncate_text ( $module [ 'nombre' ], 'module_small' , false , true , false ) . '</h3>' ;
echo '<strong>' . __ ( 'Type' ) . ':</strong> ' ;
$agentmoduletype = modules_get_agentmodule_type ( $module [ 'id_agente_modulo' ]);
echo modules_get_moduletype_name ( $agentmoduletype ) . ' ' ;
echo html_print_image ( 'images/' . modules_get_type_icon ( $agentmoduletype ), true ) . '<br />' ;
echo '<strong>' . __ ( 'Module group' ) . ':</strong> ' ;
$modulegroup = modules_get_modulegroup_name ( modules_get_agentmodule_modulegroup ( $module [ 'id_agente_modulo' ]));
if ( $modulegroup === false ) {
echo __ ( 'None' ) . '<br />' ;
} else {
echo $modulegroup . '<br />' ;
}
echo '<strong>' . __ ( 'Agent' ) . ':</strong> ' ;
echo ui_print_truncate_text ( modules_get_agentmodule_agent_alias ( $module [ 'id_agente_modulo' ]), 'agent_small' , false , true , false ) . '<br />' ;
if ( $module [ 'id_tipo_modulo' ] == 18 ) {
echo '<strong>' . __ ( 'Address' ) . ':</strong> ' ;
2019-02-21 13:21:05 +01:00
// Get the IP/IPs from the module description Always the IP
// is the last part of the description (after the last space).
2019-01-30 16:18:44 +01:00
$ips = explode ( ' ' , $module [ 'descripcion' ]);
$ips = $ips [( count ( $ips ) - 1 )];
$ips = explode ( ',' , $ips );
if ( count ( $ips ) == 1 ) {
echo $ips [ 0 ];
} else {
echo '<ul style="display:inline;">' ;
foreach ( $ips as $ip ) {
2019-02-21 13:21:05 +01:00
echo '<li>' . $ip . '</li>' ;
2019-01-30 16:18:44 +01:00
}
echo '</ul>' ;
}
}
if ( $metaconsole ) {
metaconsole_restore_db ();
}
return ;
}
if ( $get_group_status_tooltip ) {
$id_group = ( int ) get_parameter ( 'id_group' );
$group = db_get_row ( 'tgrupo' , 'id_grupo' , $id_group );
echo '<h3>' . html_print_image ( 'images/groups_small/' . groups_get_icon ( $group [ 'id_grupo' ]) . '.png' , true );
echo ui_print_truncate_text ( $group [ 'nombre' ], GENERIC_SIZE_TEXT , false , true , false ) . '</h3>' ;
echo '<strong>' . __ ( 'Parent' ) . ':</strong> ' ;
if ( $group [ 'parent' ] == 0 ) {
echo __ ( 'None' ) . '<br />' ;
} else {
$group_parent = db_get_row ( 'tgrupo' , 'id_grupo' , $group [ 'parent' ]);
echo html_print_image ( 'images/groups_small/' . groups_get_icon ( $group [ 'parent' ]) . '.png' , true );
echo $group_parent [ 'nombre' ] . '<br />' ;
}
echo '<strong>' . __ ( 'Sons' ) . ':</strong> ' ;
$groups_sons = db_get_all_fields_in_table ( 'tgrupo' , 'parent' , $group [ 'id_grupo' ]);
if ( $groups_sons === false ) {
echo __ ( 'None' ) . '<br />' ;
} else {
echo '<br /><br />' ;
foreach ( $groups_sons as $group_son ) {
echo html_print_image ( 'images/groups_small/' . groups_get_icon ( $group_son [ 'id_grupo' ]) . '.png' , true );
echo $group_son [ 'nombre' ] . '<br />' ;
}
}
return ;
}
if ( $get_agent_id ) {
$agent_name = ( string ) get_parameter ( 'agent_name' );
echo agents_get_agent_id ( $agent_name );
return ;
}
if ( $get_agents_source_json ) {
$source = get_parameter ( 'source' , '' );
if ( empty ( $source )) {
$sql_report_log = ' SELECT id_agente , alias
2018-05-31 17:33:51 +02:00
FROM tagente , tagent_module_log
WHERE tagente . id_agente = tagent_module_log . id_agent AND tagente . disabled = 0 ' ;
2019-01-30 16:18:44 +01:00
} else {
$sql_report_log = ' SELECT id_agente , alias
2018-05-31 17:33:51 +02:00
FROM tagente , tagent_module_log
2019-01-30 16:18:44 +01:00
WHERE tagente . id_agente = tagent_module_log . id_agent AND tagente . disabled = 0 AND tagent_module_log . source like " '. $source .' " ' ;
}
$all_agent_log = db_get_all_rows_sql ( $sql_report_log );
foreach ( $all_agent_log as $key => $value ) {
$agents2 [ $value [ 'id_agente' ]] = $value [ 'alias' ];
}
echo json_encode ( $agents2 );
return ;
}
return ;
2008-06-17 Esteban Sanchez <estebans@artica.es>
* ajax.php: Added to repository. AJAX interface for Pandora. A new
time is coming...
* pandoradb.sql: Added id_group to treport. A report is now assigned
to a group of agents. Changes in treport_content to add an order
field, drop sla fields and use an enum for the type. NOTE: This will
break all your current defined reports, update under your
responsabillity. Added table treport_content_sla_combined to define
SLAs in the SLA types reports.
* godmode/reporting/graph_builder.php: Use Pandora functions. Adde
javascript code to display the module icon when changing from the
dropdown menu.
* godmode/reporting/reporting_builder.php: Almost complet rewritten to
use Pandora HTML functions. Style correction.
* include/functions.php: Added new report types. Style correction.
* include/functions_db.php: Use Pandora database functions to get
simple values. Added functions get_agents_in_group(),
get_modules_in_agent(), get_simple_alerts_in_agent(),
get_combined_alerts_in_agent(), get_alerts_in_agent(),
get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(),
get_alert_fires_in_period(),
get_alert_last_fire_timestamp_in_period(). Deleted debug output and
fixed calling to an inexistent function in
return_moduledata_sum_value().
* include/functions_html.php: Tab style correction. Thanks to Ramon
for the advice. Fixed some errors on print_table that was causing not
to work fine if rowclass or colspan was defined.
* include/functions_reporting.php: Adde date support to
return_module_SLA(), event_reporting(). Added alert_reporting(),
monitor_health_reporting(), general_group_reporting() and
agents_detailed_reporting() to implement new report types. Style
correction.
* include/javascript/pandora.js: Added html_entity_decode() function
to decode some AJAX results.
* javascript/jquery.js: Added to repository. jQuery version 1.2.4a
* include/javascript/jquery.timeentry.js: jQuery plugin to manage time
inputs.
* include/javascript/jquery.ui.datepicker.js: jQuery plugin to manage
date inputs in a dropdown calendar.
* include/languages/date_*.js, include/languages/time_*.js: Added to
repository. Translation of date and time strings for the new calendar
javascript support.
* include/languages/language_en.php: Added new strings relatives to
reports.
* include/languages/language_de.php,
include/languages/language_fr.php, include/languages/language_gl.php,
include/languages/language_pt_br.php: Fixed a variable name.
* godmode/groups/group_list.php: Avoid the use of an extra indentation
by returning if no success on comprueba_login().
* include/styles/pandora.css: Add some classes. Tab style correction.
* operation/agentes/ver_agente.php: Added AJAX support to agent
operations.
* operation/reporting/graph_viewer.php: Period dropdown selection
improved and printed with Pandora functions.
* operation/reporting/reporting_viewer.php: Massive rewritten.
Implemented date and time support, added new report types, use Pandora
functions...
* reporting/fgraph.php: Documentation fix. Added a new graphic to show
monitors health.
* godmode/agentes/agent_manager.php,
operation/reporting/custom_reporting.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@869 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-17 16:30:44 +02:00
}
2019-01-30 16:18:44 +01:00
$id_agente = ( int ) get_parameter ( 'id_agente' , 0 );
if ( empty ( $id_agente )) {
return ;
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2019-01-30 16:18:44 +01:00
$agent_a = check_acl ( $config [ 'id_user' ], 0 , 'AR' );
$agent_w = check_acl ( $config [ 'id_user' ], 0 , 'AW' );
2016-09-08 16:06:12 +02:00
$access = ( $agent_a == true ) ? 'AR' : (( $agent_w == true ) ? 'AW' : 'AR' );
2019-01-30 16:18:44 +01:00
$agent = db_get_row ( 'tagente' , 'id_agente' , $id_agente );
2019-02-21 13:21:05 +01:00
// Get group for this id_agente.
2010-01-27 13:50:28 +01:00
$id_grupo = $agent [ 'id_grupo' ];
2011-11-24 19:19:09 +01:00
2019-01-30 16:18:44 +01:00
$is_extra = enterprise_hook ( 'policies_is_agent_extra_policy' , [ $id_agente ]);
2011-11-24 19:19:09 +01:00
2012-02-13 13:54:41 +01:00
if ( $is_extra === ENTERPRISE_NOT_HOOK ) {
2019-01-30 16:18:44 +01:00
$is_extra = false ;
2011-11-24 19:19:09 +01:00
}
2019-01-30 16:18:44 +01:00
$all_groups = agents_get_all_groups_agent ( $id_agente , $id_grupo );
2018-03-26 12:52:37 +02:00
2019-01-30 16:18:44 +01:00
if ( ! check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AR' ) && ! check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' , $id_agente ) && ! $is_extra ) {
db_pandora_audit (
'ACL Violation' ,
'Trying to access (read) to agent ' . agents_get_name ( $id_agente )
);
include 'general/noaccess.php' ;
return ;
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2008-07-21 14:23:28 +02:00
2019-02-21 13:21:05 +01:00
// Check for Network FLAG change request.
2010-10-06 13:04:16 +02:00
$flag = get_parameter ( 'flag' , '' );
if ( $flag !== '' ) {
2019-01-30 16:18:44 +01:00
if ( $flag == 1 && check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
$id_agent_module = get_parameter ( 'id_agente_modulo' );
db_process_sql_update (
'tagente_modulo' ,
[ 'flag' => 1 ],
[ 'id_agente_modulo' => $id_agent_module ]
);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2019-01-30 16:18:44 +01:00
2019-02-21 13:21:05 +01:00
// Check for Network FLAG change request.
2019-01-30 16:18:44 +01:00
$flag_agent = get_parameter ( 'flag_agent' , '' );
2012-02-13 13:54:41 +01:00
if ( $flag_agent !== '' ) {
2019-01-30 16:18:44 +01:00
if ( $flag_agent == 1 && check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
db_process_sql_update ( 'tagente_modulo' , [ 'flag' => 1 ], [ 'id_agente' => $id_agente ]);
}
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}
2019-01-30 16:18:44 +01:00
if ( $agent [ 'icon_path' ]) {
$icon = gis_get_agent_icon_map ( $agent [ 'id_agente' ], true );
} else {
$icon = 'images/bricks.png' ;
2010-01-27 13:50:28 +01:00
}
2010-07-23 12:55:20 +02:00
2019-02-21 13:21:05 +01:00
// Code for the tabs in the header of agent page.
2019-01-30 16:18:44 +01:00
$tab = get_parameter ( 'tab' , 'main' );
2019-02-21 13:21:05 +01:00
// Manage tab.
2019-01-30 16:18:44 +01:00
$managetab = [];
2010-07-23 12:55:20 +02:00
2019-01-30 16:18:44 +01:00
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' ) || $is_extra ) {
$managetab [ 'text' ] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '">' . html_print_image ( 'images/setup.png' , true , [ 'title' => __ ( 'Manage' )]) . '</a>' ;
2013-08-30 13:21:51 +02:00
2019-01-30 16:18:44 +01:00
if ( $tab == 'manage' ) {
$managetab [ 'active' ] = true ;
} else {
$managetab [ 'active' ] = false ;
}
$managetab [ 'godmode' ] = 1 ;
2006-03-27 05:37:27 +02:00
}
2008-07-21 14:23:28 +02:00
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2019-02-21 13:21:05 +01:00
// Main tab.
2019-01-30 16:18:44 +01:00
$maintab [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente . '">' . html_print_image ( 'images/agent_mc.png' , true , [ 'title' => __ ( 'Main' )]) . '</a>' ;
2013-08-30 13:21:51 +02:00
2019-01-30 16:18:44 +01:00
if ( $tab == 'main' ) {
$maintab [ 'active' ] = true ;
} else {
$maintab [ 'active' ] = false ;
}
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2013-08-30 13:21:51 +02:00
2019-02-21 13:21:05 +01:00
// Alert tab.
2019-01-30 16:18:44 +01:00
$alerttab [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente . '&tab=alert">' . html_print_image ( 'images/op_alerts.png' , true , [ 'title' => __ ( 'Alerts' )]) . '</a>' ;
2013-08-30 13:21:51 +02:00
2019-01-30 16:18:44 +01:00
if ( $tab == 'alert' ) {
$alerttab [ 'active' ] = true ;
} else {
$alerttab [ 'active' ] = false ;
}
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2019-02-21 13:21:05 +01:00
// Inventory.
2019-01-30 16:18:44 +01:00
$inventorytab = enterprise_hook ( 'inventory_tab' );
if ( $inventorytab == - 1 ) {
$inventorytab = '' ;
}
2010-07-23 12:55:20 +02:00
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2019-02-21 13:21:05 +01:00
// Collection.
2010-07-23 12:55:20 +02:00
$collectiontab = enterprise_hook ( 'collection_tab' );
2019-01-30 16:18:44 +01:00
if ( $collectiontab == - 1 ) {
$collectiontab = '' ;
}
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2019-02-21 13:21:05 +01:00
// Policy.
2010-10-21 17:06:53 +02:00
$policyTab = enterprise_hook ( 'policy_tab' );
2019-01-30 16:18:44 +01:00
if ( $policyTab == - 1 ) {
$policyTab = '' ;
}
2019-02-21 13:21:05 +01:00
// WUX Console.
2019-01-30 16:18:44 +01:00
$modules_wux = enterprise_hook ( 'get_wux_modules' , [ $id_agente ]);
if ( $modules_wux ) {
$wux_console_tab = enterprise_hook ( 'wux_console_tab' );
if ( $wux_console_tab == - 1 ) {
$wux_console_tab = '' ;
}
2017-08-18 12:42:48 +02:00
}
2013-08-30 13:21:51 +02:00
2019-01-30 16:18:44 +01:00
$url_route_analyzer = enterprise_hook ( 'get_url_route_analyzer_modules' , [ $id_agente ]);
2017-09-08 09:01:58 +02:00
if ( $url_route_analyzer ) {
2019-01-30 16:18:44 +01:00
$url_route_analyzer_tab = enterprise_hook ( 'url_route_analyzer_tab' );
if ( $url_route_analyzer_tab == - 1 ) {
$url_route_analyzer_tab = '' ;
}
2017-09-08 09:01:58 +02:00
}
2019-02-21 13:21:05 +01:00
// GIS tab.
2019-01-30 16:18:44 +01:00
$gistab = [];
2010-01-25 16:29:33 +01:00
if ( $config [ 'activate_gis' ]) {
2019-01-30 16:18:44 +01:00
$gistab [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente=' . $id_agente . '">' . html_print_image ( 'images/op_gis.png' , true , [ 'title' => __ ( 'GIS data' )]) . '</a>' ;
if ( $tab == 'gis' ) {
$gistab [ 'active' ] = true ;
} else {
$gistab [ 'active' ] = false ;
}
2010-01-25 16:29:33 +01:00
}
2012-01-23 18:01:00 +01:00
2019-02-21 13:21:05 +01:00
// Incident tab.
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
$total_incidents = agents_get_count_incidents ( $id_agente );
2017-01-25 12:40:42 +01:00
if ( $total_incidents > 0 ) {
2019-01-30 16:18:44 +01:00
$incidenttab [ 'text' ] = '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&tab=incident&id_agente=' . $id_agente . '">' . html_print_image ( 'images/book_edit.png' , true , [ 'title' => __ ( 'Incidents' )]) . '</a>' ;
if ( $tab == 'incident' ) {
$incidenttab [ 'active' ] = true ;
} else {
$incidenttab [ 'active' ] = false ;
}
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
}
2010-08-25 14:04:42 +02:00
2019-02-21 13:21:05 +01:00
// Url address tab.
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
if ( $agent [ 'url_address' ] != '' ) {
2019-01-30 16:18:44 +01:00
$urladdresstab [ 'text' ] = '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&tab=url_address&id_agente=' . $id_agente . '">' . html_print_image ( 'images/link.png' , true , [ 'title' => __ ( 'Url address' )]) . '</a>' ;
}
if ( $tab == 'url_address' ) {
$urladdresstab [ 'active' ] = true ;
} else {
$urladdresstab [ 'active' ] = false ;
2012-01-23 19:36:22 +01:00
}
2019-02-21 13:21:05 +01:00
// Custom fields tab.
2019-01-30 16:18:44 +01:00
$custom_fields [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente=' . $id_agente . '">' . html_print_image ( 'images/custom_field.png' , true , [ 'title' => __ ( 'Custom fields' )]) . '</a>' ;
2010-08-25 14:04:42 +02:00
if ( $tab == 'custom_fields' ) {
2019-01-30 16:18:44 +01:00
$custom_fields [ 'active' ] = true ;
} else {
$custom_fields [ 'active' ] = false ;
2010-08-25 14:04:42 +02:00
}
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
2019-02-21 13:21:05 +01:00
// Graphs tab.
2019-01-30 16:18:44 +01:00
$graphs [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente=' . $id_agente . '">' . html_print_image ( 'images/chart.png' , true , [ 'title' => __ ( 'Graphs' )]) . '</a>' ;
2010-09-13 12:26:33 +02:00
if ( $tab == 'graphs' ) {
2019-01-30 16:18:44 +01:00
$graphs [ 'active' ] = true ;
} else {
$graphs [ 'active' ] = false ;
2010-09-13 12:26:33 +02:00
}
2010-11-15 14:36:01 +01:00
2019-02-21 13:21:05 +01:00
// Log viewer tab.
2014-12-05 10:49:50 +01:00
if ( enterprise_installed () && $config [ 'log_collector' ]) {
2019-01-30 16:18:44 +01:00
$is_windows = strtoupper ( substr ( PHP_OS , 0 , 3 )) == 'WIN' ;
$agent_has_logs = ( bool ) db_get_value ( 'id_agent' , 'tagent_module_log' , 'id_agent' , $id_agente );
if ( $agent_has_logs && ! $is_windows ) {
$log_viewer_tab = [];
$log_viewer_tab [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente=' . $id_agente . '">' . html_print_image ( 'images/gm_log.png' , true , [ 'title' => __ ( 'Log Viewer' )]) . '</a>' ;
$log_viewer_tab [ 'active' ] = $tab == 'log_viewer' ;
}
2014-12-05 10:49:50 +01:00
}
2019-02-21 13:21:05 +01:00
// EHorus tab.
2016-06-22 14:50:57 +02:00
if ( $config [ 'ehorus_enabled' ] && ! empty ( $config [ 'ehorus_custom_field' ])
2019-05-13 15:00:29 +02:00
&& ( check_acl_one_of_groups (
$config [ 'id_user' ],
$all_groups ,
2019-05-13 17:28:23 +02:00
'AW'
2019-05-13 15:00:29 +02:00
) || is_user_admin ( $config [ 'id_user' ]))
2019-01-30 16:18:44 +01:00
) {
2019-05-13 15:00:29 +02:00
$user_info = users_get_user_by_id ( $config [ 'id_user' ]);
2019-05-29 09:51:26 +02:00
if ( $config [ 'ehorus_user_level_conf' ] && ! $user_info [ 'ehorus_user_level_enabled' ]) {
2019-05-28 17:19:13 +02:00
// If ehorus user configuration is enabled, and userr acces level is disabled do not show eHorus tab.
2019-05-13 15:00:29 +02:00
} else {
$ehorus_agent_id = agents_get_agent_custom_field ( $id_agente , $config [ 'ehorus_custom_field' ]);
if ( ! empty ( $ehorus_agent_id )) {
$tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente=' . $id_agente ;
$ehorus_tab [ 'text' ] = '<a href="' . $tab_url . '" class="ehorus_tab">' . html_print_image ( 'images/ehorus/ehorus.png' , true , [ 'title' => __ ( 'eHorus' )]) . '</a>' ;
// Hidden subtab layer.
$ehorus_tab [ 'sub_menu' ] = '<ul class="mn subsubmenu" style="float:none;">' ;
$ehorus_tab [ 'sub_menu' ] .= '<a class="tab_terminal" href="' . $tab_url . '&client_tab=terminal">' ;
$ehorus_tab [ 'sub_menu' ] .= '<li class="nomn tab_godmode" style="text-align: center;">' . html_print_image ( 'images/ehorus/terminal.png' , true , [ 'title' => __ ( 'Terminal' )]);
$ehorus_tab [ 'sub_menu' ] .= '</li>' ;
$ehorus_tab [ 'sub_menu' ] .= '</a>' ;
$ehorus_tab [ 'sub_menu' ] .= '<a class="tab_display" href="' . $tab_url . '&client_tab=display">' ;
$ehorus_tab [ 'sub_menu' ] .= '<li class="nomn tab_godmode" style="text-align: center;">' . html_print_image ( 'images/ehorus/vnc.png' , true , [ 'title' => __ ( 'Display' )]);
$ehorus_tab [ 'sub_menu' ] .= '</li>' ;
$ehorus_tab [ 'sub_menu' ] .= '</a>' ;
$ehorus_tab [ 'sub_menu' ] .= '<a class="tab_processes" href="' . $tab_url . '&client_tab=processes">' ;
$ehorus_tab [ 'sub_menu' ] .= '<li class="nomn tab_godmode" style="text-align: center;">' . html_print_image ( 'images/ehorus/processes.png' , true , [ 'title' => __ ( 'Processes' )]);
$ehorus_tab [ 'sub_menu' ] .= '</li>' ;
$ehorus_tab [ 'sub_menu' ] .= '</a>' ;
$ehorus_tab [ 'sub_menu' ] .= '<a class="tab_services" href="' . $tab_url . '&client_tab=services">' ;
$ehorus_tab [ 'sub_menu' ] .= '<li class="nomn tab_godmode" style="text-align: center;">' . html_print_image ( 'images/ehorus/services.png' , true , [ 'title' => __ ( 'Services' )]);
$ehorus_tab [ 'sub_menu' ] .= '</li>' ;
$ehorus_tab [ 'sub_menu' ] .= '</a>' ;
$ehorus_tab [ 'sub_menu' ] .= '<a class="tab_files" href="' . $tab_url . '&client_tab=files">' ;
$ehorus_tab [ 'sub_menu' ] .= '<li class="nomn tab_godmode" style="text-align: center;">' . html_print_image ( 'images/ehorus/files.png' , true , [ 'title' => __ ( 'Files' )]);
$ehorus_tab [ 'sub_menu' ] .= '</li>' ;
$ehorus_tab [ 'sub_menu' ] .= '</a>' ;
$ehorus_tab [ 'sub_menu' ] .= '</ul>' ;
$ehorus_tab [ 'active' ] = $tab == 'ehorus' ;
}
2019-01-30 16:18:44 +01:00
}
2016-05-04 19:21:24 +02:00
}
2014-12-05 10:49:50 +01:00
2019-11-20 18:01:07 +01:00
$is_sap = agents_get_sap_agents ( $id_agente );
if ( $is_sap ) {
$saptab [ 'text' ] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sap_view&page=1&id_agente=' . $id_agente . '">' . html_print_image ( 'images/sap_icon.png' , true , [ 'title' => __ ( 'SAP view' )]) . '</a>' ;
if ( $tab == 'sap_view' ) {
$saptab [ 'active' ] = true ;
} else {
$saptab [ 'active' ] = false ;
}
} else {
$saptab = '' ;
}
2019-01-30 16:18:44 +01:00
$onheader = [
'manage' => $managetab ,
'main' => $maintab ,
'alert' => $alerttab ,
'inventory' => $inventorytab ,
'collection' => $collectiontab ,
'gis' => $gistab ,
'custom' => $custom_fields ,
'graphs' => $graphs ,
'policy' => $policyTab ,
'ux_console' => $ux_console_tab ,
'wux_console' => $wux_console_tab ,
'url_route_analyzer' => $url_route_analyzer_tab ,
2019-11-20 18:01:07 +01:00
'sap_view' => $saptab ,
2019-01-30 16:18:44 +01:00
];
// Added after it exists
2019-02-21 13:21:05 +01:00
// If the agent has incidents associated.
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
if ( $total_incidents ) {
2019-01-30 16:18:44 +01:00
$onheader [ 'incident' ] = $incidenttab ;
2012-01-23 18:01:00 +01:00
}
2019-01-30 16:18:44 +01:00
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.oracle.sql, operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php,
operation/agentes/ver_agente.php,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php, pandoradb.sql,
pandoradb.postgreSQL.sql: added the feature to set a agent in
"Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 19:12:02 +02:00
if ( $agent [ 'url_address' ] != '' ) {
2019-01-30 16:18:44 +01:00
$onheader [ 'url_address' ] = $urladdresstab ;
2012-01-23 19:36:22 +01:00
}
2019-01-30 16:18:44 +01:00
2019-02-21 13:21:05 +01:00
// If the log viewer tab exists.
2014-12-05 10:49:50 +01:00
if ( isset ( $log_viewer_tab ) && ! empty ( $log_viewer_tab )) {
2019-01-30 16:18:44 +01:00
$onheader [ 'log_viewer' ] = $log_viewer_tab ;
2014-12-05 10:49:50 +01:00
}
2019-01-30 16:18:44 +01:00
2019-02-21 13:21:05 +01:00
// If the ehorus id exists.
2016-05-05 18:32:34 +02:00
if ( isset ( $ehorus_tab ) && ! empty ( $ehorus_tab )) {
2019-01-30 16:18:44 +01:00
$onheader [ 'ehorus' ] = $ehorus_tab ;
2016-05-04 19:21:24 +02:00
}
2012-01-23 19:36:22 +01:00
2019-02-21 13:21:05 +01:00
// Tabs for extensions.
2019-05-27 19:00:48 +02:00
$tab_name_extensions = '' ;
2013-08-30 13:21:51 +02:00
foreach ( $config [ 'extensions' ] as $extension ) {
2019-01-30 16:18:44 +01:00
if ( isset ( $extension [ 'extension_ope_tab' ]) && ! isset ( $extension [ 'extension_god_tab' ])) {
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , $extension [ 'extension_ope_tab' ][ 'acl' ])) {
2019-02-21 13:21:05 +01:00
// VMware extension is only available for VMware OS.
2019-01-30 16:18:44 +01:00
if ( $extension [ 'extension_ope_tab' ][ 'id' ] === 'vmware_manager' ) {
2019-02-21 13:21:05 +01:00
// Check if OS is vmware.
2019-01-30 16:18:44 +01:00
$id_remote_field = db_get_value (
'id_field' ,
'tagent_custom_fields' ,
'name' ,
'vmware_type'
);
$vmware_type = db_get_value_filter (
'description' ,
'tagent_custom_data' ,
[
'id_field' => $id_remote_field ,
'id_agent' => $agent [ 'id_agente' ],
]
);
if ( $vmware_type != 'vm' ) {
continue ;
}
}
2019-02-21 13:21:05 +01:00
// RHEV extension is only available for RHEV Virtual Machines.
2019-01-30 16:18:44 +01:00
if ( $extension [ 'extension_ope_tab' ][ 'id' ] === 'rhev_manager' ) {
2019-02-21 13:21:05 +01:00
// Get id for remote field "rhev_type".
2019-01-30 16:18:44 +01:00
$id_remote_field = db_get_value ( 'id_field' , 'tagent_custom_fields' , 'name' , 'rhev_type' );
2019-02-21 13:21:05 +01:00
// Get rhev type for this agent.
2019-01-30 16:18:44 +01:00
$rhev_type = db_get_value_filter ( 'description' , 'tagent_custom_data' , [ 'id_field' => $id_remote_field , 'id_agent' => $agent [ 'id_agente' ]]);
2019-02-21 13:21:05 +01:00
// Check if rhev type is a vm.
2019-01-30 16:18:44 +01:00
if ( $rhev_type != 'vm' ) {
continue ;
}
}
$image = $extension [ 'extension_ope_tab' ][ 'icon' ];
$name = $extension [ 'extension_ope_tab' ][ 'name' ];
$id = $extension [ 'extension_ope_tab' ][ 'id' ];
2019-05-27 19:00:48 +02:00
$tab_name_extensions = $name ;
2019-01-30 16:18:44 +01:00
$id_extension = get_parameter ( 'id_extension' , '' );
if ( $id_extension == $id ) {
$active = true ;
} else {
$active = false ;
}
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente=' . $id_agente . '&id_extension=' . $id ;
$extension_tab = [
'text' => '<a href="' . $url . '">' . html_print_image ( $image , true , [ 'title' => $name ]) . '</a>' ,
'active' => $active ,
];
$onheader = ( $onheader + [ $id => $extension_tab ]);
}
}
2010-11-15 14:36:01 +01:00
}
2019-04-24 13:53:18 +02:00
switch ( $tab ) {
2019-05-27 19:00:48 +02:00
case 'custom_fields' :
$tab_name = 'Custom fields' ;
break ;
case 'gis' :
$tab_name = 'GIS data' ;
break ;
case 'manage' :
$tab_name = 'Manage' ;
2019-04-24 13:53:18 +02:00
break ;
case 'main' :
2019-05-27 19:00:48 +02:00
$tab_name = 'Main' ;
2019-04-24 13:53:18 +02:00
$help_header = 'agent_' . $tab . '_tab' ;
break ;
2019-05-27 19:00:48 +02:00
case 'data_view' :
$tab_name = '' ;
break ;
case 'alert' :
$tab_name = 'Alerts' ;
break ;
case 'inventory' :
$tab_name = 'Inventory' ;
break ;
case 'collection' :
$tab_name = 'Collection' ;
break ;
case 'policy' :
$tab_name = 'Policies' ;
break ;
case 'ux_console_tab' :
$tab_name = 'UX Console' ;
break ;
case 'wux_console_tab' :
$tab_name = 'WUX Console' ;
$help_header = 'wux_console_tab' ;
break ;
case 'url_route_analyzer_tab' :
$tab_name = 'URL Route Analyzer' ;
break ;
case 'graphs' ;
$tab_name = 'Graphs' ;
break ;
case 'incident' :
$tab_name = 'Incidents' ;
break ;
case 'url_address' :
$tab_name = 'Url address' ;
break ;
case 'log_viewer' :
$tab_name = 'Log viewer' ;
break ;
case 'ehorus' :
$tab_name = 'eHorus' ;
break ;
case 'extension' :
$tab_name = $tab_name_extensions ;
break ;
2019-11-20 18:01:07 +01:00
case 'sap_view' :
$tab_description = '- ' . __ ( 'SAP view' );
$help_header = 'sap_view' ;
$tab_name = 'SAP View' ;
break ;
2019-04-24 13:53:18 +02:00
default :
2019-05-27 19:00:48 +02:00
$tab_name = '' ;
2019-04-24 13:53:18 +02:00
$help_header = '' ;
break ;
2017-08-24 14:04:12 +02:00
}
2019-11-25 13:50:26 +01:00
if ( ! $config [ 'pure' ]) {
ui_print_page_header (
agents_get_alias ( $id_agente ),
$icon ,
false ,
2020-05-29 11:37:06 +02:00
'' ,
2019-11-25 13:50:26 +01:00
false ,
$onheader ,
false ,
'' ,
$config [ 'item_title_size_text' ],
'' ,
ui_print_breadcrums (
[
__ ( 'Monitoring' ),
__ ( 'View' ),
'<span class="breadcrumb_active">' . $tab_name . '</span>' ,
]
)
);
}
2010-07-23 12:55:20 +02:00
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
switch ( $tab ) {
2019-01-30 16:18:44 +01:00
case 'custom_fields' :
include 'custom_fields.php' ;
break ;
case 'gis' :
include 'gis_view.php' ;
break ;
case 'manage' :
include 'estado_generalagente.php' ;
break ;
case 'main' :
2019-05-27 14:12:53 +02:00
default :
2019-01-30 16:18:44 +01:00
include 'estado_generalagente.php' ;
echo " <a name='monitors'></a> " ;
include 'estado_monitores.php' ;
echo " <a name='alerts'></a> " ;
include 'alerts_status.php' ;
2020-07-15 09:25:39 +02:00
if ( $config [ 'log_collector' ]) {
echo " <a name='log_sources'></a> " ;
include 'log_sources_status.php' ;
}
2019-07-29 15:16:24 +02:00
// Check permissions to read events
if ( check_acl ( $config [ 'id_user' ], 0 , 'ER' )) {
echo " <a name='events'></a> " ;
include 'status_events.php' ;
}
2019-01-30 16:18:44 +01:00
break ;
case 'data_view' :
include 'datos_agente.php' ;
break ;
case 'alert' :
include 'alerts_status.php' ;
break ;
case 'inventory' :
enterprise_include ( 'operation/agentes/agent_inventory.php' );
break ;
case 'collection' :
enterprise_include ( 'operation/agentes/collection_view.php' );
break ;
case 'policy' :
enterprise_include ( 'operation/agentes/policy_view.php' );
break ;
case 'ux_console_tab' :
enterprise_include ( 'operation/agentes/ux_console_view.php' );
break ;
case 'wux_console_tab' :
enterprise_include ( 'operation/agentes/wux_console_view.php' );
break ;
case 'url_route_analyzer_tab' :
enterprise_include ( 'operation/agentes/url_route_analyzer.php' );
break ;
case 'graphs' ;
include 'operation/agentes/graphs.php' ;
break ;
case 'incident' :
include 'godmode/agentes/agent_incidents.php' ;
break ;
case 'url_address' :
include 'operation/agentes/url_address.php' ;
break ;
case 'log_viewer' :
$embebed_into_agent_view = true ;
enterprise_include ( 'operation/log/log_viewer.php' );
break ;
case 'ehorus' :
include 'operation/agentes/ehorus.php' ;
break ;
2019-11-20 18:01:07 +01:00
case 'sap_view' :
include 'general/sap_view.php' ;
break ;
2019-01-30 16:18:44 +01:00
case 'extension' :
$found = false ;
foreach ( $config [ 'extensions' ] as $extension ) {
if ( isset ( $extension [ 'extension_ope_tab' ])) {
$id = $extension [ 'extension_ope_tab' ][ 'id' ];
$function = $extension [ 'extension_ope_tab' ][ 'function' ];
$id_extension = get_parameter ( 'id_extension' , '' );
if ( $id_extension == $id ) {
call_user_func_array ( $function , []);
$found = true ;
}
}
}
if ( ! $found ) {
ui_print_error_message ( 'Invalid tab specified in ' . __FILE__ . ':' . __LINE__ );
}
break ;
2008-08-11 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added __ as an alias of lang_string().
* include/functions_reporting_pdf.php,
include/functions_reporting.php, include/functions.php,
include/functions_visual_map.php, index.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/incidents/incident_note.php,
operation/incidents/incident_search.php,
operation/incidents/incident_statistics.php,
operation/snmpconsole/snmp_alert.php,
operation/snmpconsole/snmp_view.php, operation/users/user.php,
operation/users/user_edit.php, operation/users/user_statistics.php,
operation/events/event_statistics.php, operation/events/events.php,
operation/visual_console/render_view.php,
operation/visual_console/index.php, operation/extensions.php,
operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_grupo.php, operation/agentes/export_csv.php,
operation/agentes/datos_agente.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_generalagente.php,
operation/agentes/estado_agente.php, operation/agentes/bulbs.php,
operation/agentes/status_events.php, operation/agentes/sla_view.php,
operation/agentes/exportdata.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php, operation/agentes/estadisticas.php,
operation/agentes/tactical.php, operation/agentes/networkmap.php,
operation/messages/message.php,
operation/reporting/reporting_viewer.php,
operation/reporting/graph_viewer.php,
operation/reporting/custom_reporting.php,
operation/servers/view_server.php,
operation/servers/view_server_detail.php, operation/menu.php,
reporting/fgraph.php, reporting/stat_win.php, ajax.php,
general/logoff.php, general/pandora_help.php, general/footer.php,
general/noaccess.php, general/logon_failed.php,
general/links_menu.php, general/login_page.php, general/logon_ok.php,
general/header.php, general/main_menu.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/setup/news.php, godmode/setup/links.php,
godmode/setup/setup.php, godmode/users/user_list.php,
godmode/users/configure_user.php, godmode/profiles/profile_list.php,
godmode/admin_access_logs.php, godmode/db/db_info_data.php,
godmode/db/db_main.php, godmode/db/db_audit.php,
godmode/db/db_sanity.php, godmode/db/db_refine.php,
godmode/db/db_info.php, godmode/db/db_event.php,
godmode/db/db_purge.php, godmode/extensions.php,
godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/alert_manager.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_disk_conf_editor.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/agent_manager.php,
godmode/modules/manage_network_components_form.php,
godmode/modules/manage_nc_groups_form.php,
godmode/modules/manage_network_templates.php,
godmode/modules/module_list.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php,
godmode/reporting/graph_builder.php, godmode/servers/plugin.php,
godmode/servers/manage_recontask.php,
godmode/servers/modificar_server.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php,
godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a
instead of $lang_label to future use of gettext. Style
corrections.
* godmode/agentes/planned_downtime.php: Rewritten to use Pandora
functions and adopt the UI style. Replaced lang_string with __().
* pandoradb.sql: Fields in tplanned_downtime renamed to fit
guidelines.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
}