2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
2019-05-27 21:30:46 +02:00
|
|
|
/**
|
2019-05-28 09:48:09 +02:00
|
|
|
* Agent status - general overview.
|
2019-05-27 21:30:46 +02:00
|
|
|
*
|
|
|
|
* @category Agent view status.
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Classic agent management view.
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
2023-06-08 12:42:10 +02:00
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
2019-05-27 21:30:46 +02:00
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2023-06-08 11:53:13 +02:00
|
|
|
* Copyright (c) 2005-2023 Pandora FMS
|
2023-06-08 13:19:01 +02:00
|
|
|
* Please see https://pandorafms.com/community/ for full contribution list
|
2019-05-27 21:30:46 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
2023-08-25 14:15:32 +02:00
|
|
|
use PandoraFMS\ITSM\ITSM;
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// Begin.
|
2010-03-02 20:25:51 +01:00
|
|
|
global $config;
|
2009-10-06 21:54:50 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_agents.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_graph.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_groups.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_ui.php';
|
|
|
|
require_once $config['homedir'].'/include/functions_reporting_html.php';
|
2011-05-11 11:08:47 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once $config['homedir'].'/include/functions_clippy.php';
|
2014-08-14 13:25:46 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
check_login();
|
2006-07-11 13:02:20 +02:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
$strict_user = (bool) db_get_value(
|
|
|
|
'strict_acl',
|
|
|
|
'tusuario',
|
|
|
|
'id_user',
|
|
|
|
$config['id_user']
|
|
|
|
);
|
2011-05-11 11:08:47 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$id_agente = get_parameter_get('id_agente', -1);
|
2008-11-06 21:16:15 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
2008-11-06 21:16:15 +01:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
if (empty($agent['server_name']) === true) {
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_print_error_message(
|
|
|
|
__('The agent has not assigned server. Maybe agent does not run fine.')
|
|
|
|
);
|
2013-08-30 13:21:51 +02:00
|
|
|
}
|
|
|
|
|
2008-11-06 21:16:15 +01:00
|
|
|
if ($agent === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_print_error_message(__('There was a problem loading agent'));
|
|
|
|
return;
|
2008-11-06 21:16:15 +01:00
|
|
|
}
|
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') === false
|
|
|
|
&& check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === false
|
2019-05-27 21:30:46 +02:00
|
|
|
) {
|
2019-01-30 16:18:44 +01:00
|
|
|
db_pandora_audit(
|
2022-01-20 10:55:23 +01:00
|
|
|
AUDIT_LOG_ACL_VIOLATION,
|
2019-01-30 16:18:44 +01:00
|
|
|
'Trying to access Agent General Information'
|
|
|
|
);
|
|
|
|
include_once 'general/noaccess.php';
|
|
|
|
return;
|
2008-07-21 14:23:28 +02:00
|
|
|
}
|
2010-04-21 19:52:08 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$alive_animation = agents_get_starmap($id_agente, 200, 50);
|
2019-05-29 11:21:57 +02:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* START: TABLE AGENT BUILD.
|
|
|
|
*/
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentCaptionAddedMessage = [];
|
2023-02-17 14:21:29 +01:00
|
|
|
$agentCaption = '<span class="subsection_header_title">'.ucfirst(agents_get_alias($agent['id_agente'])).'</span>';
|
2022-12-23 10:21:53 +01:00
|
|
|
$in_planned_downtime = (bool) db_get_sql(
|
2019-01-30 16:18:44 +01:00
|
|
|
'SELECT executed FROM tplanned_downtime
|
2017-10-18 11:15:51 +02:00
|
|
|
INNER JOIN tplanned_downtime_agents
|
|
|
|
ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1'
|
|
|
|
);
|
2017-10-18 11:15:51 +02:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
if ((bool) $agent['disabled'] === true) {
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentCaptionAddedMessage[] = __('Disabled');
|
2022-12-20 17:22:35 +01:00
|
|
|
} else if ((bool) $agent['quiet'] === true) {
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentCaptionAddedMessage[] = __('Quiet');
|
2010-05-21 10:59:14 +02:00
|
|
|
}
|
2011-01-20 15:41:12 +01:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
if ($in_planned_downtime === true) {
|
|
|
|
$agentCaptionAddedMessage[] = __('In scheduled downtime');
|
2017-09-25 10:25:12 +02:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
if (empty($agentCaptionAddedMessage) === false) {
|
|
|
|
$agentCaption .= ' <span class="result_info_text">('.implode(' - ', $agentCaptionAddedMessage).')</span>';
|
2017-09-25 10:25:12 +02:00
|
|
|
}
|
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentIconGroup = ((bool) $config['show_group_name'] === false) ? ui_print_group_icon(
|
|
|
|
$agent['id_grupo'],
|
|
|
|
true,
|
|
|
|
'',
|
2023-03-07 13:19:52 +01:00
|
|
|
'padding-right: 6px;',
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
'',
|
|
|
|
true
|
2022-12-23 10:21:53 +01:00
|
|
|
) : '';
|
2013-05-29 15:11:40 +02:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentIconStatus = agents_detail_view_status_img(
|
2019-01-30 16:18:44 +01:00
|
|
|
$agent['critical_count'],
|
|
|
|
$agent['warning_count'],
|
|
|
|
$agent['unknown_count'],
|
|
|
|
$agent['total_count'],
|
|
|
|
$agent['notinit_count']
|
|
|
|
);
|
2013-02-22 14:48:10 +01:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$agent_details_agent_caption = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_agent_caption',
|
|
|
|
'content' => $agentCaption,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agent_details_agent_data = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_agent_data',
|
|
|
|
'content' => $agentIconGroup,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agent_details_agent_status_image = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'icono_right',
|
|
|
|
'content' => $agentIconStatus,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$agentStatusHeader = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_header',
|
|
|
|
'content' => $agent_details_agent_caption.$agent_details_agent_data.$agent_details_agent_status_image,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2013-05-20 18:43:28 +02:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// Fixed width non interactive charts.
|
2022-07-05 17:44:52 +02:00
|
|
|
$status_chart_width = 150;
|
|
|
|
$graph_width = 150;
|
2013-04-10 09:57:54 +02:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$table_status = new stdClass();
|
|
|
|
$table_status->id = 'agent_status_main';
|
|
|
|
$table_status->width = '100%';
|
|
|
|
$table_status->cellspacing = 0;
|
|
|
|
$table_status->cellpadding = 0;
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_status->class = 'floating_form';
|
2023-03-13 16:21:14 +01:00
|
|
|
$table_status->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
|
|
|
|
$table_status->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
|
2022-12-23 10:21:53 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$agentStatusGraph = html_print_div(
|
|
|
|
[
|
|
|
|
'id' => 'status_pie',
|
|
|
|
'style' => 'width: '.$graph_width.'px;',
|
|
|
|
'content' => graph_agent_status(
|
|
|
|
$id_agente,
|
|
|
|
$graph_width,
|
|
|
|
$graph_width,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true
|
|
|
|
),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2022-12-23 10:21:53 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
/*
|
|
|
|
$table_agent_graph = '<div id="status_pie" style="width: '.$graph_width.'px;">';
|
|
|
|
$table_agent_graph .= graph_agent_status(
|
2019-05-27 21:30:46 +02:00
|
|
|
$id_agente,
|
|
|
|
$graph_width,
|
|
|
|
$graph_width,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
$table_agent_graph .= '</div>';*/
|
2013-05-23 17:42:32 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
/*
|
|
|
|
$table_agent_os = '<p>'.ui_print_os_icon(
|
2019-05-27 21:30:46 +02:00
|
|
|
$agent['id_os'],
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
2022-12-23 10:21:53 +01:00
|
|
|
[
|
|
|
|
'title' => get_os_name($agent['id_os']),
|
|
|
|
'width' => '20px;',
|
|
|
|
]
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
|
|
|
$table_status->data['agent_os'][0] = __('OS');
|
2023-02-17 14:21:29 +01:00
|
|
|
$agentOS = [];
|
|
|
|
$agentOS[] = html_print_div([ 'content' => (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version']], true);
|
2023-02-17 14:26:41 +01:00
|
|
|
$agentOS[] = html_print_div([ 'style' => 'width: 16px;padding-left: 5px', 'content' => ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['width' => '16px'])], true);
|
2023-02-17 14:21:29 +01:00
|
|
|
$table_status->data['agent_os'][1] = html_print_div(['class' => 'agent_details_agent_data', 'content' => implode('', $agentOS)], true);
|
2013-04-10 09:57:54 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
// $table_agent_os .= (empty($agent['os_version']) === true) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'</p>';
|
2013-02-22 14:48:10 +01:00
|
|
|
$addresses = agents_get_addresses($id_agente);
|
|
|
|
$address = agents_get_address($id_agente);
|
2013-08-30 13:21:51 +02:00
|
|
|
|
2013-02-27 11:22:51 +01:00
|
|
|
foreach ($addresses as $k => $add) {
|
2019-01-30 16:18:44 +01:00
|
|
|
if ($add == $address) {
|
|
|
|
unset($addresses[$k]);
|
|
|
|
}
|
2011-01-20 15:41:12 +01:00
|
|
|
}
|
2013-02-22 14:48:10 +01:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
if (empty($address) === false) {
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_status->data['ip_address'][0] = __('IP address');
|
|
|
|
$table_status->data['ip_address'][1] = (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address;
|
|
|
|
/*
|
|
|
|
$table_agent_ip = '<p>'.html_print_image(
|
2021-03-11 15:40:23 +01:00
|
|
|
'images/world.png',
|
|
|
|
true,
|
|
|
|
[
|
|
|
|
'title' => __('IP address'),
|
|
|
|
'class' => 'invert_filter',
|
|
|
|
]
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
$table_agent_ip .= '<span class="align-top inline">';
|
|
|
|
$table_agent_ip .= (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address;
|
|
|
|
$table_agent_ip .= '</span></p>';
|
|
|
|
*/
|
2013-04-10 09:57:54 +02:00
|
|
|
}
|
2013-02-22 14:48:10 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_status->data['agent_version'][0] = __('Agent Version');
|
|
|
|
$table_status->data['agent_version'][1] = (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
|
|
|
|
|
|
|
|
$table_status->data['description'][0] = __('Description');
|
|
|
|
$table_status->data['description'][1] = (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
|
|
|
|
|
|
|
|
/*
|
|
|
|
$table_agent_version = '<p>'.html_print_image(
|
2021-03-11 15:40:23 +01:00
|
|
|
'images/version.png',
|
|
|
|
true,
|
|
|
|
[
|
|
|
|
'title' => __('Agent Version'),
|
|
|
|
'class' => 'invert_filter',
|
|
|
|
]
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
$table_agent_version .= '<span class="align-top inline">';
|
|
|
|
$table_agent_version .= (empty($agent['agent_version']) === true) ? '<i>'.__('N/A').'</i>' : $agent['agent_version'];
|
|
|
|
$table_agent_version .= '</span></p>';
|
2013-02-22 14:48:10 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_agent_description = '<p>'.html_print_image(
|
2021-03-11 15:40:23 +01:00
|
|
|
'images/list.png',
|
2019-01-30 16:18:44 +01:00
|
|
|
true,
|
2021-03-11 15:40:23 +01:00
|
|
|
[
|
|
|
|
'title' => __('Description'),
|
|
|
|
'class' => 'invert_filter',
|
|
|
|
]
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
$table_agent_description .= '<span class="align-top inline">';
|
|
|
|
$table_agent_description .= (empty($agent['comentarios']) === true) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
|
|
|
|
$table_agent_description .= '</span></p>';
|
|
|
|
*/
|
2019-05-27 19:00:48 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
/*
|
|
|
|
$table_agent_count_modules = reporting_tiny_stats(
|
2019-05-27 22:36:55 +02:00
|
|
|
$agent,
|
|
|
|
true,
|
|
|
|
'agent',
|
|
|
|
// Useless.
|
|
|
|
':',
|
|
|
|
true
|
2023-01-02 16:50:13 +01:00
|
|
|
);*/
|
|
|
|
|
|
|
|
$agentCountModules = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_bullets',
|
|
|
|
'content' => reporting_tiny_stats(
|
|
|
|
$agent,
|
|
|
|
true,
|
|
|
|
'agent',
|
|
|
|
// Useless.
|
|
|
|
':',
|
|
|
|
true
|
|
|
|
),
|
|
|
|
],
|
|
|
|
true
|
2019-05-27 22:36:55 +02:00
|
|
|
);
|
|
|
|
|
2019-05-28 13:27:17 +02:00
|
|
|
$has_remote_conf = enterprise_hook(
|
|
|
|
'config_agents_has_remote_configuration',
|
|
|
|
[$agent['id_agente']]
|
|
|
|
);
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if ((bool) $has_remote_conf) {
|
|
|
|
$table_status->data['remote_config'][0] = __('Remote configuration');
|
|
|
|
$table_status->data['remote_config'][1] = __('Enabled');
|
2022-06-08 13:10:01 +02:00
|
|
|
|
|
|
|
$satellite_server = (int) db_get_value_filter(
|
|
|
|
'satellite_server',
|
|
|
|
'tagente',
|
|
|
|
['id_agente' => $id_agente]
|
|
|
|
);
|
|
|
|
|
|
|
|
if (empty($satellite_server) === false) {
|
|
|
|
$satellite_name = db_get_value_filter(
|
|
|
|
'name',
|
|
|
|
'tserver',
|
|
|
|
['id_server' => $satellite_server]
|
|
|
|
);
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_status->data['remote_config'][0] = __('Satellite server');
|
|
|
|
$table_status->data['remote_config'][1] = $satellite_name;
|
2022-06-08 13:10:01 +02:00
|
|
|
}
|
2019-05-28 13:27:17 +02:00
|
|
|
}
|
|
|
|
|
2023-04-04 15:14:10 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_agent = $agentStatusHeader.'
|
2019-05-29 12:06:05 +02:00
|
|
|
<div class="agent_details_content">
|
|
|
|
<div class="agent_details_graph">
|
2023-01-02 16:50:13 +01:00
|
|
|
'.$agentStatusGraph.$agentCountModules.'
|
2019-05-29 12:06:05 +02:00
|
|
|
</div>
|
|
|
|
<div class="agent_details_info">
|
2023-01-02 16:50:13 +01:00
|
|
|
'.$alive_animation.html_print_table($table_status, true).'
|
2019-05-29 12:06:05 +02:00
|
|
|
</div>
|
|
|
|
</div>';
|
2019-05-27 21:30:46 +02:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* END: TABLE AGENT BUILD.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*START: TABLE CONTACT BUILD.
|
|
|
|
*/
|
|
|
|
|
2015-05-25 13:31:10 +02:00
|
|
|
$table_contact = new stdClass();
|
2013-02-28 16:12:49 +01:00
|
|
|
$table_contact->id = 'agent_contact_main';
|
|
|
|
$table_contact->width = '100%';
|
2015-04-21 17:26:20 +02:00
|
|
|
$table_contact->cellspacing = 0;
|
|
|
|
$table_contact->cellpadding = 0;
|
2023-01-02 16:50:13 +01:00
|
|
|
$table_contact->class = 'floating_form';
|
2023-03-13 16:21:14 +01:00
|
|
|
$table_contact->style[0] = 'height: 32px; width: 30%; padding-right: 5px; text-align: end; vertical-align: top';
|
|
|
|
$table_contact->style[1] = 'height: 32px; width: 70%; padding-left: 5px; font-weight: lighter; vertical-align: top';
|
2009-10-13 Sancho Lerena <slerena@artica.es>
Upps, Tuesday #13, bad day for a last commit before launch RC1 ! :-S
* general/logon_ok.php: Fixed ugly format of table showing last activity
(has a too wide table width).
* godmode/admin_access_logs.php: Removed that crappy div fashion code and
replaced by old and reliable table-based-code :-) to fix the mess with the
pagination.
* godmode/agentes/configurar_agente.php: fixed problem with postprocess
values very bug (like 0.0000000123), parameter is now passed as string
because PHP is passing the value as scientific notation and mYsql don't
understand that.
* operation/agentes/exportdata.php,
* operation/search_results.php,
* godmode/reporting/map_builder.php,
* godmode/agentes/agent_manager.php,
* godmode/reporting/graph_builder.php,
* godmode/agentes/modificar_agente.php: Added non-case search SQL code for make
agent searches non case sensitive (nombre COLLATE utf8_general_ci LIKE...)
* module_manager_editor_common.php: More size for postprocess field.
* pandora_console/godmode/alerts/configure_alert_action.php: More width for
field2 in action form.
* godmode/alerts/configure_alert_command.php: Command field has more width
and added a help icon for macro subtitutions.
* include/functions_db.php: get_agent_name() now defaults to non uppercase
the agent names, because 3.0 has case sensitive agent names, and all
data must show the real Case.
* include/styles/pandora.css: removed uppercase transition for menu items
and agent tabs.
* operation/agentes/estado_agente.php: Agent is not shown in uppercase
anymore.
* operation/agentes/estado_generalagente.php: Agent name and parent name
is not in uppercase. OS version shows only last 15 characters or full string
if strlen() < 15.
* operation/agentes/status_monitor.php: Agent name is not in uppercase
anymore.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2015 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-10-13 20:59:48 +02:00
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$agentContactCaption = html_print_div(
|
2021-03-11 15:40:23 +01:00
|
|
|
[
|
2022-12-23 10:21:53 +01:00
|
|
|
'class' => 'agent_details_agent_caption',
|
|
|
|
'content' => '<span class="subsection_header_title">'.__('Agent contact').'</span>',
|
2022-12-20 17:22:35 +01:00
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$buttonsRefreshAgent = html_print_button(
|
|
|
|
__('Refresh data'),
|
|
|
|
'refresh_data',
|
|
|
|
false,
|
2023-03-07 12:59:34 +01:00
|
|
|
'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60")',
|
2022-12-23 10:21:53 +01:00
|
|
|
[ 'mode' => 'link' ],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
|
2022-12-23 10:21:53 +01:00
|
|
|
$buttonsRefreshAgent .= html_print_button(
|
|
|
|
__('Force checks'),
|
|
|
|
'force_checks',
|
|
|
|
false,
|
2023-03-07 12:59:34 +01:00
|
|
|
'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente='.$id_agente.'")',
|
2022-12-23 10:21:53 +01:00
|
|
|
[ 'mode' => 'link' ],
|
2022-12-20 17:22:35 +01:00
|
|
|
true
|
|
|
|
);
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
2022-12-23 10:21:53 +01:00
|
|
|
$buttons_refresh_agent_view = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'buttons_agent_view',
|
|
|
|
'content' => $buttonsRefreshAgent,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2013-02-20 19:07:52 +01:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Data for agent contact.
|
|
|
|
$intervalHumanTime = human_time_description_raw($agent['intervalo']);
|
|
|
|
$lastContactDate = ui_print_timestamp($agent['ultimo_contacto'], true);
|
|
|
|
$remoteContactDate = ($agent['ultimo_contacto_remoto'] === '01-01-1970 00:00:00') ? __('Never') : date_w_fixed_tz($agent['ultimo_contacto_remoto']);
|
|
|
|
$lastAndRemoteContact = sprintf('%s / %s', $lastContactDate, $remoteContactDate);
|
|
|
|
$progress = agents_get_next_contact($id_agente);
|
|
|
|
$tempTimeToShow = ($agent['intervalo'] - (strtotime('now') - strtotime($agent['ultimo_contacto'])));
|
|
|
|
$progressCaption = ($tempTimeToShow >= 0) ? sprintf('%d s', $tempTimeToShow) : __('Out of bounds');
|
|
|
|
$ajaxNextContactInterval = (empty($agent['intervalo']) === true) ? 0 : (100 / $agent['intervalo']);
|
|
|
|
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
|
|
|
$secondaryLinks = [];
|
|
|
|
if (empty($secondary_groups['for_select']) === true) {
|
|
|
|
$secondaryLinks[] = '<em>'.__('N/A').'</em>';
|
|
|
|
} else {
|
|
|
|
foreach ($secondary_groups['for_select'] as $id => $name) {
|
|
|
|
$secondaryLinks[] = html_print_anchor(
|
|
|
|
[
|
|
|
|
'href' => 'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id,
|
|
|
|
'content' => $name,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$last_status_change_agent = agents_get_last_status_change($agent['id_agente']);
|
|
|
|
$time_elapsed = (empty($last_status_change_agent) === false) ? human_time_comparation($last_status_change_agent) : '<em>'.__('N/A').'</em>';
|
|
|
|
|
|
|
|
// Agent Interval.
|
2019-01-30 16:18:44 +01:00
|
|
|
$data = [];
|
2022-12-23 10:21:53 +01:00
|
|
|
$data[0] = __('Interval');
|
2022-12-20 17:22:35 +01:00
|
|
|
$data[1] = $intervalHumanTime;
|
2013-02-28 16:12:49 +01:00
|
|
|
$table_contact->data[] = $data;
|
2013-02-20 19:07:52 +01:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Last & Remote contact.
|
2019-01-30 16:18:44 +01:00
|
|
|
$data = [];
|
2022-12-23 10:21:53 +01:00
|
|
|
$data[0] = __('Last contact').' / '.__('Remote');
|
2022-12-20 17:22:35 +01:00
|
|
|
$data[1] = $lastAndRemoteContact;
|
2013-02-28 16:12:49 +01:00
|
|
|
$table_contact->data[] = $data;
|
* ChangeLog: Create this file, prior to launch final 1.2 version. For the next
versions, will use it for every branch and subproject.
* configurar_agente.php : Fixed Undefined index: combo_snmp_oid notice error.
* estado_grupo.php: Detect old "OK" monitors, but doesnt check if they are down
in time, so for example, a old monitor with OK signal but from a week old, it is
shown as GREEN (good) value, not as a DOWN (white with ? symbol). FIXED.
Now counts data modules for DOWN total account, and show grey button if ANY
type of module is down, not only monitors. Improved SQL searches.
* estado_agente.php, estado_ultimopaquete.php: Same as estado_grupo with data_modules,
included in total account, more accurate accounting. A new value shown in grey for
DOWN modules, being monitors or single data modules, no matter type. Improved SQL
searches. Individual module intervals are used to determine if a module is down,
if there is no individual module interval, global agent interval is used.
Now it's possible to have a module with higher interval than Agent interval, so
we take now the more higest interval in modules to calculate if an agent is DOWN.
* fgraph.php: updated progressbar function to show N/A when data is above 100 or below 0.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@115 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2006-07-09 22:29:44 +02:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Next contact progress.
|
2019-05-27 19:00:48 +02:00
|
|
|
$data = [];
|
2023-01-02 16:50:13 +01:00
|
|
|
$data[0] = __('Next contact');
|
2019-05-29 15:14:13 +02:00
|
|
|
$data[1] = ui_progress(
|
2019-05-29 12:42:55 +02:00
|
|
|
$progress,
|
2023-02-01 15:14:32 +01:00
|
|
|
'80%',
|
|
|
|
'1.2',
|
|
|
|
'#ececec',
|
2019-05-29 12:42:55 +02:00
|
|
|
true,
|
2022-12-20 17:22:35 +01:00
|
|
|
$progressCaption,
|
2019-06-14 10:35:10 +02:00
|
|
|
[
|
|
|
|
'page' => 'operation/agentes/ver_agente',
|
2022-12-20 17:22:35 +01:00
|
|
|
'interval' => $ajaxNextContactInterval,
|
2019-06-14 10:35:10 +02:00
|
|
|
'data' => [
|
|
|
|
'id_agente' => $id_agente,
|
|
|
|
'refresh_contact' => 1,
|
|
|
|
],
|
|
|
|
|
2023-03-21 18:12:02 +01:00
|
|
|
]
|
2019-05-29 12:42:55 +02:00
|
|
|
);
|
2013-02-28 16:12:49 +01:00
|
|
|
$table_contact->data[] = $data;
|
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Group line.
|
2019-01-30 16:18:44 +01:00
|
|
|
$data = [];
|
|
|
|
$data[0] = '<b>'.__('Group').'</b>';
|
2022-12-20 17:22:35 +01:00
|
|
|
$data[1] = html_print_anchor(
|
|
|
|
[
|
2023-03-07 13:19:52 +01:00
|
|
|
'href' => 'index.php?sec=gagente&sec2=godmode/groups/tactical&id_group='.$agent['id_grupo'],
|
2022-12-20 17:22:35 +01:00
|
|
|
'content' => groups_get_name($agent['id_grupo']),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2019-05-27 19:00:48 +02:00
|
|
|
$table_contact->data[] = $data;
|
2013-04-10 09:57:54 +02:00
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Secondary groups.
|
2019-01-30 16:18:44 +01:00
|
|
|
$data = [];
|
2019-05-27 19:00:48 +02:00
|
|
|
$data[0] = '<b>'.__('Secondary groups').'</b>';
|
2022-12-20 17:22:35 +01:00
|
|
|
$data[1] = implode(', ', $secondaryLinks);
|
2019-05-27 19:00:48 +02:00
|
|
|
$table_contact->data[] = $data;
|
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Parent agent line.
|
|
|
|
if (enterprise_installed() === true) {
|
2019-05-28 13:27:17 +02:00
|
|
|
$data = [];
|
|
|
|
$data[0] = '<b>'.__('Parent').'</b>';
|
2022-12-20 17:22:35 +01:00
|
|
|
if ((int) $agent['id_parent'] === 0) {
|
2019-05-28 13:27:17 +02:00
|
|
|
$data[1] = '<em>'.__('N/A').'</em>';
|
|
|
|
} else {
|
2022-12-20 17:22:35 +01:00
|
|
|
$data[1] = html_print_anchor(
|
|
|
|
[
|
|
|
|
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_parent'],
|
|
|
|
'content' => agents_get_alias($agent['id_parent']),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2019-05-28 13:27:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$table_contact->data[] = $data;
|
|
|
|
}
|
|
|
|
|
2022-12-20 17:22:35 +01:00
|
|
|
// Last status change line.
|
2020-03-23 12:47:58 +01:00
|
|
|
$data = [];
|
|
|
|
$data[0] = '<b>'.__('Last status change').'</b>';
|
|
|
|
$data[1] = $time_elapsed;
|
|
|
|
$table_contact->data[] = $data;
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* END: TABLE CONTACT BUILD
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* START: TABLE DATA BUILD
|
|
|
|
*/
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$data_opcional = new stdClass();
|
|
|
|
$data_opcional->id = 'agent_data_main';
|
2023-03-27 14:34:05 +02:00
|
|
|
$data_opcional->width = '100%';
|
2023-01-02 16:50:13 +01:00
|
|
|
$data_opcional->class = 'floating_form';
|
2019-05-27 21:30:46 +02:00
|
|
|
// Gis and url address.
|
2023-01-02 16:50:13 +01:00
|
|
|
$agentAdditionalContent = '';
|
2019-05-27 21:30:46 +02:00
|
|
|
// Position Information.
|
2022-12-20 17:22:35 +01:00
|
|
|
if ((bool) $config['activate_gis'] === true) {
|
2023-01-02 16:50:13 +01:00
|
|
|
$dataPositionAgent = gis_get_data_last_position_agent(
|
|
|
|
$agent['id_agente']
|
|
|
|
);
|
2023-05-16 11:37:46 +02:00
|
|
|
if (is_array($dataPositionAgent) === true && $dataPositionAgent['stored_longitude'] !== '' && $dataPositionAgent['stored_longitude'] !== '') {
|
2023-05-08 10:10:25 +02:00
|
|
|
$data_opcional->data['agent_position'][0] = __('Position (Long, Lat)');
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$dataOptionalOutput = html_print_anchor(
|
2022-12-20 17:22:35 +01:00
|
|
|
[
|
|
|
|
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente,
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'],
|
2022-12-20 17:22:35 +01:00
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if (empty($dataPositionAgent['description']) === false) {
|
|
|
|
$dataOptionalOutput .= ' ('.$dataPositionAgent['description'].')';
|
|
|
|
}
|
|
|
|
|
|
|
|
$data_opcional->data['agent_position'][1] = $dataOptionalOutput;
|
|
|
|
}
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// If the url description is set.
|
2022-12-20 17:22:35 +01:00
|
|
|
if (empty($agent['url_address']) === false) {
|
2023-01-10 10:18:37 +01:00
|
|
|
$data_opcional->data['url_address'][0] = __('Url address');
|
2023-01-02 16:50:13 +01:00
|
|
|
$data_opcional->data['url_address'][1] = html_print_anchor(
|
2022-12-20 17:22:35 +01:00
|
|
|
[
|
|
|
|
'href' => $agent['url_address'],
|
|
|
|
'content' => $agent['url_address'],
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// Other IP address and timezone offset.
|
2022-12-20 17:22:35 +01:00
|
|
|
if (empty($addresses) === false) {
|
2023-01-10 10:18:37 +01:00
|
|
|
$data_opcional->data['other_ip_address'][0] = __('Other IP addresses');
|
2023-01-02 16:50:13 +01:00
|
|
|
$data_opcional->data['other_ip_address'][1] = html_print_div(
|
2022-12-20 17:22:35 +01:00
|
|
|
[
|
|
|
|
'class' => 'overflow-y mx_height50px',
|
|
|
|
'content' => implode('<br>', $addresses),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
2013-02-21 15:26:00 +01:00
|
|
|
}
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// Timezone Offset.
|
2022-12-20 17:22:35 +01:00
|
|
|
if ((int) $agent['timezone_offset'] !== 0) {
|
2023-01-10 10:18:37 +01:00
|
|
|
$data_opcional->data['timezone_offset'][0] = __('Timezone Offset');
|
2023-01-02 16:50:13 +01:00
|
|
|
$data_opcional->data['timezone_offset'][1] = $agent['timezone_offset'];
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
// Custom fields.
|
2014-10-24 11:03:45 +02:00
|
|
|
$fields = db_get_all_rows_filter(
|
2019-01-30 16:18:44 +01:00
|
|
|
'tagent_custom_fields',
|
|
|
|
['display_on_front' => 1]
|
|
|
|
);
|
2010-10-04 13:28:31 +02:00
|
|
|
if ($fields === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$fields = [];
|
2010-10-04 13:28:31 +02:00
|
|
|
}
|
2013-02-20 19:07:52 +01:00
|
|
|
|
2019-05-27 19:00:48 +02:00
|
|
|
$custom_fields = [];
|
2013-01-30 17:29:49 +01:00
|
|
|
foreach ($fields as $field) {
|
2019-07-03 12:41:22 +02:00
|
|
|
$custom_value = db_get_all_rows_sql(
|
|
|
|
'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields
|
|
|
|
INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-07-03 12:41:22 +02:00
|
|
|
if ($custom_value[0]['description'] !== false && $custom_value[0]['description'] != '') {
|
|
|
|
$data = [];
|
|
|
|
|
|
|
|
$data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
|
|
|
|
if ($custom_value[0]['is_password_type']) {
|
|
|
|
$data[1] = '••••••••';
|
2022-11-22 11:50:07 +01:00
|
|
|
} else if ($field['is_link_enabled'] === '1') {
|
|
|
|
list($link_text, $link_url) = json_decode($custom_value[0]['description'], true);
|
|
|
|
|
|
|
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
|
|
|
$link_text = '';
|
|
|
|
$link_url = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($link_text === '') {
|
|
|
|
$link_text = $link_url;
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[1] = '<a href="'.$link_url.'">'.$link_text.'</a>';
|
2019-07-03 12:41:22 +02:00
|
|
|
} else {
|
2023-03-27 14:34:05 +02:00
|
|
|
$custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']);
|
2019-07-03 12:41:22 +02:00
|
|
|
$data[1] = $custom_value[0]['description'];
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-07-03 12:41:22 +02:00
|
|
|
$custom_fields[] = $data;
|
|
|
|
}
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$custom_fields_count = count($custom_fields);
|
2019-05-28 13:27:17 +02:00
|
|
|
for ($i = 0; $i < $custom_fields_count; $i++) {
|
2019-05-27 19:00:48 +02:00
|
|
|
$first_column = $custom_fields[$i];
|
|
|
|
$j = ($i + 1);
|
|
|
|
$second_column = $custom_fields[$j];
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if (is_array($second_column) === true) {
|
2019-05-27 19:00:48 +02:00
|
|
|
$columns = array_merge($first_column, $second_column);
|
|
|
|
} else {
|
|
|
|
$columns = $first_column;
|
2023-02-08 12:43:08 +01:00
|
|
|
if ($data_opcional->data !== null) {
|
|
|
|
$filas = count($data_opcional->data);
|
2022-09-27 09:51:37 +02:00
|
|
|
}
|
|
|
|
|
2023-02-08 12:43:08 +01:00
|
|
|
$data_opcional->colspan[$filas][1] = 3;
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
2023-02-08 12:43:08 +01:00
|
|
|
$data_opcional->data[] = $columns;
|
2019-05-27 19:00:48 +02:00
|
|
|
|
|
|
|
$i++;
|
2010-08-25 14:04:42 +02:00
|
|
|
}
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* END: TABLE DATA BUILD
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* START: ACCESS RATE GRAPH
|
|
|
|
*/
|
|
|
|
|
2019-05-27 19:00:48 +02:00
|
|
|
$access_agent = db_get_value_sql(
|
|
|
|
'SELECT COUNT(id_agent)
|
|
|
|
FROM tagent_access
|
|
|
|
WHERE id_agent = '.$id_agente
|
|
|
|
);
|
2019-05-27 21:30:46 +02:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if ((bool) $config['agentaccess'] === true && $access_agent > 0) {
|
|
|
|
$agentAccessRateHeader = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_header',
|
|
|
|
'content' => '<span class="subsection_header_title">'.__('Agent access rate (Last 24h)').'</span>',
|
|
|
|
],
|
2019-05-27 21:30:46 +02:00
|
|
|
true
|
2020-03-26 12:29:38 +01:00
|
|
|
);
|
2023-01-02 16:50:13 +01:00
|
|
|
|
|
|
|
$agentAccessRateContent = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'white-table-graph-content',
|
|
|
|
'content' => graphic_agentaccess(
|
|
|
|
$id_agente,
|
|
|
|
SECONDS_1DAY,
|
|
|
|
true,
|
|
|
|
true
|
|
|
|
),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agentAccessRate = html_print_div(
|
|
|
|
[
|
2023-03-15 17:02:25 +01:00
|
|
|
'class' => 'box-flat agent_details_col mrgn_lft_20px w50p',
|
2023-01-02 16:50:13 +01:00
|
|
|
'id' => 'table_access_rate',
|
|
|
|
'content' => $agentAccessRateHeader.$agentAccessRateContent,
|
|
|
|
],
|
2019-05-27 21:30:46 +02:00
|
|
|
true
|
2020-03-26 12:29:38 +01:00
|
|
|
);
|
2023-01-02 16:50:13 +01:00
|
|
|
} else {
|
|
|
|
$agentAccessRate = '';
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* END: ACCESS RATE GRAPH
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* START: TABLE INTERFACES
|
|
|
|
*/
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$network_interfaces_by_agents = agents_get_network_interfaces([$agent]);
|
2014-03-18 Alejandro Gallardo <alejandro.gallardo@artica.es>
* pandoradb.data.oracle.sql,
pandoradb.data.postgreSQL.sql,
pandoradb.sql,
extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql,
extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql,
extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql:
Added the table "tmodule_relationship".
* operation/agentes/estado_generalagente.php: Added a
new table to show the network interfaces of the agent.
Minor fixes.
* include/styles/pandora.css: Added properties for the
class transparent'.
* include/ajax/module.php: Fixed an error and added code
to retrieve a module autocomplete input or add, remove
or update a module relation via ajax.
* include/functions_modules.php: Added the functions
"modules_get_relations", "modules_relation_exists",
"modules_add_relation", "modules_delete_relation" and
"modules_change_relation_lock".
* godmode/agentes/module_manager_editor_common.php:
Added a table and control to show, add or delete
relations with other modules. Added the javascript
functions "change_modules_autocomplete_input",
"add_new_relation", "change_lock_relation" and
"delete_relation".
* godmode/agentes/module_manager_editor.php: Added a
line to show the module relations table and control.
* godmode/agentes/module_manager_editor_network.php:
Minor fix.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9610 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-03-18 12:49:33 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$network_interfaces = [];
|
2023-01-10 12:03:16 +01:00
|
|
|
if (empty($network_interfaces_by_agents) === false && empty($network_interfaces_by_agents[$id_agente]) === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
2015-02-02 13:22:35 +01:00
|
|
|
}
|
|
|
|
|
2023-01-10 12:03:16 +01:00
|
|
|
if (empty($network_interfaces) === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$table_interface = new stdClass();
|
|
|
|
$table_interface->id = 'agent_interface_info';
|
2019-05-27 19:00:48 +02:00
|
|
|
$table_interface->class = 'info_table';
|
|
|
|
$table_interface->width = '100%';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table_interface->style = [];
|
2023-04-25 13:31:59 +02:00
|
|
|
$table_interface->style['interface_event_graph'] = 'width: 35%;';
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table_interface->head = [];
|
|
|
|
$options = [
|
|
|
|
'class' => 'closed',
|
2019-05-27 19:00:48 +02:00
|
|
|
'style' => 'cursor:pointer;',
|
2019-01-30 16:18:44 +01:00
|
|
|
];
|
|
|
|
$table_interface->data = [];
|
|
|
|
$event_text_cont = 0;
|
|
|
|
|
|
|
|
foreach ($network_interfaces as $interface_name => $interface) {
|
2023-01-10 12:03:16 +01:00
|
|
|
if (empty($interface['traffic']) === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
|
|
|
|
|
|
|
|
if ($permission) {
|
|
|
|
$params = [
|
|
|
|
'interface_name' => $interface_name,
|
|
|
|
'agent_id' => $id_agente,
|
|
|
|
'traffic_module_in' => $interface['traffic']['in'],
|
|
|
|
'traffic_module_out' => $interface['traffic']['out'],
|
|
|
|
];
|
|
|
|
$params_json = json_encode($params);
|
|
|
|
$params_encoded = base64_encode($params_json);
|
|
|
|
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
2019-05-29 12:06:05 +02:00
|
|
|
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=";
|
|
|
|
$graph_link .= $params_encoded."','";
|
2020-10-01 15:29:54 +02:00
|
|
|
$graph_link .= $win_handle."', 800, 480)\">";
|
2019-05-29 12:06:05 +02:00
|
|
|
$graph_link .= html_print_image(
|
2021-03-11 15:40:23 +01:00
|
|
|
'images/chart.png',
|
2019-05-29 12:06:05 +02:00
|
|
|
true,
|
2021-03-11 15:40:23 +01:00
|
|
|
[
|
|
|
|
'title' => __('Interface traffic'),
|
|
|
|
'class' => 'invert_filter',
|
|
|
|
]
|
2019-05-29 12:06:05 +02:00
|
|
|
).'</a>';
|
2019-01-30 16:18:44 +01:00
|
|
|
} else {
|
|
|
|
$graph_link = '';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$graph_link = '';
|
|
|
|
}
|
|
|
|
|
2023-04-25 13:31:59 +02:00
|
|
|
$content = [
|
|
|
|
'id_agent_module' => $interface['status_module_id'],
|
|
|
|
'id_group' => $id_group,
|
|
|
|
'period' => SECONDS_1DAY,
|
|
|
|
'time_from' => '00:00:00',
|
|
|
|
'time_to' => '00:00:00',
|
|
|
|
'sizeForTicks' => 250,
|
|
|
|
'height_graph' => 40,
|
|
|
|
[
|
|
|
|
['id_agent_module' => $interface['status_module_id']],
|
|
|
|
]
|
|
|
|
];
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-04-25 13:31:59 +02:00
|
|
|
$e_graph = \reporting_module_histogram_graph(
|
|
|
|
['datetime' => time()],
|
|
|
|
$content
|
2019-01-30 16:18:44 +01:00
|
|
|
);
|
2015-10-07 09:57:45 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$sqlLast_contact = sprintf(
|
|
|
|
'
|
2019-03-29 13:24:22 +01:00
|
|
|
SELECT timestamp
|
2015-10-07 09:57:45 +02:00
|
|
|
FROM tagente_estado
|
2019-01-30 16:18:44 +01:00
|
|
|
WHERE id_agente_modulo = '.$interface['status_module_id']
|
|
|
|
);
|
|
|
|
|
|
|
|
$last_contact = db_get_all_rows_sql($sqlLast_contact);
|
|
|
|
$last_contact = array_shift($last_contact);
|
|
|
|
$last_contact = array_shift($last_contact);
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
$data['interface_name'] = '<strong>'.$interface_name.'</strong>';
|
|
|
|
$data['interface_status'] = $interface['status_image'];
|
|
|
|
$data['interface_graph'] = $graph_link;
|
|
|
|
$data['interface_ip'] = $interface['ip'];
|
|
|
|
$data['interface_mac'] = $interface['mac'];
|
|
|
|
$data['last_contact'] = __('Last contact: ').$last_contact;
|
2023-04-25 13:31:59 +02:00
|
|
|
$data['interface_event_graph'] = $e_graph['chart'];
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table_interface->data[] = $data;
|
|
|
|
}
|
2019-05-27 19:00:48 +02:00
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* END: TABLE INTERFACES
|
|
|
|
*/
|
|
|
|
|
|
|
|
// This javascript piece of code is used to make expandible
|
|
|
|
// the body of the table.
|
2019-05-27 19:00:48 +02:00
|
|
|
?>
|
2019-01-30 16:18:44 +01:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready (function () {
|
2019-06-03 13:04:49 +02:00
|
|
|
|
2019-05-27 19:00:48 +02:00
|
|
|
$("#agent_data_main").find("thead").click (function () {
|
|
|
|
close_table('#agent_data_main');
|
|
|
|
})
|
|
|
|
.css('cursor', 'pointer');
|
|
|
|
|
|
|
|
$("#table_events").find(".white_table_graph_header").click (function () {
|
|
|
|
close_table_white('#table_events');
|
|
|
|
})
|
|
|
|
.css('cursor', 'pointer');
|
|
|
|
|
|
|
|
$("#table_access_rate").find(".white_table_graph_header").click (function () {
|
|
|
|
close_table_white('#table_access_rate');
|
|
|
|
})
|
|
|
|
.css('cursor', 'pointer');
|
2023-01-10 12:03:16 +01:00
|
|
|
|
2019-05-27 19:00:48 +02:00
|
|
|
function close_table(id){
|
|
|
|
var arrow = $(id).find("thead").find("img");
|
|
|
|
if (arrow.hasClass("closed")) {
|
|
|
|
arrow.removeClass("closed");
|
|
|
|
arrow.prop("src", "images/arrow_down_green.png");
|
|
|
|
$(id).find("tbody").show();
|
|
|
|
} else {
|
|
|
|
arrow.addClass("closed");
|
|
|
|
arrow.prop("src", "images/arrow_right_green.png");
|
|
|
|
$(id).find("tbody").hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function close_table_white(id){
|
|
|
|
var arrow = $(id).find(".white_table_graph_header").find("img");
|
|
|
|
if (arrow.hasClass("closed")) {
|
|
|
|
arrow.removeClass("closed");
|
|
|
|
arrow.prop("src", "images/arrow_down_green.png");
|
|
|
|
$(id).find(".white_table_graph_content").show();
|
|
|
|
} else {
|
|
|
|
arrow.addClass("closed");
|
|
|
|
arrow.prop("src", "images/arrow_right_green.png");
|
|
|
|
$(id).find(".white_table_graph_content").hide();
|
|
|
|
}
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
});
|
|
|
|
</script>
|
2019-05-27 21:30:46 +02:00
|
|
|
<?php
|
2023-01-02 16:50:13 +01:00
|
|
|
$agent_contact = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_header',
|
|
|
|
'content' => $agentContactCaption.$buttons_refresh_agent_view,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agent_contact .= html_print_table($table_contact, true);
|
|
|
|
|
|
|
|
$agentDetails = html_print_div(
|
|
|
|
[
|
2023-02-24 13:37:47 +01:00
|
|
|
'class' => 'box-flat agent_details_col',
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $table_agent,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agentContact = html_print_div(
|
|
|
|
[
|
2023-02-24 13:37:47 +01:00
|
|
|
'class' => 'box-flat agent_details_col mrgn_lft_20px',
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $agent_contact,
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agentEventsHeader = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_header',
|
|
|
|
'content' => '<span class="subsection_header_title">'.__('Events (Last 24h)').'</span>',
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agentEventsGraph = html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'white-table-graph-content',
|
|
|
|
'content' => graph_graphic_agentevents(
|
|
|
|
$id_agente,
|
|
|
|
95,
|
|
|
|
70,
|
|
|
|
SECONDS_1DAY,
|
|
|
|
'',
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
500
|
|
|
|
),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
|
|
|
$agentEvents = html_print_div(
|
|
|
|
[
|
2023-03-15 17:02:25 +01:00
|
|
|
'class' => 'box-flat agent_details_col w50p',
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $agentEventsHeader.$agentEventsGraph,
|
|
|
|
],
|
2019-05-27 21:30:46 +02:00
|
|
|
true
|
2020-03-26 12:29:38 +01:00
|
|
|
);
|
2023-01-02 16:50:13 +01:00
|
|
|
|
2019-05-27 21:30:46 +02:00
|
|
|
/*
|
|
|
|
* EVENTS TABLE END.
|
|
|
|
*/
|
2023-01-10 12:03:16 +01:00
|
|
|
if (isset($data_opcional) === false || isset($data_opcional->data) === false || empty($data_opcional->data) === true) {
|
2023-01-02 16:50:13 +01:00
|
|
|
$agentAdditionalInfo = '';
|
2019-11-07 09:52:06 +01:00
|
|
|
} else {
|
2023-01-10 12:03:16 +01:00
|
|
|
$agentAdditionalInfo = ui_toggle(
|
|
|
|
html_print_table($data_opcional, true),
|
|
|
|
'<span class="subsection_header_title">'.__('Agent data').'</span>',
|
|
|
|
'status_monitor_agent',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
2023-03-27 14:34:05 +02:00
|
|
|
'',
|
|
|
|
'white-box-content',
|
|
|
|
'box-flat white_table_graph w100p'
|
2023-01-10 12:03:16 +01:00
|
|
|
);
|
2019-11-07 09:52:06 +01:00
|
|
|
}
|
2013-02-28 16:12:49 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
$agentIncidents = (isset($table_incident) === false) ? '' : html_print_table($table_incident, true);
|
2022-12-23 10:21:53 +01:00
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
html_print_div(
|
2022-12-23 10:21:53 +01:00
|
|
|
[
|
2023-01-02 16:50:13 +01:00
|
|
|
'class' => 'agent_details_first_row agent_details_line',
|
|
|
|
'content' => $agentDetails.$agentContact,
|
|
|
|
]
|
2022-12-23 10:21:53 +01:00
|
|
|
);
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
html_print_div(
|
2022-12-23 10:21:53 +01:00
|
|
|
[
|
2023-01-10 10:18:37 +01:00
|
|
|
'class' => 'agent_details_line',
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $agentEvents.$agentAccessRate,
|
|
|
|
]
|
2022-12-23 10:21:53 +01:00
|
|
|
);
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if (empty($agentAdditionalInfo) === false) {
|
|
|
|
html_print_div(
|
|
|
|
[
|
2023-01-10 10:18:37 +01:00
|
|
|
'class' => 'agent_details_line',
|
2023-01-02 16:50:13 +01:00
|
|
|
'content' => $agentAdditionalInfo,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-08-25 14:15:32 +02:00
|
|
|
if ((bool) $config['ITSM_enabled'] === true) {
|
|
|
|
$show_tab_issue = false;
|
|
|
|
try {
|
|
|
|
$ITSM = new ITSM();
|
|
|
|
$list = $ITSM->listIncidenceAgents($id_agente);
|
|
|
|
if (empty($list) === false) {
|
|
|
|
$show_tab_issue = true;
|
|
|
|
}
|
|
|
|
} catch (\Throwable $th) {
|
|
|
|
$show_tab_issue = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($show_tab_issue === true) {
|
|
|
|
try {
|
|
|
|
$table_itsm = $ITSM->getTableIncidencesForAgent($id_agente, true, 0);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$table_itsm = $e->getMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
$itsmInfo = ui_toggle(
|
|
|
|
$table_itsm,
|
|
|
|
'<span class="subsection_header_title">'.__('Incidences').'</span>',
|
|
|
|
'status_monitor_agent',
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
'',
|
|
|
|
'white-box-content',
|
|
|
|
'box-flat white_table_graph w100p'
|
|
|
|
);
|
|
|
|
|
|
|
|
html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'agent_details_line',
|
|
|
|
'content' => $itsmInfo,
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-02 16:50:13 +01:00
|
|
|
if (empty($agentIncidents) === false) {
|
|
|
|
html_print_div(
|
|
|
|
[
|
2023-01-10 10:18:37 +01:00
|
|
|
'class' => 'agent_details_line',
|
2023-05-16 15:43:02 +02:00
|
|
|
'content' => ui_toggle(
|
|
|
|
'<div class=\'w100p\' id=\'agent_incident\'>'.$agentIncidents.'</div>',
|
|
|
|
'<span class="subsection_header_title">'.__('Active issue on this agent').'</span>',
|
|
|
|
__('Agent incident main'),
|
|
|
|
'agent_incident',
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
'',
|
|
|
|
'box-flat white-box-content no_border',
|
|
|
|
'box-flat white_table_graph w100p',
|
|
|
|
),
|
|
|
|
],
|
2023-01-02 16:50:13 +01:00
|
|
|
);
|
|
|
|
}
|
2022-12-23 10:21:53 +01:00
|
|
|
|
2022-10-27 16:12:17 +02:00
|
|
|
if (isset($table_interface) === true) {
|
2019-05-29 17:34:11 +02:00
|
|
|
ui_toggle(
|
2019-05-29 17:49:09 +02:00
|
|
|
html_print_table($table_interface, true),
|
2020-10-02 14:16:55 +02:00
|
|
|
'<b>'.__('Interface information (SNMP)').'</b>',
|
|
|
|
'',
|
|
|
|
'interface-table-status-agent',
|
|
|
|
true
|
2019-05-29 17:34:11 +02:00
|
|
|
);
|
2019-05-27 21:30:46 +02:00
|
|
|
}
|