mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge remote-tracking branch 'origin/develop' into ent-4697-cicd-pandorafms
Conflicts: pandora_server/pandora_server.spec
This commit is contained in:
commit
50a2d74adb
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.742-200110
|
||||
Version: 7.0NG.742-200127
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.742-200110"
|
||||
pandora_version="7.0NG.742-200127"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.742';
|
||||
use constant AGENT_BUILD => '200110';
|
||||
use constant AGENT_BUILD => '200127';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.742"
|
||||
PI_BUILD="200110"
|
||||
PI_BUILD="200127"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{200110}
|
||||
{200127}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.742(Build 200110)")
|
||||
#define PANDORA_VERSION ("7.0NG.742(Build 200127)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.742(Build 200110))"
|
||||
VALUE "ProductVersion", "(7.0NG.742(Build 200127))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.742-200110
|
||||
Version: 7.0NG.742-200127
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.742-200110"
|
||||
pandora_version="7.0NG.742-200127"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -64,9 +64,11 @@ if (!empty($files)) {
|
||||
$document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT']));
|
||||
$file['location'] = str_replace('\\', '/', io_safe_output($file['location']));
|
||||
$relative_path = str_replace($document_root, '', $file['location']);
|
||||
$file_path = base64_encode($relative_path);
|
||||
$hash = md5($relative_path.$config['dbpass']);
|
||||
$url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash");
|
||||
$file_name = explode('/', $file['location']);
|
||||
$file_decoded = $file_name[(count($file_name) - 1)];
|
||||
$file_path = base64_encode($file_decoded);
|
||||
$hash = md5($file_path.$config['dbpass']);
|
||||
$url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash);
|
||||
$date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
|
||||
|
||||
$data[0] = "<a href=\"$url\" target=\"_blank\">".$file['name'].'</a>';
|
||||
|
@ -109,6 +109,6 @@ if (empty($data)) {
|
||||
}
|
||||
|
||||
echo '{
|
||||
"label": "'.$graph_title.'",
|
||||
"data": [["'.time().'", '.$data.']]
|
||||
"label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'",
|
||||
"data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']]
|
||||
}';
|
||||
|
9
pandora_console/extras/mr/35.sql
Normal file
9
pandora_console/extras/mr/35.sql
Normal file
@ -0,0 +1,9 @@
|
||||
START TRANSACTION;
|
||||
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}');
|
||||
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
|
||||
ALTER TABLE `treport_content_item` ADD `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` (
|
||||
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`generated` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`filter` TEXT,
|
||||
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
|
||||
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -1401,6 +1403,7 @@ ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
|
||||
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
@ -1775,6 +1778,7 @@ ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) NOT NULL defau
|
||||
-- Table `tserver`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevent_response`
|
||||
@ -2433,6 +2437,21 @@ CREATE TABLE `tagent_repository` (
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `treport_content_item`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `treport_content_item` (
|
||||
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
||||
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`server_name` text,
|
||||
`operation` text,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tdeployment_hosts`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
@ -703,8 +703,7 @@ if ($config['menu_type'] == 'classic') {
|
||||
},
|
||||
success: function (data) {
|
||||
$('#result_order').html(data);
|
||||
console.log(data);
|
||||
},
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to interpreter order", data)
|
||||
}
|
||||
|
@ -95,7 +95,12 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
||||
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
|
||||
<div class='modalcontenttex'>
|
||||
<?php
|
||||
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
||||
if ($config['history_db_connection'] === false) {
|
||||
echo __('Failure to connect to historical database, please check the configuration or contact system administrator if you need assistance.');
|
||||
} else {
|
||||
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@ -134,4 +139,4 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
||||
<div id="opacity"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -208,7 +208,7 @@ if (!$new_agent && $alias != '') {
|
||||
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'</p>';
|
||||
$table_agent_name .= '<div class="label_select_parent">';
|
||||
$table_agent_name .= '<div class="label_select_child_left" style="width: 60%;">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
|
||||
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
|
||||
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 70%;">';
|
||||
|
||||
if ($id_agente) {
|
||||
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" readonly value="'.$id_agente.'" />';
|
||||
|
@ -45,3 +45,22 @@ switch ($wizard_section) {
|
||||
*/
|
||||
|
||||
require 'agent_wizard.'.$wizard_section.'.php';
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function satellite_remote_warn(id_satellite, remote)
|
||||
{
|
||||
if(!remote)
|
||||
{
|
||||
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
|
||||
$('#satellite_remote_tip').removeAttr("style").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#satellite_remote_tip').removeAttr("style").hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
@ -738,11 +738,16 @@ $servers_to_exec[0] = __('Local console');
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_satellite.php');
|
||||
|
||||
$rows = get_proxy_servers(true);
|
||||
$rows = get_proxy_servers();
|
||||
|
||||
// Check if satellite server has remote configuration enabled.
|
||||
$satellite_remote = config_agents_has_remote_configuration($id_agent);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($row['server_type'] != 13) {
|
||||
$s_type = ' (Standard)';
|
||||
} else {
|
||||
$id_satellite = $row['id_server'];
|
||||
$s_type = ' (Satellite)';
|
||||
}
|
||||
|
||||
@ -750,8 +755,16 @@ if (enterprise_installed()) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
|
||||
$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
|
||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
|
||||
$table->data[1][3] = html_print_select(
|
||||
$servers_to_exec,
|
||||
'server_to_exec',
|
||||
$server_to_exec,
|
||||
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
@ -1020,6 +1033,8 @@ ui_require_javascript_file('pandora_modules');
|
||||
var separator = '<?php echo $separator; ?>';
|
||||
|
||||
$(document).ready (function () {
|
||||
$('#server_to_exec option').trigger('change');
|
||||
|
||||
$("#walk_form").submit(function() {
|
||||
$("#oid_loading").show ();
|
||||
});
|
||||
|
@ -492,7 +492,7 @@ if (enterprise_installed()) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
|
||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
|
||||
$table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
|
||||
$table->data[1][4] = html_print_select(
|
||||
$servers_to_exec,
|
||||
@ -734,20 +734,5 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
"json");
|
||||
}
|
||||
|
||||
|
||||
function satellite_remote_warn(id_satellite, remote)
|
||||
{
|
||||
if(!remote)
|
||||
{
|
||||
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
|
||||
$('#satellite_remote_tip').removeAttr("style").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#satellite_remote_tip').removeAttr("style").hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -64,12 +64,22 @@ if ($wmiexplore) {
|
||||
$processes_name_field = 1;
|
||||
if (enterprise_installed() && (int) $server_to_exec != 0) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_processes."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_processes."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_processes."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_processes, $output);
|
||||
}
|
||||
@ -110,12 +120,21 @@ if ($wmiexplore) {
|
||||
'id_server',
|
||||
$server_to_exec
|
||||
);
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_services."'",
|
||||
'".$wmi_services."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_services."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_services, $output);
|
||||
}
|
||||
@ -145,12 +164,22 @@ if ($wmiexplore) {
|
||||
|
||||
if (enterprise_installed() && (int) $server_to_exec != 0) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_disks."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_disks."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_disks."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_disks, $output);
|
||||
}
|
||||
@ -469,7 +498,7 @@ if (enterprise_installed()) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Server to execute command').'</b>';
|
||||
$table->data[2][0] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
|
||||
$table->data[2][1] = html_print_select(
|
||||
$servers_to_exec,
|
||||
'server_to_exec',
|
||||
|
@ -163,8 +163,23 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Threshold');
|
||||
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
||||
$table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>';
|
||||
$table->data[3][1] = html_print_extended_select_for_time(
|
||||
'module_action_threshold',
|
||||
0,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
if (!isset($step)) {
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
|
@ -412,65 +412,56 @@ $url_up_template = $url.'&sort_field=template&sort=up&pure='.$pure;
|
||||
$url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure;
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table_alert_list = new stdClass();
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table->class = 'alert_list databox';
|
||||
$table_alert_list->class = 'alert_list databox';
|
||||
} else {
|
||||
$table->class = 'info_table';
|
||||
$table_alert_list->class = 'info_table';
|
||||
}
|
||||
|
||||
$table->width = '100%';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->size = [];
|
||||
$table_alert_list->width = '100%';
|
||||
$table_alert_list->cellpadding = 0;
|
||||
$table_alert_list->cellspacing = 0;
|
||||
$table_alert_list->size = [];
|
||||
|
||||
$table->align = [];
|
||||
$table->align[0] = 'left';
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[4] = 'left';
|
||||
$table_alert_list->align = [];
|
||||
$table_alert_list->align[0] = 'left';
|
||||
$table_alert_list->align[1] = 'left';
|
||||
$table_alert_list->align[2] = 'left';
|
||||
$table_alert_list->align[3] = 'left';
|
||||
$table_alert_list->align[4] = 'left';
|
||||
|
||||
$table->head = [];
|
||||
$table_alert_list->head = [];
|
||||
|
||||
if (! $id_agente) {
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
||||
$table->headstyle[0] = 'width: 100%; min-width: 12em;';
|
||||
$table->headstyle[1] = 'min-width: 15em;';
|
||||
$table->headstyle[2] = 'min-width: 20em;';
|
||||
$table->headstyle[3] = 'min-width: 1em;';
|
||||
$table->headstyle[4] = 'min-width: 15em;';
|
||||
|
||||
/*
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[4] = '8%';
|
||||
}*/
|
||||
$table_alert_list->style = [];
|
||||
$table_alert_list->style[0] = 'font-weight: bold;';
|
||||
$table_alert_list->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
||||
} else {
|
||||
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||
$table->headstyle[0] = 'width: 100%; min-width: 15em;';
|
||||
$table->headstyle[1] = 'min-width: 15em;';
|
||||
$table->headstyle[2] = 'min-width: 20em;';
|
||||
$table->headstyle[3] = 'min-width: 1em;';
|
||||
$table->headstyle[4] = 'min-width: 15em;';
|
||||
$table_alert_list->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||
}
|
||||
|
||||
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||
$table->head[2] = __('Actions');
|
||||
$table->head[3] = __('Status');
|
||||
$table->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
|
||||
$table_alert_list->head[1] = __('Status');
|
||||
$table_alert_list->head[2] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||
$table_alert_list->head[3] = __('Actions');
|
||||
$table_alert_list->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
|
||||
|
||||
$table->valign[0] = 'middle';
|
||||
$table->valign[1] = 'middle';
|
||||
$table->valign[2] = 'middle';
|
||||
$table->valign[3] = 'middle';
|
||||
$table->valign[4] = 'middle';
|
||||
$table_alert_list->headstyle[0] = 'min-width: 200px; width:30%;';
|
||||
$table_alert_list->headstyle[1] = 'min-width: 50px; width:8%';
|
||||
$table_alert_list->headstyle[2] = 'min-width: 150px; width:22%;';
|
||||
$table_alert_list->headstyle[3] = 'min-width: 200px; width:30%;';
|
||||
$table_alert_list->headstyle[4] = 'min-width: 150px; width:10%;';
|
||||
|
||||
$table->style[4] = 'min-width:80px';
|
||||
$table_alert_list->valign[0] = 'middle';
|
||||
$table_alert_list->valign[1] = 'middle';
|
||||
$table_alert_list->valign[2] = 'middle';
|
||||
$table_alert_list->valign[3] = 'middle';
|
||||
$table_alert_list->valign[4] = 'middle';
|
||||
|
||||
$table->data = [];
|
||||
$table_alert_list->cellstyle = [];
|
||||
|
||||
$table_alert_list->data = [];
|
||||
|
||||
$url .= $sort_params;
|
||||
|
||||
@ -479,14 +470,14 @@ $iterator = 0;
|
||||
|
||||
foreach ($simple_alerts as $alert) {
|
||||
if ($alert['disabled']) {
|
||||
$table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
|
||||
$table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;';
|
||||
$table_alert_list->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
|
||||
$table_alert_list->style[$iterator][2] = 'font-style: italic; color: #aaaaaa;';
|
||||
}
|
||||
|
||||
if ($rowPair) {
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
$table_alert_list->rowclass[$iterator] = 'rowPair';
|
||||
} else {
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
$table_alert_list->rowclass[$iterator] = 'rowOdd';
|
||||
}
|
||||
|
||||
$rowPair = !$rowPair;
|
||||
@ -523,38 +514,53 @@ foreach ($simple_alerts as $alert) {
|
||||
$all_groups = agents_get_all_groups_agent($id_agente);
|
||||
}
|
||||
|
||||
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
|
||||
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[…]', 'display:block;font-size: 7.2pt').'<br>';
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = '';
|
||||
|
||||
if ($alert['times_fired'] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
|
||||
} else if ($alert['disabled'] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
$title = __('Alert disabled');
|
||||
} else {
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = __('Alert not fired');
|
||||
}
|
||||
|
||||
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
|
||||
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[…]', 'display:block;font-weight:normal;').'<br>';
|
||||
|
||||
$data[1] = ui_print_status_image($status, $title, true);
|
||||
|
||||
$template_group = db_get_value('id_group', 'talert_templates', 'id', $alert['id_alert_template']);
|
||||
|
||||
// The access to the template manage page is necessary have LW permissions on template group
|
||||
if (check_acl($config['id_user'], $template_group, 'LW')) {
|
||||
$data[1] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$alert['id_alert_template']."'>";
|
||||
$data[2] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$alert['id_alert_template']."'>";
|
||||
}
|
||||
|
||||
$data[1] .= ui_print_truncate_text(
|
||||
$data[2] .= ui_print_truncate_text(
|
||||
alerts_get_alert_template_name($alert['id_alert_template']),
|
||||
'module_medium',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'[…]',
|
||||
'font-size: 7.1pt'
|
||||
''
|
||||
);
|
||||
$data[1] .= ' <a class="template_details"
|
||||
$data[2] .= ' <a class="template_details"
|
||||
href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
|
||||
$data[1] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help']);
|
||||
$data[1] .= '</a> ';
|
||||
$data[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']);
|
||||
$data[2] .= '</a> ';
|
||||
|
||||
if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) {
|
||||
$data[1] .= '</a>';
|
||||
$data[2] .= '</a>';
|
||||
}
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions($alert['id']);
|
||||
|
||||
$data[2] = "<table width='70%'>";
|
||||
$data[3] = "<table style='width:100%;'>";
|
||||
// Get and show default actions for this alert
|
||||
$default_action = db_get_sql(
|
||||
'SELECT id_alert_action
|
||||
@ -562,69 +568,74 @@ foreach ($simple_alerts as $alert) {
|
||||
WHERE id = '.$alert['id_alert_template']
|
||||
);
|
||||
if ($default_action != '') {
|
||||
$data[2] .= "<tr><td><ul class='action_list'><li>";
|
||||
$data[2] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' <em>('.__('Default').')</em>';
|
||||
$data[2] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
|
||||
$data[2] .= '</li></ul></td>';
|
||||
$data[2] .= '<td></td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[3] .= "<tr><td colspan='2'><ul class='action_list'><li>";
|
||||
$data[3] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' <em>('.__('Default').')</em>';
|
||||
$data[3] .= '</li></ul></td>';
|
||||
$data[3] .= '</tr>';
|
||||
}
|
||||
|
||||
foreach ($actions as $action_id => $action) {
|
||||
$data[2] .= '<tr>';
|
||||
$data[2] .= '<td>';
|
||||
$data[2] .= '<ul class="action_list" style="display:inline;">';
|
||||
$data[2] .= '<li style="display:inline;">';
|
||||
$data[3] .= '<tr style="display: grid; grid-template-columns: 1fr 1fr; align-items: center;">';
|
||||
$data[3] .= '<td>';
|
||||
$data[3] .= '<ul class="action_list" style="display:inline;">';
|
||||
$data[3] .= '<li style="display:inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[2] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[3] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
} else {
|
||||
$data[2] .= '<font class="action_name">';
|
||||
$data[3] .= '<font class="action_name">';
|
||||
}
|
||||
|
||||
$data[2] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false);
|
||||
$data[2] .= ' <em>(';
|
||||
$data[3] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false);
|
||||
$data[3] .= ' <em>(';
|
||||
if ($action['fires_min'] == $action['fires_max']) {
|
||||
if ($action['fires_min'] == 0) {
|
||||
$data[2] .= __('Always');
|
||||
$data[3] .= __('Always');
|
||||
} else {
|
||||
$data[2] .= __('On').' '.$action['fires_min'];
|
||||
$data[3] .= __('On').' '.$action['fires_min'];
|
||||
}
|
||||
} else if ($action['fires_min'] < $action['fires_max']) {
|
||||
if ($action['fires_min'] == 0) {
|
||||
$data[2] .= __('Until').' '.$action['fires_max'];
|
||||
$data[3] .= __('Until').' '.$action['fires_max'];
|
||||
} else {
|
||||
$data[2] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max'];
|
||||
$data[3] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max'];
|
||||
}
|
||||
} else {
|
||||
$data[2] .= __('From').' '.$action['fires_min'];
|
||||
$data[3] .= __('From').' '.$action['fires_min'];
|
||||
}
|
||||
|
||||
if ($action['module_action_threshold'] != 0) {
|
||||
$data[2] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny');
|
||||
$data[3] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny');
|
||||
}
|
||||
|
||||
$data[2] .= ')</em>';
|
||||
$data[2] .= '</font>';
|
||||
$data[2] .= '</li>';
|
||||
$data[2] .= '</ul>';
|
||||
$data[3] .= ')</em>';
|
||||
$data[3] .= '</font>';
|
||||
$data[3] .= '</li>';
|
||||
$data[3] .= '</ul>';
|
||||
|
||||
// Is possible manage actions if have LW permissions in the agent group of the alert module
|
||||
$data[3] .= '</td>';
|
||||
|
||||
$data[3] .= '<td style=" display: flex; align-items: center;">';
|
||||
$data[3] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
|
||||
// Is possible manage actions if have LW permissions in the agent group of the alert module
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) {
|
||||
// ~ $data[2] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline; vertical-align: -50%;">';
|
||||
$data[2] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">';
|
||||
$data[2] .= html_print_input_image(
|
||||
$data[3] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">';
|
||||
$data[3] .= html_print_input_image(
|
||||
'delete',
|
||||
'images/cross.png',
|
||||
1,
|
||||
'padding:0px;',
|
||||
'padding:0px; margin-left:5px; margin-right:5px;',
|
||||
true,
|
||||
['title' => __('Delete action')]
|
||||
[
|
||||
'title' => __('Delete action'),
|
||||
'class' => 'action_button_img',
|
||||
]
|
||||
);
|
||||
$data[2] .= html_print_input_hidden('delete_action', 1, true);
|
||||
$data[2] .= html_print_input_hidden('id_alert', $alert['id'], true);
|
||||
$data[2] .= html_print_input_hidden('id_action', $action_id, true);
|
||||
$data[2] .= '</form>';
|
||||
$data[2] .= html_print_input_image(
|
||||
$data[3] .= html_print_input_hidden('delete_action', 1, true);
|
||||
$data[3] .= html_print_input_hidden('id_alert', $alert['id'], true);
|
||||
$data[3] .= html_print_input_hidden('id_action', $action_id, true);
|
||||
$data[3] .= '</form>';
|
||||
$data[3] .= html_print_input_image(
|
||||
'update_action',
|
||||
'images/config.png',
|
||||
1,
|
||||
@ -632,19 +643,20 @@ foreach ($simple_alerts as $alert) {
|
||||
true,
|
||||
[
|
||||
'title' => __('Update action'),
|
||||
'class' => 'action_button_img',
|
||||
'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action_id.'\',\''.$alert['id_agent_module'].'\')',
|
||||
]
|
||||
);
|
||||
$data[2] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
|
||||
$data[3] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
|
||||
}
|
||||
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
}
|
||||
|
||||
$data[2] .= '<div id="update_action-div" style="display:none;text-align:left">';
|
||||
$data[2] .= '</div>';
|
||||
$data[2] .= '</table>';
|
||||
$data[3] .= '<div id="update_action-div" style="display:none;text-align:left">';
|
||||
$data[3] .= '</div>';
|
||||
$data[3] .= '</table>';
|
||||
// Is possible manage actions if have LW permissions in the agent group of the alert module
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
@ -660,45 +672,45 @@ foreach ($simple_alerts as $alert) {
|
||||
$actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')');
|
||||
}
|
||||
|
||||
$data[2] .= '<div id="add_action-div-'.$alert['id'].'" style="display:none;text-align:left">';
|
||||
$data[2] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
|
||||
$data[2] .= '<table class="databox_color" style="width:100%">';
|
||||
$data[2] .= html_print_input_hidden('add_action', 1, true);
|
||||
$data[2] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
|
||||
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" style="display:none;text-align:left">';
|
||||
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
|
||||
$data[3] .= '<table class="databox_color" style="width:100%">';
|
||||
$data[3] .= html_print_input_hidden('add_action', 1, true);
|
||||
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
|
||||
|
||||
if (! $id_agente) {
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Agent');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[3] .= '<tr class="datos2">';
|
||||
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[3] .= __('Agent');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td class="datos">';
|
||||
$data[3] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[…]');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
}
|
||||
|
||||
$data[2] .= '<tr class="datos">';
|
||||
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Module');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[…]');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Action');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos2">';
|
||||
$data[2] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos">';
|
||||
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Number of alerts match from');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos">';
|
||||
$data[2] .= html_print_input_text(
|
||||
$data[3] .= '<tr class="datos">';
|
||||
$data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[3] .= __('Module');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td class="datos">';
|
||||
$data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[…]');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
$data[3] .= '<tr class="datos2">';
|
||||
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[3] .= __('Action');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td class="datos2">';
|
||||
$data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
$data[3] .= '<tr class="datos">';
|
||||
$data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||
$data[3] .= __('Number of alerts match from');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td class="datos">';
|
||||
$data[3] .= html_print_input_text(
|
||||
'fires_min',
|
||||
0,
|
||||
'',
|
||||
@ -706,8 +718,8 @@ foreach ($simple_alerts as $alert) {
|
||||
10,
|
||||
true
|
||||
);
|
||||
$data[2] .= ' '.__('to').' ';
|
||||
$data[2] .= html_print_input_text(
|
||||
$data[3] .= ' '.__('to').' ';
|
||||
$data[3] .= html_print_input_text(
|
||||
'fires_max',
|
||||
0,
|
||||
'',
|
||||
@ -715,47 +727,40 @@ foreach ($simple_alerts as $alert) {
|
||||
10,
|
||||
true
|
||||
);
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '<tr class="datos2">';
|
||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[2] .= __('Threshold');
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '<td class="datos2">';
|
||||
$data[2] .= html_print_input_text(
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
$data[3] .= '<tr class="datos2">';
|
||||
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||
$data[3] .= __('Threshold');
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '<td class="datos2">';
|
||||
$data[3] .= html_print_extended_select_for_time(
|
||||
'module_action_threshold',
|
||||
0,
|
||||
'',
|
||||
'',
|
||||
4,
|
||||
10,
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data[2] .= '</td>';
|
||||
$data[2] .= '</tr>';
|
||||
$data[2] .= '</table>';
|
||||
$data[2] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true);
|
||||
$data[2] .= '</form>';
|
||||
$data[2] .= '</div>';
|
||||
$data[3] .= '</td>';
|
||||
$data[3] .= '</tr>';
|
||||
$data[3] .= '</table>';
|
||||
$data[3] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true);
|
||||
$data[3] .= '</form>';
|
||||
$data[3] .= '</div>';
|
||||
}
|
||||
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = '';
|
||||
|
||||
if ($alert['times_fired'] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
|
||||
} else if ($alert['disabled'] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
$title = __('Alert disabled');
|
||||
} else {
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = __('Alert not fired');
|
||||
}
|
||||
|
||||
$data[3] = ui_print_status_image($status, $title, true);
|
||||
|
||||
$table->cellclass[] = [
|
||||
3 => 'action_buttons',
|
||||
$table_alert_list->cellclass[] = [
|
||||
1 => 'action_buttons',
|
||||
4 => 'action_buttons',
|
||||
];
|
||||
$data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">';
|
||||
@ -790,11 +795,11 @@ foreach ($simple_alerts as $alert) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false) {
|
||||
$data[3] .= '';
|
||||
$data[1] .= '';
|
||||
} else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[3] .= ' <a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
|
||||
$data[1] .= ' <a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -840,11 +845,11 @@ foreach ($simple_alerts as $alert) {
|
||||
$data[4] .= '</form>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
array_push($table_alert_list->data, $data);
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
html_print_table($table);
|
||||
html_print_table($table_alert_list);
|
||||
if ($id_agente) {
|
||||
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
} else {
|
||||
@ -864,7 +869,7 @@ if (isset($dont_display_alert_create_bttn)) {
|
||||
}
|
||||
|
||||
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table_alert_list->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'crtbtn', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
|
@ -177,7 +177,23 @@ $table->data[2][1] .= '<div id="command_description" style=""></div>';
|
||||
$table->colspan[2][1] = 2;
|
||||
|
||||
$table->data[3][0] = __('Threshold');
|
||||
$table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true);
|
||||
$table->data[3][1] = html_print_extended_select_for_time(
|
||||
'action_threshold',
|
||||
$action_threshold,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
$table->colspan[3][1] = 2;
|
||||
|
||||
$table->data[4][0] = '';
|
||||
|
@ -55,7 +55,7 @@ if ($id) {
|
||||
$id_group = $filter['id_group'];
|
||||
$id_name = $filter['id_name'];
|
||||
$event_type = $filter['event_type'];
|
||||
$severity = $filter['severity'];
|
||||
$severity = explode(',', $filter['severity']);
|
||||
$status = $filter['status'];
|
||||
$search = $filter['search'];
|
||||
$text_agent = $filter['text_agent'];
|
||||
@ -123,7 +123,7 @@ if ($update || $create) {
|
||||
$id_group_filter = get_parameter('id_group_filter');
|
||||
$id_name = (string) get_parameter('id_name');
|
||||
$event_type = get_parameter('event_type', '');
|
||||
$severity = get_parameter('severity', '');
|
||||
$severity = implode(',', get_parameter('severity', -1));
|
||||
$status = get_parameter('status', '');
|
||||
$search = get_parameter('search', '');
|
||||
$text_agent = get_parameter('text_agent', '');
|
||||
@ -172,6 +172,8 @@ if ($update || $create) {
|
||||
'user_comment' => $user_comment,
|
||||
'filter_only_alert' => $filter_only_alert,
|
||||
];
|
||||
|
||||
$severity = explode(',', $severity);
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
@ -289,15 +291,24 @@ $table->data[3][1] = html_print_select(
|
||||
true
|
||||
);
|
||||
|
||||
if (empty($severity) && $severity !== '0') {
|
||||
$severity = -1;
|
||||
}
|
||||
|
||||
$table->data[4][0] = '<b>'.__('Severity').'</b>';
|
||||
$table->data[4][1] = html_print_select(
|
||||
get_priorities(),
|
||||
'severity',
|
||||
'severity[]',
|
||||
$severity,
|
||||
'',
|
||||
__('All'),
|
||||
'-1',
|
||||
true
|
||||
-1,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 175px'
|
||||
);
|
||||
|
||||
$fields = events_get_all_status();
|
||||
|
@ -290,7 +290,7 @@ $table_aux = new stdClass();
|
||||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>';
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
|
||||
|
||||
$data[1] = ui_print_truncate_text($graph['description'], 70);
|
||||
|
||||
|
@ -628,6 +628,8 @@ switch ($action) {
|
||||
$unknown_checks = $item['unknown_checks'];
|
||||
$agent_max_value = $item['agent_max_value'];
|
||||
$agent_min_value = $item['agent_min_value'];
|
||||
$failover_mode = $item['failover_mode'];
|
||||
$failover_type = $item['failover_type'];
|
||||
break;
|
||||
|
||||
case 'group_report':
|
||||
@ -3263,6 +3265,13 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
$meta = false;
|
||||
}
|
||||
|
||||
$failover_mode = db_get_value(
|
||||
'failover_mode',
|
||||
'treport_content',
|
||||
'id_rc',
|
||||
$idItem
|
||||
);
|
||||
|
||||
$operation = [
|
||||
'avg' => __('rate'),
|
||||
'max' => __('max'),
|
||||
@ -3284,6 +3293,18 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
<th class="header" scope="col">
|
||||
<?php echo __('Module'); ?>
|
||||
</th>
|
||||
<?php
|
||||
if ($failover_mode) {
|
||||
?>
|
||||
<th class="header" scope="col">
|
||||
<?php echo __('Agent Failover'); ?>
|
||||
</th>
|
||||
<th class="header" scope="col">
|
||||
<?php echo __('Module Failover'); ?>
|
||||
</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th class="header" scope="col">
|
||||
<?php echo __('Action'); ?>
|
||||
</th>
|
||||
@ -3318,7 +3339,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
case 'new':
|
||||
?>
|
||||
<tr id="general_template" style="" class="datos">
|
||||
<td colspan="3">
|
||||
<td colspan="4">
|
||||
<?php
|
||||
echo __('Please save the report to start adding items into the list.');
|
||||
?>
|
||||
@ -3365,19 +3386,50 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
['id_agente_modulo' => $item['id_agent_module']]
|
||||
);
|
||||
|
||||
if (isset($item['id_agent_module_failover']) === true
|
||||
&& $item['id_agent_module_failover'] !== 0
|
||||
) {
|
||||
$idAgentFailover = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_failover']]
|
||||
);
|
||||
$nameAgentFailover = agents_get_alias(
|
||||
$idAgentFailover
|
||||
);
|
||||
|
||||
$nameModuleFailover = db_get_value_filter(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_failover']]
|
||||
);
|
||||
}
|
||||
|
||||
$server_name_element = '';
|
||||
if ($meta && $server_name != '') {
|
||||
$server_name_element .= ' ('.$server_name.')';
|
||||
}
|
||||
|
||||
if ($type == 'availability') {
|
||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||
<td>'.printSmallFont($nameModule).'</td>
|
||||
<td style="text-align: center;">
|
||||
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
||||
</td>
|
||||
</tr>';
|
||||
if ($failover_mode) {
|
||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||
<td>'.printSmallFont($nameModule).'</td>
|
||||
<td>'.printSmallFont($nameAgentFailover).$server_name_element.'</td>
|
||||
<td>'.printSmallFont($nameModuleFailover).'</td>
|
||||
<td style="text-align: center;">
|
||||
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
||||
</td>
|
||||
</tr>';
|
||||
} else {
|
||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||
<td>'.printSmallFont($nameModule).'</td>
|
||||
<td style="text-align: center;">
|
||||
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
} else {
|
||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||
@ -3403,6 +3455,15 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
<td class="agent_name"></td>
|
||||
<td class="module_name"></td>
|
||||
<?php
|
||||
if ($type == 'availability'
|
||||
&& $failover_mode
|
||||
) {
|
||||
?>
|
||||
<td class="agent_name_failover"></td>
|
||||
<td class="module_name_failover"></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($type != 'availability') {
|
||||
?>
|
||||
<td class="operation_name"></td>
|
||||
@ -3456,6 +3517,43 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
if ($type == 'availability' && $failover_mode) {
|
||||
?>
|
||||
<td class="sla_list_agent_failover_col">
|
||||
<input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
|
||||
<input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
|
||||
<?php
|
||||
$params = [];
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent_failover';
|
||||
$params['value'] = '';
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module_failover';
|
||||
$params['add_none_module'] = false;
|
||||
if ($meta) {
|
||||
$params['use_input_id_server'] = true;
|
||||
$params['input_id_server_id'] = 'hidden-id_server';
|
||||
$params['disabled_javascript_on_blur_function'] = true;
|
||||
}
|
||||
|
||||
ui_print_agent_autocomplete_input($params);
|
||||
?>
|
||||
</td>
|
||||
<td class="sla_list_module_failover_col">
|
||||
<select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
|
||||
<option value="0">
|
||||
<?php
|
||||
echo __('Select an Agent first');
|
||||
?>
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ($type !== 'availability') {
|
||||
?>
|
||||
<td>
|
||||
@ -4495,6 +4593,10 @@ function addGeneralRow() {
|
||||
var idAgent = $("input[name=id_agent_general]").val();
|
||||
var serverId = $("input[name=id_server]").val();
|
||||
var idModule = $("#id_agent_module_general").val();
|
||||
var nameAgentFailover = $("input[name=agent_failover]").val();
|
||||
var idModuleFailover = $("#id_agent_module_failover").val();
|
||||
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
|
||||
|
||||
var operation;
|
||||
if ($("#id_operation_module_general").length) {
|
||||
operation = $("#id_operation_module_general").val();
|
||||
@ -4580,10 +4682,63 @@ function addGeneralRow() {
|
||||
}
|
||||
});
|
||||
|
||||
if (nameAgentFailover != '') {
|
||||
//Truncate nameAgentFailover
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameAgentFailover);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action=
|
||||
<?php
|
||||
echo '"'.ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'"';
|
||||
?>
|
||||
+ "/ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameAgentFailover = data;
|
||||
}
|
||||
});
|
||||
|
||||
//Truncate nameModuleFailover
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameModuleFailover);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action=
|
||||
<?php
|
||||
echo '"'.ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'"';
|
||||
?>
|
||||
+ "/ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameModuleFailover = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var params = [];
|
||||
params.push("add_general=1");
|
||||
params.push("id=" + $("input[name=id_item]").val());
|
||||
params.push("id_module=" + idModule);
|
||||
params.push("id_module_failover=" + idModuleFailover);
|
||||
params.push("id_server=" + serverId);
|
||||
params.push("operation=" + operation);
|
||||
params.push("id_agent=" + idAgent);
|
||||
@ -4610,6 +4765,8 @@ function addGeneralRow() {
|
||||
$("#row", row).attr('id', 'general_' + data['id']);
|
||||
$(".agent_name", row).html(nameAgent);
|
||||
$(".module_name", row).html(nameModule);
|
||||
$(".agent_name_failover", row).html(nameAgentFailover);
|
||||
$(".module_name_failover", row).html(nameModuleFailover);
|
||||
$(".operation_name", row).html(nameOperation);
|
||||
$(".delete_button", row).attr(
|
||||
'href',
|
||||
@ -4624,6 +4781,15 @@ function addGeneralRow() {
|
||||
$("#id_operation_module_general").val('avg');
|
||||
$("#id_agent_module_general").empty();
|
||||
$("#id_agent_module_general").attr('disabled', 'true');
|
||||
|
||||
$("input[name=id_agent_failover]").val('');
|
||||
$("input[name=agent_failover]").val('');
|
||||
$("#id_agent_module_failover").empty();
|
||||
$("#id_agent_module_failover").attr('disabled', 'true');
|
||||
$("#id_agent_module_failover").append(
|
||||
$("<option></option>")
|
||||
.attr ("value", 0)
|
||||
.html ($("#module_sla_text").html()));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -5111,6 +5277,12 @@ function chooseType() {
|
||||
$("#row_select_fields3").hide();
|
||||
}
|
||||
$("#row_historical_db_check").hide();
|
||||
|
||||
$("#row_failover_mode").show();
|
||||
var failover_checked = $("input[name='failover_mode']").prop("checked");
|
||||
if(failover_checked){
|
||||
$("#row_failover_type").show();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'group_report':
|
||||
|
@ -1207,8 +1207,7 @@ switch ($action) {
|
||||
$report_id_user = get_parameter('report_id_user');
|
||||
$non_interactive = get_parameter('non_interactive', 0);
|
||||
|
||||
// Pretty font by default for pdf.
|
||||
$custom_font = 'FreeSans.ttf';
|
||||
$custom_font = $config['custom_report_front_font'];
|
||||
|
||||
switch ($type_access_selected) {
|
||||
case 'group_view':
|
||||
@ -1284,7 +1283,6 @@ switch ($action) {
|
||||
$metaconsole_report = (int) is_metaconsole();
|
||||
|
||||
if ($config['custom_report_front']) {
|
||||
$custom_font = $config['custom_report_front_font'];
|
||||
$logo = $config['custom_report_front_logo'];
|
||||
$header = $config['custom_report_front_header'];
|
||||
$first_page = $config['custom_report_front_firstpage'];
|
||||
@ -1611,6 +1609,14 @@ switch ($action) {
|
||||
$values['agent_min_value'] = get_parameter(
|
||||
'agent_min_value'
|
||||
);
|
||||
$values['failover_mode'] = get_parameter(
|
||||
'failover_mode',
|
||||
0
|
||||
);
|
||||
$values['failover_type'] = get_parameter(
|
||||
'failover_type',
|
||||
REPORT_FAILOVER_TYPE_NORMAL
|
||||
);
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
|
@ -32,7 +32,7 @@ if (isset($_GET['server'])) {
|
||||
$id_server = get_parameter_get('server');
|
||||
// Headers
|
||||
ui_print_page_header(__('Update Server'), 'images/gm_servers.png', false, 'servers', true);
|
||||
$sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy FROM tserver WHERE id_server = %d', $id_server);
|
||||
$sql = sprintf('SELECT name, ip_address, description, server_type, exec_proxy, port FROM tserver WHERE id_server = %d', $id_server);
|
||||
$row = db_get_row_sql($sql);
|
||||
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
|
||||
html_print_input_hidden('server', $id_server);
|
||||
@ -75,6 +75,14 @@ if (isset($_GET['server'])) {
|
||||
__('Exec Server'),
|
||||
html_print_checkbox('exec_proxy', 1, $row['exec_proxy'], true),
|
||||
];
|
||||
|
||||
$port_number = empty($row['port']) ? '' : $row['port'];
|
||||
|
||||
$table->data[] = [
|
||||
__('Port'),
|
||||
html_print_input_text('port', $port_number, '', 10, 0, true).ui_print_help_tip(__('Leave blank to use SSH default port (22)'), true),
|
||||
];
|
||||
|
||||
if ($row['exec_proxy']) {
|
||||
$table->data[] = [
|
||||
__('Check Exec Server'),
|
||||
@ -136,11 +144,15 @@ if (isset($_GET['server'])) {
|
||||
$description = get_parameter_post('description');
|
||||
$id_server = get_parameter_post('server');
|
||||
$exec_proxy = get_parameter_post('exec_proxy');
|
||||
$port = get_parameter_post('port');
|
||||
|
||||
$port_number = empty($port) ? 0 : $port;
|
||||
|
||||
$values = [
|
||||
'ip_address' => $address,
|
||||
'description' => $description,
|
||||
'exec_proxy' => $exec_proxy,
|
||||
'port' => $port_number,
|
||||
];
|
||||
$result = db_process_sql_update('tserver', $values, ['id_server' => $id_server]);
|
||||
if ($result !== false) {
|
||||
|
@ -101,6 +101,10 @@ foreach ($servers as $server) {
|
||||
$data[2] .= ui_print_help_tip(__('This is a master server'), true);
|
||||
}
|
||||
|
||||
if ($server['exec_proxy'] == 1) {
|
||||
$data[2] .= html_print_image('images/star.png', true, ['title' => __('Exec server enabled')]);
|
||||
}
|
||||
|
||||
// $data[2] .= '</span> <span style="font-size:8px;"> v' .. '</span>';
|
||||
switch ($server['type']) {
|
||||
case 'snmp':
|
||||
|
@ -1011,6 +1011,7 @@ $row++;
|
||||
$table_report->class = 'databox filters';
|
||||
$table_report->style[0] = 'font-weight: bold;';
|
||||
$table_report->size[0] = '50%';
|
||||
|
||||
$table_report->data = [];
|
||||
|
||||
$table_report->data[$row][0] = __('Show report info with description').ui_print_help_tip(
|
||||
@ -1048,6 +1049,20 @@ $row++;
|
||||
|
||||
$row++;
|
||||
|
||||
$table_report->data[$row][0] = __('PDF font family');
|
||||
$table_report->data[$row][1] = html_print_select(
|
||||
$fonts,
|
||||
'custom_report_front_font',
|
||||
$config['custom_report_front_font'],
|
||||
false,
|
||||
__('Default'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$row++;
|
||||
|
||||
|
||||
$table_report->data[$row][0] = __('Graph image height for HTML reports');
|
||||
$table_report->data[$row][0] .= ui_print_help_tip(
|
||||
__('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'),
|
||||
@ -1078,18 +1093,6 @@ $row++;
|
||||
}
|
||||
}
|
||||
|
||||
// Font
|
||||
$table_report->data['custom_report_front-font'][0] = __('Custom report front').' - '.__('Font family');
|
||||
$table_report->data['custom_report_front-font'][1] = html_print_select(
|
||||
$fonts,
|
||||
'custom_report_front_font',
|
||||
$config['custom_report_front_font'],
|
||||
false,
|
||||
__('Default'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
// Logo
|
||||
$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip(
|
||||
__("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."),
|
||||
@ -1155,7 +1158,6 @@ $row++;
|
||||
html_print_table($table_report);
|
||||
echo '</fieldset>';
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// OTHER CONFIGURATION
|
||||
// ----------------------------------------------------------------------
|
||||
@ -1164,17 +1166,17 @@ $row++;
|
||||
$table_other->class = 'databox filters';
|
||||
$table_other->style[0] = 'font-weight: bold;';
|
||||
$table_other->size[0] = '50%';
|
||||
$table_other->size[1] = '26%';
|
||||
$table_other->size[2] = '12%';
|
||||
$table_other->size[3] = '12%';
|
||||
$table_other->data = [];
|
||||
|
||||
|
||||
|
||||
|
||||
$table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true);
|
||||
$table_other->data[$row][1] = html_print_input_text(
|
||||
'graphviz_bin_dir',
|
||||
$config['graphviz_bin_dir'],
|
||||
'',
|
||||
50,
|
||||
25,
|
||||
255,
|
||||
true
|
||||
);
|
||||
@ -1192,8 +1194,6 @@ $row++;
|
||||
);
|
||||
$row++;
|
||||
|
||||
|
||||
|
||||
$table_other->data[$row][0] = __('Show only the group name');
|
||||
$table_other->data[$row][0] .= ui_print_help_tip(
|
||||
__('Show the group name instead the group icon.'),
|
||||
@ -1239,16 +1239,15 @@ $row++;
|
||||
// CUSTOM VALUES POST PROCESS
|
||||
// ----------------------------------------------------------------------
|
||||
$table_other->data[$row][0] = __('Custom values post process');
|
||||
$table_other->data[$row][1] = '<table>';
|
||||
$table_other->data[$row][1] .= __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true);
|
||||
$table_other->data[$row][1] .= ' '.__('Text').': '.html_print_input_text('custom_text', '', '', 25, 50, true);
|
||||
$table_other->data[$row][1] .= ' ';
|
||||
$table_other->data[$row][1] .= html_print_input_hidden(
|
||||
$table_other->data[$row][1] = __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true);
|
||||
$table_other->data[$row][2] = __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true);
|
||||
$table_other->data[$row][2] .= ' ';
|
||||
$table_other->data[$row][2] .= html_print_input_hidden(
|
||||
'custom_value_add',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table_other->data[$row][1] .= html_print_button(
|
||||
$table_other->data[$row][3] = html_print_button(
|
||||
__('Add'),
|
||||
'custom_value_add_btn',
|
||||
false,
|
||||
@ -1257,10 +1256,11 @@ $row++;
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[$row][1] .= '<br /><br />';
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][1] .= __('Delete custom values').': ';
|
||||
$table_other->data[$row][1] .= html_print_select(
|
||||
$table_other->data[$row][0] = '';
|
||||
$table_other->data[$row][1] = __('Delete custom values').': ';
|
||||
$table_other->data[$row][2] = html_print_select(
|
||||
post_process_get_custom_values(),
|
||||
'custom_values',
|
||||
'',
|
||||
@ -1270,7 +1270,7 @@ $row++;
|
||||
true
|
||||
);
|
||||
$count_custom_postprocess = post_process_get_custom_values();
|
||||
$table_other->data[$row][1] .= html_print_button(
|
||||
$table_other->data[$row][3] = html_print_button(
|
||||
__('Delete'),
|
||||
'custom_values_del_btn',
|
||||
empty($count_custom_postprocess),
|
||||
@ -1284,7 +1284,8 @@ $row++;
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table_other->data[$row][1] .= '</table>';
|
||||
$table_other->data[$row][3] .= '<br><br>';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
// CUSTOM INTERVAL VALUES
|
||||
@ -1299,22 +1300,52 @@ $row++;
|
||||
SECONDS_1MONTH => __('months'),
|
||||
SECONDS_1YEAR => __('years'),
|
||||
];
|
||||
$table_other->data[$row][1] = __('Add new custom value to intervals').': ';
|
||||
$table_other->data[$row][1] = __('Value').': ';
|
||||
$table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true);
|
||||
$table_other->data[$row][1] .= html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false);
|
||||
$table_other->data[$row][1] .= html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true);
|
||||
$table_other->data[$row][1] .= '<br><br>';
|
||||
$table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false);
|
||||
$table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true);
|
||||
|
||||
$table_other->data[$row][1] .= __('Delete interval').': ';
|
||||
$table_other->data[$row][1] .= html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true);
|
||||
$table_other->data[$row][1] .= html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true);
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = '';
|
||||
$table_other->data[$row][1] = __('Delete interval').': ';
|
||||
$table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true);
|
||||
$table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true);
|
||||
|
||||
$table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true);
|
||||
// This hidden field will be filled from jQuery before submit
|
||||
$table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true);
|
||||
$table_other->data[$row][3] .= '<br><br>';
|
||||
// ----------------------------------------------------------------------
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Module units');
|
||||
$table_other->data[$row][1] = __('Value').': ';
|
||||
$table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true);
|
||||
$table_other->data[$row][2] = '';
|
||||
$table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true);
|
||||
|
||||
$row++;
|
||||
$table_other->data[$row][0] = '';
|
||||
$table_other->data[$row][1] = __('Delete custom values').': ';
|
||||
$table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p');
|
||||
$table_other->data[$row][3] = html_print_button(
|
||||
__('Delete'),
|
||||
'custom_module_unit_del_btn',
|
||||
empty($count_custom_postprocess),
|
||||
'',
|
||||
'class="sub cancel"',
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[$row][3] .= html_print_input_hidden(
|
||||
'custom_module_unit_to_delete',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$row++;
|
||||
|
||||
$common_dividers = [
|
||||
';' => ';',
|
||||
',' => ',',
|
||||
@ -1331,6 +1362,14 @@ $row++;
|
||||
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Data multiplier to use in graphs/data');
|
||||
$options_data_multiplier = [];
|
||||
$options_data_multiplier[0] = __('Use 1024 when module unit are bytes');
|
||||
$options_data_multiplier[1] = __('Use always 1000');
|
||||
$options_data_multiplier[2] = __('Use always 1024');
|
||||
|
||||
$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false);
|
||||
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).'</legend>';
|
||||
@ -1397,7 +1436,6 @@ function edit_csv_divider () {
|
||||
function display_custom_report_front (show,table) {
|
||||
|
||||
if (show == true) {
|
||||
$('tr#'+table+'-custom_report_front-font').show();
|
||||
$('tr#'+table+'-custom_report_front-logo').show();
|
||||
$('tr#'+table+'-custom_report_front-preview').show();
|
||||
$('tr#'+table+'-custom_report_front-header').show();
|
||||
@ -1405,7 +1443,6 @@ function display_custom_report_front (show,table) {
|
||||
$('tr#'+table+'-custom_report_front-footer').show();
|
||||
}
|
||||
else {
|
||||
$('tr#'+table+'-custom_report_front-font').hide();
|
||||
$('tr#'+table+'-custom_report_front-logo').hide();
|
||||
$('tr#'+table+'-custom_report_front-preview').hide();
|
||||
$('tr#'+table+'-custom_report_front-header').hide();
|
||||
@ -1547,7 +1584,20 @@ $(document).ready (function () {
|
||||
});
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// CUSTOM MODULE UNITS
|
||||
//------------------------------------------------------------------
|
||||
$("#button-custom_module_unit_del_btn").click( function() {
|
||||
var unit_selected = $('#module_units option:selected').val();
|
||||
$('#hidden-custom_module_unit_to_delete').val(unit_selected);
|
||||
$('#submit-update_button').trigger('click');
|
||||
});
|
||||
|
||||
$("#button-module_unit_add_btn").click( function() {
|
||||
$('#submit-update_button').trigger('click');
|
||||
});
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Juanma (06/05/2014) New feature: Custom front page for reports
|
||||
var custom_report = $('#checkbox-custom_report_front')
|
||||
.prop('checked');
|
||||
|
@ -46,6 +46,13 @@ if (! check_acl($config['id_user'], 0, 'PM')
|
||||
|
||||
$baseurl = ui_get_full_url(false, false, false, false);
|
||||
|
||||
$current_package = db_get_value(
|
||||
'value',
|
||||
'tconfig',
|
||||
'token',
|
||||
'current_package_enterprise'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!-- Add the stylesheet here cause somehow the 'ui_require_css_file'
|
||||
@ -90,6 +97,8 @@ is not working on the metaconsole and there is no time to fix it -->
|
||||
|
||||
var text1_package_file = "<?php echo __('There is a new update available'); ?>\n";
|
||||
var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n";
|
||||
var text1_warning = "<?php echo __('WARNING'); ?>\n";
|
||||
var text2_warning = "<?php echo __('This update does not correspond to the next version of Pandora'); ?>\n";
|
||||
var applying_mr = "<?php echo __('Applying DB MR'); ?>\n";
|
||||
var cancel_button = "<?php echo __('Cancel'); ?>\n";
|
||||
var ok_button = "<?php echo __('Ok'); ?>\n";
|
||||
@ -109,5 +118,5 @@ is not working on the metaconsole and there is no time to fix it -->
|
||||
<script src="<?php echo $baseurl; ?>/include/javascript/update_manager.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
form_upload("<?php echo $baseurl; ?>");
|
||||
form_upload("<?php echo $baseurl; ?>", "<?php echo $current_package; ?>");
|
||||
</script>
|
||||
|
@ -264,12 +264,21 @@ if ($show_update_action_menu) {
|
||||
$data .= __('Threshold');
|
||||
$data .= '</td>';
|
||||
$data .= '<td class="datos2">';
|
||||
$data .= html_print_input_text(
|
||||
$data .= html_print_extended_select_for_time(
|
||||
'module_action_threshold_ajax',
|
||||
$action_option['module_action_threshold'],
|
||||
'',
|
||||
4,
|
||||
10,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data .= '</td>';
|
||||
|
@ -231,7 +231,7 @@ if ($save_event_filter) {
|
||||
$values['id_name'] = get_parameter('id_name');
|
||||
$values['id_group'] = get_parameter('id_group');
|
||||
$values['event_type'] = get_parameter('event_type');
|
||||
$values['severity'] = get_parameter('severity');
|
||||
$values['severity'] = implode(',', get_parameter('severity', -1));
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['search'] = get_parameter('search');
|
||||
$values['text_agent'] = get_parameter('text_agent');
|
||||
@ -278,7 +278,7 @@ if ($update_event_filter) {
|
||||
$id = get_parameter('id');
|
||||
$values['id_group'] = get_parameter('id_group');
|
||||
$values['event_type'] = get_parameter('event_type');
|
||||
$values['severity'] = get_parameter('severity');
|
||||
$values['severity'] = implode(',', get_parameter('severity', -1));
|
||||
$values['status'] = get_parameter('status');
|
||||
$values['search'] = get_parameter('search');
|
||||
$values['text_agent'] = get_parameter('text_agent');
|
||||
@ -439,8 +439,10 @@ function load_form_filter() {
|
||||
$("#id_group").val(val);
|
||||
if (i == 'event_type')
|
||||
$("#event_type").val(val);
|
||||
if (i == 'severity')
|
||||
$("#severity").val(val);
|
||||
if (i == 'severity') {
|
||||
const multiple = val.split(",");
|
||||
$("#severity").val(multiple);
|
||||
}
|
||||
if (i == 'status')
|
||||
$("#status").val(val);
|
||||
if (i == 'search')
|
||||
@ -954,7 +956,11 @@ if ($perform_event_response) {
|
||||
break;
|
||||
}
|
||||
|
||||
system('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val);
|
||||
if (empty($server_data['port'])) {
|
||||
system('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val);
|
||||
} else {
|
||||
system('ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$timeout_bin.' '.$command_timeout.' '.io_safe_output($command).' 2>&1"', $ret_val);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (PHP_OS) {
|
||||
@ -1579,7 +1585,7 @@ if ($get_list_events_agents) {
|
||||
$id_agent = get_parameter('id_agent');
|
||||
$server_id = get_parameter('server_id');
|
||||
$event_type = get_parameter('event_type');
|
||||
$severity = get_parameter('severity');
|
||||
$severity = implode(',', get_parameter('severity', -1));
|
||||
$status = get_parameter('status');
|
||||
$search = get_parameter('search');
|
||||
$id_agent_module = get_parameter('id_agent_module');
|
||||
|
@ -111,6 +111,7 @@ if ($add_general) {
|
||||
$id_module = get_parameter('id_module', 0);
|
||||
$id_server = (int) get_parameter('id_server', 0);
|
||||
$operation = get_parameter('operation', '');
|
||||
$id_module_failover = (int) get_parameter('id_module_failover', 0);
|
||||
|
||||
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
|
||||
|
||||
@ -126,10 +127,11 @@ if ($add_general) {
|
||||
$result = db_process_sql_insert(
|
||||
'treport_content_item',
|
||||
[
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'server_name' => $connection['server_name'],
|
||||
'operation' => $operation,
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'server_name' => $connection['server_name'],
|
||||
'operation' => $operation,
|
||||
'id_agent_module_failover' => $id_module_failover,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -442,20 +442,16 @@ switch ($action) {
|
||||
|| ($layoutData['type'] == PERCENTILE_BUBBLE)
|
||||
) {
|
||||
if ($value_show == 'value') {
|
||||
$returnValue = format_for_graph($returnValue, 2);
|
||||
|
||||
$unit_text_db = db_get_sql(
|
||||
'SELECT unit
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
|
||||
);
|
||||
$unit_text_db = trim(io_safe_output($unit_text_db));
|
||||
|
||||
if ($value_show == 'value') {
|
||||
// Set empty string unit at the moment
|
||||
// and change for old false value
|
||||
$unit_text = '';
|
||||
}
|
||||
$divisor = get_data_multiplier($unit_text_db);
|
||||
|
||||
$returnValue = format_for_graph($returnValue, 2, '.', ',', $divisor);
|
||||
|
||||
if (!empty($unit_text_db)) {
|
||||
$unit_text = $unit_text_db;
|
||||
|
@ -83,6 +83,7 @@ if (check_login(false) === false) {
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -140,6 +141,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
|
||||
|
@ -1340,6 +1340,10 @@ class NetworkMap
|
||||
if ($rel['parent_type'] == NODE_MODULE
|
||||
&& $rel['child_type'] == NODE_MODULE
|
||||
) {
|
||||
// Keep std references.
|
||||
$ref_id_parent = $id_parent;
|
||||
$ref_id_child = $id_child;
|
||||
|
||||
// Module information available.
|
||||
$id_parent = $rel['id_parent_source_data'];
|
||||
$id_child = $rel['id_child_source_data'];
|
||||
@ -1374,6 +1378,12 @@ class NetworkMap
|
||||
'index' => $index,
|
||||
'priority' => $priority,
|
||||
];
|
||||
|
||||
// Keep node reference mapping - low precedence relationship.
|
||||
$rel_map[$ref_id_parent.'_'.$ref_id_child] = [
|
||||
'index' => $index,
|
||||
'priority' => $priority,
|
||||
];
|
||||
}
|
||||
} else if ($rel['parent_type'] == NODE_AGENT
|
||||
&& $rel['child_type'] == NODE_AGENT
|
||||
|
@ -616,7 +616,8 @@ class Tree
|
||||
&& $statusType !== STATUS_MODULE_NO_DATA_BALL
|
||||
) {
|
||||
if (is_numeric($module['value'])) {
|
||||
$statusTitle .= ' : '.format_for_graph($module['value']);
|
||||
$divisor = get_data_multiplier($module['unit']);
|
||||
$statusTitle .= ' : '.format_for_graph($module['value'], 1, '.', ',', $divisor);
|
||||
} else {
|
||||
$statusTitle .= ' : '.substr(io_safe_output($module['value']), 0, 42);
|
||||
}
|
||||
@ -1061,7 +1062,7 @@ class Tree
|
||||
|
||||
$columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name,
|
||||
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
||||
tam.parent_module_id AS parent, tatm.id AS alerts';
|
||||
tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
FROM tagente_modulo tam
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC200110';
|
||||
$build_version = 'PC200127';
|
||||
$pandora_version = 'v7.0NG.742';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -262,6 +262,11 @@ function format_for_graph(
|
||||
$divider=1000,
|
||||
$sufix=''
|
||||
) {
|
||||
// Exception to exclude modules whose unit is already formatted as KB (satellite modules)
|
||||
if (!empty($sufix) && $sufix == 'KB') {
|
||||
return;
|
||||
}
|
||||
|
||||
$shorts = [
|
||||
'',
|
||||
'K',
|
||||
@ -1994,7 +1999,12 @@ function get_snmpwalk(
|
||||
if (enterprise_installed()) {
|
||||
if ($server_to_exec != 0) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
exec('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc);
|
||||
} else {
|
||||
exec('ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc);
|
||||
}
|
||||
} else {
|
||||
exec($command_str, $output, $rc);
|
||||
}
|
||||
@ -2503,12 +2513,13 @@ function get_user_dashboards($id_user)
|
||||
/**
|
||||
* Get all the possible periods in seconds.
|
||||
*
|
||||
* @param bool Flag to show or not custom fist option
|
||||
* @param bool Show the periods by default if it is empty
|
||||
* @param boolean $custom Flag to show or not custom fist option
|
||||
* @param boolean $show_default Show the periods by default if it is empty
|
||||
* @param boolean $allow_zero Allow the use of the value zero.
|
||||
*
|
||||
* @return The possible periods in an associative array.
|
||||
* @return array The possible periods in an associative array.
|
||||
*/
|
||||
function get_periods($custom=true, $show_default=true)
|
||||
function get_periods($custom=true, $show_default=true, $allow_zero=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -2520,6 +2531,10 @@ function get_periods($custom=true, $show_default=true)
|
||||
|
||||
if (empty($config['interval_values'])) {
|
||||
if ($show_default) {
|
||||
if ($allow_zero === true) {
|
||||
$periods[0] = sprintf(__('%s seconds'), '0');
|
||||
}
|
||||
|
||||
$periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5');
|
||||
$periods[SECONDS_30MINUTES] = sprintf(__('%s minutes'), '30 ');
|
||||
$periods[SECONDS_1HOUR] = __('1 hour');
|
||||
@ -5465,6 +5480,45 @@ function get_help_info($section_name)
|
||||
} else {
|
||||
$result .= 'Discovery&printable=yes';
|
||||
}
|
||||
|
||||
case 'alert_configure':
|
||||
if ($es) {
|
||||
$result .= 'Alerts#Correlation_alert_creation';
|
||||
} else {
|
||||
$result .= 'Alerts#Correlation_alert_creation';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alert_correlation':
|
||||
if ($es) {
|
||||
$result .= 'Alerts#Alert_correlation:_event_and_log_alerts';
|
||||
} else {
|
||||
$result .= 'Alerts#Alert_correlation:_event_and_log_alerts';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alert_rules':
|
||||
if ($es) {
|
||||
$result .= 'Alerts#Rules_within_a_correlation_alert';
|
||||
} else {
|
||||
$result .= 'Alerts#Rules_within_a_correlation_alert';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alert_fields':
|
||||
if ($es) {
|
||||
$result .= 'Alerts#Step_3:_Advanced_fields';
|
||||
} else {
|
||||
$result .= 'Alerts#Step_3:_Advanced_fields';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alert_triggering':
|
||||
if ($es) {
|
||||
$result .= 'Alerts#Configuring_an_alert_template';
|
||||
} else {
|
||||
$result .= 'Alerts#Configuring_an_alert_template';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5494,3 +5548,108 @@ if (!function_exists('getallheaders')) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update config token that contains custom module units.
|
||||
*
|
||||
* @param string Name of new module unit.
|
||||
* @return boolean Success or failure.
|
||||
*/
|
||||
function add_custom_module_unit($value)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$custom_module_units = get_custom_module_units();
|
||||
|
||||
$custom_module_units[$value] = $value;
|
||||
|
||||
$new_conf = json_encode($custom_module_units);
|
||||
|
||||
$return = config_update_value(
|
||||
'custom_module_units',
|
||||
$new_conf
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
$config['custom_module_units'] = $new_conf;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_custom_module_units()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!isset($config['custom_module_units'])) {
|
||||
$custom_module_units = [];
|
||||
} else {
|
||||
$custom_module_units = json_decode(
|
||||
io_safe_output($config['custom_module_units']),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
return $custom_module_units;
|
||||
}
|
||||
|
||||
|
||||
function delete_custom_module_unit($value)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$custom_units = get_custom_module_units();
|
||||
|
||||
unset($custom_units[io_safe_output($value)]);
|
||||
|
||||
$new_conf = json_encode($custom_units);
|
||||
$return = config_update_value(
|
||||
'custom_module_units',
|
||||
$new_conf
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
$config['custom_module_units'] = $new_conf;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get multiplier to be applied on module data in order to represent it properly. Based on setup configuration and module's unit, either 1000 or 1024 will be returned.
|
||||
*
|
||||
* @param string Module's unit.
|
||||
*
|
||||
* @return integer Multiplier.
|
||||
*/
|
||||
function get_data_multiplier($unit)
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($config['use_data_multiplier']) {
|
||||
case 0:
|
||||
if (strpos(strtolower($unit), 'yte') !== false) {
|
||||
$multiplier = 1024;
|
||||
} else {
|
||||
$multiplier = 1000;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$multiplier = 1024;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
default:
|
||||
$multiplier = 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
return $multiplier;
|
||||
}
|
||||
|
@ -3512,13 +3512,18 @@ function agents_get_status_animation($up=true)
|
||||
function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0)
|
||||
{
|
||||
$agents_id = [];
|
||||
$all_agents = agents_get_agents(false, ['id_agente', 'alias']);
|
||||
if (is_metaconsole()) {
|
||||
$all_agents = agents_meta_get_agents('AR', '|');
|
||||
} else {
|
||||
$all_agents = agents_get_group_agents(0, true, 'lower', false, false, true, '|');
|
||||
}
|
||||
|
||||
$agent_match = '/'.$alias_regex.'/'.$flag;
|
||||
|
||||
foreach ($all_agents as $agent) {
|
||||
$result_agent_match = preg_match($agent_match, $agent['alias']);
|
||||
foreach ($all_agents as $agent_id => $agent_alias) {
|
||||
$result_agent_match = preg_match($agent_match, $agent_alias);
|
||||
if ($result_agent_match) {
|
||||
$agents_id[] = $agent['id_agente'];
|
||||
$agents_id[] = $agent_id;
|
||||
$i++;
|
||||
if ($i === $limit) {
|
||||
break;
|
||||
|
@ -1279,6 +1279,28 @@ function config_update_config()
|
||||
$error_update[] = __('Delete interval');
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// --------------------------------------------------
|
||||
// MODULE CUSTOM UNITS
|
||||
// --------------------------------------------------
|
||||
$custom_unit = get_parameter('custom_module_unit');
|
||||
$custom_unit_to_delete = get_parameter('custom_module_unit_to_delete', '');
|
||||
|
||||
if (!empty($custom_unit)) {
|
||||
if (!add_custom_module_unit(
|
||||
$custom_unit
|
||||
)
|
||||
) {
|
||||
$error_update[] = __('Add custom module unit');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($custom_unit_to_delete)) {
|
||||
if (!delete_custom_module_unit($custom_unit_to_delete)) {
|
||||
$error_update[] = __('Delete custom module unit');
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
if (!config_update_value('custom_report_info', get_parameter('custom_report_info'))) {
|
||||
$error_update[] = __('Custom report info');
|
||||
@ -1324,6 +1346,10 @@ function config_update_config()
|
||||
if (!config_update_value('csv_divider', (string) get_parameter('csv_divider', ';'))) {
|
||||
$error_update[] = __('CSV divider');
|
||||
}
|
||||
|
||||
if (!config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'))) {
|
||||
$error_update[] = __('Use data multiplier');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'net':
|
||||
@ -2820,6 +2846,10 @@ function config_process_config()
|
||||
config_update_value('csv_divider', ';');
|
||||
}
|
||||
|
||||
if (!isset($config['use_data_multiplier'])) {
|
||||
config_update_value('use_data_multiplier', '1');
|
||||
}
|
||||
|
||||
if (!isset($config['command_snapshot'])) {
|
||||
config_update_value('command_snapshot', 1);
|
||||
}
|
||||
|
@ -624,7 +624,37 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
|
||||
break;
|
||||
}
|
||||
|
||||
return db_process_sql($update_sql);
|
||||
$result = db_process_sql($update_sql);
|
||||
|
||||
if ($result) {
|
||||
switch ($status) {
|
||||
case EVENT_STATUS_NEW:
|
||||
$status_string = 'New';
|
||||
break;
|
||||
|
||||
case EVENT_STATUS_VALIDATED:
|
||||
$status_string = 'Validated';
|
||||
break;
|
||||
|
||||
case EVENT_STATUS_INPROCESS:
|
||||
$status_string = 'In process';
|
||||
break;
|
||||
|
||||
default:
|
||||
$status_string = '';
|
||||
break;
|
||||
}
|
||||
|
||||
events_comment(
|
||||
$id_evento,
|
||||
'',
|
||||
'Change status to '.$status_string,
|
||||
is_metaconsole() ? true : false,
|
||||
$history
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -751,43 +781,78 @@ function events_get_all(
|
||||
}
|
||||
|
||||
if (isset($filter['severity']) && $filter['severity'] > 0) {
|
||||
switch ($filter['severity']) {
|
||||
case EVENT_CRIT_MAINTENANCE:
|
||||
case EVENT_CRIT_INFORMATIONAL:
|
||||
case EVENT_CRIT_NORMAL:
|
||||
case EVENT_CRIT_MINOR:
|
||||
case EVENT_CRIT_WARNING:
|
||||
case EVENT_CRIT_MAJOR:
|
||||
case EVENT_CRIT_CRITICAL:
|
||||
default:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity = %d ',
|
||||
$filter['severity']
|
||||
);
|
||||
break;
|
||||
if (is_array($filter['severity'])) {
|
||||
if (!in_array(-1, $filter['severity'])) {
|
||||
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
|
||||
if ($not_normal !== false) {
|
||||
unset($filter['severity'][$not_normal]);
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity != %d',
|
||||
EVENT_CRIT_NORMAL
|
||||
);
|
||||
} else {
|
||||
$critical_warning = array_search(EVENT_CRIT_WARNING_OR_CRITICAL, $filter['severity']);
|
||||
if ($critical_warning !== false) {
|
||||
unset($filter['severity'][$critical_warning]);
|
||||
$filter['severity'][] = EVENT_CRIT_WARNING;
|
||||
$filter['severity'][] = EVENT_CRIT_CRITICAL;
|
||||
}
|
||||
|
||||
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (criticity = %d OR criticity = %d)',
|
||||
EVENT_CRIT_WARNING,
|
||||
EVENT_CRIT_CRITICAL
|
||||
);
|
||||
break;
|
||||
$critical_normal = array_search(EVENT_CRIT_OR_NORMAL, $filter['severity']);
|
||||
if ($critical_normal !== false) {
|
||||
unset($filter['severity'][$critical_normal]);
|
||||
$filter['severity'][] = EVENT_CRIT_NORMAL;
|
||||
$filter['severity'][] = EVENT_CRIT_CRITICAL;
|
||||
}
|
||||
|
||||
case EVENT_CRIT_NOT_NORMAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity != %d',
|
||||
EVENT_CRIT_NORMAL
|
||||
);
|
||||
break;
|
||||
if (!empty($filter['severity'])) {
|
||||
$filter['severity'] = implode(',', $filter['severity']);
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity IN (%s)',
|
||||
$filter['severity']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch ($filter['severity']) {
|
||||
case EVENT_CRIT_MAINTENANCE:
|
||||
case EVENT_CRIT_INFORMATIONAL:
|
||||
case EVENT_CRIT_NORMAL:
|
||||
case EVENT_CRIT_MINOR:
|
||||
case EVENT_CRIT_WARNING:
|
||||
case EVENT_CRIT_MAJOR:
|
||||
case EVENT_CRIT_CRITICAL:
|
||||
default:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity = %d ',
|
||||
$filter['severity']
|
||||
);
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_OR_NORMAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (criticity = %d OR criticity = %d)',
|
||||
EVENT_CRIT_NORMAL,
|
||||
EVENT_CRIT_CRITICAL
|
||||
);
|
||||
break;
|
||||
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (criticity = %d OR criticity = %d)',
|
||||
EVENT_CRIT_WARNING,
|
||||
EVENT_CRIT_CRITICAL
|
||||
);
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_NOT_NORMAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND criticity != %d',
|
||||
EVENT_CRIT_NORMAL
|
||||
);
|
||||
break;
|
||||
|
||||
case EVENT_CRIT_OR_NORMAL:
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (criticity = %d OR criticity = %d)',
|
||||
EVENT_CRIT_NORMAL,
|
||||
EVENT_CRIT_CRITICAL
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,12 +106,8 @@ if (!function_exists('mime_content_type')) {
|
||||
finfo_close($finfo);
|
||||
return $mimetype;
|
||||
} else {
|
||||
$temp = exec('file '.$filename);
|
||||
if (isset($temp) && $temp != '') {
|
||||
return $temp;
|
||||
} else {
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini');
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
@ -694,8 +690,9 @@ function filemanager_file_explorer(
|
||||
|
||||
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>';
|
||||
} else {
|
||||
$hash = md5($relative_path.$config['dbpass']);
|
||||
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode(base64_encode($relative_path)).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
|
||||
$filename = base64_encode($relative_directory.'/'.$fileinfo['name']);
|
||||
$hash = md5($filename.$config['dbpass']);
|
||||
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
|
||||
}
|
||||
|
||||
// Notice that uploaded php files could be dangerous
|
||||
@ -755,8 +752,9 @@ function filemanager_file_explorer(
|
||||
}
|
||||
|
||||
if ((!$fileinfo['is_dir']) && ($download_button)) {
|
||||
$hash = md5($fileinfo['realpath'].$config['dbpass']);
|
||||
$data[4] .= '<a href="include/get_file.php?file='.urlencode(base64_encode($fileinfo['realpath'])).'&hash='.$hash.'" style="vertical-align: 25%;">';
|
||||
$filename = base64_encode($fileinfo['name']);
|
||||
$hash = md5($filename.$config['dbpass']);
|
||||
$data[4] .= '<a href="include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'" style="vertical-align: 25%;">';
|
||||
$data[4] .= html_print_image('images/file.png', true);
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ function grafico_modulo_sparse_data(
|
||||
|
||||
|
||||
/**
|
||||
* Functions tu create graphs.
|
||||
* Functions to create graphs.
|
||||
*
|
||||
* @param array $params Details builds graphs. For example:
|
||||
* 'agent_module_id' => $agent_module_id,
|
||||
@ -856,6 +856,10 @@ function grafico_modulo_sparse($params)
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($params['divisor'])) {
|
||||
$params['divisor'] = get_data_multiplier($params['unit']);
|
||||
}
|
||||
|
||||
if (!$params['array_data_create']) {
|
||||
if ($params['baseline']) {
|
||||
$array_data = get_baseline_data(
|
||||
@ -1478,6 +1482,10 @@ function graphic_combined_module(
|
||||
$data_module_graph['module_id'] = $agent_module_id;
|
||||
$data_module_graph['unit'] = $module_data['unit'];
|
||||
|
||||
$params['unit'] = $module_data['unit'];
|
||||
|
||||
$params['divisor'] = get_data_multiplier($params['unit']);
|
||||
|
||||
// Stract data.
|
||||
$array_data_module = grafico_modulo_sparse_data(
|
||||
$agent_module_id,
|
||||
|
@ -798,6 +798,10 @@ function html_print_extended_select_for_unit(
|
||||
$fields['_timeticks_'] = 'Timeticks';
|
||||
$fields['none'] = __('none');
|
||||
|
||||
$default_module_custom_units = get_custom_module_units();
|
||||
|
||||
$fields = array_merge($fields, $default_module_custom_units);
|
||||
|
||||
if ($no_change != 0) {
|
||||
$fields[-1] = __('No change');
|
||||
}
|
||||
@ -988,20 +992,24 @@ function html_print_extended_select_for_post_process(
|
||||
/**
|
||||
* Render a pair of select for times and text box for set the time more fine.
|
||||
*
|
||||
* @param string Select form name
|
||||
* @param variant Current selected value. Can be a single value or an
|
||||
* array of selected values (in combination with multiple)
|
||||
* @param string Javascript onChange (select) code.
|
||||
* @param string Label when nothing is selected.
|
||||
* @param variant Value when nothing is selected
|
||||
* @param integer $size Size of the input.
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param bool Wherter to assign to combo a unique name (to have more than one on same page, like dashboard)
|
||||
*
|
||||
* @param string $name Select form name
|
||||
* @param variant $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple)
|
||||
* @param string $script Javascript onChange (select) code.
|
||||
* @param string $nothing Label when nothing is selected.
|
||||
* @param variant $nothing_value Value when nothing is selected
|
||||
* @param integer $size Size of the input.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param boolean $select_style Wherter to assign to combo a unique name (to have more than one on same page, like dashboard)
|
||||
* @param boolean $unique_name
|
||||
* @param string $class
|
||||
* @param boolean $readonly
|
||||
* @param string $custom_fields
|
||||
* @param string $style_icon
|
||||
* @param boolean $no_change
|
||||
* @param boolean $allow_zero Allow the use of the value zero.
|
||||
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
|
||||
|
||||
function html_print_extended_select_for_time(
|
||||
$name,
|
||||
$selected='',
|
||||
@ -1016,14 +1024,15 @@ function html_print_extended_select_for_time(
|
||||
$readonly=false,
|
||||
$custom_fields=false,
|
||||
$style_icon='',
|
||||
$no_change=false
|
||||
$no_change=false,
|
||||
$allow_zero=false
|
||||
) {
|
||||
global $config;
|
||||
$admin = is_user_admin($config['id_user']);
|
||||
if ($custom_fields) {
|
||||
$fields = $custom_fields;
|
||||
} else {
|
||||
$fields = get_periods();
|
||||
$fields = get_periods(true, true, $allow_zero);
|
||||
}
|
||||
|
||||
if ($no_change) {
|
||||
@ -1045,7 +1054,14 @@ function html_print_extended_select_for_time(
|
||||
}
|
||||
}
|
||||
|
||||
if (($selected !== false) && (!isset($fields[$selected]) && $selected != 0)) {
|
||||
// Allow the use of the value zero.
|
||||
if ($allow_zero === true) {
|
||||
$selected_zero = true;
|
||||
} else {
|
||||
$selected_zero = ($selected != 0) ? true : false;
|
||||
}
|
||||
|
||||
if (($selected !== false) && (!isset($fields[$selected]) && $selected_zero)) {
|
||||
$fields[$selected] = human_time_description_raw($selected, true);
|
||||
}
|
||||
|
||||
@ -1136,7 +1152,7 @@ function html_print_extended_select_for_time(
|
||||
echo '</div>';
|
||||
echo "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
period_select_init('$uniq_name');
|
||||
period_select_init('$uniq_name', $allow_zero);
|
||||
period_select_events('$uniq_name');
|
||||
});
|
||||
function period_select_".$name."_update(seconds) {
|
||||
@ -1178,8 +1194,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
|
||||
}
|
||||
|
||||
// Minutes
|
||||
for ($i = 0; $i < 60; $i += 5) {
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
$minutes[$i] = $i;
|
||||
|
||||
// If minute is not a multiple of 5, then add style to option in order to hide it from minute select but still is a valid value that input can adopt. We want this in case a value that is not a multiple of 5 is entered in module's data configuration.
|
||||
if (($i % 5) != 0) {
|
||||
$minutes_hidden_options[$i] = 'display: none;';
|
||||
}
|
||||
}
|
||||
|
||||
// Month days
|
||||
@ -1216,13 +1237,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
|
||||
|
||||
if ($to) {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
} else {
|
||||
$table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
|
||||
$table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
$table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
|
||||
|
@ -2133,6 +2133,8 @@ function modules_get_agentmodule_data(
|
||||
// remote_snmp_string
|
||||
case 17:
|
||||
// async_string
|
||||
case 36:
|
||||
// remote_cmd_string
|
||||
case 23:
|
||||
// Free search is a json with value and exact modifier
|
||||
$freesearch = json_decode($freesearch, true);
|
||||
|
@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete relations given id_map
|
||||
*
|
||||
* @param integer $id_map
|
||||
* @return integer result
|
||||
*/
|
||||
function networkmap_delete_relations($id_map)
|
||||
{
|
||||
$result = db_process_sql_delete('trel_item', ['id_map' => $id_map]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function get_networkmaps($id)
|
||||
{
|
||||
$groups = array_keys(users_get_groups(null, 'IW'));
|
||||
|
@ -190,6 +190,8 @@ function reporting_make_reporting_data(
|
||||
$metaconsole_on = is_metaconsole();
|
||||
$index_content = 0;
|
||||
foreach ($contents as $content) {
|
||||
$content['name'] = io_safe_input($content['name']);
|
||||
$content['description'] = io_safe_input($content['description']);
|
||||
if (!empty($content['id_agent_module']) && !empty($content['id_agent'])
|
||||
&& tags_has_user_acl_tags($config['id_user'])
|
||||
) {
|
||||
@ -1580,7 +1582,10 @@ function reporting_event_top_n(
|
||||
$data['module'] = $module_name[$i];
|
||||
|
||||
$data['value'] = $dt;
|
||||
$data['formated_value'] = format_for_graph($dt, 2).' '.$units[$i];
|
||||
|
||||
$divisor = get_data_multiplier($units[$i]);
|
||||
|
||||
$data['formated_value'] = format_for_graph($dt, 2, '.', ',', $divisor, $units[$i]);
|
||||
$data_return[] = $data;
|
||||
}
|
||||
|
||||
@ -1633,12 +1638,15 @@ function reporting_event_top_n(
|
||||
|
||||
$data_pie_graph[$item_name] = $data_top[$i];
|
||||
$data_hbar[$item_name]['g'] = $data_top[$i];
|
||||
|
||||
$divisor = get_data_multiplier($units[$i]);
|
||||
|
||||
if ($show_graph == 0 || $show_graph == 1) {
|
||||
$data = [];
|
||||
$data['agent'] = $an;
|
||||
$data['module'] = $module_name[$i];
|
||||
$data['value'] = $data_top[$i];
|
||||
$data['formated_value'] = format_for_graph($data_top[$i], 2).' '.$units[$i];
|
||||
$data['formated_value'] = format_for_graph($data_top[$i], 2, '.', ',', $divisor, $units[$i]);
|
||||
$data_return[] = $data;
|
||||
}
|
||||
|
||||
@ -1714,14 +1722,15 @@ function reporting_event_top_n(
|
||||
$i++;
|
||||
}
|
||||
|
||||
$unit = $data_top_values['units'][0];
|
||||
$avg = ($avg / $i);
|
||||
|
||||
$return['resume']['min']['value'] = $min;
|
||||
$return['resume']['min']['formated_value'] = format_for_graph($min, 2);
|
||||
$return['resume']['min']['formated_value'] = format_for_graph($min, 2, '.', ',', $divisor, $unit);
|
||||
$return['resume']['avg']['value'] = $avg;
|
||||
$return['resume']['avg']['formated_value'] = format_for_graph($avg, 2);
|
||||
$return['resume']['avg']['formated_value'] = format_for_graph($avg, 2, '.', ',', $divisor, $unit);
|
||||
$return['resume']['max']['value'] = $max;
|
||||
$return['resume']['max']['formated_value'] = format_for_graph($max, 2);
|
||||
$return['resume']['max']['formated_value'] = format_for_graph($max, 2, '.', ',', $divisor, $unit);
|
||||
}
|
||||
|
||||
$return['data'] = $data_return;
|
||||
@ -4286,14 +4295,7 @@ function reporting_sql_graph(
|
||||
|
||||
case 'data':
|
||||
$data = [];
|
||||
foreach ($modules as $key => $value) {
|
||||
$data[$value] = modules_get_agentmodule_data(
|
||||
$value,
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
}
|
||||
|
||||
$data = db_get_all_rows_sql($content['external_source']);
|
||||
$return['chart'] = $data;
|
||||
break;
|
||||
}
|
||||
@ -4902,6 +4904,8 @@ function reporting_value($report, $content, $type, $pdf=false)
|
||||
case 'max':
|
||||
case 'min':
|
||||
case 'avg':
|
||||
$divisor = get_data_multiplier($unit);
|
||||
|
||||
if ($content['lapse_calc'] == 0) {
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
@ -4932,7 +4936,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
} else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
|
||||
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
}
|
||||
} else {
|
||||
$return['visual_format'] = $content['visual_format'];
|
||||
@ -4940,17 +4944,17 @@ function reporting_value($report, $content, $type, $pdf=false)
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
|
||||
case 'min':
|
||||
$params['force_interval'] = 'min_only';
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
|
||||
case 'avg':
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
|
||||
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4980,15 +4984,15 @@ function reporting_value($report, $content, $type, $pdf=false)
|
||||
if ($i > $time_begin['utimestamp']) {
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
|
||||
case 'min':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
|
||||
case 'avg':
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
|
||||
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -5017,7 +5021,9 @@ function reporting_value($report, $content, $type, $pdf=false)
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
} else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
|
||||
$divisor = get_data_multiplier($unit);
|
||||
|
||||
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -6250,27 +6256,6 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
||||
$return['kind_availability'] = 'module';
|
||||
}
|
||||
|
||||
if (empty($content['subitems'])) {
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT id_agent_module,
|
||||
server_name, operation
|
||||
FROM treport_content_item
|
||||
WHERE id_report_content = %d',
|
||||
$content['id_rc']
|
||||
);
|
||||
|
||||
$items = db_process_sql($sql);
|
||||
} else {
|
||||
$items = $content['subitems'];
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$avg = 0;
|
||||
$min = null;
|
||||
$min_text = '';
|
||||
@ -6278,180 +6263,241 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
||||
$max_text = '';
|
||||
$count = 0;
|
||||
|
||||
$style = io_safe_output($content['style']);
|
||||
if ($style['hide_notinit_agents']) {
|
||||
$aux_id_agents = $agents;
|
||||
$i = 0;
|
||||
foreach ($items as $item) {
|
||||
$utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
|
||||
if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
|
||||
unset($items[$i]);
|
||||
if ($content['failover_mode']) {
|
||||
$availability_graph_data = reporting_availability_graph($report, $content, false, true);
|
||||
$data = $availability_graph_data['data'];
|
||||
|
||||
foreach ($data as $key => $item_data) {
|
||||
$percent_ok = $item_data['sla_value'];
|
||||
$data[$key]['SLA'] = $percent_ok;
|
||||
|
||||
if ($item_data['failover'] != 'result') {
|
||||
$data[$key]['availability_item'] = $item_data['module'];
|
||||
$text = $item_data['agent'].' ('.$item_data['module'].')';
|
||||
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
|
||||
if (is_null($min)) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
} else {
|
||||
if ($min > $percent_ok) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null($max)) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
} else {
|
||||
if ($max < $percent_ok) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
}
|
||||
}
|
||||
|
||||
$count++;
|
||||
} else {
|
||||
$data[$key]['availability_item'] = '--';
|
||||
$data[$key]['agent'] = '--';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (empty($content['subitems'])) {
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT id_agent_module, id_agent_module_failover,
|
||||
server_name, operation
|
||||
FROM treport_content_item
|
||||
WHERE id_report_content = %d',
|
||||
$content['id_rc']
|
||||
);
|
||||
|
||||
$items = db_process_sql($sql);
|
||||
} else {
|
||||
$items = $content['subitems'];
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$style = io_safe_output($content['style']);
|
||||
if ($style['hide_notinit_agents']) {
|
||||
$aux_id_agents = $agents;
|
||||
$i = 0;
|
||||
foreach ($items as $item) {
|
||||
$utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
|
||||
if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
|
||||
unset($items[$i]);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($items)) {
|
||||
foreach ($items as $item) {
|
||||
// aaMetaconsole connection
|
||||
$server_name = $item['server_name'];
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($item['id_agent_module'])
|
||||
|| modules_is_not_init($item['id_agent_module'])
|
||||
) {
|
||||
// Restore dbconnection
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
if (!empty($items)) {
|
||||
foreach ($items as $item) {
|
||||
// aaMetaconsole connection
|
||||
$server_name = $item['server_name'];
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($item['id_agent_module'])
|
||||
|| modules_is_not_init($item['id_agent_module'])
|
||||
) {
|
||||
$row = [];
|
||||
|
||||
$text = '';
|
||||
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
null,
|
||||
// min_value -> dynamic
|
||||
null,
|
||||
// max_value -> dynamic
|
||||
null,
|
||||
// inverse_interval -> dynamic
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to']
|
||||
);
|
||||
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
if ($content['show_graph']) {
|
||||
$text = $row['data']['availability_item'] = agents_get_address(
|
||||
modules_get_agentmodule_agent($item['id_agent_module'])
|
||||
);
|
||||
|
||||
if (empty($text)) {
|
||||
$text = $row['data']['availability_item'] = __('No Address');
|
||||
}
|
||||
} else {
|
||||
$text = $row['data']['availability_item'] = modules_get_agentmodule_name(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
}
|
||||
|
||||
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
|
||||
$text = $row['data']['agent'].' ('.$text.')';
|
||||
|
||||
// Restore dbconnection
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
// find order
|
||||
$row['data']['order'] = $row['data']['SLA'];
|
||||
|
||||
$row = [];
|
||||
|
||||
$text = '';
|
||||
|
||||
$row['data'] = reporting_advanced_sla(
|
||||
$item['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
null,
|
||||
// min_value -> dynamic
|
||||
null,
|
||||
// max_value -> dynamic
|
||||
null,
|
||||
// inverse_interval -> dynamic
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to']
|
||||
);
|
||||
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules
|
||||
if ($content['show_graph']) {
|
||||
$text = $row['data']['availability_item'] = agents_get_address(
|
||||
modules_get_agentmodule_agent($item['id_agent_module'])
|
||||
);
|
||||
|
||||
if (empty($text)) {
|
||||
$text = $row['data']['availability_item'] = __('No Address');
|
||||
}
|
||||
} else {
|
||||
$text = $row['data']['availability_item'] = modules_get_agentmodule_name(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
}
|
||||
|
||||
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
|
||||
$item['id_agent_module']
|
||||
);
|
||||
|
||||
$text = $row['data']['agent'].' ('.$text.')';
|
||||
|
||||
// Restore dbconnection
|
||||
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// find order
|
||||
$row['data']['order'] = $row['data']['SLA'];
|
||||
|
||||
$percent_ok = $row['data']['SLA'];
|
||||
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
|
||||
if (is_null($min)) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
} else {
|
||||
if ($min > $percent_ok) {
|
||||
$percent_ok = $row['data']['SLA'];
|
||||
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
|
||||
if (is_null($min)) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
} else {
|
||||
if ($min > $percent_ok) {
|
||||
$min = $percent_ok;
|
||||
$min_text = $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null($max)) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
} else {
|
||||
if ($max < $percent_ok) {
|
||||
if (is_null($max)) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
} else {
|
||||
if ($max < $percent_ok) {
|
||||
$max = $percent_ok;
|
||||
$max_text = $text;
|
||||
}
|
||||
}
|
||||
|
||||
$data[] = $row['data'];
|
||||
$count++;
|
||||
}
|
||||
|
||||
$data[] = $row['data'];
|
||||
$count++;
|
||||
}
|
||||
switch ($content['order_uptodown']) {
|
||||
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($content['order_uptodown']) {
|
||||
case REPORT_ITEM_ORDER_BY_AGENT_NAME:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
|
||||
break;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
$data = $temp;
|
||||
break;
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
case REPORT_ITEM_ORDER_BY_ASCENDING:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($row['data']['SLA'] < $t_row['order']) {
|
||||
break;
|
||||
}
|
||||
|
||||
case REPORT_ITEM_ORDER_BY_ASCENDING:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($row['data']['SLA'] < $t_row['order']) {
|
||||
break;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
$data = $temp;
|
||||
break;
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
case REPORT_ITEM_ORDER_BY_DESCENDING:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($row['data']['SLA'] > $t_row['order']) {
|
||||
break;
|
||||
}
|
||||
|
||||
case REPORT_ITEM_ORDER_BY_DESCENDING:
|
||||
$temp = [];
|
||||
foreach ($data as $row) {
|
||||
$i = 0;
|
||||
foreach ($temp as $t_row) {
|
||||
if ($row['data']['SLA'] > $t_row['order']) {
|
||||
break;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
|
||||
array_splice($temp, $i, 0, [$row]);
|
||||
}
|
||||
|
||||
$data = $temp;
|
||||
break;
|
||||
$data = $temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6490,7 +6536,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
||||
*
|
||||
* @return array Generates a structure the report.
|
||||
*/
|
||||
function reporting_availability_graph($report, $content, $pdf=false)
|
||||
function reporting_availability_graph($report, $content, $pdf=false, $failover=false)
|
||||
{
|
||||
global $config;
|
||||
$return = [];
|
||||
@ -6532,7 +6578,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
||||
|
||||
$slas = io_safe_output(
|
||||
db_get_all_rows_field_filter(
|
||||
'treport_content_sla_combined',
|
||||
($failover) ? 'treport_content_item' : 'treport_content_sla_combined',
|
||||
'id_report_content',
|
||||
$content['id_rc']
|
||||
)
|
||||
@ -6937,9 +6983,19 @@ function prepare_data_for_paint(
|
||||
$alias_agent = modules_get_agentmodule_agent_alias(
|
||||
$sla['id_agent_module']
|
||||
);
|
||||
$name_module = modules_get_agentmodule_name(
|
||||
$sla['id_agent_module']
|
||||
);
|
||||
|
||||
if ($content['show_graph']) {
|
||||
$name_module = agents_get_address(
|
||||
modules_get_agentmodule_agent($sla['id_agent_module'])
|
||||
);
|
||||
if (empty($name_module)) {
|
||||
$name_module = __('No Address');
|
||||
}
|
||||
} else {
|
||||
$name_module = modules_get_agentmodule_name(
|
||||
$sla['id_agent_module']
|
||||
);
|
||||
}
|
||||
|
||||
$data['agent'] = $alias_agent;
|
||||
$data['module'] = $name_module;
|
||||
@ -7334,6 +7390,8 @@ function reporting_general($report, $content)
|
||||
}
|
||||
}
|
||||
|
||||
$divisor = get_data_multiplier($unit);
|
||||
|
||||
switch ($content['group_by_agent']) {
|
||||
case REPORT_GENERAL_NOT_GROUP_BY_AGENT:
|
||||
$id_agent_module[$index] = $row['id_agent_module'];
|
||||
@ -7364,7 +7422,7 @@ function reporting_general($report, $content)
|
||||
if (!is_numeric($data_res[$index])) {
|
||||
$return['data'][$name_agent][$mod_name] = $data_res[$index];
|
||||
} else {
|
||||
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
|
||||
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -7383,7 +7441,7 @@ function reporting_general($report, $content)
|
||||
|
||||
if ($change_min) {
|
||||
$return['min']['value'] = $data_res[$index];
|
||||
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2).' '.$unit;
|
||||
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
|
||||
$return['min']['agent'] = $ag_name;
|
||||
$return['min']['module'] = $mod_name;
|
||||
}
|
||||
@ -7399,7 +7457,7 @@ function reporting_general($report, $content)
|
||||
|
||||
if ($change_max) {
|
||||
$return['max']['value'] = $data_res[$index];
|
||||
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2).' '.$unit;
|
||||
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
|
||||
$return['max']['agent'] = $ag_name;
|
||||
$return['max']['module'] = $mod_name;
|
||||
}
|
||||
@ -7517,13 +7575,15 @@ function reporting_general($report, $content)
|
||||
break;
|
||||
}
|
||||
|
||||
$divisor = get_data_multiplier($units[$i]);
|
||||
|
||||
if (!is_numeric($d) || $is_string[$i]) {
|
||||
$data['value'] = $d;
|
||||
// to see the chains on the table
|
||||
$data['formated_value'] = $d;
|
||||
} else {
|
||||
$data['value'] = $d;
|
||||
$data['formated_value'] = format_for_graph($d, 2).' '.$units[$i];
|
||||
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, $units[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7640,7 +7700,7 @@ function reporting_custom_graph(
|
||||
$return['title'] = $content['name'];
|
||||
$return['landscape'] = $content['landscape'];
|
||||
$return['pagebreak'] = $content['pagebreak'];
|
||||
$return['subtitle'] = io_safe_output($graph['name']);
|
||||
$return['subtitle'] = $graph['name'];
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
$return['description'] = $content['description'];
|
||||
|
@ -130,7 +130,7 @@ function html_do_report_info($report)
|
||||
|
||||
$html .= '</tr>
|
||||
<tr>
|
||||
<td valign="top"><b>'.__('Description').': </b></td><td>'.io_safe_output($report['description']).'</td>
|
||||
<td valign="top"><b>'.__('Description').': </b></td><td>'.htmlspecialchars($report['description']).'</td>
|
||||
</tr>
|
||||
</table>'.'</div>';
|
||||
|
||||
@ -3028,6 +3028,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table1->data = [];
|
||||
|
||||
$table1->head = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table1->head[-1] = __('Failover');
|
||||
}
|
||||
|
||||
$table1->head[0] = __('Agent');
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules.
|
||||
@ -3076,6 +3080,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table1->head[8] = __('% Ok');
|
||||
|
||||
$table1->headstyle = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table1->headstyle[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table1->headstyle[0] = 'text-align: left';
|
||||
$table1->headstyle[1] = 'text-align: left';
|
||||
$table1->headstyle[2] = 'text-align: center';
|
||||
@ -3086,6 +3094,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table1->headstyle[7] = 'text-align: right';
|
||||
$table1->headstyle[8] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table1->style[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: center';
|
||||
@ -3101,6 +3113,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table2->data = [];
|
||||
|
||||
$table2->head = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table2->head[-1] = __('Failover');
|
||||
}
|
||||
|
||||
$table2->head[0] = __('Agent');
|
||||
// HACK it is saved in show_graph field.
|
||||
// Show interfaces instead the modules.
|
||||
@ -3135,6 +3151,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
}
|
||||
|
||||
$table2->headstyle = [];
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table2->headstyle[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table2->headstyle[0] = 'text-align: left';
|
||||
$table2->headstyle[1] = 'text-align: left';
|
||||
$table2->headstyle[2] = 'text-align: right';
|
||||
@ -3142,6 +3162,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table2->headstyle[4] = 'text-align: right';
|
||||
$table2->headstyle[5] = 'text-align: right';
|
||||
|
||||
if (isset($item['data'][0]['failover'])) {
|
||||
$table2->style[-1] = 'text-align: left';
|
||||
}
|
||||
|
||||
$table2->style[0] = 'text-align: left';
|
||||
$table2->style[1] = 'text-align: left';
|
||||
$table2->style[2] = 'text-align: right';
|
||||
@ -3151,8 +3175,21 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
|
||||
foreach ($item['data'] as $row) {
|
||||
$table_row = [];
|
||||
$table_row[] = $row['agent'];
|
||||
$table_row[] = $row['availability_item'];
|
||||
if (isset($row['failover'])) {
|
||||
if (strpos($row['failover'], 'failover') !== false) {
|
||||
$table_row[] = __('Failover');
|
||||
} else {
|
||||
$table_row[] = ucfirst($row['failover']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($row['failover']) && $row['failover'] === 'result') {
|
||||
$table_row[] = '--';
|
||||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = $row['agent'];
|
||||
$table_row[] = $row['availability_item'];
|
||||
}
|
||||
|
||||
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
|
||||
$table_row[] = human_time_description_raw(
|
||||
@ -3229,6 +3266,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
||||
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
|
||||
|
||||
$table_row2 = [];
|
||||
if (isset($row['failover'])) {
|
||||
$table_row2[] = ucfirst($row['failover']);
|
||||
}
|
||||
|
||||
$table_row2[] = $row['agent'];
|
||||
$table_row2[] = $row['availability_item'];
|
||||
if ($item['fields']['total_checks']) {
|
||||
|
@ -919,9 +919,10 @@ function servers_get_info($id_server=-1)
|
||||
|
||||
// Remote servers LAG Calculation (server_type != 0).
|
||||
if ($server['server_type'] != 0) {
|
||||
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
|
||||
$result = db_get_row_sql(
|
||||
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
|
||||
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
|
||||
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
|
||||
FROM tagente_estado, tagente_modulo, tagente
|
||||
WHERE utimestamp > 0
|
||||
AND tagente.disabled = 0
|
||||
@ -935,9 +936,10 @@ function servers_get_info($id_server=-1)
|
||||
);
|
||||
} else {
|
||||
// Local/Dataserver server LAG calculation.
|
||||
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
|
||||
$result = db_get_row_sql(
|
||||
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
|
||||
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
|
||||
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
|
||||
FROM tagente_estado, tagente_modulo, tagente
|
||||
WHERE utimestamp > 0
|
||||
AND tagente.disabled = 0
|
||||
|
@ -409,11 +409,20 @@ function snmp_browser_get_oid(
|
||||
|
||||
if ($server_to_exec != 0) {
|
||||
$command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid);
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
|
||||
$translate_output,
|
||||
$rc
|
||||
);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
|
||||
$translate_output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
|
||||
$translate_output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec(
|
||||
$snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid),
|
||||
|
@ -1892,7 +1892,13 @@ function ui_process_page_head($string, $bitfield)
|
||||
}
|
||||
|
||||
// Pandora specific JavaScript should go first.
|
||||
$config['js'] = array_merge(['pandora' => 'include/javascript/pandora.js'], $config['js']);
|
||||
$config['js'] = array_merge(
|
||||
[
|
||||
'pandora' => 'include/javascript/pandora.js',
|
||||
'pandora_ui' => 'include/javascript/pandora_ui.js',
|
||||
],
|
||||
$config['js']
|
||||
);
|
||||
// Load base64 javascript library.
|
||||
$config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
|
||||
// Load webchat javascript library.
|
||||
|
@ -1593,6 +1593,7 @@ function visual_map_print_item(
|
||||
|
||||
case CLOCK:
|
||||
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
|
||||
$image_prefix = (is_metaconsole()) ? '../../' : '';
|
||||
if ($width == 0) {
|
||||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
if ($layoutData['clock_animation'] == 'analogic_1') {
|
||||
@ -1606,17 +1607,16 @@ function visual_map_print_item(
|
||||
}
|
||||
} else {
|
||||
if ($layoutData['clock_animation'] == 'analogic_1') {
|
||||
$img = '<img src="images/console/signes/clock.png" style="width:200px;height:240px;">';
|
||||
$img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:200px;height:240px;">';
|
||||
} else {
|
||||
if ($layoutData['time_format'] == 'time') {
|
||||
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:71px">';
|
||||
$img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:71px">';
|
||||
} else {
|
||||
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:91px">';
|
||||
$img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:91px">';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$image_prefix = ($layoutData['id_metaconsole'] != 0) ? '../../' : '';
|
||||
if ($layoutData['clock_animation'] == 'analogic_1') {
|
||||
$img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:'.$width.'px;height:'.($width + 40).'px;">';
|
||||
} else {
|
||||
@ -1901,7 +1901,7 @@ function visual_map_print_item(
|
||||
}
|
||||
} else {
|
||||
$is_meta = is_metaconsole();
|
||||
|
||||
|
||||
$agents_critical = agents_get_agents(
|
||||
[
|
||||
'disabled' => 0,
|
||||
|
@ -29,29 +29,42 @@ if ($auth_method != 'ad' && $auth_method != 'ldap') {
|
||||
|
||||
$styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;';
|
||||
|
||||
$file = get_parameter('file', null);
|
||||
$file_raw = get_parameter('file', null);
|
||||
|
||||
$file = base64_decode($file);
|
||||
$file = base64_decode(urldecode($file_raw));
|
||||
|
||||
$hash = get_parameter('hash', null);
|
||||
|
||||
$testHash = md5($file.$config['dbpass']);
|
||||
|
||||
if ($hash != $testHash) {
|
||||
if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) || !isset($_SERVER['HTTP_REFERER'])) {
|
||||
echo "<h3 style='".$styleError."'>".__('Security error. Please contact the administrator.').'</h3>';
|
||||
} else if (!empty($file) && !empty($hash)) {
|
||||
// echo $file;
|
||||
if (!file_exists($file)) {
|
||||
$file = $_SERVER['DOCUMENT_ROOT'].$file;
|
||||
} else {
|
||||
$downloadable_file = '';
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
if ($parse_sec2_query[0] === 'sec2') {
|
||||
switch ($parse_sec2_query[1]) {
|
||||
case 'godmode/setup/file_manager':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
|
||||
break;
|
||||
|
||||
case 'extensions/files_repo':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
break;
|
||||
|
||||
default:
|
||||
$downloadable_file = '';
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
if ($downloadable_file === '' || !file_exists($downloadable_file)) {
|
||||
echo "<h3 style='".$styleError."'>".__('File is missing in disk storage. Please contact the administrator.').'</h3>';
|
||||
} else {
|
||||
header('Content-type: aplication/octet-stream;');
|
||||
header('Content-type: '.mime_content_type($file).';');
|
||||
header('Content-Length: '.filesize($file));
|
||||
header('Content-Disposition: attachment; filename="'.basename($file).'"');
|
||||
readfile($file);
|
||||
header('Content-type: '.mime_content_type($downloadable_file).';');
|
||||
header('Content-Length: '.filesize($downloadable_file));
|
||||
header('Content-Disposition: attachment; filename="'.basename($downloadable_file).'"');
|
||||
readfile($downloadable_file);
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ switch ($graph_type) {
|
||||
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
||||
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
||||
|
||||
// Add relative path to avoid phar object injection.
|
||||
$out_of_lim_image = '../graphs/'.$out_of_lim_image;
|
||||
|
||||
$title = get_parameter('title');
|
||||
|
||||
$mode = get_parameter('mode', 1);
|
||||
|
@ -1037,6 +1037,11 @@ function pandoraFlotArea(
|
||||
var update_legend = {};
|
||||
var force_integer = 0;
|
||||
var title = params.title;
|
||||
var divisor = params.divisor;
|
||||
|
||||
if (typeof divisor === "undefined") {
|
||||
divisor = 1000;
|
||||
}
|
||||
|
||||
if (typeof type === "undefined" || type == "") {
|
||||
type = params.type_graph;
|
||||
@ -2443,11 +2448,6 @@ function pandoraFlotArea(
|
||||
}
|
||||
}
|
||||
|
||||
var y_array = format_unit_yaxes(y);
|
||||
|
||||
y = y_array["y"];
|
||||
var how_bigger = y_array["unit"];
|
||||
|
||||
var data_legend = [];
|
||||
|
||||
// The graphs of points type and unknown graphs will dont be updated
|
||||
@ -2465,10 +2465,7 @@ function pandoraFlotArea(
|
||||
.html(
|
||||
label_aux +
|
||||
" value = " +
|
||||
(short_data
|
||||
? number_format(y, 0, "", short_data)
|
||||
: parseFloat(y)) +
|
||||
how_bigger +
|
||||
number_format(y, 0, "", short_data, divisor) +
|
||||
" " +
|
||||
unit
|
||||
);
|
||||
@ -2516,20 +2513,11 @@ function pandoraFlotArea(
|
||||
|
||||
data_legend[index] =
|
||||
" Min: " +
|
||||
(short_data
|
||||
? number_format(min_y, 0, "", short_data)
|
||||
: parseFloat(min_y)) +
|
||||
min_bigger +
|
||||
number_format(value[x].min, 0, unit, short_data, divisor) +
|
||||
" Max: " +
|
||||
(short_data
|
||||
? number_format(max_y, 0, "", short_data)
|
||||
: parseFloat(max_y)) +
|
||||
max_bigger +
|
||||
number_format(value[x].max, 0, unit, short_data, divisor) +
|
||||
" Avg: " +
|
||||
(short_data
|
||||
? number_format(avg_y, 0, "", short_data)
|
||||
: parseFloat(avg_y)) +
|
||||
avg_bigger;
|
||||
number_format(value[x].avg, 0, unit, short_data, divisor);
|
||||
});
|
||||
|
||||
label_aux =
|
||||
@ -2734,12 +2722,13 @@ function pandoraFlotArea(
|
||||
|
||||
function yFormatter(v) {
|
||||
var formatted = v;
|
||||
|
||||
if (short_data) {
|
||||
formatted = number_format(v, force_integer, "", short_data);
|
||||
formatted = number_format(v, force_integer, unit, short_data, divisor);
|
||||
} else {
|
||||
// It is an integer.
|
||||
if (v - Math.floor(v) == 0) {
|
||||
formatted = number_format(v, force_integer, "", 2);
|
||||
formatted = number_format(v, force_integer, unit, 2, divisor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3067,7 +3056,18 @@ function check_adaptions(graph_id) {
|
||||
});
|
||||
}
|
||||
|
||||
function number_format(number, force_integer, unit, short_data) {
|
||||
function number_format(number, force_integer, unit, short_data, divisor) {
|
||||
divisor = typeof divisor !== "undefined" ? divisor : 1000;
|
||||
|
||||
if (unit == "KB") {
|
||||
return number + unit;
|
||||
}
|
||||
|
||||
// Set maximum decimal precision to 99 in case short_data is not set.
|
||||
if (!short_data) {
|
||||
short_data = 99;
|
||||
}
|
||||
|
||||
if (force_integer) {
|
||||
if (Math.round(number) != number) {
|
||||
return "";
|
||||
@ -3080,17 +3080,15 @@ function number_format(number, force_integer, unit, short_data) {
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
while (1) {
|
||||
if (number >= 1000) {
|
||||
//as long as the number can be divided by 1000
|
||||
pos++; //Position in array starting with 0
|
||||
number = number / 1000;
|
||||
} else if (number <= -1000) {
|
||||
pos++;
|
||||
number = number / 1000;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
while (number >= divisor) {
|
||||
// As long as the number can be divided by 1000 or 1024.
|
||||
pos++;
|
||||
number = number / divisor;
|
||||
}
|
||||
|
||||
if (divisor) {
|
||||
number = Math.round(number * decimals) / decimals;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos] + unit;
|
||||
|
@ -712,7 +712,7 @@ function post_process_select_init_unit(name, selected) {
|
||||
});
|
||||
|
||||
if (select_or_text) {
|
||||
$("#" + name + "_select option[value=" + selected + "]").attr(
|
||||
$("#" + name + "_select option[value='" + selected + "']").attr(
|
||||
"selected",
|
||||
true
|
||||
);
|
||||
@ -728,7 +728,7 @@ function post_process_select_init_unit(name, selected) {
|
||||
|
||||
$("#" + name + "_select").change(function() {
|
||||
var value = $("#" + name + "_select").val();
|
||||
$("#" + name + "_select option[value=" + value + "]").attr(
|
||||
$("#" + name + "_select option[value='" + value + "']").attr(
|
||||
"selected",
|
||||
true
|
||||
);
|
||||
@ -833,8 +833,9 @@ function post_process_select_events(name) {
|
||||
* This function initialize the values of the control
|
||||
*
|
||||
* @param name string with the name of the select for time
|
||||
* @param allow_zero bool Allow the use of the value zero
|
||||
*/
|
||||
function period_select_init(name) {
|
||||
function period_select_init(name, allow_zero) {
|
||||
// Manual mode is hidden by default
|
||||
$("#" + name + "_manual").hide();
|
||||
$("#" + name + "_default").show();
|
||||
@ -849,7 +850,7 @@ function period_select_init(name) {
|
||||
} else {
|
||||
$("#" + name + "_select option:eq(1)").prop("selected", true);
|
||||
}
|
||||
} else if ($("#text-" + name + "_text").val() == 0) {
|
||||
} else if ($("#text-" + name + "_text").val() == 0 && allow_zero != true) {
|
||||
$("#" + name + "_units option:last").prop("selected", false);
|
||||
$("#" + name + "_manual").show();
|
||||
$("#" + name + "_default").hide();
|
||||
@ -1825,342 +1826,6 @@ function ellipsize(str, max, ellipse) {
|
||||
return str.trim().length > max ? str.substr(0, max).trim() + ellipse : str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a dialog with an image
|
||||
*
|
||||
* @param {string} icon_name The name of the icon you will display
|
||||
* @param {string} icon_path The path to the icon
|
||||
* @param {Object} incoming_options All options
|
||||
* grayed: {bool} True to display the background black
|
||||
* title {string} 'Logo preview' by default
|
||||
*/
|
||||
function logo_preview(icon_name, icon_path, incoming_options) {
|
||||
// Get the options
|
||||
options = {
|
||||
grayed: false,
|
||||
title: "Logo preview"
|
||||
};
|
||||
$.extend(options, incoming_options);
|
||||
|
||||
if (icon_name == "") return;
|
||||
|
||||
$dialog = $("<div></div>");
|
||||
$image = $('<img src="' + icon_path + '">');
|
||||
$image.css("max-width", "500px").css("max-height", "500px");
|
||||
|
||||
try {
|
||||
$dialog
|
||||
.hide()
|
||||
.html($image)
|
||||
.dialog({
|
||||
title: options.title,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
dialogClass: options.grayed ? "dialog-grayed" : "",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
minHeight: 1,
|
||||
width: $image.width,
|
||||
close: function() {
|
||||
$dialog.empty().remove();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} catch (err) {
|
||||
// console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
// Advanced Form control.
|
||||
function load_modal(settings) {
|
||||
var AJAX_RUNNING = 0;
|
||||
var data = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined) data.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
data.append("page", settings.onshow.page);
|
||||
data.append("method", settings.onshow.method);
|
||||
if (settings.onshow.extradata != undefined) {
|
||||
data.append("extradata", JSON.stringify(settings.onshow.extradata));
|
||||
}
|
||||
|
||||
if (settings.target == undefined) {
|
||||
var uniq = uniqId();
|
||||
var div = document.createElement("div");
|
||||
div.id = "div-modal-" + uniq;
|
||||
div.style.display = "none";
|
||||
|
||||
document.getElementById("main").append(div);
|
||||
|
||||
var id_modal_target = "#div-modal-" + uniq;
|
||||
|
||||
settings.target = $(id_modal_target);
|
||||
}
|
||||
|
||||
var width = 630;
|
||||
if (settings.onshow.width) {
|
||||
width = settings.onshow.width;
|
||||
}
|
||||
|
||||
if (settings.modal.overlay == undefined) {
|
||||
settings.modal.overlay = {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
};
|
||||
}
|
||||
|
||||
settings.target.html("Loading modal...");
|
||||
settings.target
|
||||
.dialog({
|
||||
title: "Loading",
|
||||
close: false,
|
||||
width: 200,
|
||||
buttons: []
|
||||
})
|
||||
.show();
|
||||
var required_buttons = [];
|
||||
if (settings.modal.cancel != undefined) {
|
||||
//The variable contains a function
|
||||
// that is responsible for executing the method it receives from settings
|
||||
// which confirms the closure of a modal
|
||||
var cancelModal = function() {
|
||||
settings.target.dialog("close");
|
||||
if (AJAX_RUNNING) return;
|
||||
AJAX_RUNNING = 1;
|
||||
var formdata = new FormData();
|
||||
|
||||
formdata.append("page", settings.oncancel.page);
|
||||
formdata.append("method", settings.oncancel.method);
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formdata,
|
||||
success: function(data) {
|
||||
if (typeof settings.oncancel.callback == "function") {
|
||||
settings.oncancel.callback(data);
|
||||
settings.target.dialog("close");
|
||||
}
|
||||
AJAX_RUNNING = 0;
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
text: settings.modal.cancel,
|
||||
click: function() {
|
||||
if (settings.oncancel != undefined) {
|
||||
if (typeof settings.oncancel.confirm == "function") {
|
||||
//receive function
|
||||
settings.oncancel.confirm(cancelModal);
|
||||
} else if (settings.oncancel != undefined) {
|
||||
cancelModal();
|
||||
}
|
||||
} else {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.modal.ok != undefined) {
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: settings.modal.ok,
|
||||
click: function() {
|
||||
if (AJAX_RUNNING) return;
|
||||
|
||||
if (settings.onsubmit != undefined) {
|
||||
if (settings.onsubmit.preaction != undefined) {
|
||||
settings.onsubmit.preaction();
|
||||
}
|
||||
AJAX_RUNNING = 1;
|
||||
if (settings.onsubmit.dataType == undefined) {
|
||||
settings.onsubmit.dataType = "html";
|
||||
}
|
||||
|
||||
var formdata = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined)
|
||||
formdata.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
formdata.append("page", settings.onsubmit.page);
|
||||
formdata.append("method", settings.onsubmit.method);
|
||||
|
||||
var flagError = false;
|
||||
|
||||
$("#" + settings.form + " :input").each(function() {
|
||||
if (this.checkValidity() === false) {
|
||||
$(this).attr("title", this.validationMessage);
|
||||
$(this).tooltip({
|
||||
tooltipClass: "uitooltip",
|
||||
position: {
|
||||
my: "right bottom",
|
||||
at: "right top",
|
||||
using: function(position, feedback) {
|
||||
$(this).css(position);
|
||||
$("<div>")
|
||||
.addClass("arrow")
|
||||
.addClass(feedback.vertical)
|
||||
.addClass(feedback.horizontal)
|
||||
.appendTo(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this).tooltip("open");
|
||||
|
||||
var element = $(this);
|
||||
setTimeout(
|
||||
function(element) {
|
||||
element.tooltip("destroy");
|
||||
element.removeAttr("title");
|
||||
},
|
||||
3000,
|
||||
element
|
||||
);
|
||||
|
||||
flagError = true;
|
||||
}
|
||||
|
||||
if (this.type == "file") {
|
||||
if ($(this).prop("files")[0]) {
|
||||
formdata.append(this.name, $(this).prop("files")[0]);
|
||||
}
|
||||
} else {
|
||||
if ($(this).attr("type") == "checkbox") {
|
||||
if (this.checked) {
|
||||
formdata.append(this.name, "on");
|
||||
}
|
||||
} else {
|
||||
formdata.append(this.name, $(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (flagError === false) {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formdata,
|
||||
dataType: settings.onsubmit.dataType,
|
||||
success: function(data) {
|
||||
if (settings.ajax_callback != undefined) {
|
||||
if (settings.idMsgCallback != undefined) {
|
||||
settings.ajax_callback(data, settings.idMsgCallback);
|
||||
} else {
|
||||
settings.ajax_callback(data);
|
||||
}
|
||||
}
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
} else {
|
||||
// No onsumbit configured. Directly close.
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: data,
|
||||
success: function(data) {
|
||||
settings.target.html(data);
|
||||
if (settings.onload != undefined) {
|
||||
settings.onload(data);
|
||||
}
|
||||
settings.target.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: settings.modal.title,
|
||||
width: width,
|
||||
overlay: settings.modal.overlay,
|
||||
buttons: required_buttons,
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
close: function() {
|
||||
if (id_modal_target != undefined) {
|
||||
$(id_modal_target).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
|
||||
function confirmDialog(settings) {
|
||||
var randomStr = uniqId();
|
||||
|
||||
$("body").append(
|
||||
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
|
||||
);
|
||||
$("#confirm_" + randomStr);
|
||||
$("#confirm_" + randomStr)
|
||||
.dialog({
|
||||
title: settings.title,
|
||||
close: false,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
text: "Cancel",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onDeny == "function") settings.onDeny();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Ok",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onAccept == "function") settings.onAccept();
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
function uniqId() {
|
||||
var randomStr =
|
||||
Math.random()
|
||||
@ -2173,58 +1838,6 @@ function uniqId() {
|
||||
return randomStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show modal with message Validation.
|
||||
*
|
||||
* @param {json} data Json example:
|
||||
* $return = [
|
||||
* 'error' => 0 or 1,
|
||||
* 'title' => [
|
||||
* Failed,
|
||||
* Success,
|
||||
* ],
|
||||
* 'text' => [
|
||||
* Failed,
|
||||
* Success,
|
||||
* ],
|
||||
*];
|
||||
* @param {string} idMsg ID div charge modal.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function generalShowMsg(data, idMsg) {
|
||||
var title = data.title[data.error];
|
||||
var text = data.text[data.error];
|
||||
var failed = !data.error;
|
||||
|
||||
$("#" + idMsg).empty();
|
||||
$("#" + idMsg).html(text);
|
||||
$("#" + idMsg).dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: "center",
|
||||
at: "center",
|
||||
of: window,
|
||||
collision: "fit"
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: "OK",
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
} else {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for AJAX request.
|
||||
*
|
||||
|
@ -214,8 +214,8 @@ function show_massive_response_dialog(
|
||||
$("#button-submit_event_response").show();
|
||||
},
|
||||
close: function() {
|
||||
$("#checkbox-all_validate_box").prop("checked", false);
|
||||
$(".chk_val").prop("checked", false);
|
||||
$("#event_response_command_window").dialog("close");
|
||||
},
|
||||
width: response["modal_width"],
|
||||
height: response["modal_height"]
|
||||
|
399
pandora_console/include/javascript/pandora_ui.js
Normal file
399
pandora_console/include/javascript/pandora_ui.js
Normal file
@ -0,0 +1,399 @@
|
||||
/* global $ */
|
||||
/* exported load_modal */
|
||||
/*JS to Show user modals :
|
||||
- Confirm dialogs.
|
||||
- Display dialogs.
|
||||
- Load modal windows.
|
||||
- Logo Previews.
|
||||
- General show messages.
|
||||
*/
|
||||
|
||||
var ENTERPRISE_DIR = "enterprise";
|
||||
|
||||
/**
|
||||
* Display a dialog with an image
|
||||
*
|
||||
* @param {string} icon_name The name of the icon you will display
|
||||
* @param {string} icon_path The path to the icon
|
||||
* @param {Object} incoming_options All options
|
||||
* grayed: {bool} True to display the background black
|
||||
* title {string} 'Logo preview' by default
|
||||
*/
|
||||
function logo_preview(icon_name, icon_path, incoming_options) {
|
||||
// Get the options
|
||||
options = {
|
||||
grayed: false,
|
||||
title: "Logo preview"
|
||||
};
|
||||
$.extend(options, incoming_options);
|
||||
|
||||
if (icon_name == "") return;
|
||||
|
||||
$dialog = $("<div></div>");
|
||||
$image = $('<img src="' + icon_path + '">');
|
||||
$image.css("max-width", "500px").css("max-height", "500px");
|
||||
|
||||
try {
|
||||
$dialog
|
||||
.hide()
|
||||
.html($image)
|
||||
.dialog({
|
||||
title: options.title,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
dialogClass: options.grayed ? "dialog-grayed" : "",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
minHeight: 1,
|
||||
width: $image.width,
|
||||
close: function() {
|
||||
$dialog.empty().remove();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
} catch (err) {
|
||||
// console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
// Advanced Form control.
|
||||
function load_modal(settings) {
|
||||
var AJAX_RUNNING = 0;
|
||||
var data = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined) data.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
data.append("page", settings.onshow.page);
|
||||
data.append("method", settings.onshow.method);
|
||||
if (settings.onshow.extradata != undefined) {
|
||||
data.append("extradata", JSON.stringify(settings.onshow.extradata));
|
||||
}
|
||||
|
||||
if (settings.target == undefined) {
|
||||
var uniq = uniqId();
|
||||
var div = document.createElement("div");
|
||||
div.id = "div-modal-" + uniq;
|
||||
div.style.display = "none";
|
||||
|
||||
document.getElementById("main").append(div);
|
||||
|
||||
var id_modal_target = "#div-modal-" + uniq;
|
||||
|
||||
settings.target = $(id_modal_target);
|
||||
}
|
||||
|
||||
var width = 630;
|
||||
if (settings.onshow.width) {
|
||||
width = settings.onshow.width;
|
||||
}
|
||||
|
||||
if (settings.modal.overlay == undefined) {
|
||||
settings.modal.overlay = {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
};
|
||||
}
|
||||
|
||||
settings.target.html("Loading modal...");
|
||||
settings.target
|
||||
.dialog({
|
||||
title: "Loading",
|
||||
close: false,
|
||||
width: 200,
|
||||
buttons: []
|
||||
})
|
||||
.show();
|
||||
var required_buttons = [];
|
||||
if (settings.modal.cancel != undefined) {
|
||||
//The variable contains a function
|
||||
// that is responsible for executing the method it receives from settings
|
||||
// which confirms the closure of a modal
|
||||
var cancelModal = function() {
|
||||
settings.target.dialog("close");
|
||||
if (AJAX_RUNNING) return;
|
||||
AJAX_RUNNING = 1;
|
||||
var formdata = new FormData();
|
||||
|
||||
formdata.append("page", settings.oncancel.page);
|
||||
formdata.append("method", settings.oncancel.method);
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formdata,
|
||||
success: function(data) {
|
||||
if (typeof settings.oncancel.callback == "function") {
|
||||
settings.oncancel.callback(data);
|
||||
settings.target.dialog("close");
|
||||
}
|
||||
AJAX_RUNNING = 0;
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
text: settings.modal.cancel,
|
||||
click: function() {
|
||||
if (settings.oncancel != undefined) {
|
||||
if (typeof settings.oncancel.confirm == "function") {
|
||||
//receive function
|
||||
settings.oncancel.confirm(cancelModal);
|
||||
} else if (settings.oncancel != undefined) {
|
||||
cancelModal();
|
||||
}
|
||||
} else {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.modal.ok != undefined) {
|
||||
required_buttons.push({
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: settings.modal.ok,
|
||||
click: function() {
|
||||
if (AJAX_RUNNING) return;
|
||||
|
||||
if (settings.onsubmit != undefined) {
|
||||
if (settings.onsubmit.preaction != undefined) {
|
||||
settings.onsubmit.preaction();
|
||||
}
|
||||
AJAX_RUNNING = 1;
|
||||
if (settings.onsubmit.dataType == undefined) {
|
||||
settings.onsubmit.dataType = "html";
|
||||
}
|
||||
|
||||
var formdata = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined)
|
||||
formdata.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
formdata.append("page", settings.onsubmit.page);
|
||||
formdata.append("method", settings.onsubmit.method);
|
||||
|
||||
var flagError = false;
|
||||
|
||||
$("#" + settings.form + " :input").each(function() {
|
||||
if (this.checkValidity() === false) {
|
||||
$(this).attr("title", this.validationMessage);
|
||||
$(this).tooltip({
|
||||
tooltipClass: "uitooltip",
|
||||
position: {
|
||||
my: "right bottom",
|
||||
at: "right top",
|
||||
using: function(position, feedback) {
|
||||
$(this).css(position);
|
||||
$("<div>")
|
||||
.addClass("arrow")
|
||||
.addClass(feedback.vertical)
|
||||
.addClass(feedback.horizontal)
|
||||
.appendTo(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this).tooltip("open");
|
||||
|
||||
var element = $(this);
|
||||
setTimeout(
|
||||
function(element) {
|
||||
element.tooltip("destroy");
|
||||
element.removeAttr("title");
|
||||
},
|
||||
3000,
|
||||
element
|
||||
);
|
||||
|
||||
flagError = true;
|
||||
}
|
||||
|
||||
if (this.type == "file") {
|
||||
if ($(this).prop("files")[0]) {
|
||||
formdata.append(this.name, $(this).prop("files")[0]);
|
||||
}
|
||||
} else {
|
||||
if ($(this).attr("type") == "checkbox") {
|
||||
if (this.checked) {
|
||||
formdata.append(this.name, "on");
|
||||
}
|
||||
} else {
|
||||
formdata.append(this.name, $(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (flagError === false) {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formdata,
|
||||
dataType: settings.onsubmit.dataType,
|
||||
success: function(data) {
|
||||
if (settings.ajax_callback != undefined) {
|
||||
if (settings.idMsgCallback != undefined) {
|
||||
settings.ajax_callback(data, settings.idMsgCallback);
|
||||
} else {
|
||||
settings.ajax_callback(data);
|
||||
}
|
||||
}
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
} else {
|
||||
// No onsumbit configured. Directly close.
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: data,
|
||||
success: function(data) {
|
||||
settings.target.html(data);
|
||||
if (settings.onload != undefined) {
|
||||
settings.onload(data);
|
||||
}
|
||||
settings.target.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: settings.modal.title,
|
||||
width: width,
|
||||
overlay: settings.modal.overlay,
|
||||
buttons: required_buttons,
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
close: function() {
|
||||
if (id_modal_target != undefined) {
|
||||
$(id_modal_target).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(data) {
|
||||
// console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
|
||||
function confirmDialog(settings) {
|
||||
var randomStr = uniqId();
|
||||
|
||||
$("body").append(
|
||||
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
|
||||
);
|
||||
$("#confirm_" + randomStr);
|
||||
$("#confirm_" + randomStr)
|
||||
.dialog({
|
||||
title: settings.title,
|
||||
close: false,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{
|
||||
text: "Cancel",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onDeny == "function") settings.onDeny();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Ok",
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (typeof settings.onAccept == "function") settings.onAccept();
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show modal with message Validation.
|
||||
*
|
||||
* @param {json} data Json example:
|
||||
* $return = [
|
||||
* 'error' => 0 or 1,
|
||||
* 'title' => [
|
||||
* Failed,
|
||||
* Success,
|
||||
* ],
|
||||
* 'text' => [
|
||||
* Failed,
|
||||
* Success,
|
||||
* ],
|
||||
*];
|
||||
* @param {string} idMsg ID div charge modal.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function generalShowMsg(data, idMsg) {
|
||||
var title = data.title[data.error];
|
||||
var text = data.text[data.error];
|
||||
var failed = !data.error;
|
||||
|
||||
$("#" + idMsg).empty();
|
||||
$("#" + idMsg).html(text);
|
||||
$("#" + idMsg).dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: "center",
|
||||
at: "center",
|
||||
of: window,
|
||||
collision: "fit"
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: "OK",
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
} else {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
var correct_install_progress = true;
|
||||
|
||||
function form_upload(homeurl) {
|
||||
function form_upload(homeurl, current_package) {
|
||||
var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : "";
|
||||
|
||||
//Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
|
||||
@ -164,7 +164,7 @@ function form_upload(homeurl) {
|
||||
.change();
|
||||
|
||||
// Begin the installation
|
||||
install_package(res.package, homeurl);
|
||||
install_package(res.package, homeurl, current_package);
|
||||
});
|
||||
} else {
|
||||
// Something has gone wrong!
|
||||
@ -214,7 +214,7 @@ function formatFileSize(bytes) {
|
||||
return (bytes / 1000).toFixed(2) + " KB";
|
||||
}
|
||||
|
||||
function install_package(package, homeurl) {
|
||||
function install_package(package, homeurl, current_package) {
|
||||
var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : "";
|
||||
|
||||
$(
|
||||
@ -1235,6 +1235,50 @@ function install_package(package, homeurl) {
|
||||
|
||||
$("#pkg_apply_dialog").html(dialog_text);
|
||||
$("#pkg_apply_dialog").dialog("open");
|
||||
|
||||
const number_update = package.match(/package_(\d+).oum/);
|
||||
|
||||
if (number_update === null || number_update[1] != current_package - 0 + 1) {
|
||||
$(
|
||||
"<div id='warning_pkg' class='dialog ui-dialog-content' title='" +
|
||||
package_available +
|
||||
"'></div>"
|
||||
).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 600,
|
||||
height: 250,
|
||||
buttons: [
|
||||
{
|
||||
text: ok_button,
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
var dialog_warning = "<div class='update_popup'>";
|
||||
dialog_warning =
|
||||
dialog_warning +
|
||||
"<div class='update_text'><h3>" +
|
||||
text1_warning +
|
||||
"</h3>";
|
||||
dialog_warning = dialog_warning + "<p>" + text2_warning + "</p></div>";
|
||||
dialog_warning =
|
||||
dialog_warning +
|
||||
"<div class='update_icon'><img src='" +
|
||||
home_url +
|
||||
"images/icono_warning_mr.png'></div>";
|
||||
dialog_warning = dialog_warning + "</div>";
|
||||
|
||||
$("#warning_pkg").html(dialog_warning);
|
||||
}
|
||||
}
|
||||
|
||||
function check_install_package(package, homeurl) {
|
||||
|
@ -70,7 +70,7 @@ class User
|
||||
$this->sessions[$data['phpsessionid']] = 1;
|
||||
$info = \db_get_row_filter(
|
||||
'tsessions_php',
|
||||
['id_session' => $data['phpsessionid']]
|
||||
['id_session' => io_safe_input($data['phpsessionid'])]
|
||||
);
|
||||
|
||||
if ($info !== false) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
.agent_options_column_left {
|
||||
padding-right: 50px;
|
||||
padding-right: 60px;
|
||||
}
|
||||
|
||||
.agent_qr {
|
||||
@ -61,7 +61,7 @@ a#qr_code_agent_view {
|
||||
.first_row .agent_options_column_right select,
|
||||
.first_row .agent_options_column_right input,
|
||||
.first_row .agent_options_column_left select#grupo {
|
||||
width: 95%;
|
||||
width: 93%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ div.mini-criticity.h100p {
|
||||
form.flex-row div.filter_input,
|
||||
form.flex-row ul {
|
||||
width: 30%;
|
||||
min-width: 300px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
@ -47,12 +46,13 @@ div.filter_input_little {
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
flex-wrap: nowrap;
|
||||
margin: 0.5em 0 0.5em 1em;
|
||||
margin: 0.5em 0 0.5em 0em;
|
||||
}
|
||||
|
||||
form.flex-row div.filter_input.large {
|
||||
flex: 1;
|
||||
min-width: 470px;
|
||||
min-width: 700px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div.filter_input > label,
|
||||
@ -120,6 +120,8 @@ table.dataTable tbody td {
|
||||
|
||||
.filter_input {
|
||||
align-items: center;
|
||||
min-width: 400px;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.filter_input_little > select,
|
||||
|
@ -4985,11 +4985,10 @@ input:checked + .p-slider:before {
|
||||
.action_buttons input[type="image"],
|
||||
.action_button_img {
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdcdc;
|
||||
padding: 1px;
|
||||
border: 1px solid #dcdcdc !important;
|
||||
padding: 1px !important;
|
||||
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
|
||||
max-width: 21px;
|
||||
background-color: transparent; /*BORRAR*/
|
||||
}
|
||||
|
||||
/* This class is for only one icon to be a button type. */
|
||||
|
@ -1234,9 +1234,13 @@ if ($searchPage) {
|
||||
|
||||
if (isset($_GET['sec2'])) {
|
||||
$file = $_GET['sec2'].'.php';
|
||||
// Make file path absolute to prevent accessing remote files.
|
||||
$file = __DIR__.'/'.$file;
|
||||
// Translate some secs.
|
||||
$main_sec = get_sec($_GET['sec']);
|
||||
$_GET['sec'] = ($main_sec == false) ? $_GET['sec'] : $main_sec;
|
||||
|
||||
// Third condition is aimed to prevent from traversal attack.
|
||||
if (!file_exists($file)
|
||||
|| ($_GET['sec2'] != 'general/logon_ok' && enterprise_hook(
|
||||
'enterprise_acl',
|
||||
@ -1247,7 +1251,8 @@ if ($searchPage) {
|
||||
true,
|
||||
isset($_GET['sec3']) ? $_GET['sec3'] : '',
|
||||
]
|
||||
) == false)
|
||||
) == false
|
||||
|| strpos(realpath($file), __DIR__) === false)
|
||||
) {
|
||||
unset($_GET['sec2']);
|
||||
include 'general/noaccess.php';
|
||||
|
@ -129,7 +129,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.742';
|
||||
$build = '200110';
|
||||
$build = '200103';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -775,6 +775,7 @@ class Ui
|
||||
echo " <script src='include/javascript/jquery.js'></script>\n";
|
||||
echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n";
|
||||
echo " <script src='../include/javascript/pandora.js'></script>\n";
|
||||
echo " <script src='../include/javascript/pandora_ui.js'></script>\n";
|
||||
|
||||
echo " </head>\n";
|
||||
echo " <body>\n";
|
||||
|
@ -81,8 +81,8 @@ if ($edit_networkmap) {
|
||||
$id_group = $values['id_group'];
|
||||
|
||||
// ACL for the network map.
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -95,6 +95,9 @@ if ($edit_networkmap) {
|
||||
|
||||
$name = io_safe_output($values['name']);
|
||||
|
||||
// Id group of the map itself, not data source.
|
||||
$id_group_map = $values['id_group_map'];
|
||||
|
||||
$description = $values['description'];
|
||||
|
||||
$filter = json_decode($values['filter'], true);
|
||||
@ -267,8 +270,8 @@ if ($not_found) {
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'id_group_map',
|
||||
$id_group_map,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
@ -329,6 +332,28 @@ if ($not_found) {
|
||||
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
|
||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
|
||||
|
||||
$table->data['source_data_group'][0] = __('Source group');
|
||||
$table->data['source_data_group'][1] = html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
true,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data['source_data_group'][1] .= html_print_image(
|
||||
'images/error.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'group_change_warning',
|
||||
'title' => __('Source id group changed. All elements in networkmap will be lost.'),
|
||||
'style' => 'display : none',
|
||||
]
|
||||
);
|
||||
|
||||
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
|
||||
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
|
||||
'dont_show_subgroups',
|
||||
@ -379,7 +404,7 @@ if ($not_found) {
|
||||
$table->data['kval'][0] = __('Default ideal node separation');
|
||||
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
echo '<form id="networkmap_options_form" method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
@ -420,8 +445,11 @@ $(document).ready(function() {
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_dont_show_subgroups")
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_group")
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_recon_task")
|
||||
.css('display', '');
|
||||
|
||||
}
|
||||
else if (source == 'ip_mask') {
|
||||
$("#form_editor-source_data_ip_mask")
|
||||
@ -430,6 +458,8 @@ $(document).ready(function() {
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_dont_show_subgroups")
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_group")
|
||||
.css('display', 'none');
|
||||
}
|
||||
else if (source == 'group') {
|
||||
$("#form_editor-source_data_ip_mask")
|
||||
@ -438,6 +468,8 @@ $(document).ready(function() {
|
||||
.css('display', 'none');
|
||||
$("#form_editor-source_data_dont_show_subgroups")
|
||||
.css('display', '');
|
||||
$("#form_editor-source_data_group")
|
||||
.css('display', '');
|
||||
}
|
||||
});
|
||||
|
||||
@ -508,5 +540,53 @@ $(document).ready(function() {
|
||||
|
||||
$("input[name='source']").trigger("change");
|
||||
$("#method").trigger("change");
|
||||
|
||||
|
||||
// Control if id_group has changed.
|
||||
var id_group_old = $("#id_group").val();
|
||||
var id_group_changed = false;
|
||||
|
||||
$("#id_group").on('change',{id_group_old: id_group_old}, function () {
|
||||
|
||||
var id_group_new = $("#id_group").val();
|
||||
if((id_group_old != id_group_new) && (update_networkmap == 1 )) {
|
||||
id_group_changed = true;
|
||||
$("#group_change_warning").show();
|
||||
|
||||
} else {
|
||||
id_group_changed = false;
|
||||
$("#group_change_warning").hide();
|
||||
}
|
||||
});
|
||||
|
||||
var update_networkmap = 0;
|
||||
// Show advice if id_group has changed.
|
||||
update_networkmap = $("input[name='update_networkmap']").val();
|
||||
|
||||
$( "#submit-crt" ).click(function( event ) {
|
||||
|
||||
if(update_networkmap == 1 && id_group_changed === true) {
|
||||
confirmDialog({
|
||||
title: '<?php echo __('Are you sure?'); ?>',
|
||||
message: '<?php echo __('Source id group changed. All elements in Networkmap will be lost'); ?>',
|
||||
ok: '<?php echo __('OK'); ?>',
|
||||
cancel: '<?php echo __('Cancel'); ?>',
|
||||
onDeny: function() {
|
||||
// Continue execution.
|
||||
return false;
|
||||
},
|
||||
onAccept: function () {
|
||||
// Submit form
|
||||
$("#networkmap_options_form").submit();
|
||||
}
|
||||
})
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -12,10 +12,10 @@
|
||||
// Load global variables
|
||||
global $config;
|
||||
|
||||
// Check user credentials
|
||||
// Check user credentials.
|
||||
check_login();
|
||||
|
||||
// General ACL for the network maps
|
||||
// General ACL for the network maps.
|
||||
$networkmaps_read = check_acl($config['id_user'], 0, 'MR');
|
||||
$networkmaps_write = check_acl($config['id_user'], 0, 'MW');
|
||||
$networkmaps_manage = check_acl($config['id_user'], 0, 'MM');
|
||||
@ -53,11 +53,12 @@ if (enterprise_installed()) {
|
||||
|
||||
if ($save_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_paramater('id_group_map', 0);
|
||||
|
||||
// ACL for the network map
|
||||
// ACL for the network map.
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -93,6 +94,7 @@ if (enterprise_installed()) {
|
||||
$values['description'] = $description;
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
@ -139,10 +141,12 @@ if (enterprise_installed()) {
|
||||
}
|
||||
} else if ($update_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM');
|
||||
$networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -221,11 +225,13 @@ if ($new_networkmap || $save_networkmap) {
|
||||
|
||||
if ($save_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -282,6 +288,7 @@ if ($new_networkmap || $save_networkmap) {
|
||||
$values['height'] = $height;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
|
||||
switch ($method) {
|
||||
case 'twopi':
|
||||
@ -401,8 +408,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
if ($id_group_old === false) {
|
||||
// ACL for the network map.
|
||||
$id_group_map_old = db_get_value('id_group_map', 'tmap', 'id', $id);
|
||||
|
||||
if ($id_group_map_old === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to accessnode graph builder'
|
||||
@ -411,9 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ACL for the network map
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group_old, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group_old, 'MM');
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -426,10 +434,14 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
|
||||
if ($update_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
// Get id of old group source to check changes.
|
||||
$id_group_old = db_get_value('id_group', 'tmap', 'id', $id);
|
||||
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM');
|
||||
$id_group_map = (int) get_parameter('id_group_map', 0);
|
||||
$networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW');
|
||||
$networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -456,6 +468,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
@ -493,6 +506,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
// If change the group, the map must be regenerated
|
||||
if ($id_group != $id_group_old) {
|
||||
networkmap_delete_nodes($id);
|
||||
// Delete relations.
|
||||
networkmap_delete_relations($id);
|
||||
}
|
||||
|
||||
$networkmap_write = $networkmap_write_new;
|
||||
@ -701,9 +716,9 @@ switch ($tab) {
|
||||
$network_maps = db_get_all_rows_filter(
|
||||
'tmap',
|
||||
[
|
||||
'id_group' => $id_groups,
|
||||
'limit' => $limit,
|
||||
'offset' => $offset,
|
||||
'id_group_map' => $id_groups,
|
||||
'limit' => $limit,
|
||||
'offset' => $offset,
|
||||
]
|
||||
);
|
||||
|
||||
@ -712,9 +727,9 @@ switch ($tab) {
|
||||
|
||||
foreach ($network_maps as $network_map) {
|
||||
// ACL for the network map
|
||||
$networkmap_read = check_acl($config['id_user'], $network_map['id_group'], 'MR');
|
||||
$networkmap_write = check_acl($config['id_user'], $network_map['id_group'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $network_map['id_group'], 'MM');
|
||||
$networkmap_read = check_acl($config['id_user'], $network_map['id_group_map'], 'MR');
|
||||
$networkmap_write = check_acl($config['id_user'], $network_map['id_group_map'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $network_map['id_group_map'], 'MM');
|
||||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -722,7 +737,7 @@ switch ($tab) {
|
||||
'Trying to access networkmap enterprise'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
@ -768,7 +783,7 @@ switch ($tab) {
|
||||
}
|
||||
}
|
||||
|
||||
$data['groups'] = ui_print_group_icon($network_map['id_group'], true);
|
||||
$data['groups'] = ui_print_group_icon($network_map['id_group_map'], true);
|
||||
|
||||
if ($networkmap_write || $networkmap_manage) {
|
||||
$table->cellclass[] = [
|
||||
|
@ -576,8 +576,8 @@ if (is_ajax()) {
|
||||
$filter = json_encode($array_filter);
|
||||
|
||||
// ACL for the network map.
|
||||
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
|
||||
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
@ -800,9 +800,9 @@ if ($networkmap === false) {
|
||||
return;
|
||||
} else {
|
||||
// ACL for the network map.
|
||||
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
|
||||
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
|
||||
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group_map'], 'MR');
|
||||
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM');
|
||||
|
||||
if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
|
@ -65,6 +65,7 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
|
||||
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/pandora_ui.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
|
||||
|
@ -73,6 +73,7 @@ $label = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id)
|
||||
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/pandora_ui.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
|
||||
|
@ -135,6 +135,10 @@ $id_agent = get_parameter(
|
||||
'filter[id_agent]',
|
||||
$filter['id_agent']
|
||||
);
|
||||
$text_module = get_parameter(
|
||||
'filter[text_module]',
|
||||
$filter['text_module']
|
||||
);
|
||||
$id_agent_module = get_parameter(
|
||||
'filter[id_agent_module]',
|
||||
$filter['id_agent_module']
|
||||
@ -210,10 +214,38 @@ $id_source_event = get_parameter(
|
||||
$filter['id_source_event']
|
||||
);
|
||||
|
||||
$server_id = get_parameter(
|
||||
'filter[server_id]',
|
||||
$filter['id_server_meta']
|
||||
);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// Connect to node database.
|
||||
$id_node = $server_id;
|
||||
if ($id_node != 0) {
|
||||
if (metaconsole_connect(null, $id_node) != NOERR) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($text_agent) && !empty($id_agent)) {
|
||||
$text_agent = agents_get_alias($id_agent);
|
||||
}
|
||||
|
||||
if (empty($text_module) && !empty($id_agent_module)) {
|
||||
$text_module = modules_get_agentmodule_name($id_agent_module);
|
||||
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// Return to metaconsole database.
|
||||
if ($id_node != 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
// Ajax responses.
|
||||
if (is_ajax()) {
|
||||
$get_events = get_parameter('get_events', 0);
|
||||
@ -862,22 +894,6 @@ $in = '<div class="filter_input"><label>'.__('Event type').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// Criticity - severity.
|
||||
$severity_select .= html_print_select(
|
||||
get_priorities(),
|
||||
'severity',
|
||||
$severity,
|
||||
'',
|
||||
__('All'),
|
||||
'-1',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$in = '<div class="filter_input"><label>'.__('Severity').'</label>';
|
||||
$in .= $severity_select.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
// Event status.
|
||||
$data = html_print_select(
|
||||
events_get_all_status(),
|
||||
@ -929,6 +945,28 @@ $in = '<div class="filter_input"><label>'.__('Free search').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
if (empty($severity) && $severity !== '0') {
|
||||
$severity = -1;
|
||||
}
|
||||
|
||||
// Criticity - severity.
|
||||
$data = html_print_select(
|
||||
get_priorities(),
|
||||
'severity',
|
||||
$severity,
|
||||
'',
|
||||
__('All'),
|
||||
-1,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$in = '<div class="filter_input"><label>'.__('Severity').'</label>';
|
||||
$in .= $data.'</div>';
|
||||
$inputs[] = $in;
|
||||
|
||||
$buttons = [];
|
||||
|
||||
$buttons[] = [
|
||||
@ -1083,8 +1121,6 @@ if (is_metaconsole()) {
|
||||
$adv_inputs[] = $in;
|
||||
}
|
||||
|
||||
// Gap.
|
||||
$adv_inputs[] = '<div class="filter_input"></div>';
|
||||
|
||||
// Date from.
|
||||
$data = html_print_input_text(
|
||||
@ -1634,6 +1670,10 @@ function process_datatables_callback(table, settings) {
|
||||
|
||||
}
|
||||
|
||||
// Uncheck checkbox to select all.
|
||||
if ($('#checkbox-all_validate_box').length) {
|
||||
$('#checkbox-all_validate_box').uncheck();
|
||||
}
|
||||
}
|
||||
|
||||
function process_datatables_item(item) {
|
||||
|
@ -87,8 +87,8 @@ if ($layout) {
|
||||
$id_layout,
|
||||
true,
|
||||
true,
|
||||
$width,
|
||||
$height,
|
||||
$bwidth,
|
||||
$bheight,
|
||||
'../../',
|
||||
true,
|
||||
true,
|
||||
@ -196,7 +196,6 @@ $ignored_params['refr'] = '';
|
||||
|
||||
$('body').css('background-color','<?php echo $layout['background_color']; ?>');
|
||||
$('body').css('margin','0');
|
||||
$('body').css('height','100%');
|
||||
$('body').css('overflow','hidden');
|
||||
$(".module_graph .menu_graph").css('display','none');
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1020,6 +1020,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
|
||||
`server_keepalive` int(11) NOT NULL default 0,
|
||||
`stat_utimestamp` bigint(20) NOT NULL default '0',
|
||||
`exec_proxy` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`port` int(5) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id_server`),
|
||||
KEY `name` (`name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -1098,7 +1099,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
|
||||
`id_name` varchar(600) NOT NULL,
|
||||
`id_group` int(10) NOT NULL default 0,
|
||||
`event_type` text NOT NULL,
|
||||
`severity` int(10) NOT NULL default -1,
|
||||
`severity` text NOT NULL,
|
||||
`status` int(10) NOT NULL default -1,
|
||||
`search` TEXT,
|
||||
`text_agent` TEXT,
|
||||
@ -1485,14 +1486,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
|
||||
-- Table `treport_content_item`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `treport_content_item` (
|
||||
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
||||
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
||||
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`server_name` text,
|
||||
`operation` text,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -2188,6 +2190,7 @@ CREATE TABLE IF NOT EXISTS `tmap` (
|
||||
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`generated` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`filter` TEXT,
|
||||
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -140,7 +140,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||
('cr_incident_title', ''),
|
||||
('cr_incident_content', ''),
|
||||
('sample_agent', '0'),
|
||||
('gotty', '/usr/bin/gotty');
|
||||
('gotty', '/usr/bin/gotty'),
|
||||
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}');
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.742-200110
|
||||
Version: 7.0NG.742-200127
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.742-200110"
|
||||
pandora_version="7.0NG.742-200127"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -163,7 +163,12 @@ wmiserver 1
|
||||
network_timeout 4
|
||||
|
||||
# Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY).
|
||||
rcmd_timeout 30
|
||||
|
||||
rcmd_timeout 10
|
||||
|
||||
# Pandora FMS remote execution commands timeout tool filepath (by default at /usr/bin)
|
||||
|
||||
rcmd_timeout_bin /usr/bin/timeout
|
||||
|
||||
# Remote execution modules, ssh_launcher extra option (PANDORA FMS ENTERPRISE ONLY).
|
||||
ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh
|
||||
|
@ -148,6 +148,14 @@ wmiserver 0
|
||||
|
||||
network_timeout 5
|
||||
|
||||
# Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY).
|
||||
|
||||
rcmd_timeout 10
|
||||
|
||||
# Pandora FMS remote execution commands timeout tool filepath (by default at /usr/bin)
|
||||
|
||||
rcmd_timeout_bin C:\PandoraFMS\Pandora_Server\bin\pandora_exec.exe
|
||||
|
||||
# Server keepalive (in seconds)
|
||||
|
||||
server_keepalive 45
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.742";
|
||||
my $pandora_build = "200110";
|
||||
my $pandora_build = "200127";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
@ -275,7 +275,8 @@ sub pandora_load_config {
|
||||
$pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1
|
||||
$pa_config->{"snmp_checks"} = 1; # Introduced on 1.3.1
|
||||
$pa_config->{"snmp_timeout"} = 8; # Introduced on 1.3.1
|
||||
$pa_config->{"rcmd_timeout"} = 30; # Introduced on 7.0.740
|
||||
$pa_config->{"rcmd_timeout"} = 10; # Introduced on 7.0.740
|
||||
$pa_config->{"rcmd_timeout_bin"} = '/usr/bin/timeout'; # Introduced on 7.0.743
|
||||
$pa_config->{"snmp_trapd"} = '/usr/sbin/snmptrapd'; # 3.0
|
||||
$pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1
|
||||
$pa_config->{"tcp_timeout"} = 20; # Introduced on 1.3.1
|
||||
@ -806,6 +807,9 @@ sub pandora_load_config {
|
||||
elsif ($parametro =~ m/^rcmd_timeout\s+([0-9]*)/i) {
|
||||
$pa_config->{"rcmd_timeout"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^rcmd_timeout_bin\s(.*)/i) {
|
||||
$pa_config->{"rcmd_timeout_bin"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^tcp_checks\s+([0-9]*)/i) {
|
||||
$pa_config->{"tcp_checks"} = clean_blank($1);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.742";
|
||||
my $pandora_build = "200110";
|
||||
my $pandora_build = "200127";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -1447,7 +1447,7 @@ sub cloud_scan($) {
|
||||
} else {
|
||||
|
||||
# Unrecognized task type.
|
||||
call('message', 'Unrecognized task type', 1);
|
||||
$self->call('message', 'Unrecognized task type', 1);
|
||||
$self->call('update_progress', -1);
|
||||
return;
|
||||
}
|
||||
@ -1469,7 +1469,7 @@ sub cloud_scan($) {
|
||||
if (!$cloudObj) {
|
||||
|
||||
# Failed to initialize, check Cloud credentials or anything.
|
||||
call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3);
|
||||
$self->call('message', 'Unable to initialize PandoraFMS::Recon::Cloud::'.$type, 3);
|
||||
} else {
|
||||
|
||||
# Let Cloud object manage scan.
|
||||
@ -1581,7 +1581,7 @@ sub app_scan($) {
|
||||
$type = 'SAP';
|
||||
} else {
|
||||
# Unrecognized task type.
|
||||
call('message', 'Unrecognized task type', 1);
|
||||
$self->call('message', 'Unrecognized task type', 1);
|
||||
$self->call('update_progress', -1);
|
||||
return;
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ sub app_scan($) {
|
||||
$self->{'c_network_percent'} = 0;
|
||||
|
||||
# Send message
|
||||
call('message', 'Checking target ' . $target, 10);
|
||||
$self->call('message', 'Checking target ' . $target, 10);
|
||||
|
||||
# Force target acquirement.
|
||||
$self->{'task_data'}->{'dbhost'} = $target;
|
||||
@ -1633,7 +1633,7 @@ sub app_scan($) {
|
||||
# Verify if object is connected. If cannot connect to current target
|
||||
# return with module.
|
||||
if (!$obj->is_connected()) {
|
||||
call('message', 'Cannot connect to target ' . $target, 3);
|
||||
$self->call('message', 'Cannot connect to target ' . $target, 3);
|
||||
$global_percent += $global_step;
|
||||
$self->{'c_network_percent'} = 90;
|
||||
|
||||
@ -1739,7 +1739,7 @@ sub deploy_scan($) {
|
||||
if (!$deployer) {
|
||||
|
||||
# Failed to initialize, check Cloud credentials or anything.
|
||||
call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
|
||||
$self->call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
|
||||
} else {
|
||||
|
||||
# Let deployer object manage scan.
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.742
|
||||
%define release 200110
|
||||
%define release 200127
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
@ -47,6 +47,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%setup -q -n pandora_server
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.742"
|
||||
PI_BUILD="200110"
|
||||
PI_BUILD="200127"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.742 PS200110";
|
||||
my $version = "7.0NG.742 PS200127";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.742 PS200110";
|
||||
my $version = "7.0NG.742 PS200127";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user