Merge branch 'develop' into 'ent-4967-9083-Valores-unidades-en-graficas-no-son-por-1024'

# Conflicts:
#   pandora_console/extras/mr/35.sql
This commit is contained in:
Alejandro Campos 2020-01-20 12:00:42 +01:00
commit e7769b8bf4
54 changed files with 861 additions and 670 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.742-200115 Version: 7.0NG.742-200120
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.742-200115" pandora_version="7.0NG.742-200120"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.742'; use constant AGENT_VERSION => '7.0NG.742';
use constant AGENT_BUILD => '200115'; use constant AGENT_BUILD => '200120';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.742" PI_VERSION="7.0NG.742"
PI_BUILD="200115" PI_BUILD="200120"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200115} {200120}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.742(Build 200115)") #define PANDORA_VERSION ("7.0NG.742(Build 200120)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.742(Build 200115))" VALUE "ProductVersion", "(7.0NG.742(Build 200120))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.742-200115 Version: 7.0NG.742-200120
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.742-200115" pandora_version="7.0NG.742-200120"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1,6 +1,7 @@
START TRANSACTION; 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"}'); 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 `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL; ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;

View File

@ -1778,6 +1778,7 @@ ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) NOT NULL defau
-- Table `tserver` -- Table `tserver`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0; 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` -- Table `tevent_response`

View File

@ -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'> <img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
<div class='modalcontenttex'> <div class='modalcontenttex'>
<?php <?php
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.'); echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
}
?> ?>
</div> </div>
</div> </div>

View File

@ -45,3 +45,22 @@ switch ($wizard_section) {
*/ */
require 'agent_wizard.'.$wizard_section.'.php'; 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>

View File

@ -738,11 +738,16 @@ $servers_to_exec[0] = __('Local console');
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php'); 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) { foreach ($rows as $row) {
if ($row['server_type'] != 13) { if ($row['server_type'] != 13) {
$s_type = ' (Standard)'; $s_type = ' (Standard)';
} else { } else {
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)'; $s_type = ' (Satellite)';
} }
@ -750,8 +755,16 @@ 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][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', 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['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
@ -1020,6 +1033,8 @@ ui_require_javascript_file('pandora_modules');
var separator = '<?php echo $separator; ?>'; var separator = '<?php echo $separator; ?>';
$(document).ready (function () { $(document).ready (function () {
$('#server_to_exec option').trigger('change');
$("#walk_form").submit(function() { $("#walk_form").submit(function() {
$("#oid_loading").show (); $("#oid_loading").show ();
}); });

View File

@ -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][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( $table->data[1][4] = html_print_select(
$servers_to_exec, $servers_to_exec,
@ -734,20 +734,5 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
"json"); "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> </script>

View File

@ -64,12 +64,22 @@ if ($wmiexplore) {
$processes_name_field = 1; $processes_name_field = 1;
if (enterprise_installed() && (int) $server_to_exec != 0) { if (enterprise_installed() && (int) $server_to_exec != 0) {
$server_data = db_get_row('tserver', 'id_server', $server_to_exec); $server_data = db_get_row('tserver', 'id_server', $server_to_exec);
if (empty($server_data['port'])) {
exec( exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address']." 'ssh pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_processes."'", '".$wmi_processes."'",
$output, $output,
$rc $rc
); );
} else {
exec(
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_processes."'",
$output,
$rc
);
}
} else { } else {
exec($wmi_processes, $output); exec($wmi_processes, $output);
} }
@ -110,12 +120,21 @@ if ($wmiexplore) {
'id_server', 'id_server',
$server_to_exec $server_to_exec
); );
if (empty($server_data['port'])) {
exec( exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address']." 'ssh pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_services."'", '".$wmi_services."'",
$output, $output,
$rc $rc
); );
} else {
exec(
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_services."'",
$output,
$rc
);
}
} else { } else {
exec($wmi_services, $output); exec($wmi_services, $output);
} }
@ -145,12 +164,22 @@ if ($wmiexplore) {
if (enterprise_installed() && (int) $server_to_exec != 0) { if (enterprise_installed() && (int) $server_to_exec != 0) {
$server_data = db_get_row('tserver', 'id_server', $server_to_exec); $server_data = db_get_row('tserver', 'id_server', $server_to_exec);
if (empty($server_data['port'])) {
exec( exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address']." 'ssh pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_disks."'", '".$wmi_disks."'",
$output, $output,
$rc $rc
); );
} else {
exec(
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
'".$wmi_disks."'",
$output,
$rc
);
}
} else { } else {
exec($wmi_disks, $output); 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( $table->data[2][1] = html_print_select(
$servers_to_exec, $servers_to_exec,
'server_to_exec', 'server_to_exec',

View File

@ -163,8 +163,23 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
} }
$table->data[3][0] = __('Threshold'); $table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); $table->data[3][1] = html_print_extended_select_for_time(
$table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>'; 'module_action_threshold',
0,
'',
'',
'',
false,
true,
false,
true,
'',
false,
false,
'',
false,
true
);
if (!isset($step)) { if (!isset($step)) {
echo '<form class="add_alert_form" method="post">'; echo '<form class="add_alert_form" method="post">';

View File

@ -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; $url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure;
$table = new stdClass(); $table_alert_list = new stdClass();
if (is_metaconsole()) { if (is_metaconsole()) {
$table->class = 'alert_list databox'; $table_alert_list->class = 'alert_list databox';
} else { } else {
$table->class = 'info_table'; $table_alert_list->class = 'info_table';
} }
$table->width = '100%'; $table_alert_list->width = '100%';
$table->cellpadding = 0; $table_alert_list->cellpadding = 0;
$table->cellspacing = 0; $table_alert_list->cellspacing = 0;
$table->size = []; $table_alert_list->size = [];
$table->align = []; $table_alert_list->align = [];
$table->align[0] = 'left'; $table_alert_list->align[0] = 'left';
$table->align[1] = 'left'; $table_alert_list->align[1] = 'left';
$table->align[2] = 'left'; $table_alert_list->align[2] = 'left';
$table->align[3] = 'left'; $table_alert_list->align[3] = 'left';
$table->align[4] = 'left'; $table_alert_list->align[4] = 'left';
$table->head = []; $table_alert_list->head = [];
if (! $id_agente) { if (! $id_agente) {
$table->style = []; $table_alert_list->style = [];
$table->style[0] = 'font-weight: bold;'; $table_alert_list->style[0] = 'font-weight: bold;';
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); $table_alert_list->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%';
}*/
} else { } else {
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table_alert_list->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->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); $table_alert_list->head[1] = __('Status');
$table->head[2] = __('Actions'); $table_alert_list->head[2] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[3] = __('Status'); $table_alert_list->head[3] = __('Actions');
$table->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>'; $table_alert_list->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
$table->valign[0] = 'middle'; $table_alert_list->headstyle[0] = 'min-width: 200px; width:30%;';
$table->valign[1] = 'middle'; $table_alert_list->headstyle[1] = 'min-width: 50px; width:8%';
$table->valign[2] = 'middle'; $table_alert_list->headstyle[2] = 'min-width: 150px; width:22%;';
$table->valign[3] = 'middle'; $table_alert_list->headstyle[3] = 'min-width: 200px; width:30%;';
$table->valign[4] = 'middle'; $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; $url .= $sort_params;
@ -479,14 +470,14 @@ $iterator = 0;
foreach ($simple_alerts as $alert) { foreach ($simple_alerts as $alert) {
if ($alert['disabled']) { if ($alert['disabled']) {
$table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;'; $table_alert_list->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
$table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;'; $table_alert_list->style[$iterator][2] = 'font-style: italic; color: #aaaaaa;';
} }
if ($rowPair) { if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair'; $table_alert_list->rowclass[$iterator] = 'rowPair';
} else { } else {
$table->rowclass[$iterator] = 'rowOdd'; $table_alert_list->rowclass[$iterator] = 'rowOdd';
} }
$rowPair = !$rowPair; $rowPair = !$rowPair;
@ -523,38 +514,53 @@ foreach ($simple_alerts as $alert) {
$all_groups = agents_get_all_groups_agent($id_agente); $all_groups = agents_get_all_groups_agent($id_agente);
} }
$module_name = modules_get_agentmodule_name($alert['id_agent_module']); $status = STATUS_ALERT_NOT_FIRED;
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-size: 7.2pt').'<br>'; $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, '[&hellip;]', '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']); $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 // The access to the template manage page is necessary have LW permissions on template group
if (check_acl($config['id_user'], $template_group, 'LW')) { 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']), alerts_get_alert_template_name($alert['id_alert_template']),
'module_medium', 'module_medium',
false, false,
true, true,
true, true,
'[&hellip;]', '[&hellip;]',
'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'].'">'; 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[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']);
$data[1] .= '</a> '; $data[2] .= '</a> ';
if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) { 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']); $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 // Get and show default actions for this alert
$default_action = db_get_sql( $default_action = db_get_sql(
'SELECT id_alert_action 'SELECT id_alert_action
@ -562,69 +568,74 @@ foreach ($simple_alerts as $alert) {
WHERE id = '.$alert['id_alert_template'] WHERE id = '.$alert['id_alert_template']
); );
if ($default_action != '') { if ($default_action != '') {
$data[2] .= "<tr><td><ul class='action_list'><li>"; $data[3] .= "<tr><td colspan='2'><ul class='action_list'><li>";
$data[2] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' <em>('.__('Default').')</em>'; $data[3] .= 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[3] .= '</li></ul></td>';
$data[2] .= '</li></ul></td>'; $data[3] .= '</tr>';
$data[2] .= '<td></td>';
$data[2] .= '</tr>';
} }
foreach ($actions as $action_id => $action) { foreach ($actions as $action_id => $action) {
$data[2] .= '<tr>'; $data[3] .= '<tr style="display: grid; grid-template-columns: 1fr 1fr; align-items: center;">';
$data[2] .= '<td>'; $data[3] .= '<td>';
$data[2] .= '<ul class="action_list" style="display:inline;">'; $data[3] .= '<ul class="action_list" style="display:inline;">';
$data[2] .= '<li style="display:inline;">'; $data[3] .= '<li style="display:inline;">';
if ($alert['disabled']) { 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 { } 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[3] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false);
$data[2] .= ' <em>('; $data[3] .= ' <em>(';
if ($action['fires_min'] == $action['fires_max']) { if ($action['fires_min'] == $action['fires_max']) {
if ($action['fires_min'] == 0) { if ($action['fires_min'] == 0) {
$data[2] .= __('Always'); $data[3] .= __('Always');
} else { } else {
$data[2] .= __('On').' '.$action['fires_min']; $data[3] .= __('On').' '.$action['fires_min'];
} }
} else if ($action['fires_min'] < $action['fires_max']) { } else if ($action['fires_min'] < $action['fires_max']) {
if ($action['fires_min'] == 0) { if ($action['fires_min'] == 0) {
$data[2] .= __('Until').' '.$action['fires_max']; $data[3] .= __('Until').' '.$action['fires_max'];
} else { } else {
$data[2] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max']; $data[3] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max'];
} }
} else { } else {
$data[2] .= __('From').' '.$action['fires_min']; $data[3] .= __('From').' '.$action['fires_min'];
} }
if ($action['module_action_threshold'] != 0) { 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[3] .= ')</em>';
$data[2] .= '</font>'; $data[3] .= '</font>';
$data[2] .= '</li>'; $data[3] .= '</li>';
$data[2] .= '</ul>'; $data[3] .= '</ul>';
$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 // 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')) { 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; vertical-align: -50%;">';
$data[2] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">'; $data[3] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">';
$data[2] .= html_print_input_image( $data[3] .= html_print_input_image(
'delete', 'delete',
'images/cross.png', 'images/cross.png',
1, 1,
'padding:0px;', 'padding:0px; margin-left:5px; margin-right:5px;',
true, true,
['title' => __('Delete action')] [
'title' => __('Delete action'),
'class' => 'action_button_img',
]
); );
$data[2] .= html_print_input_hidden('delete_action', 1, true); $data[3] .= html_print_input_hidden('delete_action', 1, true);
$data[2] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[2] .= html_print_input_hidden('id_action', $action_id, true); $data[3] .= html_print_input_hidden('id_action', $action_id, true);
$data[2] .= '</form>'; $data[3] .= '</form>';
$data[2] .= html_print_input_image( $data[3] .= html_print_input_image(
'update_action', 'update_action',
'images/config.png', 'images/config.png',
1, 1,
@ -632,19 +643,20 @@ foreach ($simple_alerts as $alert) {
true, true,
[ [
'title' => __('Update action'), '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'].'\')', '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[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
} }
$data[2] .= '<div id="update_action-div" style="display:none;text-align:left">'; $data[3] .= '<div id="update_action-div" style="display:none;text-align:left">';
$data[2] .= '</div>'; $data[3] .= '</div>';
$data[2] .= '</table>'; $data[3] .= '</table>';
// Is possible manage actions if have LW permissions in the agent group of the alert module // 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')) { 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']); $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.')'); $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[3] .= '<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[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[2] .= '<table class="databox_color" style="width:100%">'; $data[3] .= '<table class="databox_color" style="width:100%">';
$data[2] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('add_action', 1, true);
$data[2] .= html_print_input_hidden('id_alert_module', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
if (! $id_agente) { if (! $id_agente) {
$data[2] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Agent'); $data[3] .= __('Agent');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '<td class="datos">'; $data[3] .= '<td class="datos">';
$data[2] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]'); $data[3] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
} }
$data[2] .= '<tr class="datos">'; $data[3] .= '<tr class="datos">';
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">'; $data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Module'); $data[3] .= __('Module');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '<td class="datos">'; $data[3] .= '<td class="datos">';
$data[2] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]'); $data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
$data[2] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Action'); $data[3] .= __('Action');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '<td class="datos2">'; $data[3] .= '<td class="datos2">';
$data[2] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px'); $data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
$data[2] .= '<tr class="datos">'; $data[3] .= '<tr class="datos">';
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">'; $data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Number of alerts match from'); $data[3] .= __('Number of alerts match from');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '<td class="datos">'; $data[3] .= '<td class="datos">';
$data[2] .= html_print_input_text( $data[3] .= html_print_input_text(
'fires_min', 'fires_min',
0, 0,
'', '',
@ -706,8 +718,8 @@ foreach ($simple_alerts as $alert) {
10, 10,
true true
); );
$data[2] .= ' '.__('to').' '; $data[3] .= ' '.__('to').' ';
$data[2] .= html_print_input_text( $data[3] .= html_print_input_text(
'fires_max', 'fires_max',
0, 0,
'', '',
@ -715,47 +727,40 @@ foreach ($simple_alerts as $alert) {
10, 10,
true true
); );
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
$data[2] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">'; $data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Threshold'); $data[3] .= __('Threshold');
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '<td class="datos2">'; $data[3] .= '<td class="datos2">';
$data[2] .= html_print_input_text( $data[3] .= html_print_extended_select_for_time(
'module_action_threshold', 'module_action_threshold',
0,
'', '',
'', '',
4, '',
10, false,
true,
false,
true,
'',
false,
false,
'',
false,
true true
); );
$data[2] .= '</td>'; $data[3] .= '</td>';
$data[2] .= '</tr>'; $data[3] .= '</tr>';
$data[2] .= '</table>'; $data[3] .= '</table>';
$data[2] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true); $data[3] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true);
$data[2] .= '</form>'; $data[3] .= '</form>';
$data[2] .= '</div>'; $data[3] .= '</div>';
} }
$status = STATUS_ALERT_NOT_FIRED; $table_alert_list->cellclass[] = [
$title = ''; 1 => 'action_buttons',
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',
4 => 'action_buttons', 4 => 'action_buttons',
]; ];
$data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">'; $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) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = policies_is_alert_in_policy2($alert['id'], false); $policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false) { if ($policyInfo === false) {
$data[3] .= ''; $data[1] .= '';
} else { } else {
$img = 'images/policies.png'; $img = 'images/policies.png';
$data[3] .= '&nbsp;&nbsp;<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] .= '&nbsp;&nbsp;<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>'; $data[4] .= '</form>';
} }
array_push($table->data, $data); array_push($table_alert_list->data, $data);
} }
if (isset($data)) { if (isset($data)) {
html_print_table($table); html_print_table($table_alert_list);
if ($id_agente) { 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'); 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 { } 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) { 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.'">'; 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"'); html_print_submit_button(__('Create'), 'crtbtn', false, 'class="sub next"');
echo '</form>'; echo '</form>';

View File

@ -177,7 +177,23 @@ $table->data[2][1] .= '<div id="command_description" style=""></div>';
$table->colspan[2][1] = 2; $table->colspan[2][1] = 2;
$table->data[3][0] = __('Threshold'); $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->colspan[3][1] = 2;
$table->data[4][0] = ''; $table->data[4][0] = '';

View File

@ -32,7 +32,7 @@ if (isset($_GET['server'])) {
$id_server = get_parameter_get('server'); $id_server = get_parameter_get('server');
// Headers // Headers
ui_print_page_header(__('Update Server'), 'images/gm_servers.png', false, 'servers', true); 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); $row = db_get_row_sql($sql);
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">'; 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); html_print_input_hidden('server', $id_server);
@ -75,6 +75,14 @@ if (isset($_GET['server'])) {
__('Exec Server'), __('Exec Server'),
html_print_checkbox('exec_proxy', 1, $row['exec_proxy'], true), 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']) { if ($row['exec_proxy']) {
$table->data[] = [ $table->data[] = [
__('Check Exec Server'), __('Check Exec Server'),
@ -136,11 +144,15 @@ if (isset($_GET['server'])) {
$description = get_parameter_post('description'); $description = get_parameter_post('description');
$id_server = get_parameter_post('server'); $id_server = get_parameter_post('server');
$exec_proxy = get_parameter_post('exec_proxy'); $exec_proxy = get_parameter_post('exec_proxy');
$port = get_parameter_post('port');
$port_number = empty($port) ? 0 : $port;
$values = [ $values = [
'ip_address' => $address, 'ip_address' => $address,
'description' => $description, 'description' => $description,
'exec_proxy' => $exec_proxy, 'exec_proxy' => $exec_proxy,
'port' => $port_number,
]; ];
$result = db_process_sql_update('tserver', $values, ['id_server' => $id_server]); $result = db_process_sql_update('tserver', $values, ['id_server' => $id_server]);
if ($result !== false) { if ($result !== false) {

View File

@ -101,6 +101,10 @@ foreach ($servers as $server) {
$data[2] .= ui_print_help_tip(__('This is a master server'), true); $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>'; // $data[2] .= '</span> <span style="font-size:8px;"> v' .. '</span>';
switch ($server['type']) { switch ($server['type']) {
case 'snmp': case 'snmp':

View File

@ -264,12 +264,21 @@ if ($show_update_action_menu) {
$data .= __('Threshold'); $data .= __('Threshold');
$data .= '</td>'; $data .= '</td>';
$data .= '<td class="datos2">'; $data .= '<td class="datos2">';
$data .= html_print_input_text( $data .= html_print_extended_select_for_time(
'module_action_threshold_ajax', 'module_action_threshold_ajax',
$action_option['module_action_threshold'], $action_option['module_action_threshold'],
'', '',
4, '',
10, '',
false,
true,
false,
true,
'',
false,
false,
'',
false,
true true
); );
$data .= '</td>'; $data .= '</td>';

View File

@ -956,7 +956,11 @@ if ($perform_event_response) {
break; break;
} }
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); 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 { } else {
switch (PHP_OS) { switch (PHP_OS) {

View File

@ -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.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.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.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-3.3.1.min.js'></script>
</head> </head>
<body> <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.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.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.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-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.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script> <script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC200115'; $build_version = 'PC200120';
$pandora_version = 'v7.0NG.742'; $pandora_version = 'v7.0NG.742';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -1999,7 +1999,12 @@ function get_snmpwalk(
if (enterprise_installed()) { if (enterprise_installed()) {
if ($server_to_exec != 0) { if ($server_to_exec != 0) {
$server_data = db_get_row('tserver', 'id_server', $server_to_exec); $server_data = db_get_row('tserver', 'id_server', $server_to_exec);
if (empty($server_data['port'])) {
exec('ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_str.'"', $output, $rc); 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 { } else {
exec($command_str, $output, $rc); exec($command_str, $output, $rc);
} }
@ -2508,12 +2513,13 @@ function get_user_dashboards($id_user)
/** /**
* Get all the possible periods in seconds. * Get all the possible periods in seconds.
* *
* @param bool Flag to show or not custom fist option * @param boolean $custom Flag to show or not custom fist option
* @param bool Show the periods by default if it is empty * @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; global $config;
@ -2525,6 +2531,10 @@ function get_periods($custom=true, $show_default=true)
if (empty($config['interval_values'])) { if (empty($config['interval_values'])) {
if ($show_default) { if ($show_default) {
if ($allow_zero === true) {
$periods[0] = sprintf(__('%s seconds'), '0');
}
$periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5'); $periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5');
$periods[SECONDS_30MINUTES] = sprintf(__('%s minutes'), '30 '); $periods[SECONDS_30MINUTES] = sprintf(__('%s minutes'), '30 ');
$periods[SECONDS_1HOUR] = __('1 hour'); $periods[SECONDS_1HOUR] = __('1 hour');

View File

@ -992,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. * Render a pair of select for times and text box for set the time more fine.
* *
* @param string Select form name * @param string $name Select form name
* @param variant Current selected value. Can be a single value or an * @param variant $selected Current selected value. Can be a single value or an array of selected values (in combination with multiple)
* array of selected values (in combination with multiple) * @param string $script Javascript onChange (select) code.
* @param string Javascript onChange (select) code. * @param string $nothing Label when nothing is selected.
* @param string Label when nothing is selected. * @param variant $nothing_value Value when nothing is selected
* @param variant Value when nothing is selected
* @param integer $size Size of the input. * @param integer $size Size of the input.
* @param bool Whether to return an output string or echo now (optional, echo by default). * @param boolean $return 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 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. * @return string HTML code if return parameter is true.
*/ */
function html_print_extended_select_for_time( function html_print_extended_select_for_time(
$name, $name,
$selected='', $selected='',
@ -1020,14 +1024,15 @@ function html_print_extended_select_for_time(
$readonly=false, $readonly=false,
$custom_fields=false, $custom_fields=false,
$style_icon='', $style_icon='',
$no_change=false $no_change=false,
$allow_zero=false
) { ) {
global $config; global $config;
$admin = is_user_admin($config['id_user']); $admin = is_user_admin($config['id_user']);
if ($custom_fields) { if ($custom_fields) {
$fields = $custom_fields; $fields = $custom_fields;
} else { } else {
$fields = get_periods(); $fields = get_periods(true, true, $allow_zero);
} }
if ($no_change) { if ($no_change) {
@ -1049,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); $fields[$selected] = human_time_description_raw($selected, true);
} }
@ -1140,7 +1152,7 @@ function html_print_extended_select_for_time(
echo '</div>'; echo '</div>';
echo "<script type='text/javascript'> echo "<script type='text/javascript'>
$(document).ready (function () { $(document).ready (function () {
period_select_init('$uniq_name'); period_select_init('$uniq_name', $allow_zero);
period_select_events('$uniq_name'); period_select_events('$uniq_name');
}); });
function period_select_".$name."_update(seconds) { function period_select_".$name."_update(seconds) {

View File

@ -409,11 +409,20 @@ function snmp_browser_get_oid(
if ($server_to_exec != 0) { if ($server_to_exec != 0) {
$command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid); $command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid);
if (empty($server_data['port'])) {
exec( exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"', 'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
$translate_output, $translate_output,
$rc $rc
); );
} else {
exec(
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
$translate_output,
$rc
);
}
} else { } else {
exec( exec(
$snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid), $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid),

View File

@ -1892,7 +1892,13 @@ function ui_process_page_head($string, $bitfield)
} }
// Pandora specific JavaScript should go first. // 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. // Load base64 javascript library.
$config['js']['base64'] = 'include/javascript/encode_decode_base64.js'; $config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
// Load webchat javascript library. // Load webchat javascript library.

View File

@ -833,8 +833,9 @@ function post_process_select_events(name) {
* This function initialize the values of the control * This function initialize the values of the control
* *
* @param name string with the name of the select for time * @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 // Manual mode is hidden by default
$("#" + name + "_manual").hide(); $("#" + name + "_manual").hide();
$("#" + name + "_default").show(); $("#" + name + "_default").show();
@ -849,7 +850,7 @@ function period_select_init(name) {
} else { } else {
$("#" + name + "_select option:eq(1)").prop("selected", true); $("#" + 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 + "_units option:last").prop("selected", false);
$("#" + name + "_manual").show(); $("#" + name + "_manual").show();
$("#" + name + "_default").hide(); $("#" + name + "_default").hide();
@ -1825,342 +1826,6 @@ function ellipsize(str, max, ellipse) {
return str.trim().length > max ? str.substr(0, max).trim() + ellipse : str; 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() { function uniqId() {
var randomStr = var randomStr =
Math.random() Math.random()
@ -2173,58 +1838,6 @@ function uniqId() {
return randomStr; 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. * Function for AJAX request.
* *

View 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");
}
}
}
]
});
}

View File

@ -4985,11 +4985,10 @@ input:checked + .p-slider:before {
.action_buttons input[type="image"], .action_buttons input[type="image"],
.action_button_img { .action_button_img {
border-radius: 4px; border-radius: 4px;
border: 1px solid #dcdcdc; border: 1px solid #dcdcdc !important;
padding: 1px; padding: 1px !important;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1); box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
max-width: 21px; max-width: 21px;
background-color: transparent; /*BORRAR*/
} }
/* This class is for only one icon to be a button type. */ /* This class is for only one icon to be a button type. */

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.742'; $version = '7.0NG.742';
$build = '200115'; $build = '200120';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -775,6 +775,7 @@ class Ui
echo " <script src='include/javascript/jquery.js'></script>\n"; 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/jquery.mobile-1.3.1.js'></script>\n";
echo " <script src='../include/javascript/pandora.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 " </head>\n";
echo " <body>\n"; echo " <body>\n";

View File

@ -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/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.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.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-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.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script> <script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>

View File

@ -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.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.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.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-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.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script> <script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1020,6 +1020,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`server_keepalive` int(11) NOT NULL default 0, `server_keepalive` int(11) NOT NULL default 0,
`stat_utimestamp` bigint(20) NOT NULL default '0', `stat_utimestamp` bigint(20) NOT NULL default '0',
`exec_proxy` tinyint(1) UNSIGNED 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`), PRIMARY KEY (`id_server`),
KEY `name` (`name`) KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.742-200115 Version: 7.0NG.742-200120
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.742-200115" pandora_version="7.0NG.742-200120"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -163,7 +163,12 @@ wmiserver 1
network_timeout 4 network_timeout 4
# Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY). # 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). # Remote execution modules, ssh_launcher extra option (PANDORA FMS ENTERPRISE ONLY).
ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh

View File

@ -148,6 +148,14 @@ wmiserver 0
network_timeout 5 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 (in seconds)
server_keepalive 45 server_keepalive 45

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742"; my $pandora_version = "7.0NG.742";
my $pandora_build = "200115"; my $pandora_build = "200120";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -275,7 +275,8 @@ sub pandora_load_config {
$pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1 $pa_config->{"alert_recovery"} = 0; # Introduced on 1.3.1
$pa_config->{"snmp_checks"} = 1; # 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->{"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->{"snmp_trapd"} = '/usr/sbin/snmptrapd'; # 3.0
$pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1 $pa_config->{"tcp_checks"} = 1; # Introduced on 1.3.1
$pa_config->{"tcp_timeout"} = 20; # 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) { elsif ($parametro =~ m/^rcmd_timeout\s+([0-9]*)/i) {
$pa_config->{"rcmd_timeout"} = clean_blank($1); $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) { elsif ($parametro =~ m/^tcp_checks\s+([0-9]*)/i) {
$pa_config->{"tcp_checks"} = clean_blank($1); $pa_config->{"tcp_checks"} = clean_blank($1);
} }

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742"; my $pandora_version = "7.0NG.742";
my $pandora_build = "200115"; my $pandora_build = "200120";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -1447,7 +1447,7 @@ sub cloud_scan($) {
} else { } else {
# Unrecognized task type. # Unrecognized task type.
call('message', 'Unrecognized task type', 1); $self->call('message', 'Unrecognized task type', 1);
$self->call('update_progress', -1); $self->call('update_progress', -1);
return; return;
} }
@ -1469,7 +1469,7 @@ sub cloud_scan($) {
if (!$cloudObj) { if (!$cloudObj) {
# Failed to initialize, check Cloud credentials or anything. # 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 { } else {
# Let Cloud object manage scan. # Let Cloud object manage scan.
@ -1581,7 +1581,7 @@ sub app_scan($) {
$type = 'SAP'; $type = 'SAP';
} else { } else {
# Unrecognized task type. # Unrecognized task type.
call('message', 'Unrecognized task type', 1); $self->call('message', 'Unrecognized task type', 1);
$self->call('update_progress', -1); $self->call('update_progress', -1);
return; return;
} }
@ -1607,7 +1607,7 @@ sub app_scan($) {
$self->{'c_network_percent'} = 0; $self->{'c_network_percent'} = 0;
# Send message # Send message
call('message', 'Checking target ' . $target, 10); $self->call('message', 'Checking target ' . $target, 10);
# Force target acquirement. # Force target acquirement.
$self->{'task_data'}->{'dbhost'} = $target; $self->{'task_data'}->{'dbhost'} = $target;
@ -1633,7 +1633,7 @@ sub app_scan($) {
# Verify if object is connected. If cannot connect to current target # Verify if object is connected. If cannot connect to current target
# return with module. # return with module.
if (!$obj->is_connected()) { 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; $global_percent += $global_step;
$self->{'c_network_percent'} = 90; $self->{'c_network_percent'} = 90;
@ -1739,7 +1739,7 @@ sub deploy_scan($) {
if (!$deployer) { if (!$deployer) {
# Failed to initialize, check Cloud credentials or anything. # 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 { } else {
# Let deployer object manage scan. # Let deployer object manage scan.

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.742 %define version 7.0NG.742
%define release 200115 %define release 200120
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.742" PI_VERSION="7.0NG.742"
PI_BUILD="200115" PI_BUILD="200120"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.742 PS200115"; my $version = "7.0NG.742 PS200120";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.742 PS200115"; my $version = "7.0NG.742 PS200120";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);