Merge remote-tracking branch 'origin/develop' into ent-5735-9752-problema-no-inicializados-modulos-de-tipo-log

This commit is contained in:
fbsanchez 2020-07-13 13:56:54 +02:00
commit a0028e47ad
43 changed files with 967 additions and 427 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.747-200710 Version: 7.0NG.747-200713
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.747-200710" pandora_version="7.0NG.747-200713"
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.747'; use constant AGENT_VERSION => '7.0NG.747';
use constant AGENT_BUILD => '200710'; use constant AGENT_BUILD => '200713';
# 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.747 %define version 7.0NG.747
%define release 200710 %define release 200713
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.747 %define version 7.0NG.747
%define release 200710 %define release 200713
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.747" PI_VERSION="7.0NG.747"
PI_BUILD="200710" PI_BUILD="200713"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200710} {200713}
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.747(Build 200710)") #define PANDORA_VERSION ("7.0NG.747(Build 200713)")
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.747(Build 200710))" VALUE "ProductVersion", "(7.0NG.747(Build 200713))"
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.747-200710 Version: 7.0NG.747-200713
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.747-200710" pandora_version="7.0NG.747-200713"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -106,7 +106,7 @@ img.modalclose {
<span class='modalheadertex'> <span class='modalheadertex'>
<?php echo __('Database error'); ?> <?php echo __('Database error'); ?>
</span> </span>
<img class='modalclose' src='<?php echo $config['homeurl']; ?>images/icono_cerrar.png'> <img class='modalclose' src='<?php echo $config['homeurl']; ?>/images/icono_cerrar.png'>
</div> </div>
<div class='modalconten'> <div class='modalconten'>

View File

@ -171,6 +171,11 @@ if ($delete_action) {
); );
} }
if (is_central_policies_on_node() === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
$search_string = (string) get_parameter('search_string', ''); $search_string = (string) get_parameter('search_string', '');
$group = (int) get_parameter('group', 0); $group = (int) get_parameter('group', 0);
@ -224,8 +229,11 @@ $table->data = [];
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Group'); $table->head[1] = __('Group');
$table->head[2] = __('Copy'); if (is_central_policies_on_node() === false) {
$table->head[3] = __('Delete'); $table->head[2] = __('Copy');
$table->head[3] = __('Delete');
}
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->size = []; $table->size = [];
@ -292,7 +300,9 @@ foreach ($actions as $action) {
); );
} }
if (check_acl($config['id_user'], $action['id_group'], 'LM')) { if (is_central_policies_on_node() === false
&& check_acl($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [ $table->cellclass[] = [
2 => 'action_buttons', 2 => 'action_buttons',
3 => 'action_buttons', 3 => 'action_buttons',
@ -318,12 +328,14 @@ if (isset($data)) {
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; if (is_central_policies_on_node() === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
html_print_input_hidden('create_alert', 1); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '</form>'; html_print_input_hidden('create_alert', 1);
echo '</div>'; echo '</form>';
echo '</div>';
}
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

View File

@ -46,6 +46,8 @@ if (is_ajax()) {
$id = (int) get_parameter('id', 0); $id = (int) get_parameter('id', 0);
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1); $get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
$is_central_policies_on_node = is_central_policies_on_node();
// If command ID is not provided, check for action id. // If command ID is not provided, check for action id.
if ($id == 0) { if ($id == 0) {
$id_action = (int) get_parameter('id_action'); $id_action = (int) get_parameter('id_action');
@ -124,40 +126,142 @@ if (is_ajax()) {
// HTML type. // HTML type.
if (preg_match('/^_html_editor_$/i', $field_value)) { if (preg_match('/^_html_editor_$/i', $field_value)) {
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>'; $editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
$editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true); $editor_type_chkbx .= __('Basic');
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_value')", '', true); $editor_type_chkbx .= ui_print_help_tip(
__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'),
true
);
$editor_type_chkbx .= html_print_radio_button_extended(
'editor_type_value_'.$i,
0,
'',
false,
$is_central_policies_on_node,
"removeTinyMCE('textarea_field".$i."_value')",
'',
true
);
$editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$editor_type_chkbx .= __('Advanced').'&nbsp;&nbsp;'; $editor_type_chkbx .= __('Advanced').'&nbsp;&nbsp;';
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_value')", '', true); $editor_type_chkbx .= html_print_radio_button_extended(
'editor_type_value_'.$i,
0,
'',
true,
$is_central_policies_on_node,
"addTinyMCE('textarea_field".$i."_value')",
'',
true
);
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$ffield = $editor_type_chkbx; $ffield = $editor_type_chkbx;
$ffield .= html_print_textarea('field'.$i.'_value', 1, 1, '', 'class="fields"', true); $ffield .= html_print_textarea(
'field'.$i.'_value',
1,
1,
'',
'class="fields"',
true,
'',
$is_central_policies_on_node
);
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>'; $editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
$editor_type_chkbx .= __('Basic').'&nbsp;&nbsp;'; $editor_type_chkbx .= __('Basic').'&nbsp;&nbsp;';
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery_value')", '', true); $editor_type_chkbx .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i,
0,
'',
false,
$is_central_policies_on_node,
"removeTinyMCE('textarea_field".$i."_recovery_value')",
'',
true
);
$editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$editor_type_chkbx .= __('Advanced').'&nbsp;&nbsp;'; $editor_type_chkbx .= __('Advanced').'&nbsp;&nbsp;';
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery_value')", '', true); $editor_type_chkbx .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i,
0,
'',
true,
$is_central_policies_on_node,
"addTinyMCE('textarea_field".$i."_recovery_value')",
'',
true
);
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
$rfield .= html_print_textarea('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true); $rfield .= html_print_textarea(
'field'.$i.'_recovery_value',
1,
1,
'',
'class="fields_recovery"',
true,
'',
$is_central_policies_on_node
);
} else if (preg_match('/^_content_type_$/i', $field_value)) { } else if (preg_match('/^_content_type_$/i', $field_value)) {
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>'; $editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true); $editor_type_chkbx .= __('Text/plain');
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/plain', '', '', false, '', '', true); $editor_type_chkbx .= ui_print_help_tip(
__('For sending emails only text plain'),
true
);
$editor_type_chkbx .= html_print_radio_button_extended(
'field'.$i.'_value',
'text/plain',
'',
'',
$is_central_policies_on_node,
'',
'',
true
);
$editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$editor_type_chkbx .= __('Text/html').'&nbsp;&nbsp;'; $editor_type_chkbx .= __('Text/html').'&nbsp;&nbsp;';
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true); $editor_type_chkbx .= html_print_radio_button_extended(
'field'.$i.'_value',
'text/html',
'',
'text/html',
$is_central_policies_on_node,
'',
'',
true
);
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$ffield = $editor_type_chkbx; $ffield = $editor_type_chkbx;
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>'; $editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true); $editor_type_chkbx .= __('Text/plain');
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/plain', '', '', false, '', '', true); $editor_type_chkbx .= ui_print_help_tip(
__('For sending emails only text plain'),
true
);
$editor_type_chkbx .= html_print_radio_button_extended(
'field'.$i.'_recovery_value',
'text/plain',
'',
'',
$is_central_policies_on_node,
'',
'',
true
);
$editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $editor_type_chkbx .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$editor_type_chkbx .= __('Text/html').'&nbsp;&nbsp;'; $editor_type_chkbx .= __('Text/html').'&nbsp;&nbsp;';
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true); $editor_type_chkbx .= html_print_radio_button_extended(
'field'.$i.'_recovery_value',
'text/html',
'',
'text/html',
$is_central_policies_on_node,
'',
'',
true
);
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
// Select type. // Select type.
@ -192,7 +296,8 @@ if (is_ajax()) {
true, true,
false, false,
false, false,
'fields' 'fields',
$is_central_policies_on_node
); );
$rfield = html_print_select( $rfield = html_print_select(
$fields_value_select, $fields_value_select,
@ -204,7 +309,8 @@ if (is_ajax()) {
true, true,
false, false,
false, false,
'fields_recovery' 'fields_recovery',
$is_central_policies_on_node
); );
} else { } else {
$ffield = html_print_textarea( $ffield = html_print_textarea(
@ -213,7 +319,9 @@ if (is_ajax()) {
1, 1,
$fv[0], $fv[0],
'style="min-height:40px; '.$style.'" class="fields"', 'style="min-height:40px; '.$style.'" class="fields"',
true true,
'',
$is_central_policies_on_node
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
@ -221,7 +329,9 @@ if (is_ajax()) {
1, 1,
$fv[0], $fv[0],
'style="min-height:40px; '.$style.'" class="fields_recovery', 'style="min-height:40px; '.$style.'" class="fields_recovery',
true true,
'',
$is_central_policies_on_node
); );
} }
} }
@ -232,7 +342,9 @@ if (is_ajax()) {
1, 1,
'', '',
'style="min-height:40px; '.$style.'" class="fields"', 'style="min-height:40px; '.$style.'" class="fields"',
true true,
'',
$is_central_policies_on_node
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
'field'.$i.'_recovery_value', 'field'.$i.'_recovery_value',
@ -240,7 +352,9 @@ if (is_ajax()) {
1, 1,
'', '',
'style="min-height:40px; '.$style.'" class="fields_recovery"', 'style="min-height:40px; '.$style.'" class="fields_recovery"',
true true,
'',
$is_central_policies_on_node
); );
} }
@ -404,6 +518,15 @@ if ($copy_command) {
} }
} }
$is_central_policies_on_node = is_central_policies_on_node();
if ($is_central_policies_on_node === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
$table = new stdClass;
$table->width = '100%'; $table->width = '100%';
$table->class = 'info_table'; $table->class = 'info_table';
@ -457,7 +580,7 @@ foreach ($commands as $command) {
); );
$data['action'] = ''; $data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons'; $table->cellclass[]['action'] = 'action_buttons';
if (! $command['internal']) { if ($is_central_policies_on_node === false && !$command['internal']) {
$data['action'] = '<span style="display: inline-flex">'; $data['action'] = '<span style="display: inline-flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
@ -475,11 +598,13 @@ if (count($table->data) > 0) {
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; if ($is_central_policies_on_node === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
html_print_input_hidden('create_alert', 1); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '</form>'; html_print_input_hidden('create_alert', 1);
echo '</div>'; echo '</form>';
echo '</div>';
}
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');

View File

@ -125,13 +125,13 @@ if (defined('METACONSOLE')) {
$sec = 'galertas'; $sec = 'galertas';
} }
// This prevents to duplicate the header in case delete_templete action is performed // This prevents to duplicate the header in
// case delete_templete action is performed.
if (!$delete_template) { if (!$delete_template) {
// Header // Header.
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
// ~ ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
ui_print_page_header( ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert templates'), __('Alerts').' &raquo; '.__('Alert templates'),
'images/gm_alerts.png', 'images/gm_alerts.png',
@ -142,7 +142,6 @@ if (!$delete_template) {
} }
} }
if ($update_template) { if ($update_template) {
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
@ -151,7 +150,7 @@ if ($update_template) {
$fields_recovery = []; $fields_recovery = [];
for ($i = 1; $i <= 10; $i++) { for ($i = 1; $i <= 10; $i++) {
$values['field'.$i] = (string) get_parameter('field'.$i); $values['field'.$i] = (string) get_parameter('field'.$i);
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter('field'.$i.'_recovery') : ''; $values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : '';
} }
$values['recovery_notify'] = $recovery_notify; $values['recovery_notify'] = $recovery_notify;
@ -164,13 +163,15 @@ if ($update_template) {
); );
} }
// If user tries to delete a template with group=ALL then must have "PM" access privileges // If user tries to delete a template with group=ALL
// then must have "PM" access privileges.
if ($delete_template) { if ($delete_template) {
$id = get_parameter('id'); $id = get_parameter('id');
$al_template = alerts_get_alert_template($id); $al_template = alerts_get_alert_template($id);
if ($al_template !== false) { if ($al_template !== false) {
// If user tries to delete a template with group=ALL then must have "PM" access privileges // If user tries to delete a template with group=ALL
// then must have "PM" access privileges.
if ($al_template['id_group'] == 0) { if ($al_template['id_group'] == 0) {
if (! check_acl($config['id_user'], 0, 'PM')) { if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit( db_pandora_audit(
@ -192,8 +193,7 @@ if ($delete_template) {
); );
} }
} }
} //end if } else {
else {
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM')); $own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
@ -202,7 +202,7 @@ if ($delete_template) {
} }
$is_in_group = in_array($al_template['id_group'], $own_groups); $is_in_group = in_array($al_template['id_group'], $own_groups);
// Then template group have to be is his own groups // Then template group have to be is his own groups.
if ($is_in_group) { if ($is_in_group) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
@ -241,9 +241,15 @@ if ($delete_template) {
$result = alerts_delete_alert_template($id); $result = alerts_delete_alert_template($id);
if ($result) { if ($result) {
db_pandora_audit('Template alert management', 'Delete alert template #'.$id); db_pandora_audit(
'Template alert management',
'Delete alert template #'.$id
);
} else { } else {
db_pandora_audit('Template alert management', 'Fail try to delete alert template #'.$id); db_pandora_audit(
'Template alert management',
'Fail try to delete alert template #'.$id
);
} }
ui_print_result_message( ui_print_result_message(
@ -253,6 +259,11 @@ if ($delete_template) {
); );
} }
if (is_central_policies_on_node() === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
$search_string = (string) get_parameter('search_string'); $search_string = (string) get_parameter('search_string');
$search_type = (string) get_parameter('search_type'); $search_type = (string) get_parameter('search_type');
@ -269,7 +280,7 @@ $url = ui_get_url_refresh(
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
} }
@ -313,7 +324,7 @@ $table->data[0][4] .= html_print_submit_button(
); );
$table->data[0][4] .= '</div>'; $table->data[0][4] .= '</div>';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$filter = '<form class="" method="post" action="'.$url.'">'; $filter = '<form class="" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true); $filter .= html_print_table($table, true);
$filter .= '</form>'; $filter .= '</form>';
@ -394,18 +405,34 @@ foreach ($templates as $template) {
$data[1] = ui_print_group_icon($template['id_group'], true); $data[1] = ui_print_group_icon($template['id_group'], true);
$data[3] = alerts_get_alert_templates_type_name($template['type']); $data[3] = alerts_get_alert_templates_type_name($template['type']);
if (check_acl($config['id_user'], $template['id_group'], 'LM')) { if (is_central_policies_on_node() === false
&& check_acl($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons'; $table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">'; $data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
$data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden('source_id', $template['id'], true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true);
$data[4] .= html_print_input_image('dup', 'images/copy.png', 1, '', true, ['title' => __('Duplicate')]); $data[4] .= html_print_input_image(
'dup',
'images/copy.png',
1,
'',
true,
['title' => __('Duplicate')]
);
$data[4] .= '</form> '; $data[4] .= '</form> ';
$data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">'; $data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_template', 1, true); $data[4] .= html_print_input_hidden('delete_template', 1, true);
$data[4] .= html_print_input_hidden('id', $template['id'], true); $data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image('del', 'images/cross.png', 1, '', true, ['title' => __('Delete')]); $data[4] .= html_print_input_image(
'del',
'images/cross.png',
1,
'',
true,
['title' => __('Delete')]
);
$data[4] .= '</form> '; $data[4] .= '</form> ';
} else { } else {
$data[4] = ''; $data[4] = '';
@ -415,18 +442,34 @@ foreach ($templates as $template) {
} }
ui_pagination($total_templates, $url); ui_pagination($total_templates, $url);
if (isset($data)) { if (isset($data) === true) {
html_print_table($table); html_print_table($table);
ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination(
$total_templates,
$url,
0,
0,
false,
'offset',
true,
'pagination-bottom'
);
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]); ui_print_info_message(
[
'no_close' => true,
'message' => __('No alert templates defined'),
]
);
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; if (is_central_policies_on_node() === false) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
html_print_input_hidden('create_alert', 1); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '</form>'; html_print_input_hidden('create_alert', 1);
echo '</div>'; echo '</form>';
echo '</div>';
}
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');

View File

@ -80,12 +80,20 @@ if ($al_action !== false) {
} }
$is_central_policies_on_node = is_central_policies_on_node();
if ($is_central_policies_on_node === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
$name = ''; $name = '';
$id_command = ''; $id_command = '';
$group = 0; $group = 0;
// All group is 0
$action_threshold = 0; $action_threshold = 0;
// All group is 0 // All group is 0.
if ($id) { if ($id) {
$action = alerts_get_alert_action($id); $action = alerts_get_alert_action($id);
$name = $action['name']; $name = $action['name'];
@ -95,7 +103,7 @@ if ($id) {
$action_threshold = $action['action_threshold']; $action_threshold = $action['action_threshold'];
} }
// Hidden div with help hint to fill with javascript // Hidden div with help hint to fill with javascript.
html_print_div( html_print_div(
[ [
'id' => 'help_alert_macros_hint', 'id' => 'help_alert_macros_hint',
@ -126,7 +134,26 @@ $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '20%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true); $table->data[0][1] = html_print_input_text(
'name',
$name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
);
if (io_safe_output($name) == 'Monitoring Event') { if (io_safe_output($name) == 'Monitoring Event') {
$table->data[0][1] .= '&nbsp;&nbsp;'.ui_print_help_tip( $table->data[0][1] .= '&nbsp;&nbsp;'.ui_print_help_tip(
__('This action may stop working, if you change its name.'), __('This action may stop working, if you change its name.'),
@ -141,7 +168,21 @@ $table->data[1][0] = __('Group');
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
$table->data[1][1] = html_print_select_groups(false, 'LW', true, 'group', $group, '', '', 0, true); $table->data[1][1] = html_print_select_groups(
false,
'LW',
true,
'group',
$group,
'',
'',
0,
true,
false,
true,
'',
$is_central_policies_on_node
);
$table->colspan[1][1] = 2; $table->colspan[1][1] = 2;
$table->data[2][0] = __('Command'); $table->data[2][0] = __('Command');
@ -163,10 +204,15 @@ $table->data[2][1] = html_print_select_from_sql(
'', '',
__('None'), __('None'),
0, 0,
true true,
false,
false,
$is_central_policies_on_node
); );
$table->data[2][1] .= ' '; $table->data[2][1] .= ' ';
if (check_acl($config['id_user'], 0, 'PM')) { if ($is_central_policies_on_node === false
&& check_acl($config['id_user'], 0, 'PM')
) {
$table->data[2][1] .= __('Create Command'); $table->data[2][1] .= __('Create Command');
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">'; $table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
$table->data[2][1] .= html_print_image('images/add.png', true); $table->data[2][1] .= html_print_image('images/add.png', true);
@ -188,7 +234,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
false, false,
true, true,
'', '',
false, $is_central_policies_on_node,
false, false,
'', '',
false, false,
@ -251,46 +297,44 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">'; echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">';
$table_html = html_print_table($table, true); $table_html = html_print_table($table, true);
//
// Hack to hook the bubble dialog of clippy in any place, the intro.js
// fails with new elements in the dom from javascript code
// ----------------------------------------------------------------------
/*
$table_html = str_replace(
"</table>",
"</div>",
$table_html);
$table_html = str_replace(
'<tr id="table_macros-field1" style="" class="datos2">',
"</tbody></table>
<div id=\"clippy_fields\">
<table>
<tbody>
<tr id=\"table_macros-field1\" class=\"datos\">",
$table_html);
*/
//
echo $table_html; echo $table_html;
if ($is_central_policies_on_node === false) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) { if ($id) {
html_print_input_hidden('id', $id); html_print_input_hidden('id', $id);
if ($al_action['id_group'] == 0) { if ($al_action['id_group'] == 0) {
// then must have "PM" access privileges // Then must have "PM" access privileges.
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
'create',
false,
'class="sub upd"'
);
}
} else {
html_print_input_hidden('update_action', 1); html_print_input_hidden('update_action', 1);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); html_print_submit_button(
__('Update'),
'create',
false,
'class="sub upd"'
);
} }
} else { } else {
html_print_input_hidden('update_action', 1); html_print_input_hidden('create_action', 1);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); html_print_submit_button(
__('Create'),
'create',
false,
'class="sub wand"'
);
} }
} else {
html_print_input_hidden('create_action', 1); echo '</div>';
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
} }
echo '</div>';
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');

View File

@ -36,7 +36,7 @@ $pure = get_parameter('pure', 0);
$alert = []; $alert = [];
// Header. // Header.
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_page_header(
@ -135,30 +135,39 @@ if ($id) {
$fields_hidden = $alert['fields_hidden']; $fields_hidden = $alert['fields_hidden'];
} }
if (!empty($fields_descriptions)) { if (empty($fields_descriptions) === false) {
$fields_descriptions = json_decode($fields_descriptions, true); $fields_descriptions = json_decode($fields_descriptions, true);
} }
if (!empty($fields_values)) { if (empty($fields_values) === false) {
$fields_values = json_decode($fields_values, true); $fields_values = json_decode($fields_values, true);
} }
if (!empty($fields_hidden)) { if (empty($fields_hidden) === false) {
$fields_hidden = json_decode($fields_hidden, true); $fields_hidden = json_decode($fields_hidden, true);
} }
$is_central_policies_on_node = is_central_policies_on_node();
if ($is_central_policies_on_node === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$table->head[0] = ($id) ? __('Update Command') : __('Create Command'); $table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
} }
$table->style = []; $table->style = [];
if (!defined('METACONSOLE')) { if (is_metaconsole() === false) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold'; $table->style[4] = 'font-weight: bold';
@ -170,11 +179,38 @@ $table->data = [];
$table->colspan['name'][1] = 3; $table->colspan['name'][1] = 3;
$table->data['name'][0] = __('Name'); $table->data['name'][0] = __('Name');
$table->data['name'][2] = html_print_input_text('name', $name, '', 35, 255, true); $table->data['name'][2] = html_print_input_text(
'name',
$name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
);
$table->colspan['command'][1] = 3; $table->colspan['command'][1] = 3;
$table->data['command'][0] = __('Command'); $table->data['command'][0] = __('Command');
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true); $table->data['command'][1] = html_print_textarea(
'command',
8,
30,
$command,
'',
true,
'',
$is_central_policies_on_node
);
$table->colspan['group'][1] = 3; $table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group'); $table->data['group'][0] = __('Group');
@ -187,60 +223,124 @@ $table->data['group'][1] = html_print_select_groups(
false, false,
'', '',
0, 0,
true true,
false,
true,
'',
$is_central_policies_on_node
); );
$table->colspan['description'][1] = 3; $table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description'); $table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea('description', 10, 30, $description, '', true); $table->data['description'][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
$is_central_policies_on_node
);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i); $table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
if (!empty($fields_descriptions)) { if (empty($fields_descriptions) === false) {
$field_description = $fields_descriptions[($i - 1)]; $field_description = $fields_descriptions[($i - 1)];
} else { } else {
$field_description = ''; $field_description = '';
} }
$table->data['field'.$i][1] = html_print_input_text('field'.$i.'_description', $field_description, '', 30, 255, true); $table->data['field'.$i][1] = html_print_input_text(
'field'.$i.'_description',
$field_description,
'',
30,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
);
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i).ui_print_help_tip(__('value1,tag1;value2,tag2;value3,tag3'), true); $table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
$table->data['field'.$i][2] .= ui_print_help_tip(
__('value1,tag1;value2,tag2;value3,tag3'),
true
);
if (!empty($fields_values)) { if (empty($fields_values) === false) {
$field_values = $fields_values[($i - 1)]; $field_values = $fields_values[($i - 1)];
} else { } else {
$field_values = ''; $field_values = '';
} }
if (!empty($fields_hidden)) { if (empty($fields_hidden) === false) {
$selected = (bool) $fields_hidden[($i - 1)]; $selected = (bool) $fields_hidden[($i - 1)];
} else { } else {
$selected = false; $selected = false;
} }
$table->data['field'.$i][3] = html_print_input_text('field'.$i.'_values', $field_values, '', 55, 255, true, false, false, '', 'field_value'); $table->data['field'.$i][3] = html_print_input_text(
'field'.$i.'_values',
$field_values,
'',
55,
255,
true,
false,
false,
'',
'field_value',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
);
$table->data['field'.$i][4] = __('Hide'); $table->data['field'.$i][4] = __('Hide');
$table->data['field'.$i][5] = html_print_checkbox_extended('field'.$i.'_hide', 1, $selected, false, 'cursor: \'pointer\'', 'class="hide_inputs"', true); $table->data['field'.$i][5] = html_print_checkbox_extended(
'field'.$i.'_hide',
1,
$selected,
$is_central_policies_on_node,
'cursor: \'pointer\'',
'class="hide_inputs"',
true
);
} }
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; if ($is_central_policies_on_node === false) {
if ($id) { echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden('id', $id); if ($id) {
html_print_input_hidden('update_command', 1); html_print_input_hidden('id', $id);
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); html_print_input_hidden('update_command', 1);
} else { html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
html_print_input_hidden('create_command', 1); } else {
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"'); html_print_input_hidden('create_command', 1);
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
}
echo '</div>';
} }
echo '</div>';
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
@ -251,20 +351,20 @@ $(document).ready (function () {
$(".hide_inputs").each(function(index) { $(".hide_inputs").each(function(index) {
var $input_in_row = $(this).closest('tr').find('.field_value'); var $input_in_row = $(this).closest('tr').find('.field_value');
if($(this).is(':checked')) { if($(this).is(':checked')) {
$input_in_row.prop('style', '-webkit-text-security: disc;'); $input_in_row.prop('style', '-webkit-text-security: disc;');
} else { } else {
$input_in_row.prop('style', ''); $input_in_row.prop('style', '');
} }
}); });
$(".hide_inputs").click(function() { $(".hide_inputs").click(function() {
var $input_in_row = $(this).closest('tr').find('.field_value'); var $input_in_row = $(this).closest('tr').find('.field_value');
if($(this).is(':checked')) { if($(this).is(':checked')) {
$input_in_row.prop('style', '-webkit-text-security: disc;'); $input_in_row.prop('style', '-webkit-text-security: disc;');
} else { } else {
$input_in_row.prop('style', ''); $input_in_row.prop('style', '');
} }
}); });
}); });
</script> </script>

View File

@ -363,7 +363,15 @@ function update_template($step)
} }
// We set here the number of steps $is_central_policies_on_node = is_central_policies_on_node();
if ($is_central_policies_on_node === true) {
ui_print_warning_message(
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
);
}
// We set here the number of steps.
define('LAST_STEP', 3); define('LAST_STEP', 3);
$step = (int) get_parameter('step', 1); $step = (int) get_parameter('step', 1);
@ -579,27 +587,74 @@ if ($step == 2) {
$show_matches = false; $show_matches = false;
} }
// Firing conditions and events // Firing conditions and events.
$table->colspan = []; $table->colspan = [];
// $table->colspan[4][1] = 1;
$table->data[0][0] = __('Days of week'); $table->data[0][0] = __('Days of week');
$table->data[0][1] = __('Mon'); $table->data[0][1] = __('Mon');
$table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true); $table->data[0][1] .= html_print_checkbox(
'monday',
1,
$monday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Tue'); $table->data[0][1] .= __('Tue');
$table->data[0][1] .= html_print_checkbox('tuesday', 1, $tuesday, true); $table->data[0][1] .= html_print_checkbox(
'tuesday',
1,
$tuesday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Wed'); $table->data[0][1] .= __('Wed');
$table->data[0][1] .= html_print_checkbox('wednesday', 1, $wednesday, true); $table->data[0][1] .= html_print_checkbox(
'wednesday',
1,
$wednesday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Thu'); $table->data[0][1] .= __('Thu');
$table->data[0][1] .= html_print_checkbox('thursday', 1, $thursday, true); $table->data[0][1] .= html_print_checkbox(
'thursday',
1,
$thursday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Fri'); $table->data[0][1] .= __('Fri');
$table->data[0][1] .= html_print_checkbox('friday', 1, $friday, true); $table->data[0][1] .= html_print_checkbox(
'friday',
1,
$friday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Sat'); $table->data[0][1] .= __('Sat');
$table->data[0][1] .= html_print_checkbox('saturday', 1, $saturday, true); $table->data[0][1] .= html_print_checkbox(
'saturday',
1,
$saturday,
true,
$is_central_policies_on_node
);
$table->data[0][1] .= __('Sun'); $table->data[0][1] .= __('Sun');
$table->data[0][1] .= html_print_checkbox('sunday', 1, $sunday, true); $table->data[0][1] .= html_print_checkbox(
'sunday',
1,
$sunday,
true,
$is_central_policies_on_node
);
$table->data[0][2] = __('Use special days list'); $table->data[0][2] = __('Use special days list');
$table->data[0][3] = html_print_checkbox('special_day', 1, $special_day, true); $table->data[0][3] = html_print_checkbox(
'special_day',
1,
$special_day,
true,
$is_central_policies_on_node
);
$table->data[1][0] = __('Time from'); $table->data[1][0] = __('Time from');
$table->data[1][1] = html_print_input_text( $table->data[1][1] = html_print_input_text(
@ -608,7 +663,18 @@ if ($step == 2) {
'', '',
7, 7,
8, 8,
true true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
); );
$table->data[1][2] = __('Time to'); $table->data[1][2] = __('Time to');
$table->data[1][3] = html_print_input_text( $table->data[1][3] = html_print_input_text(
@ -617,7 +683,18 @@ if ($step == 2) {
'', '',
7, 7,
8, 8,
true true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
); );
$table->colspan['threshold'][1] = 3; $table->colspan['threshold'][1] = 3;
@ -629,7 +706,11 @@ if ($step == 2) {
'', '',
'', '',
false, false,
true true,
false,
true,
'',
$is_central_policies_on_node
); );
$table->data[3][0] = __('Min. number of alerts'); $table->data[3][0] = __('Min. number of alerts');
@ -639,11 +720,32 @@ if ($step == 2) {
'', '',
5, 5,
7, 7,
true true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
); );
$table->data[3][2] = __('Reset counter for non-sustained alerts').ui_print_help_tip(__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'), true); $table->data[3][2] = __('Reset counter for non-sustained alerts');
$table->data[3][3] = html_print_checkbox('min_alerts_reset_counter', 1, $min_alerts_reset_counter, true); $table->data[3][2] .= ui_print_help_tip(
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
true
);
$table->data[3][3] = html_print_checkbox(
'min_alerts_reset_counter',
1,
$min_alerts_reset_counter,
true,
$is_central_policies_on_node
);
$table->data[4][0] = __('Max. number of alerts'); $table->data[4][0] = __('Max. number of alerts');
$table->data[4][1] = html_print_input_text( $table->data[4][1] = html_print_input_text(
@ -652,39 +754,43 @@ if ($step == 2) {
'', '',
5, 5,
7, 7,
true true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
); );
$table->data[4][2] = __('Disable event'); $table->data[4][2] = __('Disable event');
$table->data[4][3] = html_print_checkbox('disable_event', 1, $disable_event, true); $table->data[4][3] = html_print_checkbox(
'disable_event',
1,
$disable_event,
true,
$is_central_policies_on_node
);
$table->data[5][0] = __('Default action'); $table->data[5][0] = __('Default action');
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true))); $usr_groups = implode(
switch ($config['dbtype']) { ',',
case 'mysql': array_keys(users_get_groups($config['id_user'], 'LM', true))
case 'postgresql': );
$sql_query = sprintf(
'
SELECT id, name
FROM talert_actions
WHERE id_group IN (%s)
ORDER BY name',
$usr_groups
);
break;
case 'oracle': $sql_query = sprintf(
$sql_query = sprintf( '
' SELECT id, name
SELECT id, FROM talert_actions
dbms_lob.substr(name,4000,1) AS nombre WHERE id_group IN (%s)
FROM talert_actions ORDER BY name',
WHERE id_group IN (%s) $usr_groups
ORDER BY dbms_lob.substr(name,4000,1)', );
$usr_groups
);
break;
}
$table->data[5][1] = html_print_select_from_sql( $table->data[5][1] = html_print_select_from_sql(
$sql_query, $sql_query,
@ -696,11 +802,12 @@ if ($step == 2) {
true, true,
false, false,
false, false,
false, $is_central_policies_on_node,
false, false,
false, false,
0 0
).ui_print_help_tip( );
$table->data[5][1] .= ui_print_help_tip(
__('Unless they\'re left blank, the fields from the action will override those set on the template.'), __('Unless they\'re left blank, the fields from the action will override those set on the template.'),
true true
); );
@ -715,7 +822,9 @@ if ($step == 2) {
0, 0,
true, true,
false, false,
false false,
'',
$is_central_policies_on_node
); );
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>'; $table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
$table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true); $table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
@ -760,7 +869,7 @@ if ($step == 2) {
$table->data['value'][1] .= '</span>'; $table->data['value'][1] .= '</span>';
$table->colspan['value'][1] = 3; $table->colspan['value'][1] = 3;
// Min first, then max, that's more logical // Min first, then max, that's more logical.
$table->data['min'][0] = __('Min.'); $table->data['min'][0] = __('Min.');
$table->data['min'][1] = html_print_input_text( $table->data['min'][1] = html_print_input_text(
'min', 'min',
@ -798,25 +907,12 @@ if ($step == 2) {
$table->size[1] = '45%'; $table->size[1] = '45%';
$table->size[2] = '45%'; $table->size[2] = '45%';
// Alert recover // Alert recover.
if (! $recovery_notify) { if (! $recovery_notify) {
$table->cellstyle['label_fields'][2] = 'display:none;'; $table->cellstyle['label_fields'][2] = 'display:none;';
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->cellstyle['field'.$i][2] = 'display:none;'; $table->cellstyle['field'.$i][2] = 'display:none;';
} }
/*
$table->cellstyle['field1'][2] = 'display:none;';
$table->cellstyle['field2'][2] = 'display:none;';
$table->cellstyle['field3'][2] = 'display:none;';
$table->cellstyle['field4'][2] = 'display:none;';
$table->cellstyle['field5'][2] = 'display:none;';
$table->cellstyle['field6'][2] = 'display:none;';
$table->cellstyle['field7'][2] = 'display:none;';
$table->cellstyle['field8'][2] = 'display:none;';
$table->cellstyle['field9'][2] = 'display:none;';
$table->cellstyle['field10'][2] = 'display:none;';
*/
} }
$table->data[0][0] = __('Alert recovery'); $table->data[0][0] = __('Alert recovery');
@ -833,7 +929,9 @@ if ($step == 2) {
'', '',
true, true,
false, false,
false false,
'',
$is_central_policies_on_node
); );
$table->colspan[0][1] = 2; $table->colspan[0][1] = 2;
@ -842,45 +940,98 @@ if ($step == 2) {
$table->data['label_fields'][2] = __('Recovery fields'); $table->data['label_fields'][2] = __('Recovery fields');
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (isset($template[$name])) { if (isset($template[$name]) === true) {
$value = $template[$name]; $value = $template[$name];
} else { } else {
$value = ''; $value = '';
} }
// $table->rowclass['field'.$i] = 'row_field';
$table->data['field'.$i][0] = sprintf(__('Field %s'), $i); $table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
// TinyMCE // TinyMCE.
// triggering fields // triggering fields.
// basic // Basic.
$table->data['field'.$i][1] = '<div style="padding: 4px 0px;"><b><small>'; $table->data['field'.$i][1] = '<div style="padding: 4px 0px;"><b><small>';
$table->data['field'.$i][1] .= __('Basic').'&nbsp;&nbsp;'; $table->data['field'.$i][1] .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."')", '', true); $table->data['field'.$i][1] .= html_print_radio_button_extended(
// Advanced 'editor_type_value_'.$i,
$table->data['field'.$i][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; 0,
$table->data['field'.$i][1] .= __('Advanced').'&nbsp;&nbsp;'; '',
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."')", '', true); false,
$table->data['field'.$i][1] .= '</small></b></div>'; $is_central_policies_on_node,
"removeTinyMCE('textarea_field".$i."')",
'',
true
);
// Advanced.
$table->data['field'.$i][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][1] .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended(
'editor_type_value_'.$i,
0,
'',
true,
$is_central_policies_on_node,
"addTinyMCE('textarea_field".$i."')",
'',
true
);
$table->data['field'.$i][1] .= '</small></b></div>';
// Texarea // Texarea.
$table->data['field'.$i][1] .= html_print_textarea('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true); $table->data['field'.$i][1] .= html_print_textarea(
'field'.$i,
1,
1,
isset($fields[$i]) ? $fields[$i] : '',
'style="min-height:40px;" class="fields"',
true,
'',
$is_central_policies_on_node
);
// Recovery // Recovery.
// basic // Basic.
$table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>'; $table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>';
$table->data['field'.$i][2] .= __('Basic').'&nbsp;&nbsp;'; $table->data['field'.$i][2] .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery')", '', true); $table->data['field'.$i][2] .= html_print_radio_button_extended(
// advanced 'editor_type_recovery_value_'.$i,
$table->data['field'.$i][2] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; 0,
$table->data['field'.$i][2] .= __('Advanced').'&nbsp;&nbsp;'; '',
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery')", '', true); false,
$table->data['field'.$i][2] .= '</small></b></div>'; $is_central_policies_on_node,
"removeTinyMCE('textarea_field".$i."_recovery')",
'',
true
);
// Advanced.
$table->data['field'.$i][2] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][2] .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i,
0,
'',
true,
$is_central_policies_on_node,
"addTinyMCE('textarea_field".$i."_recovery')",
'',
true
);
$table->data['field'.$i][2] .= '</small></b></div>';
// Texarea // Texarea.
$table->data['field'.$i][2] .= html_print_textarea('field'.$i.'_recovery', 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', 'style="min-height:40px" class="fields"', true); $table->data['field'.$i][2] .= html_print_textarea(
'field'.$i.'_recovery',
1,
1,
isset($fields_recovery[$i]) ? $fields_recovery[$i] : '',
'style="min-height:40px" class="fields"',
true,
'',
$is_central_policies_on_node
);
} }
} else { } else {
// Step 1 by default // Step 1 by default.
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '20%';
$table->data = []; $table->data = [];
@ -916,20 +1067,53 @@ if ($step == 2) {
} }
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true); $table->data[0][1] = html_print_input_text(
'name',
$name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
$is_central_policies_on_node
);
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Group'); $table->data[0][1] .= '&nbsp;&nbsp;'.__('Group');
$groups = users_get_groups(); $groups = users_get_groups();
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges // Only display group "All" if user is administrator or has "PM" privileges.
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$display_all_group = true; $display_all_group = true;
} else { } else {
$display_all_group = false; $display_all_group = false;
} }
$table->data[0][1] .= '&nbsp;'.html_print_select_groups(false, 'AR', $display_all_group, 'id_group', $id_group, '', '', 0, true); $table->data[0][1] .= '&nbsp;';
$table->data[0][1] .= html_print_select_groups(
false,
'AR',
$display_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
$is_central_policies_on_node
);
$table->data[1][0] = __('Description'); $table->data[1][0] = __('Description');
@ -939,7 +1123,9 @@ if ($step == 2) {
30, 30,
$description, $description,
'', '',
true true,
'',
$is_central_policies_on_node
); );
$table->data[2][0] = __('Priority'); $table->data[2][0] = __('Priority');
@ -952,7 +1138,9 @@ if ($step == 2) {
0, 0,
true, true,
false, false,
false false,
'',
$is_central_policies_on_node
); );
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
@ -1000,25 +1188,32 @@ if (!$create_alert && !$create_template) {
} }
if (!$disabled) { if (!$disabled) {
if ($step >= LAST_STEP) { if ($is_central_policies_on_node === false) {
html_print_submit_button(__('Finish'), 'finish', false, 'class="sub upd"'); if ($step >= LAST_STEP) {
} else {
html_print_input_hidden('step', ($step + 1));
if ($step == 2) {
// Javascript onsubmit to avoid min = 0 and max = 0
html_print_submit_button( html_print_submit_button(
__('Next'), __('Finish'),
'next', 'finish',
false, false,
'class="sub next" onclick="return check_fields_step2();"' 'class="sub upd"'
); );
} else { } else {
html_print_submit_button( html_print_input_hidden('step', ($step + 1));
__('Next'), if ($step == 2) {
'next', // Javascript onsubmit to avoid min = 0 and max = 0
false, html_print_submit_button(
'class="sub next"' __('Next'),
); 'next',
false,
'class="sub next" onclick="return check_fields_step2();"'
);
} else {
html_print_submit_button(
__('Next'),
'next',
false,
'class="sub next"'
);
}
} }
} }
} }
@ -1041,7 +1236,7 @@ var matches_not = <?php echo '"'.__("The alert would fire when the value doesn\'
var is = <?php echo "'".__('The alert would fire when the value is <span id="value"></span>')."'"; ?>; var is = <?php echo "'".__('The alert would fire when the value is <span id="value"></span>')."'"; ?>;
var is_not = <?php echo "'".__('The alert would fire when the value is not <span id="value"></span>')."'"; ?>; var is_not = <?php echo "'".__('The alert would fire when the value is not <span id="value"></span>')."'"; ?>;
var between = <?php echo "'".__('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>')."'"; ?>; var between = <?php echo "'".__('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>')."'"; ?>;
var between_not = <?php echo '"'.__("The alert would fire when the value is not between <span id=\'min\'></span> and <span id=\'max\'></span>").'"'; ?>; var between_not = <?php echo '"'.__('The alert would fire when the value is not between <span id=min></span> and <span id=max></span>').'"'; ?>;
var under = <?php echo "'".__('The alert would fire when the value is below <span id="min"></span>')."'"; ?>; var under = <?php echo "'".__('The alert would fire when the value is below <span id="min"></span>')."'"; ?>;
var over = <?php echo "'".__('The alert would fire when the value is above <span id="max"></span>')."'"; ?>; var over = <?php echo "'".__('The alert would fire when the value is above <span id="max"></span>')."'"; ?>;
var warning = <?php echo "'".__('The alert would fire when the module is in warning status')."'"; ?>; var warning = <?php echo "'".__('The alert would fire when the module is in warning status')."'"; ?>;

View File

@ -190,8 +190,20 @@ if ($editGraph) {
$weights = implode(',', $weight_array); $weights = implode(',', $weight_array);
} }
$count_module_array = count($module_array);
if ($count_module_array > 10) {
ui_print_warning_message(
__(
'The maximum number of items in a chart is 10. You have %s elements, only first 10 will be displayed.',
$count_module_array
)
);
}
// Modules table. // Modules table.
if (count($module_array) > 0) { if ($count_module_array > 0) {
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>"; echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
echo '<tr> echo '<tr>
<th>'.__('P.').'</th> <th>'.__('P.').'</th>
@ -202,7 +214,7 @@ if (count($module_array) > 0) {
<th>'.__('Delete').'</th> <th>'.__('Delete').'</th>
<th>'.__('Sort').'</th>'; <th>'.__('Sort').'</th>';
$color = 0; $color = 0;
for ($a = 0; $a < count($module_array); $a++) { for ($a = 0; $a < $count_module_array; $a++) {
// Calculate table line color. // Calculate table line color.
if ($color == 1) { if ($color == 1) {
$tdcolor = 'datos'; $tdcolor = 'datos';

View File

@ -140,8 +140,8 @@ if (isset($_GET['server'])) {
ui_print_error_message(__('There was a problem deleting the server')); ui_print_error_message(__('There was a problem deleting the server'));
} }
} else if (isset($_GET['update'])) { } else if (isset($_GET['update'])) {
$address = get_parameter_post('address'); $address = trim(get_parameter_post('address'), '&#x20;');
$description = get_parameter_post('description'); $description = trim(get_parameter_post('description'), '&#x20;');
$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 = get_parameter_post('port');

View File

@ -871,6 +871,11 @@ if ($get_response_description) {
} }
if ($get_response_params) { if ($get_response_params) {
if (! check_acl($config['id_user'], 0, 'EW')) {
echo 'unauthorized';
return;
}
$response_id = get_parameter('response_id'); $response_id = get_parameter('response_id');
$params = db_get_value('params', 'tevent_response', 'id', $response_id); $params = db_get_value('params', 'tevent_response', 'id', $response_id);
@ -885,6 +890,11 @@ if ($get_response_params) {
} }
if ($get_response_target) { if ($get_response_target) {
if (! check_acl($config['id_user'], 0, 'EW')) {
echo 'unauthorized';
return;
}
$response_id = (int) get_parameter('response_id'); $response_id = (int) get_parameter('response_id');
$event_id = (int) get_parameter('event_id'); $event_id = (int) get_parameter('event_id');
$server_id = (int) get_parameter('server_id'); $server_id = (int) get_parameter('server_id');
@ -901,6 +911,11 @@ if ($get_response_target) {
} }
if ($get_response) { if ($get_response) {
if (! check_acl($config['id_user'], 0, 'EW')) {
echo 'unauthorized';
return;
}
$response_id = get_parameter('response_id'); $response_id = get_parameter('response_id');
$event_response = db_get_row('tevent_response', 'id', $response_id); $event_response = db_get_row('tevent_response', 'id', $response_id);
@ -917,6 +932,11 @@ if ($get_response) {
if ($perform_event_response) { if ($perform_event_response) {
global $config; global $config;
if (! check_acl($config['id_user'], 0, 'EW')) {
echo 'unauthorized';
return;
}
$response_id = get_parameter('response_id'); $response_id = get_parameter('response_id');
$event_id = (int) get_parameter('event_id'); $event_id = (int) get_parameter('event_id');
$server_id = (int) get_parameter('server_id', 0); $server_id = (int) get_parameter('server_id', 0);
@ -1011,6 +1031,11 @@ if ($perform_event_response) {
if ($dialogue_event_response) { if ($dialogue_event_response) {
global $config; global $config;
if (! check_acl($config['id_user'], 0, 'EW')) {
echo 'unauthorized';
return;
}
$event_id = get_parameter('event_id'); $event_id = get_parameter('event_id');
$response_id = get_parameter('response_id'); $response_id = get_parameter('response_id');
$command = get_parameter('target'); $command = get_parameter('target');

View File

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

View File

@ -2118,7 +2118,7 @@ function events_comment(
switch ($comments_format) { switch ($comments_format) {
case 'new': case 'new':
$comment_for_json['comment'] = $comment; $comment_for_json['comment'] = io_safe_input($comment);
$comment_for_json['action'] = $action; $comment_for_json['action'] = $action;
$comment_for_json['id_user'] = $config['id_user']; $comment_for_json['id_user'] = $config['id_user'];
$comment_for_json['utimestamp'] = time(); $comment_for_json['utimestamp'] = time();
@ -2141,7 +2141,7 @@ function events_comment(
$comment = str_replace(["\r\n", "\r", "\n"], '<br>', $comment); $comment = str_replace(["\r\n", "\r", "\n"], '<br>', $comment);
if ($comment != '') { if ($comment != '') {
$commentbox = '<div style="border:1px dotted #CCC; min-height: 10px;">'.$comment.'</div>'; $commentbox = '<div style="border:1px dotted #CCC; min-height: 10px;">'.io_safe_input($comment).'</div>';
} else { } else {
$commentbox = ''; $commentbox = '';
} }
@ -3377,7 +3377,7 @@ function events_page_responses($event, $childrens_ids=[])
); );
if ($strict_user) { if ($strict_user) {
$user_name = db_get_value( $user_name = db_get_value(
'fullname', 'id_user',
'tusuario', 'tusuario',
'id_user', 'id_user',
$config['id_user'] $config['id_user']
@ -3395,14 +3395,14 @@ function events_page_responses($event, $childrens_ids=[])
} }
foreach ($users as $u) { foreach ($users as $u) {
$owners[$u['id_user']] = $u['fullname']; $owners[$u['id_user']] = $u['id_user'];
} }
if ($event['owner_user'] == '') { if ($event['owner_user'] == '') {
$owner_name = __('None'); $owner_name = __('None');
} else { } else {
$owner_name = db_get_value( $owner_name = db_get_value(
'fullname', 'id_user',
'tusuario', 'tusuario',
'id_user', 'id_user',
$event['owner_user'] $event['owner_user']

View File

@ -36,7 +36,8 @@ function forecast_projection_graph(
$prediction_period, $prediction_period,
$max_value=false, $max_value=false,
$min_value=false, $min_value=false,
$csv=false $csv=false,
$server_name=''
) { ) {
global $config; global $config;
@ -55,7 +56,7 @@ function forecast_projection_graph(
'projection' => true, 'projection' => true,
]; ];
$module_data = grafico_modulo_sparse($params); $module_data = grafico_modulo_sparse($params, $server_name);
if (empty($module_data)) { if (empty($module_data)) {
return []; return [];
@ -252,12 +253,13 @@ function forecast_prediction_date(
$module_id, $module_id,
$period=SECONDS_2MONTHS, $period=SECONDS_2MONTHS,
$max_value=0, $max_value=0,
$min_value=0 $min_value=0,
$server_name=''
) { ) {
// Checks interval // Checks interval
if ($min_value > $max_value) { if ($min_value > $max_value) {
return false; return false;
} }
return forecast_projection_graph($module_id, $period, false, $max_value, $min_value); return forecast_projection_graph($module_id, $period, false, $max_value, $min_value, false, $server_name);
} }

View File

@ -616,7 +616,7 @@ function grafico_modulo_sparse_data(
* *
* @return string html Content graphs. * @return string html Content graphs.
*/ */
function grafico_modulo_sparse($params) function grafico_modulo_sparse($params, $server_name='')
{ {
global $config; global $config;
@ -812,6 +812,12 @@ function grafico_modulo_sparse($params)
$date_array['final_date'] = $params['date']; $date_array['final_date'] = $params['date'];
$date_array['start_date'] = ($params['date'] - $params['period']); $date_array['start_date'] = ($params['date'] - $params['period']);
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($server_name);
$server = metaconsole_get_connection_by_id($id_meta);
metaconsole_connect($server);
}
if ($agent_module_id) { if ($agent_module_id) {
$module_data = db_get_row_sql( $module_data = db_get_row_sql(
'SELECT * FROM tagente_modulo 'SELECT * FROM tagente_modulo
@ -1022,6 +1028,10 @@ function grafico_modulo_sparse($params)
} }
} }
if (is_metaconsole()) {
metaconsole_restore_db();
}
return $return; return $return;
} }
@ -1483,6 +1493,11 @@ function graphic_combined_module(
continue; continue;
} }
// Only 10 item for chart.
if ($i > 9) {
break;
}
if (is_metaconsole()) { if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id( $server = metaconsole_get_connection_by_id(
$agent_module_id['server'] $agent_module_id['server']
@ -1826,28 +1841,23 @@ function graphic_combined_module(
} }
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false; if (is_metaconsole() === true) {
if ($config['metaconsole']) {
// Automatic custom graph from the report // Automatic custom graph from the report
// template in metaconsole. // template in metaconsole.
if (is_array($module_list[$i])) { $server = metaconsole_get_connection_by_id(
$server = metaconsole_get_connection_by_id( $module_item['server']
$module_item['server'] );
);
metaconsole_connect($server); metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
} }
$module = $module_item['module'];
$search_in_history_db = db_search_in_history_db($datelimit); $search_in_history_db = db_search_in_history_db($datelimit);
$temp[$module] = io_safe_output(modules_get_agentmodule($module)); $temp[$module] = io_safe_output(
modules_get_agentmodule($module)
);
$query_last_value = sprintf( $query_last_value = sprintf(
' '
SELECT datos SELECT datos
@ -1912,12 +1922,8 @@ function graphic_combined_module(
$temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min; $temp[$module]['min'] = ($temp_min === false) ? 0 : $temp_min;
if ($config['metaconsole']) { if (is_metaconsole() === true) {
// Automatic custom graph from the metaconsole_restore_db();
// report template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
} }
} }
@ -1962,25 +1968,15 @@ function graphic_combined_module(
$i = 0; $i = 0;
$number_elements = count($module_list); $number_elements = count($module_list);
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false; if (is_metaconsole() === true) {
if ($config['metaconsole']) { $server = metaconsole_get_connection_by_id(
// Automatic custom graph from $module_item['server']
// the report template in metaconsole. );
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id( metaconsole_connect($server);
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
} }
$module = $module_item['module'];
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$query_last_value = sprintf( $query_last_value = sprintf(
' '
@ -2036,12 +2032,8 @@ function graphic_combined_module(
$temp[$module]['gauge'] = uniqid('gauge_'); $temp[$module]['gauge'] = uniqid('gauge_');
if ($config['metaconsole']) { if (is_metaconsole() === true) {
// Automatic custom graph from the report metaconsole_restore_db();
// template in metaconsole.
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
} }
$i++; $i++;
@ -2089,25 +2081,15 @@ function graphic_combined_module(
case CUSTOM_GRAPH_VBARS: case CUSTOM_GRAPH_VBARS:
$label = ''; $label = '';
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false;
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Automatic custom graph from the report $server = metaconsole_get_connection_by_id(
// template in metaconsole. $module_item['server']
if (is_array($module_list[$i]) === true) { );
$server = metaconsole_get_connection_by_id(
$module_item['server'] metaconsole_connect($server);
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta === true) {
$module = $module_item['module'];
} else {
$module = $module_item;
} }
$module = $module_item['module'];
$module_data = modules_get_agentmodule($module); $module_data = modules_get_agentmodule($module);
$query_last_value = sprintf( $query_last_value = sprintf(
'SELECT datos 'SELECT datos
@ -2156,11 +2138,7 @@ function graphic_combined_module(
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Automatic custom graph from the report metaconsole_restore_db();
// template in metaconsole.
if (is_array($module_list[0]) === true) {
metaconsole_restore_db();
}
} }
} }
@ -2230,29 +2208,18 @@ function graphic_combined_module(
case CUSTOM_GRAPH_PIE: case CUSTOM_GRAPH_PIE:
$total_modules = 0; $total_modules = 0;
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false; if (is_metaconsole() === true) {
if ($config['metaconsole']) { $server = metaconsole_get_connection_by_id(
// Automatic custom graph from the report $module_item['server']
// template in metaconsole. );
if (is_array($module_list[$i])) {
$server = metaconsole_get_connection_by_id( metaconsole_connect($server);
$module_item['server']
);
metaconsole_connect($server);
$automatic_custom_graph_meta = true;
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
} }
$module = $module_item['module'];
$data_module = modules_get_agentmodule($module); $data_module = modules_get_agentmodule($module);
$query_last_value = sprintf( $query_last_value = sprintf(
' 'SELECT datos
SELECT datos
FROM tagente_datos FROM tagente_datos
WHERE id_agente_modulo = %d WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp > %d
@ -2297,12 +2264,9 @@ function graphic_combined_module(
'value' => $value, 'value' => $value,
'unit' => $data_module['unit'], 'unit' => $data_module['unit'],
]; ];
if ($config['metaconsole']) {
// Automatic custom graph from the report if (is_metaconsole() === true) {
// template in metaconsole. metaconsole_restore_db();
if (is_array($module_list[0])) {
metaconsole_restore_db();
}
} }
} }

View File

@ -1833,13 +1833,14 @@ function html_print_input_text_extended(
$alt, $alt,
$size, $size,
$maxlength, $maxlength,
$disabled, $readonly,
$script, $script,
$attributes, $attributes,
$return=false, $return=false,
$password=false, $password=false,
$function='', $function='',
$autocomplete='off' $autocomplete='off',
$disabled=false
) { ) {
static $idcounter = 0; static $idcounter = 0;
@ -1895,10 +1896,14 @@ function html_print_input_text_extended(
$output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" '); $output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" ');
if ($disabled && (!is_array($attributes) || !array_key_exists('disabled', $attributes))) { if ($readonly && (!is_array($attributes) || !array_key_exists('readonly', $attributes))) {
$output .= 'readonly="readonly" '; $output .= 'readonly="readonly" ';
} }
if ($disabled && (!is_array($attributes) || !array_key_exists('disabled', $attributes))) {
$output .= 'disabled="disabled" ';
}
if (is_array($attributes)) { if (is_array($attributes)) {
foreach ($attributes as $attribute => $attr_value) { foreach ($attributes as $attribute => $attr_value) {
if (! in_array($attribute, $valid_attrs)) { if (! in_array($attribute, $valid_attrs)) {
@ -2102,7 +2107,7 @@ function html_print_input_text(
$size=50, $size=50,
$maxlength=255, $maxlength=255,
$return=false, $return=false,
$disabled=false, $readonly=false,
$required=false, $required=false,
$function='', $function='',
$class='', $class='',
@ -2111,7 +2116,8 @@ function html_print_input_text(
$autofocus=false, $autofocus=false,
$onKeyDown='', $onKeyDown='',
$formTo='', $formTo='',
$onKeyUp='' $onKeyUp='',
$disabled=false
) { ) {
if ($maxlength == 0) { if ($maxlength == 0) {
$maxlength = 255; $maxlength = 255;
@ -2163,12 +2169,14 @@ function html_print_input_text(
$alt, $alt,
$size, $size,
$maxlength, $maxlength,
$disabled, $readonly,
'', '',
$attr, $attr,
$return, $return,
false, false,
$function $function,
'off',
$disabled
); );
} }
@ -2661,8 +2669,16 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='', $disable=false) function html_print_textarea(
{ $name,
$rows,
$columns,
$value='',
$attributes='',
$return=false,
$class='',
$disable=false
) {
$disabled = ($disable) ? 'disabled' : ''; $disabled = ($disable) ? 'disabled' : '';
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>'; $output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>';
$output .= ($value); $output .= ($value);

View File

@ -4664,7 +4664,7 @@ function reporting_prediction_date($report, $content)
$max_interval = $intervals_text[0]; $max_interval = $intervals_text[0];
$min_interval = $intervals_text[1]; $min_interval = $intervals_text[1];
$value = forecast_prediction_date($content['id_agent_module'], $content['period'], $max_interval, $min_interval); $value = forecast_prediction_date($content['id_agent_module'], $content['period'], $max_interval, $min_interval, $content['server_name']);
if ($value === false) { if ($value === false) {
$return['data']['value'] = __('Unknown'); $return['data']['value'] = __('Unknown');

View File

@ -2432,7 +2432,7 @@ function pandoraFlotArea(
if (!value[x]) { if (!value[x]) {
x = x + 1; x = x + 1;
} }
if (value[x].min) { if (typeof value[x].min !== "undefined" && value[x].min) {
min_y_array = format_unit_yaxes(value[x].min); min_y_array = format_unit_yaxes(value[x].min);
min_y = min_y_array["y"]; min_y = min_y_array["y"];
min_bigger = min_y_array["unit"]; min_bigger = min_y_array["unit"];
@ -2441,7 +2441,7 @@ function pandoraFlotArea(
min_bigger = ""; min_bigger = "";
} }
if (value[x].max) { if (typeof value[x].max !== "undefined" && value[x].max) {
max_y_array = format_unit_yaxes(value[x].max); max_y_array = format_unit_yaxes(value[x].max);
max_y = max_y_array["y"]; max_y = max_y_array["y"];
max_bigger = max_y_array["unit"]; max_bigger = max_y_array["unit"];
@ -2450,7 +2450,7 @@ function pandoraFlotArea(
max_bigger = ""; max_bigger = "";
} }
if (value[x].avg) { if (typeof value[x].avg !== "undefined" && value[x].avg) {
avg_y_array = format_unit_yaxes(value[x].avg); avg_y_array = format_unit_yaxes(value[x].avg);
avg_y = avg_y_array["y"]; avg_y = avg_y_array["y"];
avg_bigger = avg_y_array["unit"]; avg_bigger = avg_y_array["unit"];

View File

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

View File

@ -982,24 +982,26 @@ if ($group_rep == 2) {
$array_events_actions[$val['id']] = $val['name']; $array_events_actions[$val['id']] = $val['name'];
} }
if ($config['event_replication'] != 1) { if (check_acl($config['id_user'], 0, 'EW')) {
echo '<div style="width:100%;text-align:right;">'; if ($config['event_replication'] != 1) {
echo '<form method="post" id="form_event_response">'; echo '<div style="width:100%;text-align:right;">';
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); echo '<form method="post" id="form_event_response">';
echo '&nbsp&nbsp'; html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); echo '&nbsp&nbsp';
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>'; html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
echo '</form>'; echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">'; echo '</form>';
echo __( echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
'A maximum of %s event custom responses can be selected', echo __(
$config['max_execution_event_response'] 'A maximum of %s event custom responses can be selected',
).'</span>'; $config['max_execution_event_response']
echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">'; ).'</span>';
echo __( echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
'Please, select an event' echo __(
).'</span>'; 'Please, select an event'
echo '</div>'; ).'</span>';
echo '</div>';
}
} }
} }

View File

@ -1530,26 +1530,26 @@ foreach ($event_responses as $val) {
$array_events_actions[$val['id']] = $val['name']; $array_events_actions[$val['id']] = $val['name'];
} }
if (check_acl($config['id_user'], 0, 'EW')) {
echo '<div class="multi-response-buttons">'; echo '<div class="multi-response-buttons">';
echo '<form method="post" id="form_event_response">'; echo '<form method="post" id="form_event_response">';
echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />'; echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />';
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
echo '&nbsp&nbsp'; echo '&nbsp&nbsp';
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>'; echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
echo '</form>'; echo '</form>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">'; echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
echo __( echo __(
'A maximum of %s event custom responses can be selected', 'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response'] $config['max_execution_event_response']
).'</span>'; ).'</span>';
echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">'; echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
echo __( echo __(
'Please, select an event' 'Please, select an event'
).'</span>'; ).'</span>';
echo '</div>'; echo '</div>';
}
// Close viewer. // Close viewer.
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.747 %define version 7.0NG.747
%define release 200710 %define release 200713
# 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.747 %define version 7.0NG.747
%define release 200710 %define release 200713
# 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.747 %define version 7.0NG.747
%define release 200710 %define release 200713
%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

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.747-200710 Version: 7.0NG.747-200713
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.747-200710" pandora_version="7.0NG.747-200713"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

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.747"; my $pandora_version = "7.0NG.747";
my $pandora_build = "200710"; my $pandora_build = "200713";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -33,7 +33,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.747"; my $pandora_version = "7.0NG.747";
my $pandora_build = "200710"; my $pandora_build = "200713";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.747 %define version 7.0NG.747
%define release 200710 %define release 200713
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.747 %define version 7.0NG.747
%define release 200710 %define release 200713
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.747 PS200710"; my $version = "7.0NG.747 PS200713";
# 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.747 PS200710"; my $version = "7.0NG.747 PS200713";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);