Merge conflict solution

This commit is contained in:
Jonathan 2023-03-27 08:31:00 +02:00
commit f8aefa6e34
90 changed files with 1937 additions and 812 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230322 Version: 7.0NG.769-230327
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.769-230322" pandora_version="7.0NG.769-230327"
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

@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769'; use constant AGENT_VERSION => '7.0NG.769';
use constant AGENT_BUILD => '230322'; use constant AGENT_BUILD => '230327';
# 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

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230322 %define release 230327
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230322 %define release 230327
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.769" PI_VERSION="7.0NG.769"
PI_BUILD="230322" PI_BUILD="230327"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -1,5 +1,14 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tdatabase` ADD COLUMN `ssh_status` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `db_status` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `replication_status` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `replication_delay` BIGINT DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `master` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `utimestamp` BIGINT DEFAULT 0;
ALTER TABLE `tdatabase` ADD COLUMN `mysql_version` VARCHAR(10) DEFAULT '';
ALTER TABLE `tdatabase` ADD COLUMN `pandora_version` VARCHAR(10) DEFAULT '';
UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1; UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1;
UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2; UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2;
UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3; UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3;
@ -166,4 +175,6 @@ CREATE TABLE IF NOT EXISTS `tfavmenu_user` (
`section` VARCHAR(255) NOT NULL, `section` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)); PRIMARY KEY (`id`));
INSERT INTO `tconfig` (`token`, `value`) VALUES ('legacy_database_ha', 1);
COMMIT; COMMIT;

View File

@ -30,7 +30,7 @@ require_once __DIR__.'/../include/functions_html.php';
echo '<style> echo '<style>
:root {'; :root {';
if ($config['style'] === 'pandora') { if ($config['style'] === 'pandora') {
echo '--login-background-color: rgba(255, 255, 255, 0.2);'; echo '--login-background-color: rgba(255, 255, 255, 0.4);';
echo '--login-label-color: #545454;'; echo '--login-label-color: #545454;';
echo '--login-text-color: #000;'; echo '--login-text-color: #000;';
$style_theme = 'white-theme'; $style_theme = 'white-theme';
@ -213,7 +213,7 @@ echo '<div class="login_page">';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
if (!isset($config['custom_logo_login'])) { if (!isset($config['custom_logo_login'])) {
html_print_image( html_print_image(
'enterprise/images/custom_logo_login/login_logo.png', 'enterprise/images/custom_logo_login/Pandora-FMS-1.png',
false, false,
[ [
'class' => 'login_logo', 'class' => 'login_logo',
@ -238,13 +238,13 @@ if (is_metaconsole() === true) {
} }
} else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { } else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (!isset($config['custom_logo_login'])) { if (!isset($config['custom_logo_login'])) {
html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/login_logo_v7.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/Pandora-FMS-1.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
} else { } else {
if (empty($config['custom_logo_login']) === true) { if (empty($config['custom_logo_login']) === true) {
html_print_image(ui_get_full_url('images/custom_logo_login/pandora_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/Pandora-FMS-1.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image(ui_get_full_url('images/custom_logo_login/').$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image(ui_get_full_url('images/custom_logo_login/').$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
@ -472,6 +472,7 @@ html_print_csrf_hidden();
echo '<div class ="img_banner_login">'; echo '<div class ="img_banner_login">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (empty($config['custom_splash_login']) === false && $config['custom_splash_login'] !== 'default') { if (empty($config['custom_splash_login']) === false && $config['custom_splash_login'] !== 'default') {
if ($config['custom_splash_login'] !== 'none.png') {
html_print_image( html_print_image(
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'], 'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
false, false,
@ -483,6 +484,7 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
false, false,
false false
); );
}
} else { } else {
echo ' echo '
<div class="loginimg-container"> <div class="loginimg-container">
@ -522,10 +524,10 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if ($config['custom_title1_login']) { if ($config['custom_title1_login']) {
echo io_safe_output($config['custom_title1_login']); echo io_safe_output($config['custom_title1_login']);
} else { } else {
echo __('ONE TOOL TO MONITOR THEM ALL'); echo __('ONE TOOL TO RULE THEM ALL');
} }
} else { } else {
echo __('ONE TOOL TO MONITOR THEM ALL'); echo __('ONE TOOL TO RULE THEM ALL');
} }
echo '</span></div>'; echo '</span></div>';

View File

@ -184,7 +184,7 @@ if (!$double_auth_enabled
background: "black" background: "black"
}, },
width: 500, width: 500,
height: 400, height: 'auto',
close: function (event, ui) { close: function (event, ui) {
// Abort the ajax request // Abort the ajax request
if (typeof request != 'undefined'){ if (typeof request != 'undefined'){

View File

@ -57,14 +57,33 @@ if ($id_field) {
$combo_values = $field['combo_values'] ? $field['combo_values'] : ''; $combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable']; $is_combo_enable = $config['is_combo_enable'];
$is_link_enabled = $field['is_link_enabled']; $is_link_enabled = $field['is_link_enabled'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, ''); $header_title = __('Update agent custom field');
} else { } else {
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, ''); $header_title = __('Create agent custom field');
} }
$table = new stdClass(); ui_print_standard_header(
$table->class = 'databox'; $header_title,
$table->id = 'configure_field'; 'images/custom_field.png',
false,
'',
true,
[],
[
[
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/fields_manager',
'label' => __('Resources'),
],
[
'link' => 'index.php?sec=gagente&sec2=godmode/agentes/fields_manager',
'label' => __('Custom field'),
],
[
'link' => '',
'label' => __('Edit'),
],
]
);
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' class='invisible'>"; echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' class='invisible'>";
echo "<p class='center bolder'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>'; echo "<p class='center bolder'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
@ -82,42 +101,44 @@ echo "<div id='message_no_set_combo' title='".__('Agent Custom Fields Informati
echo "<p class='center bolder'>".__('If you select Passord type the Enabled combo will be disabled.').'</p>'; echo "<p class='center bolder'>".__('If you select Passord type the Enabled combo will be disabled.').'</p>';
echo '</div>'; echo '</div>';
$table = new stdClass();
$table->class = 'databox filter-table-adv';
$table->id = 'configure_field';
$table->width = '100%';
$table->size = [];
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $table->data[0][0] = html_print_label_input_block(
$table->data[1][0] = html_print_input_text( __('Name'),
html_print_input_text(
'name', 'name',
$name, $name,
'', '',
35, 35,
100, 100,
true true
)
); );
$table->data[2][0] = __('Pass type').ui_print_help_tip( $table->data[0][1] = html_print_label_input_block(
__('The fields with pass type enabled will be displayed like html input type pass in html'), __('Display on front').ui_print_help_tip(
true
);
$table->data[2][1] = __('Display on front').ui_print_help_tip(
__('The fields with display on front enabled will be displayed into the agent details'), __('The fields with display on front enabled will be displayed into the agent details'),
true true
); ),
$table->data[2][2] = __('Link type'); html_print_checkbox_switch(
$table->data[3][0] = html_print_checkbox_switch(
'is_password_type',
1,
$is_password_type,
true
);
$table->data[3][1] = html_print_checkbox_switch(
'display_on_front', 'display_on_front',
1, 1,
$display_on_front, $display_on_front,
true true
)
); );
$table->data[3][2] = html_print_checkbox_switch_extended(
$table->data[1][0] = html_print_label_input_block(
__('Link type'),
html_print_checkbox_switch_extended(
'is_link_enabled', 'is_link_enabled',
1, 1,
$is_link_enabled, $is_link_enabled,
@ -125,9 +146,25 @@ $table->data[3][2] = html_print_checkbox_switch_extended(
'', '',
'', '',
true true
)
); );
$table->data[4][0] = __('Enabled combo');
$table->data[5][0] = html_print_checkbox_switch_extended( $table->data[2][0] = html_print_label_input_block(
__('Pass type').ui_print_help_tip(
__('The fields with pass type enabled will be displayed like html input type pass in html'),
true
),
html_print_checkbox_switch(
'is_password_type',
1,
$is_password_type,
true
)
);
$table->data[2][1] = html_print_label_input_block(
__('Enabled combo'),
html_print_checkbox_switch_extended(
'is_combo_enable', 'is_combo_enable',
0, 0,
$config['is_combo_enable'], $config['is_combo_enable'],
@ -135,27 +172,25 @@ $table->data[5][0] = html_print_checkbox_switch_extended(
'', '',
'', '',
true true
)
); );
$table->data[3][0] = html_print_label_input_block(
$table->cellstyle[4][1] = 'display: none;'; __('Combo values').ui_print_help_tip(
$table->cellstyle[5][1] = 'display: none;';
$table->data[4][1] = __('Combo values').ui_print_help_tip(
__('Set values separated by comma'), __('Set values separated by comma'),
true true
); ),
$table->data[5][1] = html_print_textarea( html_print_textarea(
'combo_values', 'combo_values',
3, 3,
65, 65,
io_safe_output($combo_values), io_safe_output($combo_values),
'', '',
true true
)
); );
echo '<form class="max_floating_element_size" name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table); html_print_table($table);
if ($id_field > 0) { if ($id_field > 0) {
@ -194,65 +229,65 @@ echo '</form>';
<script> <script>
$(document).ready (function () { $(document).ready (function () {
if($('input[type=hidden][name=update_field]').val() == 1 && $('#textarea_combo_values').val() != ''){ if($('input[type=hidden][name=update_field]').val() == 1 && $('#textarea_combo_values').val() != ''){
console.log('entra2');
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true); $('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
$('#configure_field-4').show(); $('#configure_field-3').show();
$('input[type=checkbox][name=is_password_type]').change(function (e) { $('input[type=checkbox][name=is_password_type]').change(function (e) {
dialog_message("#message_set_password"); dialog_message("#message_set_password");
$('input[type=checkbox][name=is_password_type]').prop('checked', false); $('input[type=checkbox][name=is_password_type]').prop('checked', false);
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true); $('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
$('#configure_field-4').show(); $('#configure_field-3').show();
e.preventDefault(); e.preventDefault();
}); });
$('input[type=checkbox][name=is_combo_enable]').change(function (e) { $('input[type=checkbox][name=is_combo_enable]').change(function (e) {
if($('#textarea_combo_values').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){ if($('#textarea_combo_values').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){
dialog_message("#message_set_combo"); dialog_message("#message_set_combo");
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true); $('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
$('#configure_field-4').show(); $('#configure_field-3').show();
e.preventDefault(); e.preventDefault();
} }
}); });
} else {
console.log('entra');
$('#configure_field-3').hide();
} }
if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) { if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) {
$('#configure_field-1').hide(); $('#configure_field-2').hide();
$('#configure_field-3').hide();
} else { } else {
$('#configure_field-1').show(); $('#configure_field-2').show();
$('#configure_field-3').show();
} }
$('input[type=checkbox][name=is_link_enabled]').change(function () { $('input[type=checkbox][name=is_link_enabled]').change(function () {
if( $(this).is(":checked") ){ if( $(this).is(":checked") ){
$('#configure_field-1').hide(); $('#configure_field-2').hide();
$('#configure_field-3').hide(); $('#configure_field-3').hide();
} else{ } else{
$('#configure_field-1').show(); $('#configure_field-2').show();
$('#configure_field-3').show(); $('#configure_field-3').show();
} }
}); });
$('input[type=checkbox][name=is_combo_enable]').change(function () { $('input[type=checkbox][name=is_combo_enable]').change(function () {
if( $(this).is(":checked") ){ if( $(this).is(":checked") ){
$('#configure_field-4').show(); $('#configure_field-3').show();
dialog_message("#message_no_set_password"); dialog_message("#message_no_set_password");
$('#configure_field-1').hide(); $('#configure_field-1').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-4').hide(); $('#configure_field-3').hide();
$('#configure_field-1').show(); $('#configure_field-1').show();
$('#configure_field-5').show();
} }
}); });
$('input[type=checkbox][name=is_password_type]').change(function () { $('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){ if( $(this).is(":checked")){
dialog_message("#message_no_set_combo"); dialog_message("#message_no_set_combo");
$('#configure_field-3').hide(); $('#configure_field-3').hide();
$('#configure_field-5').hide();
} }
else{ else{
$('#configure_field-3').show(); $('#configure_field-3').show();
$('#configure_field-5').show();
} }
}); });
}); });

View File

@ -704,6 +704,19 @@ if ($step == 2) {
) )
); );
$usr_groups = implode(
',',
array_keys(users_get_groups($config['id_user'], 'LM', true))
);
$sql_query = sprintf(
'SELECT id, name
FROM talert_actions
WHERE id_group IN (%s)
ORDER BY name',
$usr_groups
);
$table->data[2][1] = html_print_label_input_block( $table->data[2][1] = html_print_label_input_block(
__('Default action').ui_print_help_tip( __('Default action').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.'),
@ -801,19 +814,6 @@ if ($step == 2) {
) )
); );
$usr_groups = implode(
',',
array_keys(users_get_groups($config['id_user'], 'LM', true))
);
$sql_query = sprintf(
'SELECT id, name
FROM talert_actions
WHERE id_group IN (%s)
ORDER BY name',
$usr_groups
);
$table->data[5][0] = html_print_label_input_block( $table->data[5][0] = html_print_label_input_block(
__('Condition type'), __('Condition type'),
html_print_select( html_print_select(

View File

@ -445,7 +445,7 @@ if ($is_management_allowed === true
if ($aviable_name === true) { if ($aviable_name === true) {
$values = [ $values = [
'nombre' => $name, 'nombre' => $name,
'icon' => empty($icon) ? '' : substr($icon, 0, -4), 'icon' => $icon,
'parent' => $id_parent, 'parent' => $id_parent,
'disabled' => $alerts_disabled, 'disabled' => $alerts_disabled,
'custom_id' => $custom_id, 'custom_id' => $custom_id,
@ -513,7 +513,7 @@ if ($is_management_allowed === true && $update_group === true) {
if ($aviable_name === true) { if ($aviable_name === true) {
$values = [ $values = [
'nombre' => $name, 'nombre' => $name,
'icon' => empty($icon) ? '' : substr($icon, 0, -4), 'icon' => $icon,
'parent' => ($id_parent == -1) ? 0 : $id_parent, 'parent' => ($id_parent == -1) ? 0 : $id_parent,
'disabled' => !$alerts_enabled, 'disabled' => !$alerts_enabled,
'custom_id' => $custom_id, 'custom_id' => $custom_id,
@ -741,12 +741,11 @@ if ($is_management_allowed === true
// Credential store is loaded previously in this document to avoid // Credential store is loaded previously in this document to avoid
// process group tree - list forms. // process group tree - list forms.
ui_print_spinner(__('Loading'));
if ($tab == 'tree') { if ($tab == 'tree') {
/* /*
* Group tree view. * Group tree view.
*/ */
ui_print_spinner(__('Loading'));
echo "<div id='tree-controller-recipient'></div>"; echo "<div id='tree-controller-recipient'></div>";
} else { } else {
/* /*
@ -986,7 +985,7 @@ if ($tab == 'tree') {
true, true,
'offset', 'offset',
false, false,
'pagination-bottom' ''
); );
} else { } else {
ui_print_info_message( ui_print_info_message(
@ -1038,6 +1037,7 @@ $tab = 'group_edition';
<script type="text/javascript"> <script type="text/javascript">
var treeController = TreeController.getController(); var treeController = TreeController.getController();
treeController.meta = <?php echo (is_metaconsole() === true) ? 1 : 0; ?>;
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0) if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
treeController.recipient.empty(); treeController.recipient.empty();

View File

@ -364,6 +364,11 @@ if ($access_console_node === true) {
$sub2['godmode/setup/setup&section=net']['text'] = __('Netflow'); $sub2['godmode/setup/setup&section=net']['text'] = __('Netflow');
$sub2['godmode/setup/setup&section=net']['refr'] = 0; $sub2['godmode/setup/setup&section=net']['refr'] = 0;
} }
if ((bool) $config['activate_sflow'] === true) {
$sub2['godmode/setup/setup&section=sflow']['text'] = __('Sflow');
$sub2['godmode/setup/setup&section=sflow']['refr'] = 0;
}
} }
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus'); $sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');

View File

@ -297,7 +297,7 @@ if (!empty($table->data)) {
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
ui_pagination($count_network_templates, false, $offset); ui_pagination($count_network_templates, false, $offset);
html_print_table($table); html_print_table($table);
ui_pagination($count_network_templates, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination($count_network_templates, false, $offset, 0, false, 'offset', true, '');
echo "<div class='pdd_l_5px right'>"; echo "<div class='pdd_l_5px right'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>'; echo '</div>';

View File

@ -445,7 +445,7 @@ if (!empty($graphs)) {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>"; echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_table($table); html_print_table($table);
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, '');
echo "<div class='right'>"; echo "<div class='right'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</form>'; echo '</form>';

View File

@ -115,6 +115,7 @@ $exception_condition_value = 10;
$modulegroup = 0; $modulegroup = 0;
$period = SECONDS_1DAY; $period = SECONDS_1DAY;
$search = ''; $search = '';
$full_text = 0;
$log_number = 1000; $log_number = 1000;
// Added support for projection graphs. // Added support for projection graphs.
$period_pg = SECONDS_5DAY; $period_pg = SECONDS_5DAY;
@ -316,6 +317,7 @@ switch ($action) {
$source = $es['source']; $source = $es['source'];
$search = $es['search']; $search = $es['search'];
$log_number = empty($es['log_number']) ? $log_number : $es['log_number']; $log_number = empty($es['log_number']) ? $log_number : $es['log_number'];
$full_text = empty($es['full_text']) ? 0 : $es['full_text'];
break; break;
case 'simple_graph': case 'simple_graph':
@ -1313,6 +1315,14 @@ $class = 'databox filters';
<td > <td >
<?php <?php
html_print_input_text('search', $search, '', 40, 100); html_print_input_text('search', $search, '', 40, 100);
html_print_checkbox(
'full_text',
1,
$full_text,
false,
false
);
ui_print_help_tip(__('Full context'), false);
?> ?>
</td> </td>
</tr> </tr>

View File

@ -1597,11 +1597,13 @@ switch ($action) {
$agents_to_report = get_parameter('id_agents3'); $agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', ''); $source = get_parameter('source', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', ''); $log_number = get_parameter('log_number', '');
$es['source'] = $source; $es['source'] = $source;
$es['id_agents'] = $agents_to_report; $es['id_agents'] = $agents_to_report;
$es['search'] = $search; $es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number; $es['log_number'] = $log_number;
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
@ -2542,11 +2544,13 @@ switch ($action) {
$agents_to_report = get_parameter('id_agents3'); $agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', ''); $source = get_parameter('source', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', ''); $log_number = get_parameter('log_number', '');
$es['source'] = $source; $es['source'] = $source;
$es['id_agents'] = $agents_to_report; $es['id_agents'] = $agents_to_report;
$es['search'] = $search; $es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number; $es['log_number'] = $log_number;
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);

View File

@ -137,8 +137,6 @@ echo $formHidden;
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filter-table-adv'; $table->class = 'databox filter-table-adv';
$table->size = []; $table->size = [];
$table->size[0] = '50%'; $table->size[0] = '50%';
@ -373,22 +371,20 @@ $(document).ready (function () {
alert('Default width is '+$('#imagen').width()+'px, smaller than minimum -> 1024px'); alert('Default width is '+$('#imagen').width()+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024'); $('input[name=width]').val('1024');
$('#preimagew').html(1024); $('#preimagew').html(1024);
} } else{
else{
$('input[name=width]').val($('#imagen').width()); $('input[name=width]').val($('#imagen').width());
$('#preimagew').html($('#imagen').width()); $('#preimagew').html($('#imagen').width());
} }
if (parseInt($('#imagen').height()) < 768){ if (parseInt($('#imagen').height()) < 768){
alert('Default height is '+$('#imagen').height()+'px, smaller than minimum -> 768px'); alert('Default height is '+$('#imagen').height()+'px, smaller than minimum -> 768px');
$('input[name=height]').val('768'); $('input[name=height]').val('768');
$('#preimageh').html(768); $('#preimageh').html(768);
} } else{
else{
$('input[name=height]').val($('#imagen').height()); $('input[name=height]').val($('#imagen').height());
$('#preimageh').html($('#imagen').height()); $('#preimageh').html($('#imagen').height());
} }
} } else {
else{
original_image=new Image(); original_image=new Image();
url_hack_metaconsole = metaconsole_url(); url_hack_metaconsole = metaconsole_url();
original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val(); original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
@ -396,8 +392,7 @@ $(document).ready (function () {
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px'); alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024'); $('input[name=width]').val('1024');
$('#preimagew').html(1024); $('#preimagew').html(1024);
} } else {
else{
$('input[name=width]').val(original_image.height); $('input[name=width]').val(original_image.height);
$('#preimagew').html(original_image.height); $('#preimagew').html(original_image.height);
} }
@ -405,15 +400,15 @@ $(document).ready (function () {
alert('Default height is '+original_image.height+'px, smaller than minimum -> 768px'); alert('Default height is '+original_image.height+'px, smaller than minimum -> 768px');
$('input[name=height]').val('768'); $('input[name=height]').val('768');
$('#preimageh').html(768); $('#preimageh').html(768);
} } else {
else{
$('input[name=height]').val(original_image.height); $('input[name=height]').val(original_image.height);
$('#preimageh').html(original_image.height); $('#preimageh').html(original_image.height);
} }
} }
}); });
$( "input[type=submit]" ).click(function( event ) { $( "button[type=submit]" ).click(function( event ) {
console.log('aaaaaaaaaaa');
if (parseInt($('input[name=width]').val()) < 1024){ if (parseInt($('input[name=width]').val()) < 1024){
alert('Default width is '+$('input[name=width]').val()+'px, smaller than minimum -> 1024px'); alert('Default width is '+$('input[name=width]').val()+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024'); $('input[name=width]').val('1024');
@ -431,7 +426,6 @@ $(document).ready (function () {
if (x || y){ if (x || y){
return false; return false;
} }
}); });
//Preload image size and activate auto image size changer when user click over a image in the selector //Preload image size and activate auto image size changer when user click over a image in the selector

View File

@ -63,7 +63,7 @@ if (empty($idVisualConsole) === true) {
$idVisualConsole = get_parameter('id', 0); $idVisualConsole = get_parameter('id', 0);
} }
if (!defined('METACONSOLE')) { if (is_metaconsole() === false) {
$action_name_parameter = 'action'; $action_name_parameter = 'action';
} else { } else {
$action_name_parameter = 'action2'; $action_name_parameter = 'action2';
@ -93,7 +93,6 @@ $activeTab = get_parameterBetweenListValues(
'data' 'data'
); );
// Visual console creation tab and actions. // Visual console creation tab and actions.
if (empty($idVisualConsole)) { if (empty($idVisualConsole)) {
$visualConsole = null; $visualConsole = null;
@ -137,7 +136,6 @@ $refr = (int) get_parameter('refr', $config['vc_refr']);
$id_layout = 0; $id_layout = 0;
// Save/Update data in DB // Save/Update data in DB
global $statusProcessInDB; global $statusProcessInDB;
if (empty($statusProcessInDB)) { if (empty($statusProcessInDB)) {
@ -786,7 +784,7 @@ if (isset($config['vc_refr']) and $config['vc_refr'] != 0) {
$view_refresh = '300'; $view_refresh = '300';
} }
if (!defined('METACONSOLE')) { if (is_metaconsole() === false) {
$url_base = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action='; $url_base = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action=';
$url_view = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$idVisualConsole.'&refr='.$view_refresh; $url_view = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$idVisualConsole.'&refr='.$view_refresh;
} else { } else {
@ -798,14 +796,18 @@ if (!defined('METACONSOLE')) {
$hash = User::generatePublicHash(); $hash = User::generatePublicHash();
$buttons = []; $buttons = [];
$buttons['consoles_list'] = [ $buttons['consoles_list'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder&refr='.$refr.'">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Visual consoles list'), 'class' => 'main_menu_icon invert_filter']).'</a>', 'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder&refr='.$refr.'">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Visual consoles list'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];
$buttons['public_link'] = [ $buttons['public_link'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&refr='.$refr.'&id_layout='.$idVisualConsole.'&id_user='.$config['id_user']).'">'.html_print_image('images/item-icon.svg', true, ['title' => __('Show link to public Visual Console'), 'class' => 'main_menu_icon invert_filter']).'</a>', 'text' => '<a href="'.ui_get_full_url(
'operation/visual_console/public_console.php?hash='.$hash.'&refr='.$refr.'&id_layout='.$idVisualConsole.'&id_user='.$config['id_user'],
false,
false,
false
).'">'.html_print_image('images/item-icon.svg', true, ['title' => __('Show link to public Visual Console'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];
$buttons['data'] = [ $buttons['data'] = [
'active' => false, 'active' => false,
@ -839,7 +841,7 @@ $buttons['view'] = [
'text' => '<a href="'.$url_view.'">'.html_print_image('images/enable.svg', true, ['title' => __('View'), 'class' => 'main_menu_icon invert_filter']).'</a>', 'text' => '<a href="'.$url_view.'">'.html_print_image('images/enable.svg', true, ['title' => __('View'), 'class' => 'main_menu_icon invert_filter']).'</a>',
]; ];
if ($idVisualConsole === false) { if (empty($idVisualConsole) === true) {
$buttons = ['data' => $buttons['data']]; $buttons = ['data' => $buttons['data']];
// Show only the data tab // Show only the data tab
// If it is a fail try, reset the values // If it is a fail try, reset the values
@ -850,9 +852,8 @@ if ($idVisualConsole === false) {
$buttons[$activeTab]['active'] = true; $buttons[$activeTab]['active'] = true;
$tab_builder = ($activeTab === 'editor') ? 'visual_console_editor_editor_tab' : ''; $tab_builder = ($activeTab === 'editor') ? 'visual_console_editor_editor_tab' : '';
ui_print_standard_header( ui_print_standard_header(
$visualConsoleName, ($visualConsoleName ?? ''),
'images/visual_console.png', 'images/visual_console.png',
false, false,
$tab_builder, $tab_builder,

View File

@ -65,7 +65,7 @@ switch ($action) {
$table = new stdClass(); $table = new stdClass();
$table->class = 'info_table'; $table->class = 'info_table';
$table->width = '98%'; $table->width = '100%';
$table->head[0] = __('Map connection name'); $table->head[0] = __('Map connection name');
$table->head[1] = __('Group'); $table->head[1] = __('Group');
$table->head[3] = __('Delete'); $table->head[3] = __('Delete');
@ -84,7 +84,7 @@ if ($mapsConnections !== false) {
'<a href="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2&amp;action=edit_connection_map&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'">'.$mapsConnection['conection_name'].'</a>', '<a href="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2&amp;action=edit_connection_map&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'">'.$mapsConnection['conection_name'].'</a>',
ui_print_group_icon($mapsConnection['group_id'], true), ui_print_group_icon($mapsConnection['group_id'], true),
'<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=gis&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'&amp;action=delete_connection" '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=gis&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'&amp;action=delete_connection"
onClick="javascript: if (!confirm(\''.__('Do you wan delete this connection?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'invert_filter']).'</a>', onClick="javascript: if (!confirm(\''.__('Do you wan delete this connection?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'invert_filter main_menu_icon']).'</a>',
]; ];
$table->cellclass[][2] = 'table_action_buttons'; $table->cellclass[][2] = 'table_action_buttons';
} }
@ -95,6 +95,14 @@ html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form action="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2" method="post">'; echo '<form action="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2" method="post">';
html_print_input_hidden('action', 'create_connection_map'); html_print_input_hidden('action', 'create_connection_map');
html_print_submit_button(__('Create'), '', false, 'class="sub next"'); html_print_action_buttons(
html_print_submit_button(
__('Create'),
'',
false,
['icon' => 'wand'],
true
)
);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';

View File

@ -146,17 +146,41 @@ foreach ($osList as $os) {
$table->data[] = $data; $table->data[] = $data;
} }
$tablePagination = '';
if (isset($data) === true) { if (isset($data) === true) {
html_print_table($table); html_print_table($table);
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom'); $tablePagination = ui_pagination(
$count_osList,
ui_get_url_refresh(['message' => false]),
$offset,
0,
true,
'offset',
false,
''
);
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
} }
$buttons = '';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
echo '<form method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=builder">'; $buttons .= '<form method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=builder">';
echo "<div style='text-align:right;width:".$table->width."'>"; $buttons .= html_print_submit_button(
html_print_submit_button(__('Create OS'), '', false, 'class="sub next"'); __('Create OS'),
echo '</div>'; '',
echo '</form>'; false,
['icon' => 'next'],
true
);
$buttons .= '</form>';
} }
html_print_action_buttons(
$buttons,
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
);

View File

@ -154,6 +154,20 @@ if (check_acl($config['id_user'], 0, 'AW')) {
).'</a>', ).'</a>',
]; ];
} }
if ($config['activate_sflow']) {
$buttons['sflow'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=sflow').'">'.html_print_image(
'images/op_recon.png',
true,
[
'title' => __('Sflow'),
'class' => 'invert_filter',
]
).'</a>',
];
}
} }
$buttons['integria'] = [ $buttons['integria'] = [
@ -277,6 +291,12 @@ switch ($section) {
$help_header = 'setup_netflow_tab'; $help_header = 'setup_netflow_tab';
break; break;
case 'sflow':
$buttons['sflow']['active'] = true;
$subpage = __('Sflow');
$help_header = 'setup_flow_tab';
break;
case 'ehorus': case 'ehorus':
$buttons['ehorus']['active'] = true; $buttons['ehorus']['active'] = true;
$subpage = __('eHorus'); $subpage = __('eHorus');
@ -410,6 +430,10 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_netflow.php'; include_once $config['homedir'].'/godmode/setup/setup_netflow.php';
break; break;
case 'sflow':
include_once $config['homedir'].'/godmode/setup/setup_sflow.php';
break;
case 'vis': case 'vis':
include_once $config['homedir'].'/godmode/setup/setup_visuals.php'; include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
break; break;

View File

@ -43,7 +43,7 @@ if (is_ajax() === true) {
$table = new StdClass(); $table = new StdClass();
$table->data = []; $table->data = [];
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters table_result_auth'; $table->class = 'databox filters table_result_auth filter-table-adv';
$table->size['name'] = '30%'; $table->size['name'] = '30%';
$table->style['name'] = 'font-weight: bold'; $table->style['name'] = 'font-weight: bold';
@ -94,7 +94,11 @@ if (is_ajax() === true) {
'', '',
30, 30,
100, 100,
true true,
false,
false,
'',
'w400px'
); );
$table->data['ldap_server'] = $row; $table->data['ldap_server'] = $row;
@ -107,7 +111,11 @@ if (is_ajax() === true) {
'', '',
10, 10,
100, 100,
true true,
false,
false,
'',
'w400px'
); );
$table->data['ldap_port'] = $row; $table->data['ldap_port'] = $row;
@ -126,7 +134,10 @@ if (is_ajax() === true) {
'', '',
'', '',
0, 0,
true true,
false,
true,
'w400px'
); );
$table->data['ldap_version'] = $row; $table->data['ldap_version'] = $row;
@ -189,12 +200,12 @@ if (is_ajax() === true) {
$alt = '', $alt = '',
60, 60,
100, 100,
true true,
); false,
$row['control'] .= ui_print_reveal_password( false,
'ldap_admin_pass', 'w400px-important'
true
); );
$table->data['ldap_admin_pass'] = $row; $table->data['ldap_admin_pass'] = $row;
// Ldapsearch timeout. // Ldapsearch timeout.
@ -208,7 +219,11 @@ if (is_ajax() === true) {
'', '',
10, 10,
10, 10,
true true,
false,
false,
'',
'w400px'
); );
$table->data['ldap_search_timeout'] = $row; $table->data['ldap_search_timeout'] = $row;
@ -239,7 +254,11 @@ if (is_ajax() === true) {
'', '',
30, 30,
100, 100,
true true,
false,
false,
'',
'w400px'
); );
$table->data['ldap_server_secondary'] = $row; $table->data['ldap_server_secondary'] = $row;
@ -252,7 +271,11 @@ if (is_ajax() === true) {
'', '',
10, 10,
100, 100,
true true,
false,
false,
'',
'w400px'
); );
$table->data['ldap_port_secondary'] = $row; $table->data['ldap_port_secondary'] = $row;
@ -271,7 +294,10 @@ if (is_ajax() === true) {
'', '',
'', '',
0, 0,
true true,
false,
true,
'w400px'
); );
$table->data['ldap_version_secondary'] = $row; $table->data['ldap_version_secondary'] = $row;
@ -334,11 +360,10 @@ if (is_ajax() === true) {
$alt = '', $alt = '',
60, 60,
100, 100,
true true,
); false,
$row['control'] .= ui_print_reveal_password( false,
'ldap_admin_pass_secondary', 'w400px-important'
true
); );
$table->data['ldap_admin_pass_secondary'] = $row; $table->data['ldap_admin_pass_secondary'] = $row;
break; break;
@ -407,7 +432,11 @@ if (is_ajax() === true) {
'', '',
10, 10,
10, 10,
true true,
false,
false,
'',
'w400px'
); );
$table->data['session_timeout'] = $row; $table->data['session_timeout'] = $row;
@ -421,7 +450,7 @@ require_once $config['homedir'].'/include/functions_profile.php';
$table = new StdClass(); $table = new StdClass();
$table->data = []; $table->data = [];
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size['name'] = '30%'; $table->size['name'] = '30%';
$table->style['name'] = 'font-weight: bold'; $table->style['name'] = 'font-weight: bold';
@ -459,12 +488,15 @@ $row['control'] = html_print_select(
'', '',
'', '',
0, 0,
true true,
false,
true,
'w400px'
); );
$table->data['auth'] = $row; $table->data['auth'] = $row;
// Form. // Form.
echo '<form id="form_setup" method="post">'; echo '<form id="form_setup" class="max_floating_element_size" method="post">';
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
@ -478,17 +510,14 @@ html_print_csrf_hidden();
html_print_table($table); html_print_table($table);
html_print_div([ 'id' => 'table_auth_result' ]); html_print_div([ 'id' => 'table_auth_result' ]);
html_print_div( html_print_action_buttons(
[ html_print_submit_button(
'class' => 'action-buttons w100p',
'content' => html_print_submit_button(
__('Update'), __('Update'),
'update_button', 'update_button',
false, false,
[ 'icon' => 'update' ], [ 'icon' => 'update' ],
true true
), )
]
); );
echo '</form>'; echo '</form>';

View File

@ -74,52 +74,70 @@ $table_remote->data = [];
$table_remote->width = '100%'; $table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;'; $table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'ehorus-remote-setup'; $table_remote->id = 'ehorus-remote-setup';
$table_remote->class = 'databox filters'; $table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['name'] = '30%'; $table_remote->size['ehorus_hostname'] = '50%';
$table_remote->style['name'] = 'font-weight: bold'; $table_remote->size['ehorus_port'] = '50%';
$table_remote->style['control'] = 'display: flex;align-items: center;';
// Enable eHorus user configuration. // Enable eHorus user configuration.
$row = []; $row = [];
$row['name'] = ('eHorus configuration at user level'); $row['ehorus_user_level_conf'] = html_print_label_input_block(
$row['control'] = html_print_checkbox_switch('ehorus_user_level_conf', 1, $config['ehorus_user_level_conf'], true); __('eHorus configuration at user level'),
html_print_checkbox_switch(
'ehorus_user_level_conf',
1,
$config['ehorus_user_level_conf'],
true
)
);
$table_remote->data['ehorus_user_level_conf'] = $row; $table_remote->data['ehorus_user_level_conf'] = $row;
// User. // User.
$row = []; $row = [];
$row['name'] = __('User'); $row['ehorus_user'] = html_print_label_input_block(
$row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true); __('User'),
$table_remote->data['ehorus_user'] = $row; html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true),
['div_class' => 'ehorus-remote-setup-ehorus_user']
);
// Pass. // Pass.
$row = []; $row['ehorus_pass'] = html_print_label_input_block(
$row['name'] = __('Password'); __('Password'),
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true),
$row['control'] .= ui_print_reveal_password('ehorus_pass', true); ['div_class' => 'ehorus-remote-setup-ehorus_user']
);
$table_remote->data['ehorus_pass'] = $row; $table_remote->data['ehorus_pass'] = $row;
// Directory hostname. // Directory hostname.
$row = []; $row = [];
$row['name'] = __('API Hostname'); $row['ehorus_hostname'] = html_print_label_input_block(
$row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true); __('API Hostname'),
$table_remote->data['ehorus_hostname'] = $row; html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true)
);
// Directory port. // Directory port.
$row = []; $row['ehorus_port'] = html_print_label_input_block(
$row['name'] = __('API Port'); __('API Port'),
$row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true); html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true)
);
$table_remote->data['ehorus_port'] = $row; $table_remote->data['ehorus_port'] = $row;
// Request timeout. // Request timeout.
$row = []; $row = [];
$row['name'] = __('Request timeout'); $row['ehorus_req_timeout'] = html_print_label_input_block(
$row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true); __('Request timeout'),
html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true)
);
$table_remote->data['ehorus_req_timeout'] = $row; $table_remote->data['ehorus_req_timeout'] = $row;
// Test. // Test.
$row = []; $row = [];
$row['name'] = __('Test'); $test_start = '<span id="test-ehorus-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] = html_print_button( $test_start .= '<span id="test-ehorus-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$test_start .= '<span id="test-ehorus-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$test_start .= '&nbsp;<span id="test-ehorus-message" class="invisible"></span>';
$row['ehorus_test'] = html_print_label_input_block(
__('Test'),
html_print_button(
__('Start'), __('Start'),
'test-ehorus', 'test-ehorus',
false, false,
@ -127,29 +145,27 @@ $row['control'] = html_print_button(
[ [
'icon' => 'cog', 'icon' => 'cog',
'mode' => 'secondary mini', 'mode' => 'secondary mini',
'style' => 'width: 115px;',
], ],
true true
).$test_start
); );
$row['control'] .= '<span id="test-ehorus-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="test-ehorus-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '<span id="test-ehorus-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="test-ehorus-message" class="invisible"></span>';
$table_remote->data['ehorus_test'] = $row; $table_remote->data['ehorus_test'] = $row;
// Print. // Print.
echo '<div class="center pdd_b_20px mrgn_top_20px">'; echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">'; echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
if ($config['style'] === 'pandora_black' && is_metaconsole() === true) { if ($config['style'] === 'pandora_black' && is_metaconsole() === true) {
html_print_image( html_print_image(
'include/ehorus/images/ehorus-logo.png', 'include/ehorus/images/ehorus-logo.png',
false, false,
['class' => 'w400px'] ['class' => 'w400px mrgn_top_15px']
); );
} else { } else {
html_print_image( html_print_image(
'include/ehorus/images/ehorus-logo-grey.png', 'include/ehorus/images/ehorus-logo-grey.png',
false, false,
['class' => 'w400px'] ['class' => 'w400px mrgn_top_15px']
); );
} }
@ -179,7 +195,7 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
ui_print_error_message($error_message); ui_print_error_message($error_message);
} }
echo "<form method='post'>"; echo "<form method='post' class='max_floating_element_size'>";
// Form enable. // Form enable.
echo '<div id="form_enable">'; echo '<div id="form_enable">';
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
@ -195,17 +211,14 @@ echo '</div>';
echo '</fieldset>'; echo '</fieldset>';
echo '</div>'; echo '</div>';
html_print_div( html_print_action_buttons(
[ html_print_submit_button(
'class' => 'action-buttons w100p',
'content' => html_print_submit_button(
__('Update'), __('Update'),
'update_button', 'update_button',
false, false,
['icon' => 'update'], ['icon' => 'update'],
true true
), )
]
); );
echo '</form>'; echo '</form>';
@ -220,8 +233,8 @@ if(!$('input:checkbox[name="ehorus_enabled"]').is(':checked'))
if($('input:checkbox[name="ehorus_user_level_conf"]').is(':checked')) if($('input:checkbox[name="ehorus_user_level_conf"]').is(':checked'))
{ {
$('#ehorus-remote-setup-ehorus_user').hide(); $('.ehorus-remote-setup-ehorus_user').hide();
$('#ehorus-remote-setup-ehorus_pass').hide() $('.ehorus-remote-setup-ehorus_pass').hide()
} }
@ -234,13 +247,13 @@ if($('input:checkbox[name="ehorus_user_level_conf"]').is(':checked'))
} }
var hideUserPass = function () { var hideUserPass = function () {
$('#ehorus-remote-setup-ehorus_user').hide(); $('.ehorus-remote-setup-ehorus_user').hide();
$('#ehorus-remote-setup-ehorus_pass').hide(); $('.ehorus-remote-setup-ehorus_pass').hide();
} }
var showUserPass = function () { var showUserPass = function () {
$('#ehorus-remote-setup-ehorus_user').show(); $('.ehorus-remote-setup-ehorus_user').show();
$('#ehorus-remote-setup-ehorus_pass').show(); $('.ehorus-remote-setup-ehorus_pass').show();
} }
var handleEnable = function (event) { var handleEnable = function (event) {

View File

@ -403,6 +403,32 @@ $table->data[$i++][] = html_print_label_input_block(
) )
); );
$table->data[$i][] = html_print_label_input_block(
__('Enable Sflow'),
html_print_checkbox_switch_extended(
'activate_sflow',
1,
$config['activate_sflow'],
$rbt_disabled,
'',
'',
true
),
);
$table->data[$i++][] = html_print_label_input_block(
__('General network path'),
html_print_input_text(
'general_network_path',
$config['general_network_path'],
'',
40,
255,
true
)
);
$table->colspan[$i][] = 2; $table->colspan[$i][] = 2;
$table->data[$i++][] = html_print_label_input_block( $table->data[$i++][] = html_print_label_input_block(
__('Timezone setup'), __('Timezone setup'),

View File

@ -269,52 +269,102 @@ $table_remote->data = [];
$table_remote->width = '100%'; $table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;'; $table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'integria-remote-setup'; $table_remote->id = 'integria-remote-setup';
$table_remote->class = 'databox filters'; $table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['name'] = '30%'; $table_remote->size['hostname'] = '50%';
$table_remote->style['name'] = 'font-weight: bold'; $table_remote->size['api_pass'] = '50%';
$table_remote->style['control'] = 'display: flex;align-items: center;';
// Enable eHorus user configuration. // Enable Integria user configuration.
$row = []; $row = [];
$row['name'] = ('Integria configuration at user level'); $row['user_level'] = html_print_label_input_block(
$row['control'] = html_print_checkbox_switch('integria_user_level_conf', 1, $config['integria_user_level_conf'], true); __('Integria configuration at user level'),
html_print_checkbox_switch(
'integria_user_level_conf',
1,
$config['integria_user_level_conf'],
true
)
);
$table_remote->data['integria_user_level_conf'] = $row; $table_remote->data['integria_user_level_conf'] = $row;
// Integria user. // Integria user.
$row = []; $row = [];
$row['name'] = __('User'); $row['user'] = html_print_label_input_block(
$row['control'] = html_print_input_text('integria_user', $config['integria_user'], '', 30, 100, true); __('User'),
$table_remote->data['integria_user'] = $row; html_print_input_text(
'integria_user',
$config['integria_user'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_user']
);
// Integria password. // Integria password.
$row = []; $row['password'] = html_print_label_input_block(
$row['name'] = __('Password'); __('Password'),
$row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true); html_print_input_password(
$row['control'] .= ui_print_reveal_password('integria_pass', true); 'integria_pass',
io_output_password($config['integria_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_pass']
);
$table_remote->data['integria_pass'] = $row; $table_remote->data['integria_pass'] = $row;
// Integria hostname. // Integria hostname.
$row = []; $row = [];
$row['name'] = __('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true); $row['hostname'] = html_print_label_input_block(
$row['control'] = html_print_input_text('integria_hostname', $config['integria_hostname'], '', 30, 100, true); __('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true),
$table_remote->data['integria_hostname'] = $row; html_print_input_text(
'integria_hostname',
$config['integria_hostname'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_hostname']
);
// API password. // API password.
$row = []; $row['api_pass'] = html_print_label_input_block(
$row['name'] = __('API Password'); __('API Password'),
$row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true); html_print_input_password(
$row['control'] .= ui_print_reveal_password('integria_api_pass', true); 'integria_api_pass',
io_output_password($config['integria_api_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_api_pass']
);
$table_remote->data['integria_api_pass'] = $row; $table_remote->data['integria_api_pass'] = $row;
// Request timeout. // Request timeout.
$row = []; $row = [];
$row['name'] = __('Request timeout'); $row['req_timeout'] = html_print_label_input_block(
$row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true); __('Request timeout'),
html_print_input_text(
'integria_req_timeout',
$config['integria_req_timeout'],
'',
3,
10,
true
),
['div_class' => 'integria-remote-setup-integria_req_timeout']
);
$table_remote->data['integria_req_timeout'] = $row; $table_remote->data['integria_req_timeout'] = $row;
$row = []; $row = [];
$row['name'] = __('Inventory'); $row['control'] = __('Inventory');
$row['control'] = html_print_button( $row['control'] .= html_print_button(
__('Sync inventory'), __('Sync inventory'),
'sync-inventory', 'sync-inventory',
false, false,
@ -336,14 +386,15 @@ $table_alert_settings->data = [];
$table_alert_settings->width = '100%'; $table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;'; $table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'integria-cr-settings-setup'; $table_alert_settings->id = 'integria-cr-settings-setup';
$table_alert_settings->class = 'databox filters'; $table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size['name'] = '30%'; $table_alert_settings->size[0] = '50%';
$table_alert_settings->style['name'] = 'font-weight: bold'; $table_alert_settings->size[1] = '50%';
// Alert incident title. // Alert incident title.
$row = []; $row = [];
$row['name'] = __('Title'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_input_text( __('Title'),
html_print_input_text(
'incident_title', 'incident_title',
$config['incident_title'], $config['incident_title'],
__('Name'), __('Name'),
@ -352,26 +403,28 @@ $row['control'] = html_print_input_text(
true, true,
false, false,
false false
)
); );
$table_alert_settings->data['custom_response_incident_title'] = $row;
// Alert incident description. // Alert incident description.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Ticket body'); __('Ticket body'),
$row['control'] = html_print_textarea( html_print_textarea(
'incident_content', 'incident_content',
7, 3,
25, 25,
$config['incident_content'], $config['incident_content'],
'', '',
true true
)
); );
$table_alert_settings->data['custom_response_incident_content'] = $row; $table_alert_settings->data[0] = $row;
// Alert default group. // Alert default group.
$row = []; $row = [];
$row['name'] = __('Group'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_select( __('Group'),
html_print_select(
$integria_group_values, $integria_group_values,
'default_group', 'default_group',
$config['default_group'], $config['default_group'],
@ -383,13 +436,13 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_alert_settings->data['custom_response_def_group'] = $row;
// Alert default criticity. // Alert default criticity.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Priority'); __('Priority'),
$row['control'] = html_print_select( html_print_select(
$integria_criticity_values, $integria_criticity_values,
'default_criticity', 'default_criticity',
$config['default_criticity'], $config['default_criticity'],
@ -401,24 +454,30 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_alert_settings->data['custom_response_def_criticity'] = $row; $table_alert_settings->data[1] = $row;
// Alert default owner. // Alert default owner.
$row = []; $row = [];
$row['name'] = __('Owner'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_autocomplete_users_from_integria( __('Owner'),
html_print_autocomplete_users_from_integria(
'default_owner', 'default_owner',
$config['default_owner'], $config['default_owner'],
true true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
); );
$table_alert_settings->data['custom_response_def_owner'] = $row;
// Alert default incident type. // Alert default incident type.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Type'); __('Type'),
$row['control'] = html_print_select( html_print_select(
$integria_types_values, $integria_types_values,
'incident_type', 'incident_type',
$config['incident_type'], $config['incident_type'],
@ -430,13 +489,15 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_alert_settings->data['custom_response_incident_type'] = $row; $table_alert_settings->data[2] = $row;
// Alert default incident status. // Alert default incident status.
$row = []; $row = [];
$row['name'] = __('Status'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_select( __('Status'),
html_print_select(
$integria_status_values, $integria_status_values,
'incident_status', 'incident_status',
$config['incident_status'], $config['incident_status'],
@ -448,8 +509,9 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_alert_settings->data['custom_response_incident_status'] = $row; $table_alert_settings->data[3] = $row;
// Custom response settings. // Custom response settings.
$table_cr_settings = new StdClass(); $table_cr_settings = new StdClass();
@ -457,14 +519,15 @@ $table_cr_settings->data = [];
$table_cr_settings->width = '100%'; $table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;'; $table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'integria-cr-settings-setup'; $table_cr_settings->id = 'integria-cr-settings-setup';
$table_cr_settings->class = 'databox filters'; $table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size['name'] = '30%'; $table_cr_settings->size[0] = '50%';
$table_cr_settings->style['name'] = 'font-weight: bold'; $table_cr_settings->size[1] = '50%';
// Custom response incident title. // Custom response incident title.
$row = []; $row = [];
$row['name'] = __('Title'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_input_text( __('Title'),
html_print_input_text(
'cr_incident_title', 'cr_incident_title',
$config['cr_incident_title'], $config['cr_incident_title'],
__('Name'), __('Name'),
@ -473,27 +536,29 @@ $row['control'] = html_print_input_text(
true, true,
false, false,
false false
)
); );
$table_cr_settings->data['custom_response_incident_title'] = $row;
// Custom response incident description. // Custom response incident description.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Ticket body'); __('Ticket body'),
$row['control'] = html_print_textarea( html_print_textarea(
'cr_incident_content', 'cr_incident_content',
7, 3,
25, 25,
$config['cr_incident_content'], $config['cr_incident_content'],
'', '',
true true
)
); );
$table_cr_settings->data['custom_response_incident_content'] = $row; $table_cr_settings->data[0] = $row;
// Custom response default group. // Custom response default group.
$row = []; $row = [];
$row['name'] = __('Group'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_select( __('Group'),
html_print_select(
$integria_group_values, $integria_group_values,
'cr_default_group', 'cr_default_group',
$config['cr_default_group'], $config['cr_default_group'],
@ -505,13 +570,13 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_cr_settings->data['custom_response_def_group'] = $row;
// Custom response default criticity. // Custom response default criticity.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Priority'); __('Priority'),
$row['control'] = html_print_select( html_print_select(
$integria_criticity_values, $integria_criticity_values,
'cr_default_criticity', 'cr_default_criticity',
$config['cr_default_criticity'], $config['cr_default_criticity'],
@ -523,24 +588,30 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_cr_settings->data['custom_response_def_criticity'] = $row; $table_cr_settings->data[1] = $row;
// Custom response default owner. // Custom response default owner.
$row = []; $row = [];
$row['name'] = __('Owner'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_autocomplete_users_from_integria( __('Owner'),
html_print_autocomplete_users_from_integria(
'cr_default_owner', 'cr_default_owner',
$config['cr_default_owner'], $config['cr_default_owner'],
true true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
); );
$table_cr_settings->data['custom_response_def_owner'] = $row;
// Custom response default incident type. // Custom response default incident type.
$row = []; $row[1] = html_print_label_input_block(
$row['name'] = __('Type'); __('Type'),
$row['control'] = html_print_select( html_print_select(
$integria_types_values, $integria_types_values,
'cr_incident_type', 'cr_incident_type',
$config['cr_incident_type'], $config['cr_incident_type'],
@ -552,13 +623,15 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_cr_settings->data['custom_response_incident_type'] = $row; $table_cr_settings->data[2] = $row;
// Custom response default incident status. // Custom response default incident status.
$row = []; $row = [];
$row['name'] = __('Status'); $row[0] = html_print_label_input_block(
$row['control'] = html_print_select( __('Status'),
html_print_select(
$integria_status_values, $integria_status_values,
'cr_incident_status', 'cr_incident_status',
$config['cr_incident_status'], $config['cr_incident_status'],
@ -570,13 +643,14 @@ $row['control'] = html_print_select(
true, true,
'', '',
false false
)
); );
$table_cr_settings->data['custom_response_incident_status'] = $row; $table_cr_settings->data[3] = $row;
// Test. // Test.
$row = []; $row = [];
$row['name'] = __('Test'); $row['control'] = __('Test');
$row['control'] = html_print_button( $row['control'] .= html_print_button(
__('Start'), __('Start'),
'test-integria', 'test-integria',
false, false,
@ -594,12 +668,12 @@ $row['control'] .= '&nbsp;<span id="test-integria-message" class="invisible"></s
$table_remote->data['integria_test'] = $row; $table_remote->data['integria_test'] = $row;
// Print. // Print.
echo '<div class="center pdd_b_20px mrgn_top_20px">'; echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">'; echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
html_print_image( html_print_image(
'images/integria_logo.svg', 'images/integria_logo.svg',
false, false,
['class' => 'w400px' ] ['class' => 'w400px mrgn_top_15px']
); );
echo '</a>'; echo '</a>';
echo '<br />'; echo '<br />';
@ -611,7 +685,7 @@ echo 'https://integriaims.com';
echo '</a>'; echo '</a>';
echo '</div>'; echo '</div>';
echo "<form method='post'>"; echo "<form method='post' class='max_floating_element_size'>";
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
// Form enable. // Form enable.
@ -632,7 +706,7 @@ echo '</div>';
if ($has_connection != false) { if ($has_connection != false) {
// Form alert default settings. // Form alert default settings.
echo '<div id="form_alert_settings">'; echo '<div id="form_alert_settings">';
echo '<fieldset>'; echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>'; echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings); html_print_table($table_alert_settings);
@ -642,7 +716,7 @@ if ($has_connection != false) {
// Form custom response default settings. // Form custom response default settings.
echo '<div id="form_custom_response_settings">'; echo '<div id="form_custom_response_settings">';
echo '<fieldset>'; echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>'; echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings); html_print_table($table_cr_settings);
@ -650,33 +724,24 @@ if ($has_connection != false) {
echo '</fieldset>'; echo '</fieldset>';
echo '</div>'; echo '</div>';
html_print_div( $update_button = html_print_submit_button(
[
'class' => 'action-buttons w100p',
'content' => html_print_submit_button(
__('Update'), __('Update'),
'update_button', 'update_button',
false, false,
['icon' => 'update'], ['icon' => 'update'],
true true
),
]
); );
} else { } else {
html_print_div( $update_button = html_print_submit_button(
[
'class' => 'action-buttons w100p',
'content' => html_print_submit_button(
__('Update and continue'), __('Update and continue'),
'update_button', 'update_button',
false, false,
['icon' => 'update'], ['icon' => 'update'],
true true
),
]
); );
} }
html_print_action_buttons($update_button);
echo '</form>'; echo '</form>';
@ -686,8 +751,8 @@ echo '</form>';
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked')) if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
{ {
$('#integria-remote-setup-integria_user').hide(); $('.integria-remote-setup-integria_user').hide();
$('#integria-remote-setup-integria_pass').hide() $('.integria-remote-setup-integria_pass').hide()
} }
var handleUserLevel = function(event) { var handleUserLevel = function(event) {
@ -726,13 +791,13 @@ echo '</form>';
} }
var hideUserPass = function () { var hideUserPass = function () {
$('#integria-remote-setup-integria_user').hide(); $('.integria-remote-setup-integria_user').hide();
$('#integria-remote-setup-integria_pass').hide(); $('.integria-remote-setup-integria_pass').hide();
} }
var showUserPass = function () { var showUserPass = function () {
$('#integria-remote-setup-integria_user').show(); $('.integria-remote-setup-integria_user').show();
$('#integria-remote-setup-integria_pass').show(); $('.integria-remote-setup-integria_pass').show();
} }
var handleEnable = function (event) { var handleEnable = function (event) {

View File

@ -43,7 +43,7 @@ $table->data = [];
$table->data[0][] = html_print_label_input_block( $table->data[0][] = html_print_label_input_block(
__('Data storage path'), __('Data storage path'),
html_print_input_text('netflow_path', $config['netflow_path'], false, 50, 200, true) html_print_input_text('netflow_name_dir', $config['netflow_name_dir'], false, 50, 200, true)
); );
$table->data[0][] = html_print_label_input_block( $table->data[0][] = html_print_label_input_block(
@ -100,3 +100,9 @@ html_print_action_buttons(
) )
); );
echo '</form>'; echo '</form>';
?>
<script>
$("input[name=netflow_name_dir]").on("input", function() {
$(this).val($(this).val().replace(/[^a-z0-9]/gi, ""));
});
</script>

View File

@ -0,0 +1,108 @@
<?php
/**
* Setup view for sflow
*
* @category Setup
* @package Pandora FMS
* @subpackage Configuration
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once 'include/functions_ui.php';
check_login();
$update = (bool) get_parameter('update');
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filter-table-adv';
$table->data = [];
$table->data[0][] = html_print_label_input_block(
__('Data storage path'),
html_print_input_text('sflow_name_dir', $config['sflow_name_dir'], false, 50, 200, true)
);
$table->data[0][] = html_print_label_input_block(
__('Daemon interval'),
html_print_input_text('sflow_interval', $config['sflow_interval'], false, 50, 200, true)
);
$table->data[1][] = html_print_label_input_block(
__('Daemon binary path'),
html_print_input_text('sflow_daemon', $config['sflow_daemon'], false, 50, 200, true)
);
$table->data[1][] = html_print_label_input_block(
__('Nfdump binary path'),
html_print_input_text('sflow_nfdump', $config['sflow_nfdump'], false, 50, 200, true)
);
$table->data[2][] = html_print_label_input_block(
__('Nfexpire binary path'),
html_print_input_text('sflow_nfexpire', $config['sflow_nfexpire'], false, 50, 200, true)
);
$table->data[2][] = html_print_label_input_block(
__('Maximum chart resolution'),
html_print_input_text('sflow_max_resolution', $config['sflow_max_resolution'], false, 50, 200, true)
);
$table->data[3][] = html_print_label_input_block(
__('Disable custom live view filters'),
html_print_checkbox_switch('sflow_disable_custom_lvfilters', 1, $config['sflow_disable_custom_lvfilters'], true)
);
$table->data[3][] = html_print_label_input_block(
__('Sflow max lifetime'),
html_print_input_text('sflow_max_lifetime', $config['sflow_max_lifetime'], false, 50, 200, true)
);
$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
$table->data[4][] = html_print_label_input_block(
__('Name resolution for IP address'),
html_print_checkbox_switch_extended('sflow_get_ip_hostname', 1, $config['sflow_get_ip_hostname'], false, $onclick, '', true)
);
echo '<form class="max_floating_element_size" id="sflow_setup" method="post">';
html_print_table($table);
html_print_input_hidden('update_config', 1);
html_print_action_buttons(
html_print_submit_button(
__('Update'),
'upd_button',
false,
['icon' => 'update'],
true
)
);
echo '</form>';
?>
<script>
$("input[name=sflow_name_dir]").on("input", function() {
$(this).val($(this).val().replace(/[^a-z0-9]/gi, ""));
});
</script>

View File

@ -50,7 +50,7 @@ try {
[ [
'id' => $tableId, 'id' => $tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 100%', 'style' => 'width: 99%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'include/ajax/update_manager', 'ajax_url' => 'include/ajax/update_manager',
@ -66,12 +66,13 @@ try {
[ [
'label' => __('Free search'), 'label' => __('Free search'),
'type' => 'text', 'type' => 'text',
'class' => 'mw250px', 'class' => 'w400px',
'id' => 'free_search', 'id' => 'free_search',
'name' => 'free_search', 'name' => 'free_search',
], ],
], ],
], ],
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ',
] ]
); );
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -256,20 +256,20 @@ if ((bool) is_metaconsole() === true) {
); );
} }
echo '<form method="post" action="'.$action.'">'; echo '<form method="post" action="'.$action.'" class="max_floating_element_size">';
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$i = 0; $table->size[1] = '50%';
$table->style[$i] = 'font-weight: bolder;width:250px';
$url_update_manager = update_manager_get_url(); $url_update_manager = update_manager_get_url();
$table->data[$i][0] = __('Warp Update URL'); $table->data[0][0] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input_text( __('Warp Update URL'),
html_print_input_text(
'url_update_manager', 'url_update_manager',
$url_update_manager, $url_update_manager,
__('URL update manager'), __('URL update manager'),
@ -277,112 +277,137 @@ $table->data[$i++][1] = html_print_input_text(
255, 255,
true, true,
true true
)
); );
$table->data[$i][0] = __('Use secured Warp Update'); $table->data[0][1] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input( __('Use secured Warp Update'),
html_print_input(
[ [
'type' => 'switch', 'type' => 'switch',
'name' => 'secure_update_manager', 'name' => 'secure_update_manager',
'value' => ($secure_update_manager ?? 1), 'value' => ($secure_update_manager ?? 1),
] ]
)
); );
$table->data[$i][0] = __('Proxy server'); $table->data[1][0] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input_text( __('Proxy server'),
html_print_input_text(
'update_manager_proxy_server', 'update_manager_proxy_server',
$update_manager_proxy_server, $update_manager_proxy_server,
__('Proxy server'), __('Proxy server'),
80, 80,
60, 60,
true true
)
); );
$table->data[$i][0] = __('Proxy port'); $table->data[1][1] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input_text( __('Proxy port'),
html_print_input_text(
'update_manager_proxy_port', 'update_manager_proxy_port',
$update_manager_proxy_port, $update_manager_proxy_port,
__('Proxy port'), __('Proxy port'),
80, 80,
60, 60,
true true
)
); );
$table->data[$i][0] = __('Proxy user'); $table->data[2][0] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input_text( __('Proxy user'),
html_print_input_text(
'update_manager_proxy_user', 'update_manager_proxy_user',
$update_manager_proxy_user, $update_manager_proxy_user,
__('Proxy user'), __('Proxy user'),
80, 80,
60, 60,
true true
)
); );
$table->data[$i][0] = __('Proxy password'); $table->data[2][1] = html_print_label_input_block(
$table->data[$i++][1] = html_print_input_password( __('Proxy password'),
html_print_input_password(
'update_manager_proxy_password', 'update_manager_proxy_password',
$update_manager_proxy_password, $update_manager_proxy_password,
__('Proxy password'), __('Proxy password'),
80, 80,
60, 60,
true true
)
); );
$table->data[$i][0] = __('Allow no-consecutive patches'); $table->data[3][0] = html_print_label_input_block(
$table->data[$i++][1] = html_print_switch( __('Allow no-consecutive patches'),
html_print_switch(
[ [
'name' => 'allow_offline_patches', 'name' => 'allow_offline_patches',
'value' => $allow_offline_patches, 'value' => $allow_offline_patches,
'return' => true, 'return' => true,
] ]
)
); );
$table->data[$i][0] = __('Limit to LTS updates'); $table->data[3][1] = html_print_label_input_block(
$table->data[$i++][1] = html_print_switch( __('Limit to LTS updates'),
html_print_switch(
[ [
'name' => 'lts_updates', 'name' => 'lts_updates',
'value' => $lts_updates, 'value' => $lts_updates,
'return' => true, 'return' => true,
] ]
)
); );
$table->data[4][0] = html_print_label_input_block(
$table->data[$i][0] = __('Registration ID'); __('Registration ID'),
$table->data[$i++][1] = '<i>'.($config['pandora_uid'] ?? __('Not registred yet')).'</i>'; '<i>'.($config['pandora_uid'] ?? __('Not registred yet')).'</i>'
);
if (update_manager_verify_registration() === true && users_is_admin()) { if (update_manager_verify_registration() === true && users_is_admin()) {
$table->data[$i][0] = __('Cancel registration'); $url = '<a href="';
$table->data[$i][1] = '<a href="';
if ((bool) is_metaconsole() === true) { if ((bool) is_metaconsole() === true) {
$table->data[$i][1] .= ui_get_full_url( $url .= ui_get_full_url(
'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1' 'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1'
); );
} else { } else {
$table->data[$i][1] .= ui_get_full_url( $url .= ui_get_full_url(
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1' 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1'
); );
} }
$table->data[$i++][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>'; $url .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').'</a>';
$table->data[4][1] = html_print_label_input_block(
__('Cancel registration'),
$url
);
} }
if (license_free()) { if (license_free()) {
$config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1; $config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1;
$table->data[$i][0] = __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true);
$table->data[$i][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'&nbsp;&nbsp;'; $table->data[4][1] = html_print_label_input_block(
$table->data[$i++][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true),
'<div class="inline-radio-button">
'.__('Yes').html_print_radio_button('realtimestats', 1, '', $config['realtimestats'], true).'&nbsp;&nbsp;
'.__('No').html_print_radio_button('realtimestats', 0, '', $config['realtimestats'], true).'</div>'
);
} }
html_print_input_hidden('action_update_url_update_manager', 1); html_print_input_hidden('action_update_url_update_manager', 1);
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; html_print_action_buttons(
html_print_submit_button( html_print_submit_button(
__('Update'), __('Update'),
'update_button', 'update_button',
false, false,
'class="sub upd"' ['icon' => 'wand'],
true
)
); );
echo '</div>';
echo '</form>'; echo '</form>';

View File

@ -393,6 +393,7 @@ if ($create_user === true) {
$values['default_event_filter'] = (int) get_parameter('default_event_filter'); $values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view'); $values['default_custom_view'] = (int) get_parameter('default_custom_view');
$values['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0); $values['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
$values['show_tips_startup'] = (int) get_parameter_switch('show_tips_startup');
$dashboard = get_parameter('dashboard', ''); $dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', ''); $visual_console = get_parameter('visual_console', '');

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View File

@ -216,11 +216,8 @@ if ($get_double_auth_info_page) {
$html .= '</p>'; $html .= '</p>';
$html .= '</div>'; $html .= '</div>';
$html .= '<br>'; $html .= '<br>';
$html .= '<div class="center_align">'; $html .= '<div class="flex flex-space-around">';
$html .= html_print_button(__('Download the app'), 'google_authenticator_download', false, '', '', true); $html .= html_print_button(__('Download the app'), 'google_authenticator_download', false, '', '', true);
$html .= '</div>';
$html .= '<br>';
$html .= '<div class="center_align">';
$html .= html_print_button(__('Continue'), 'continue_to_generate', false, '', '', true); $html .= html_print_button(__('Continue'), 'continue_to_generate', false, '', '', true);
$html .= '</div>'; $html .= '</div>';
@ -311,11 +308,11 @@ if ($get_double_auth_generation_page) {
$html .= '<br>'; $html .= '<br>';
$html .= __('QR').': <br>'; $html .= __('QR').': <br>';
$html .= '<div id="qr-container"></div>'; $html .= '<div id="qr-container"></div>';
$html .= '<br>'; $html .= '<br><div class="flex flex-space-around">';
$html .= html_print_button(__('Refresh code'), 'continue_to_generate', false, '', '', true); $html .= html_print_button(__('Refresh code'), 'continue_to_generate', false, '', '', true);
$html .= '&nbsp;';
$html .= html_print_button(__('Continue'), 'continue_to_validate', false, '', '', true); $html .= html_print_button(__('Continue'), 'continue_to_validate', false, '', '', true);
$html .= '</div>'; $html .= '</div>';
$html .= '</div>';
ob_clean(); ob_clean();
?> ?>
@ -453,7 +450,7 @@ if ($get_double_auth_validation_page) {
$html .= html_print_input_text('code', '', '', 50, $secret_lenght, true); $html .= html_print_input_text('code', '', '', 50, $secret_lenght, true);
$html .= '<div id="code_input_message" class="red"></div>'; $html .= '<div id="code_input_message" class="red"></div>';
$html .= '<br><br>'; $html .= '<br><br>';
$html .= '<div id="button-container">'; $html .= '<div id="button-container" class="flex flex-space-around">';
$html .= html_print_button(__('Validate code'), 'continue_to_validate', false, '', '', true); $html .= html_print_button(__('Validate code'), 'continue_to_validate', false, '', '', true);
$html .= html_print_image('images/spinner.gif', true); $html .= html_print_image('images/spinner.gif', true);
$html .= '</div>'; $html .= '</div>';

View File

@ -91,9 +91,8 @@ $node_id = (int) get_parameter('node_id', 0);
if ($get_comments === true) { if ($get_comments === true) {
$event = get_parameter('event', false); $event = get_parameter('event', false);
$event_rep = (int) get_parameter('event_rep', 0); $event_rep = (int) get_parameter_post('event')['event_rep'];
$event_rep = get_parameter_post('event')['event_rep']; $group_rep = (int) get_parameter_post('event')['group_rep'];
$group_rep = get_parameter_post('event')['group_rep'];
if ($event === false) { if ($event === false) {
return __('Failed to retrieve comments'); return __('Failed to retrieve comments');
@ -126,7 +125,7 @@ if ($get_comments === true) {
} else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) { } else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped = sprintf( $whereGrouped = sprintf(
'`id_extra` = "%s"', '`id_extra` = "%s"',
$event['id_extra'] io_safe_output($event['id_extra'])
); );
} else { } else {
$whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']); $whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']);

View File

@ -1390,7 +1390,7 @@ if (check_login()) {
false, false,
'offset', 'offset',
true, true,
'pagination-bottom', '',
'pagination_list_modules(offset_param)', 'pagination_list_modules(offset_param)',
[ [
'count' => '', 'count' => '',
@ -1692,6 +1692,18 @@ if (check_login()) {
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND '; $where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
} }
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
$status = implode(',', $expl);
}
$where .= sprintf( $where .= sprintf(
'tagente_estado.estado IN (%s) 'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0', AND tagente_modulo.delete_pending = 0',

View File

@ -234,7 +234,7 @@ class ExternalTools extends HTML
'images/change-active.svg', 'images/change-active.svg',
true, true,
[ [
'id' => 'button_sound_warning', 'id' => 'button_sound_alert',
'style' => 'vertical-align: middle; margin-left: 10px', 'style' => 'vertical-align: middle; margin-left: 10px',
'width' => '16', 'width' => '16',
'title' => __('Play sound'), 'title' => __('Play sound'),
@ -269,7 +269,7 @@ class ExternalTools extends HTML
'images/change-active.svg', 'images/change-active.svg',
true, true,
[ [
'id' => 'button_sound_warning', 'id' => 'button_sound_critical',
'style' => 'vertical-align: middle; margin-left: 10px', 'style' => 'vertical-align: middle; margin-left: 10px',
'width' => '16', 'width' => '16',
'title' => __('Play sound'), 'title' => __('Play sound'),

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC230322'; $build_version = 'PC230327';
$pandora_version = 'v7.0NG.769'; $pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
@ -153,6 +153,19 @@ if (! defined('ENTERPRISE_DIR')) {
} }
db_select_engine(); db_select_engine();
if (empty($config['remote_config']) === false
&& file_exists($config['remote_config'].'/conf/'.PANDORA_HA_FILE)
&& filesize($config['remote_config'].'/conf/'.PANDORA_HA_FILE) > 0
) {
$data = file_get_contents($config['remote_config'].'/conf/'.PANDORA_HA_FILE);
if (empty($data) === false) {
$ip_list = explode(',', $data);
// Connects to the first pandora_ha_dbs.conf database.
$config['dbhost'] = trim($ip_list[0]);
}
}
$config['dbconnection'] = db_connect(); $config['dbconnection'] = db_connect();
require_once $ownDir.'functions_config.php'; require_once $ownDir.'functions_config.php';

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Constants definitions. * Constants definitions.
* *
@ -703,6 +704,11 @@ define('HA_ACTION_ENABLE', 6);
define('HA_ACTION_CLEANUP', 7); define('HA_ACTION_CLEANUP', 7);
define('HA_ACTION_RESYNC', 8); define('HA_ACTION_RESYNC', 8);
define('HA_RESYNC', 1);
define('HA_DISABLE', 5);
define('HA_ENABLE', 6);
define('HA_UNINITIALIZED', 0); define('HA_UNINITIALIZED', 0);
define('HA_ONLINE', 1); define('HA_ONLINE', 1);
define('HA_PENDING', 2); define('HA_PENDING', 2);
@ -864,6 +870,8 @@ define(
// Pandora FMS Enterprise license. // Pandora FMS Enterprise license.
define('LICENSE_FILE', 'customer_key'); define('LICENSE_FILE', 'customer_key');
// Pandora HA database list.
define('PANDORA_HA_FILE', 'pandora_ha_hosts.conf');
// Home screen values for user definition. // Home screen values for user definition.
define('HOME_SCREEN_DEFAULT', 'default'); define('HOME_SCREEN_DEFAULT', 'default');

View File

@ -260,6 +260,24 @@ function config_update_config()
$error_update[] = __('Enable Netflow'); $error_update[] = __('Enable Netflow');
} }
if (config_update_value('activate_sflow', (bool) get_parameter('activate_sflow'), true) === false) {
$error_update[] = __('Enable Sflow');
}
if (config_update_value('general_network_path', get_parameter('general_network_path'), true) === false) {
$error_update[] = __('General network path');
} else {
if (empty($config['netflow_name_dir']) === false && $config['netflow_name_dir'] !== '') {
$path = get_parameter('general_network_path');
config_update_value('netflow_path', $path.$config['netflow_name_dir']);
}
if (empty($config['sflow_name_dir']) === false && $config['sflow_name_dir'] !== '') {
$path = get_parameter('general_network_path');
config_update_value('sflow_path', $path.$config['sflow_name_dir']);
}
}
$timezone = (string) get_parameter('timezone'); $timezone = (string) get_parameter('timezone');
if (empty($timezone) === true || config_update_value('timezone', $timezone, true) === false) { if (empty($timezone) === true || config_update_value('timezone', $timezone, true) === false) {
$error_update[] = __('Timezone setup'); $error_update[] = __('Timezone setup');
@ -456,6 +474,10 @@ function config_update_config()
$error_update[] = __('Enable Update Manager'); $error_update[] = __('Enable Update Manager');
} }
if (config_update_value('legacy_database_ha', get_parameter('legacy_database_ha'), true) === false) {
$error_update[] = __('Legacy database HA');
}
if (config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'), true) === false) { if (config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'), true) === false) {
$error_update[] = __('Ipam Ocuppied Manager Critical'); $error_update[] = __('Ipam Ocuppied Manager Critical');
} }
@ -1501,8 +1523,13 @@ function config_update_config()
break; break;
case 'net': case 'net':
if (config_update_value('netflow_path', get_parameter('netflow_path'), true) === false) { if (config_update_value('netflow_name_dir', get_parameter('netflow_name_dir'), true) === false) {
$error_update[] = __('Data storage path'); $error_update[] = __('Name storage path');
} else {
if (empty($config['general_network_path']) === false && $config['general_network_path'] !== '') {
$name = get_parameter('netflow_name_dir');
config_update_value('netflow_path', $config['general_network_path'].$name);
}
} }
if (config_update_value('netflow_interval', (int) get_parameter('netflow_interval'), true) === false) { if (config_update_value('netflow_interval', (int) get_parameter('netflow_interval'), true) === false) {
@ -1538,6 +1565,49 @@ function config_update_config()
} }
break; break;
case 'sflow':
if (config_update_value('sflow_name_dir', get_parameter('sflow_name_dir'), true) === false) {
$error_update[] = __('Sflow name dir');
} else {
if (empty($config['general_network_path']) === false && $config['general_network_path'] !== '') {
$name = get_parameter('sflow_name_dir');
config_update_value('sflow_path', $config['general_network_path'].$name);
}
}
if (config_update_value('sflow_interval', (int) get_parameter('sflow_interval'), true) === false) {
$error_update[] = __('Daemon interval');
}
if (config_update_value('sflow_daemon', get_parameter('sflow_daemon'), true) === false) {
$error_update[] = __('Daemon binary path');
}
if (config_update_value('sflow_nfdump', get_parameter('sflow_nfdump'), true) === false) {
$error_update[] = __('Nfdump binary path');
}
if (config_update_value('sflow_nfexpire', get_parameter('sflow_nfexpire'), true) === false) {
$error_update[] = __('Nfexpire binary path');
}
if (config_update_value('sflow_max_resolution', (int) get_parameter('sflow_max_resolution'), true) === false) {
$error_update[] = __('Maximum chart resolution');
}
if (config_update_value('sflow_disable_custom_lvfilters', get_parameter('sflow_disable_custom_lvfilters'), true) === false) {
$error_update[] = __('Disable custom live view filters');
}
if (config_update_value('sflow_max_lifetime', (int) get_parameter('sflow_max_lifetime'), true) === false) {
$error_update[] = __('Sflow max lifetime');
}
if (config_update_value('sflow_get_ip_hostname', (int) get_parameter('sflow_get_ip_hostname'), true) === false) {
$error_update[] = __('Name resolution for IP address');
}
break;
case 'log': case 'log':
if (config_update_value('elasticsearch_ip', get_parameter('elasticsearch_ip'), true) === false) { if (config_update_value('elasticsearch_ip', get_parameter('elasticsearch_ip'), true) === false) {
$error_update[] = __('IP ElasticSearch server'); $error_update[] = __('IP ElasticSearch server');
@ -2237,6 +2307,10 @@ function config_process_config()
config_update_value('enable_update_manager', 1); config_update_value('enable_update_manager', 1);
} }
if (!isset($config['legacy_database_ha'])) {
config_update_value('legacy_database_ha', 0);
}
if (!isset($config['disabled_newsletter'])) { if (!isset($config['disabled_newsletter'])) {
config_update_value('disabled_newsletter', 0); config_update_value('disabled_newsletter', 0);
} }
@ -2557,7 +2631,7 @@ function config_process_config()
} }
if (!isset($config['custom_logo_login'])) { if (!isset($config['custom_logo_login'])) {
config_update_value('custom_logo_login', 'login_logo_v7.png'); config_update_value('custom_logo_login', 'Pandora-FMS-1.png');
} }
if (!isset($config['custom_splash_login'])) { if (!isset($config['custom_splash_login'])) {
@ -2597,7 +2671,7 @@ function config_process_config()
} }
if (!isset($config['custom_title1_login'])) { if (!isset($config['custom_title1_login'])) {
config_update_value('custom_title1_login', __('ONE TOOL TO MONITOR THEM ALL')); config_update_value('custom_title1_login', __('ONE TOOL TO RULE THEM ALL'));
} }
if (!isset($config['custom_title2_login'])) { if (!isset($config['custom_title2_login'])) {
@ -2621,7 +2695,7 @@ function config_process_config()
} }
if (!isset($config['background_opacity'])) { if (!isset($config['background_opacity'])) {
config_update_value('background_opacity', 30); config_update_value('background_opacity', 20);
} }
if (!isset($config['meta_background_opacity'])) { if (!isset($config['meta_background_opacity'])) {
@ -2641,7 +2715,7 @@ function config_process_config()
} }
if (!isset($config['meta_custom_logo_login'])) { if (!isset($config['meta_custom_logo_login'])) {
config_update_value('meta_custom_logo_login', 'pandora_logo.png'); config_update_value('meta_custom_logo_login', 'Pandora-FMS-1.png');
} }
if (!isset($config['meta_custom_splash_login'])) { if (!isset($config['meta_custom_splash_login'])) {
@ -2649,7 +2723,7 @@ function config_process_config()
} }
if (!isset($config['meta_custom_title1_login'])) { if (!isset($config['meta_custom_title1_login'])) {
config_update_value('meta_custom_title1_login', __('ONE TOOL TO MONITOR THEM ALL')); config_update_value('meta_custom_title1_login', __('ONE TOOL TO RULE THEM ALL'));
} }
if (!isset($config['meta_custom_title2_login'])) { if (!isset($config['meta_custom_title2_login'])) {
@ -2768,6 +2842,28 @@ function config_process_config()
config_update_value('activate_netflow', 0); config_update_value('activate_netflow', 0);
} }
if (!isset($config['activate_sflow'])) {
config_update_value('activate_sflow', 0);
}
if (!isset($config['general_network_path'])) {
if ($is_windows) {
$default = 'C:\PandoraFMS\Pandora_Server\data_in\\';
} else {
$default = '/var/spool/pandora/data_in/';
}
config_update_value('general_network_path', $default);
}
if (!isset($config['netflow_name_dir'])) {
config_update_value('netflow_name_dir', 'netflow');
}
if (!isset($config['sflow_name_dir'])) {
config_update_value('sflow_name_dir', 'sflow');
}
if (!isset($config['netflow_path'])) { if (!isset($config['netflow_path'])) {
if ($is_windows) { if ($is_windows) {
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow'; $default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';
@ -2806,6 +2902,48 @@ function config_process_config()
config_update_value('netflow_max_lifetime', '5'); config_update_value('netflow_max_lifetime', '5');
} }
if (!isset($config['sflow_interval'])) {
config_update_value('sflow_interval', SECONDS_10MINUTES);
}
if (!isset($config['sflow_daemon'])) {
config_update_value('sflow_daemon', '/usr/bin/sfcapd');
}
if (!isset($config['sflow_nfdump'])) {
config_update_value('sflow_nfdump', '/usr/bin/nfdump');
}
if (!isset($config['sflow_nfexpire'])) {
config_update_value('sflow_nfexpire', '/usr/bin/nfexpire');
}
if (!isset($config['sflow_max_resolution'])) {
config_update_value('sflow_max_resolution', '50');
}
if (!isset($config['sflow_disable_custom_lvfilters'])) {
config_update_value('sflow_disable_custom_lvfilters', 0);
}
if (!isset($config['sflow_max_lifetime'])) {
config_update_value('sflow_max_lifetime', '5');
}
if (!isset($config['sflow_name_dir'])) {
config_update_value('sflow_name_dir', 'sflow');
}
if (!isset($config['sflow_path'])) {
if ($is_windows) {
$default = 'C:\PandoraFMS\Pandora_Server\data_in\sflow';
} else {
$default = '/var/spool/pandora/data_in/sflow';
}
config_update_value('sflow_path', $default);
}
if (!isset($config['auth'])) { if (!isset($config['auth'])) {
config_update_value('auth', 'mysql'); config_update_value('auth', 'mysql');
} }

View File

@ -1494,7 +1494,8 @@ function events_get_all(
break; break;
case EVENT_GROUP_REP_EXTRAIDS: case EVENT_GROUP_REP_EXTRAIDS:
// Group by events. // Group by events and ignore null.
$sql_filters[] = 'AND te.id_extra IS NOT NULL AND te.id_extra <> ""';
$group_by .= 'te.id_extra'; $group_by .= 'te.id_extra';
break; break;
} }

View File

@ -626,7 +626,7 @@ function filemanager_file_explorer(
$table->width = '100%'; $table->width = '100%';
$table->id = 'table_filemanager'; $table->id = 'table_filemanager';
$table->class = (is_metaconsole() === true) ? 'databox_tactical' : 'info_table'; $table->class = 'info_table';
$table->title = '<span>'.__('Index of %s', $relative_directory).'</span>'; $table->title = '<span>'.__('Index of %s', $relative_directory).'</span>';
$table->colspan = []; $table->colspan = [];
$table->data = []; $table->data = [];
@ -751,7 +751,7 @@ function filemanager_file_explorer(
&& ($readOnly === false) && ($readOnly === false)
) { ) {
$data[4] .= '<form method="post" action="'.$url.'" style="">'; $data[4] .= '<form method="post" action="'.$url.'" style="">';
$data[4] .= '<input type="image" style="margin-top: 2px;height:21px" class="invert_filter" src="images/delete.svg" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; $data[4] .= '<input type="image" style="margin-top: 2px;height:21px" class="invert_filter main_menu_icon" src="../../images/delete.svg" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('filename', $fileinfo['realpath'], true); $data[4] .= html_print_input_hidden('filename', $fileinfo['realpath'], true);
$data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'].$config['server_unique_identifier']), true); $data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'].$config['server_unique_identifier']), true);
$data[4] .= html_print_input_hidden('delete_file', 1, true); $data[4] .= html_print_input_hidden('delete_file', 1, true);
@ -896,7 +896,7 @@ function filemanager_file_explorer(
$uploadFileElements .= html_print_input_hidden('upload_file', 1, true); $uploadFileElements .= html_print_input_hidden('upload_file', 1, true);
} }
$uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true); $uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, [ 'class' => 'submitButton', 'style' => 'float:right; margin-top: 10px;', 'icon' => 'next'], true);
$uploadFileElements .= html_print_input_hidden('real_directory', $real_directory, true); $uploadFileElements .= html_print_input_hidden('real_directory', $real_directory, true);
$uploadFileElements .= html_print_input_hidden('directory', $relative_directory, true); $uploadFileElements .= html_print_input_hidden('directory', $relative_directory, true);
$uploadFileElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true); $uploadFileElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true);

View File

@ -3261,6 +3261,7 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
'onkeyup', 'onkeyup',
'class', 'class',
'form', 'form',
'disabled',
]; ];
foreach ($attrs as $attribute) { foreach ($attrs as $attribute) {
@ -4787,13 +4788,16 @@ function html_print_input_file($name, $return=false, $options=false)
if (isset($options['accept']) === true) { if (isset($options['accept']) === true) {
$output .= ' accept="'.$options['accept'].'"'; $output .= ' accept="'.$options['accept'].'"';
} }
$label = '';
if (isset($options['label']) === true) {
$label = $options['label'];
}
} }
// Close input. // Close input.
$output .= '/>'; $output .= '/>';
if (is_metaconsole() === false) {
$output .= ($options['caption'] ?? __('Select a file')); $output .= ($options['caption'] ?? __('Select a file'));
}
$output .= '</label>'; $output .= '</label>';
$output .= '<span class="inputFileSpan" id="span-'.$name.'">&nbsp;</span>'; $output .= '<span class="inputFileSpan" id="span-'.$name.'">&nbsp;</span>';

View File

@ -72,8 +72,10 @@ function menu_print_menu(&$menu)
$map_id = (string) get_parameter('map_id'); $map_id = (string) get_parameter('map_id');
$sec2 = 'operation/gis_maps/render_view&map_id='.$map_id; $sec2 = 'operation/gis_maps/render_view&map_id='.$map_id;
} else if ($sec2 === 'operation/gis_maps/render_view') { } else if ($sec2 === 'operation/gis_maps/render_view') {
$map_id = (string) get_parameter('map_id'); $map_id = (int) get_parameter('map_id');
$sec2 = 'operation/gis_maps/render_view&map_id='.$map_id; if (empty($map_id) === false) {
$sec2 .= '&map_id='.$map_id;
}
} else if ($sec2 === 'godmode/servers/discovery') { } else if ($sec2 === 'godmode/servers/discovery') {
$wiz = (string) get_parameter('wiz'); $wiz = (string) get_parameter('wiz');
$sec2 = 'godmode/servers/discovery&wiz='.$wiz; $sec2 = 'godmode/servers/discovery&wiz='.$wiz;

View File

@ -1025,9 +1025,29 @@ function netflow_get_command($options, $filter)
// Build command. // Build command.
$command = io_safe_output($config['netflow_nfdump']).' -N'; $command = io_safe_output($config['netflow_nfdump']).' -N';
// Netflow data path. if ($config['activate_sflow'] && $config['activate_netflow']) {
if (isset($config['netflow_path']) && $config['netflow_path'] != '') { if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== ''
$command .= ' -R. -M '.$config['netflow_path']; && isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== ''
) {
$command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir'].':'.$config['sflow_name_dir'];
}
} else {
if ($config['activate_sflow']) {
if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== ''
) {
$command .= ' -R. -M '.$config['general_network_path'].$config['sflow_name_dir'];
}
}
if ($config['activate_netflow']) {
if (isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== ''
) {
$command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir'];
}
}
} }
// Add options. // Add options.
@ -1035,7 +1055,6 @@ function netflow_get_command($options, $filter)
// Filter options. // Filter options.
$command .= ' '.netflow_get_filter_arguments($filter); $command .= ' '.netflow_get_filter_arguments($filter);
return $command; return $command;
} }

View File

@ -946,6 +946,20 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
function widthGraph () { function widthGraph () {
var parentWidth = $('.max-graph-tree-view').parent().width(); var parentWidth = $('.max-graph-tree-view').parent().width();
$('.max-graph-tree-view').children().width(parentWidth + 5); $('.max-graph-tree-view').children().width(parentWidth + 5);
$('<input>').attr({
type: 'hidden',
id: 'graph-counter',
value: 1
}).appendTo('#container');
if ($('#graph-counter').val() == 1) {
$('.max-graph-tree-view div.flot-x-axis').css('inset', '-25px').css('margin-top', '10px').css('margin-left', '10px');
$('.max-graph-tree-view canvas.flot-base').css('height', '85px');
$('#graph-counter').val(2);
}
} }
</script>"; </script>";

View File

@ -269,6 +269,7 @@
$(this).change(function() { $(this).change(function() {
var id_os = this.value; var id_os = this.value;
$("select#id_os").select2("close");
var home_url; var home_url;
if (typeof settings == "undefined") home_url = "./"; if (typeof settings == "undefined") home_url = "./";

View File

@ -652,10 +652,15 @@ var TreeController = {
typeof element.icon != "undefined" && typeof element.icon != "undefined" &&
element.icon.length > 0 element.icon.length > 0
) { ) {
console.log("a");
console.log(controller);
$content.append( $content.append(
'<div class="node-icon"><div class="node-icon-container"><img src="' + '<div class="node-icon"><div class="node-icon-container"><img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") + (controller.baseURL.length > 0 ? controller.baseURL : "") +
"images/" + (treeController.meta != undefined &&
treeController.meta == 1
? "../../images/"
: "images/") +
element.icon + element.icon +
'" class="invert_filter"/></div></div>' '" class="invert_filter"/></div></div>'
); );
@ -679,7 +684,10 @@ var TreeController = {
var $deleteBtn = $( var $deleteBtn = $(
'<a style="float: right; margin-top: 5px;"><img src="' + '<a style="float: right; margin-top: 5px;"><img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") + (controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/delete.svg" class="main_menu_icon invert_filter" style="width:18px; padding: 0 5px;"/></a>' (controller.meta != undefined && controller.meta == 1
? "../../images/"
: "images/") +
'delete.svg" class="main_menu_icon invert_filter" style="width:18px; padding: 0 5px;"/></a>'
); );
$deleteBtn.click(function(event) { $deleteBtn.click(function(event) {
var ok_function = function() { var ok_function = function() {
@ -703,7 +711,10 @@ var TreeController = {
var $updateicon = $( var $updateicon = $(
'<img src="' + '<img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") + (controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/edit.svg" class="main_menu_icon invert_filter" style="width:18px; padding: 0 5px;"/>' (controller.meta != undefined && controller.meta == 1
? "../../images/"
: "images/") +
'edit.svg" class="main_menu_icon invert_filter" style="width:18px; padding: 0 5px;"/>'
); );
var $updatebtn = $( var $updatebtn = $(
'<a style="float: right; margin-top: 5px;" href = "' + '<a style="float: right; margin-top: 5px;" href = "' +

View File

@ -474,7 +474,7 @@ class Manager implements PublicLogin
"SELECT * "SELECT *
FROM tdashboard FROM tdashboard
WHERE id = %d WHERE id = %d
AND (id_group IN (%s) AND id_user = '') OR id_user = '%s'", AND ((id_group IN (%s) AND id_user = '') OR id_user = '%s')",
$this->dashboardId, $this->dashboardId,
$this->stringGroups, $this->stringGroups,
$config['id_user'] $config['id_user']
@ -1047,6 +1047,7 @@ class Manager implements PublicLogin
'hash' => self::generatePublicHash(), 'hash' => self::generatePublicHash(),
'publicLink' => $this->publicLink, 'publicLink' => $this->publicLink,
'dashboardGroup' => $this->dashboardFields['id_group'], 'dashboardGroup' => $this->dashboardFields['id_group'],
'dashboardUser' => $this->dashboardFields['id_user'],
] ]
); );
} else { } else {

View File

@ -269,7 +269,6 @@ class ModulesByStatus extends Widget
'selected' => $status_selected, 'selected' => $status_selected,
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
'class' => 'overflow-hidden',
'size' => count($status_fields), 'size' => count($status_fields),
'select_all' => false, 'select_all' => false,
'required' => true, 'required' => true,
@ -488,6 +487,18 @@ class ModulesByStatus extends Widget
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND '; $where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
} }
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
$status = implode(',', $expl);
}
$where .= sprintf( $where .= sprintf(
'tagente_estado.estado IN (%s) 'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0', AND tagente_modulo.delete_pending = 0',

View File

@ -226,7 +226,7 @@ final class DonutGraph extends Item
'module_input' => true, 'module_input' => true,
'module_name' => 'moduleId', 'module_name' => 'moduleId',
'module_none' => false, 'module_none' => false,
'get_only_string_modules' => true, 'get_only_string_modules' => false,
], ],
]; ];
@ -235,14 +235,13 @@ final class DonutGraph extends Item
'label' => __('Module'), 'label' => __('Module'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields,
'name' => 'moduleId', 'name' => 'moduleId',
'selected' => $values['moduleId'], 'selected' => $values['moduleId'],
'return' => true, 'return' => true,
'sort' => false, 'sort' => false,
'agent_id' => $values['agentId'], 'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'], 'metaconsole_id' => $values['metaconsoleId'],
'get_only_string_modules' => true, 'get_only_string_modules' => false,
], ],
]; ];

View File

@ -68,7 +68,7 @@ div#login_f {
#ver_num { #ver_num {
width: 100%; width: 100%;
color: #dddddd; color: #fff;
text-align: center; text-align: center;
font-weight: 350; font-weight: 350;
font-size: 10px; font-size: 10px;

View File

@ -530,15 +530,6 @@ ul li {
width: 35px; width: 35px;
} }
/* Menu height: 601px, 720px, 735px */
@media screen and (max-height: 750px) {
.menu li,
.menu li a,
.menu li div {
min-height: 28px;
}
}
@media screen and (max-height: 750px) { @media screen and (max-height: 750px) {
.operation { .operation {
padding-top: 10px; padding-top: 10px;

View File

@ -509,6 +509,10 @@ select:-internal-list-box {
width: 400px; width: 400px;
} }
.w400px-important {
width: 400px !important;
}
.w450px { .w450px {
width: 450px; width: 450px;
} }
@ -11578,6 +11582,12 @@ div[role="dialog"] {
margin: 0 auto; margin: 0 auto;
} }
.database_background_state {
mask: url(../../images/database@groups.svg) no-repeat center / contain;
-webkit-mask: url(../../images/database@groups.svg) no-repeat center / contain;
margin: 0 auto;
}
.filter-list-adv .wizard li { .filter-list-adv .wizard li {
display: grid; display: grid;
} }
@ -11752,3 +11762,7 @@ div.relative > div > div#ui-datepicker-div {
border-radius: 0px; border-radius: 0px;
margin-left: 10px; margin-left: 10px;
} }
.container-div-input-password:has(.w400px-important) {
width: 400px;
}

View File

@ -12,8 +12,8 @@ span.subtitle-2 {
border: 0 !important; border: 0 !important;
} }
input[type="text"], input[type="text"]:not(.w100p-important),
input[type="number"] { input[type="number"]:not(.w100p-important) {
width: 220px; width: 220px;
} }

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.769'; $version = '7.0NG.769';
$build = '230322'; $build = '230327';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -230,10 +230,15 @@ if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) che
'title' => __('Standby'), 'title' => __('Standby'),
'text' => __('Standby'), 'text' => __('Standby'),
], ],
[
'title' => __('Operations'),
'text' => __('Operations'),
],
); );
$columns = array_merge( $columns = array_merge(
['standby'], ['standby'],
['force'],
$columns $columns
); );
@ -270,7 +275,11 @@ if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) che
$column_names, $column_names,
['text' => 'Module'], ['text' => 'Module'],
['text' => 'Template'], ['text' => 'Template'],
['text' => 'Operation'], [
'title' => __('Actions'),
'text' => __('Actions'),
'style' => 'min-width: 15%;',
],
['text' => 'Last fired'], ['text' => 'Last fired'],
['text' => 'Status'] ['text' => 'Status']
); );
@ -279,25 +288,12 @@ if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) che
$columns, $columns,
['agent_module_name'], ['agent_module_name'],
['template_name'], ['template_name'],
['operation'], ['actions'],
['last_fired'], ['last_fired'],
['status'] ['status']
); );
} }
if ($print_agent === true) {
array_push(
$column_names,
['text' => 'Agent']
);
$columns = array_merge(
$columns,
['agent_name']
);
}
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_unshift( array_unshift(
@ -315,22 +311,6 @@ if (is_metaconsole() === false) {
$columns $columns
); );
} }
if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) {
array_push(
$column_names,
[
'title' => __('Actions'),
'text' => __('Actions'),
'style' => 'min-width: 15%;',
]
);
$columns = array_merge(
$columns,
['actions']
);
}
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true) {

View File

@ -375,11 +375,13 @@ $table->data[1][0] = html_print_label_input_block(
html_print_select($fields, 'os', $os, '', 'All', 0, true) html_print_select($fields, 'os', $os, '', 'All', 0, true)
); );
if (function_exists('policies_get_policies') === true) {
$pre_fields = policies_get_policies(false, ['id', 'name']); $pre_fields = policies_get_policies(false, ['id', 'name']);
$fields = []; $fields = [];
foreach ($pre_fields as $value) { foreach ($pre_fields as $value) {
$fields[$value['id']] = $value['name']; $fields[$value['id']] = $value['name'];
} }
}
$table->data[1][1] = html_print_label_input_block( $table->data[1][1] = html_print_label_input_block(
__('Policies'), __('Policies'),

View File

@ -791,7 +791,7 @@ function print_table(
html_print_table($table); html_print_table($table);
if (count($selected_interfaces) > $config['block_size']) { if (count($selected_interfaces) > $config['block_size']) {
ui_pagination(count($selected_interfaces), false, $pagination_index, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination(count($selected_interfaces), false, $pagination_index, 0, false, 'offset', true, '');
} }
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No search parameters')]); ui_print_info_message(['no_close' => true, 'message' => __('No search parameters')]);

View File

@ -30,7 +30,7 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
global $config; global $config;
require_once 'include/functions_gis.php'; require_once $config['homedir'].'/include/functions_gis.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
@ -1481,14 +1481,15 @@ if ($policyTab === ENTERPRISE_NOT_HOOK) {
// Omnishell. // Omnishell.
if (function_exists('count_tasks_agent')) {
$tasks = count_tasks_agent($id_agente); $tasks = count_tasks_agent($id_agente);
if ($tasks === true) { if ($tasks === true) {
$omnishellTab = enterprise_hook('omnishell_tab'); $omnishellTab = enterprise_hook('omnishell_tab');
if ($omnishellTab == -1) { if ($omnishellTab == -1) {
$omnishellTab = ''; $omnishellTab = '';
} }
} }
}
// WUX Console. // WUX Console.
$modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]);

View File

@ -21,13 +21,15 @@ global $config;
require_once 'include/functions_gis.php'; require_once 'include/functions_gis.php';
// ui_require_javascript_file('openlayers.pandora');
$buttons['gis_maps_list'] = [ $buttons['gis_maps_list'] = [
'active' => true, 'active' => true,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image( 'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png', 'images/logs@svg.svg',
true, true,
['title' => __('GIS Maps list')] [
'title' => __('GIS Maps list'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>', ).'</a>',
]; ];

View File

@ -116,33 +116,34 @@ $controls = [
$layers = gis_get_layers($idMap); $layers = gis_get_layers($idMap);
// Render map // Render map.
$has_management_acl = check_acl_restricted_all($config['id_user'], $map['group_id'], 'MW') $has_management_acl = check_acl_restricted_all($config['id_user'], $map['group_id'], 'MW')
|| check_acl_restricted_all($config['id_user'], $map['group_id'], 'MM'); || check_acl_restricted_all($config['id_user'], $map['group_id'], 'MM');
$buttons = []; $buttons = [];
$buttons['gis_maps_list'] = [ $buttons['gis_maps_list'] = [
'active' => false,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image( 'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png', 'images/logs@svg.svg',
true, true,
[ [
'title' => __('GIS Maps list'), 'title' => __('GIS Maps list'),
'class' => 'invert_filter', 'class' => 'main_menu_icon invert_filter',
] ]
).'</a>', ).'</a>',
]; ];
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
$buttons[]['text'] = '<a href="index.php?sec=gismaps&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure=1">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).'</a>'; $buttons[]['text'] = '<a href="index.php?sec=gismaps&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure=1">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'main_menu_icon invert_filter']).'</a>';
} else { } else {
$buttons[]['text'] = '<a href="index.php?sec=gismaps&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.((int) get_parameter('refr', 0)).'">'.html_print_image('images/normalscreen.png', true, ['title' => __('Back to normal mode'), 'class' => 'invert_filter']).'</a>'; $buttons[]['text'] = '<a href="index.php?sec=gismaps&amp;sec2=operation/gis_maps/render_view&amp;map_id='.$idMap.'&amp;refr='.((int) get_parameter('refr', 0)).'">'.html_print_image('images/exit_fullscreen@svg.svg', true, ['title' => __('Back to normal mode'), 'class' => 'main_menu_icon invert_filter']).'</a>';
} }
if ($has_management_acl) { if ($has_management_acl === true) {
$hash = md5($config['dbpass'].$idMap.$config['id_user']); $hash = md5($config['dbpass'].$idMap.$config['id_user']);
$buttons['public_link']['text'] = '<a href="'.ui_get_full_url( $buttons['public_link']['text'] = '<a href="'.ui_get_full_url(
'operation/gis_maps/public_console.php?hash='.$hash.'&map_id='.$idMap.'&id_user='.$config['id_user'] 'operation/gis_maps/public_console.php?hash='.$hash.'&map_id='.$idMap.'&id_user='.$config['id_user']
).'" target="_blank">'.html_print_image('images/camera_mc.png', true, ['title' => __('Show link to public GIS map'), 'class' => 'invert_filter']).'</a>'; ).'" target="_blank">'.html_print_image('images/item-icon.svg', true, ['title' => __('Show link to public GIS map'), 'class' => 'main_menu_icon invert_filter']).'</a>';
} }
$times = [ $times = [
@ -170,7 +171,7 @@ $status = [
$buttons[]['text'] = "<div class='mrgn_top_6px'>".__('Filter by status').': '.html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false).'</div>'; $buttons[]['text'] = "<div class='mrgn_top_6px'>".__('Filter by status').': '.html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false).'</div>';
if ($has_management_acl) { if ($has_management_acl) {
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='.$idMap.'">'.html_print_image('images/setup.png', true, ['title' => __('Setup'), 'class' => 'invert_filter']).'</a>'; $buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='.$idMap.'">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Setup'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$buttons['setup']['godmode'] = 1; $buttons['setup']['godmode'] = 1;
} }
@ -179,7 +180,7 @@ ui_print_standard_header(
__('Map').': '.$map['map_name'], __('Map').': '.$map['map_name'],
'images/op_snmp.png', 'images/op_snmp.png',
false, false,
'snmp_console', '',
false, false,
$buttons, $buttons,
[ [

View File

@ -643,7 +643,7 @@ if (empty($table->data) === true) {
true, true,
'offset', 'offset',
false, false,
'pagination-bottom' ''
); );
} }

View File

@ -205,7 +205,7 @@ if ($access_console_node === true) {
$sub['operation/inventory/inventory']['refr'] = 0; $sub['operation/inventory/inventory']['refr'] = 0;
} }
if ($config['activate_netflow']) { if ($config['activate_netflow'] || $config['activate_sflow']) {
$sub['network_traffic'] = [ $sub['network_traffic'] = [
'text' => __('Network'), 'text' => __('Network'),
'id' => 'Network', 'id' => 'Network',
@ -213,13 +213,7 @@ if ($access_console_node === true) {
'subtype' => 'nolink', 'subtype' => 'nolink',
'refr' => 0, 'refr' => 0,
]; ];
$netflow_sub = [
// Initialize the submenu.
$netflow_sub = [];
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/netflow/netflow_explorer' => [ 'operation/netflow/netflow_explorer' => [
'text' => __('Netflow explorer'), 'text' => __('Netflow explorer'),
'id' => 'Netflow explorer', 'id' => 'Netflow explorer',
@ -228,19 +222,11 @@ if ($access_console_node === true) {
'text' => __('Netflow Live View'), 'text' => __('Netflow Live View'),
'id' => 'Netflow Live View', 'id' => 'Netflow Live View',
], ],
]
);
$netflow_sub = array_merge(
$netflow_sub,
[
'operation/network/network_usage_map' => [ 'operation/network/network_usage_map' => [
'text' => __('Network usage map'), 'text' => __('Network usage map'),
'id' => 'Network usage map', 'id' => 'Network usage map',
], ],
] ];
);
$sub['network_traffic']['sub2'] = $netflow_sub; $sub['network_traffic']['sub2'] = $netflow_sub;
} }
@ -411,7 +397,7 @@ if ($access_console_node === true) {
// INI GIS Maps. // INI GIS Maps.
if ($config['activate_gis']) { if ($config['activate_gis']) {
$sub['gismaps']['text'] = __('GIS Maps'); $sub['gismaps']['text'] = __('GIS Maps');
$sub['gismaps']['id'] = 'GIS Maps'; $sub['gismaps']['id'] = 'GIS_Maps';
$sub['gismaps']['type'] = 'direct'; $sub['gismaps']['type'] = 'direct';
$sub['gismaps']['subtype'] = 'nolink'; $sub['gismaps']['subtype'] = 'nolink';
$sub2 = []; $sub2 = [];

View File

@ -62,7 +62,13 @@ require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash'); $hash = (string) get_parameter('hash');
$visualConsoleId = (int) get_parameter('id_layout'); $visualConsoleId = (int) get_parameter('id_layout');
$userAccessMaintenance = null;
if (empty($config['id_user']) === true) {
$config['id_user'] = (string) get_parameter('id_user'); $config['id_user'] = (string) get_parameter('id_user');
} else {
$userAccessMaintenance = $config['id_user'];
}
$refr = (int) get_parameter('refr', ($config['refr'] ?? null)); $refr = (int) get_parameter('refr', ($config['refr'] ?? null));
if (!isset($config['pure'])) { if (!isset($config['pure'])) {
@ -179,6 +185,7 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
<script type="text/javascript"> <script type="text/javascript">
var container = document.getElementById("visual-console-container"); var container = document.getElementById("visual-console-container");
var user = "<?php echo $userAccessMaintenance; ?>";
var props = <?php echo (string) $visualConsole; ?>; var props = <?php echo (string) $visualConsole; ?>;
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>; var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>"; var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
@ -282,8 +289,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
); );
if(props.maintenanceMode != null) { if(props.maintenanceMode != null) {
if(props.maintenanceMode.user !== user) {
visualConsoleManager.visualConsole.enableMaintenanceMode(); visualConsoleManager.visualConsole.enableMaintenanceMode();
} }
}
var controls = document.getElementById('vc-controls'); var controls = document.getElementById('vc-controls');
autoHideElement(controls, 1000); autoHideElement(controls, 1000);

View File

@ -118,8 +118,12 @@ if ($aclRead === false && $aclWrite === false && $aclManage === false) {
// Render map. // Render map.
$options = []; $options = [];
$baseUrlList = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
if (is_metaconsole() === true) {
$baseUrlList = 'index.php?sec=screen&sec2=screens/screens&action=visualmap';
}
$options['consoles_list']['text'] = '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">'.html_print_image( $options['consoles_list']['text'] = '<a href="'.$baseUrlList.'">'.html_print_image(
'images/logs@svg.svg', 'images/logs@svg.svg',
true, true,
[ [
@ -142,11 +146,17 @@ if ($aclWrite === true || $aclManage === true) {
); );
$baseUrl = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action='.$action; $baseUrl = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action='.$action;
if (is_metaconsole() === true) {
$baseUrl = 'index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&action2='.$action;
}
$hash = md5($config['dbpass'].$visualConsoleId.$config['id_user']); $hash = md5($config['dbpass'].$visualConsoleId.$config['id_user']);
$options['public_link']['text'] = '<a href="'.ui_get_full_url( $options['public_link']['text'] = '<a href="'.ui_get_full_url(
'operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$visualConsoleId.'&refr='.$refr.'&id_user='.$config['id_user'] 'operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$visualConsoleId.'&refr='.$refr.'&id_user='.$config['id_user'],
false,
false,
false
).'" target="_blank">'.html_print_image( ).'" target="_blank">'.html_print_image(
'images/item-icon.svg', 'images/item-icon.svg',
true, true,

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230322 %define release 230327
# 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.769 %define version 7.0NG.769
%define release 230322 %define release 230327
# 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.769 %define version 7.0NG.769
%define release 230322 %define release 230327
%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

@ -2634,7 +2634,15 @@ CREATE TABLE IF NOT EXISTS `tdatabase` (
`action` TINYINT UNSIGNED DEFAULT 0, `action` TINYINT UNSIGNED DEFAULT 0,
`ssh_key` TEXT, `ssh_key` TEXT,
`ssh_pubkey` TEXT, `ssh_pubkey` TEXT,
`ssh_status` TINYINT UNSIGNED DEFAULT 0,
`last_error` TEXT, `last_error` TEXT,
`db_status` TINYINT UNSIGNED DEFAULT 0,
`replication_status` TINYINT UNSIGNED DEFAULT 0,
`replication_delay` BIGINT DEFAULT 0,
`master` TINYINT UNSIGNED DEFAULT 0,
`utimestamp` BIGINT DEFAULT 0,
`mysql_version` VARCHAR(10) DEFAULT '',
`pandora_version` VARCHAR(10) DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -72,6 +72,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('stats_interval', '60'), ('stats_interval', '60'),
('activate_gis', '0'), ('activate_gis', '0'),
('activate_netflow', '0'), ('activate_netflow', '0'),
('activate_sflow', '0'),
('timezone', 'Europe/Berlin'), ('timezone', 'Europe/Berlin'),
('string_purge', 7), ('string_purge', 7),
('audit_purge', 15), ('audit_purge', 15),
@ -87,6 +88,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('netflow_daemon', '/usr/bin/nfcapd'), ('netflow_daemon', '/usr/bin/nfcapd'),
('netflow_nfdump', '/usr/bin/nfdump'), ('netflow_nfdump', '/usr/bin/nfdump'),
('netflow_max_resolution', '50'), ('netflow_max_resolution', '50'),
('sflow_interval', '3600'),
('sflow_daemon', '/usr/bin/sfcapd'),
('sflow_nfdump', '/usr/bin/nfdump'),
('sflow_max_resolution', '50'),
('event_fields', 'mini_severity,evento,estado,agent_name,timestamp'), ('event_fields', 'mini_severity,evento,estado,agent_name,timestamp'),
('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,last_status_change,graph,warn,data,timestamp'), ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,last_status_change,graph,warn,data,timestamp'),
('list_ACL_IPs_for_API', '127.0.0.1'), ('list_ACL_IPs_for_API', '127.0.0.1'),

View File

@ -260,7 +260,7 @@ if (isset($config['public_dashboard']) === true
} }
} }
} else { } else {
if (check_acl_restricted_all($config['id_user'], $dashboardGroup, 'RW') === 0) { if ($dashboardUser !== $config['id_user'] && check_acl_restricted_all($config['id_user'], $dashboardGroup, 'RW') === 0) {
$buttons = [ $buttons = [
'back_to_dashboard_list' => $back_to_dashboard_list, 'back_to_dashboard_list' => $back_to_dashboard_list,
'fullscreen' => $fullscreen, 'fullscreen' => $fullscreen,

View File

@ -212,7 +212,7 @@ if (empty($dashboards) === true) {
true, true,
'offset', 'offset',
false, false,
'pagination-bottom' ''
); );
} }

View File

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

View File

@ -76,6 +76,9 @@ sub pandora_shutdown () {
# Stop the netflow daemon # Stop the netflow daemon
pandora_stop_netflow_daemon (); pandora_stop_netflow_daemon ();
# Stop the sflow daemon
pandora_stop_sflow_daemon ();
# Stop server threads. # Stop server threads.
stop_server_threads(); stop_server_threads();
@ -168,6 +171,9 @@ sub pandora_startup () {
# Start the netflow daemon if necessary # Start the netflow daemon if necessary
pandora_start_netflow_daemon (); pandora_start_netflow_daemon ();
# Start the sflow daemon if necessary
pandora_start_sflow_daemon ();
# Remove disabled servers # Remove disabled servers
@Servers = grep { defined ($_) } @Servers; @Servers = grep { defined ($_) } @Servers;
@ -262,8 +268,8 @@ sub pandora_start_netflow_daemon () {
# Check if netflow is enabled # Check if netflow is enabled
if ($Config{'activate_netflow'} != 1) { if ($Config{'activate_netflow'} != 1) {
logger (\%Config, " [*] Netflow daemon disabled.", 1); logger (\%Config, " [*] NetFlow daemon disabled.", 1);
print_message (\%Config, " [*] Netflow daemon disabled.", 1); print_message (\%Config, " [*] NetFlow daemon disabled.", 1);
return; return;
} }
@ -282,8 +288,8 @@ sub pandora_start_netflow_daemon () {
return; return;
} }
logger (\%Config, "[*] Netflow daemon started.", 1); logger (\%Config, "[*] NetFlow daemon started.", 1);
print_message (\%Config, "[*] Netflow daemon started.", 1); print_message (\%Config, "[*] NetFlow daemon started.", 1);
} }
######################################################################################## ########################################################################################
@ -310,6 +316,62 @@ sub pandora_stop_netflow_daemon () {
return 0; return 0;
} }
########################################################################################
# Start the sflow daemon if necessary.
########################################################################################
sub pandora_start_sflow_daemon () {
my $pid_file = '/var/run/pandora_sfcapd.pid';
# Check if sflow is enabled
if ($Config{'activate_sflow'} != 1) {
logger (\%Config, " [*] sFlow daemon disabled.", 1);
print_message (\%Config, " [*] sFlow daemon disabled.", 1);
return;
}
# Stop sfcapd if it's already running
my $pid = pandora_stop_sflow_daemon ();
if (pandora_stop_sflow_daemon () != 0) {
logger (\%Config, "sfcapd (pid $pid) is already running, attempting to kill it...", 1);
print_message (\%Config, "sfcapd (pid $pid) is already running, attempting to kill it...", 1);
}
# Start sfcapd
my $command = $Config{'sflow_daemon'} . ' -D -T all -w -t ' . $Config{'sflow_interval'} . ' -P ' . $pid_file . ' -l ' . $Config{'sflow_path'};
if (system ("$command >/dev/null 2>&1") != 0) {
logger (\%Config, " [E] Could not start sfcapd: $command", 1);
print_message (\%Config, " [E] Could not start sfcapd: $command", 1);
return;
}
logger (\%Config, "[*] sFlow daemon started.", 1);
print_message (\%Config, "[*] sFlow daemon started.", 1);
}
########################################################################################
# Stop the sflow daemon if it's running.
########################################################################################
sub pandora_stop_sflow_daemon () {
my $pid_file = '/var/run/pandora_sfcapd.pid';
# Open the pid file
if ( ! (-e $pid_file && open (PIDFILE, $pid_file))) {
return 0;
}
my $pid = <PIDFILE>;
close PIDFILE;
# Check if sfcapd is running
if (kill (0, $pid) > 0) {
kill (9, $pid);
return $pid;
}
return 0;
}
sub pandora_agent_autoconfiguration_scheduled($) { sub pandora_agent_autoconfiguration_scheduled($) {
my $pa_config = shift; my $pa_config = shift;

View File

@ -331,17 +331,18 @@ recon_timing_template 3
snmpget /usr/bin/snmpget snmpget /usr/bin/snmpget
# Location of the braa binary needed by the Enterprise SNMP Server # Location of the pandorafsnmp/braa binary needed by the Enterprise SNMP Server v1 and v2c
# /usr/bin/braa by default (PANDORA FMS ENTERPRISE ONLY). # /usr/bin/pandorafsnmp by default for v1 and v2c (PANDORA FMS ENTERPRISE ONLY).
# /usr/bin/braa could be set as optional legacy binary for snmp v1 and v2c (PANDORA FMS ENTERPRISE ONLY).
braa /usr/bin/braa braa /usr/bin/pandorafsnmp
# Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY). # Number of retries before braa hands a module over to the Network Server (PANDORA FMS ENTERPRISE ONLY).
braa_retries 3 braa_retries 3
# Location of the pandorafsnmp binary needed by the Enterprise SNMP Server. # Location of the pandorafsnmp binary needed by the Enterprise SNMP Server v3.
# /usr/bin/pandorafsnmp by default (PANDORA FMS ENTERPRISE ONLY). # /usr/bin/pandorafsnmp by default for snmp version 3 (PANDORA FMS ENTERPRISE ONLY).
fsnmp /usr/bin/pandorafsnmp fsnmp /usr/bin/pandorafsnmp
@ -701,8 +702,35 @@ ncm_ssh_utility /usr/share/pandora_server/util/ncm_ssh_extension
# Pandora FMS Daemon Watchdog execution interval in seconds (PANDORA FMS ENTERPRISE ONLY). # Pandora FMS Daemon Watchdog execution interval in seconds (PANDORA FMS ENTERPRISE ONLY).
ha_interval 30 ha_interval 30
# Pandora FMS Daemon Watchdog monitoring interval in seconds. Must be a multiple of ha_interval (PANDORA FMS ENTERPRISE ONLY). # HA operation mode. For backward compatibility with pacemaker. Do not change this value (PANDORA FMS ENTERPRISE ONLY).
ha_monitoring_interval 60 ha_mode pandora
# Comma separated list of HA host IPs or FQDNs (PANDORA FMS ENTERPRISE ONLY).
#ha_hosts 172.16.0.8,172.168.0.16
# Database username for pandora_ha (PANDORA FMS ENTERPRISE ONLY).
#ha_dbuser pandora
# Database password for pandora_ha (PANDORA FMS ENTERPRISE ONLY).
#ha_dbpass pandora
# SSH username for pandora_ha (PANDORA FMS ENTERPRISE ONLY).
#ha_sshuser pandora
# SSH port for pandora_ha (PANDORA FMS ENTERPRISE ONLY).
#ha_sshport 22
# Absolute path to the HA slave resync script (PANDORA FMS ENTERPRISE ONLY).
#ha_resync /usr/share/pandora_server/util/pandora_ha_resync_slave.sh
# Database username for HA replication (PANDORA FMS ENTERPRISE ONLY).
#repl_dbuser pandora
# Database password for HA replication (PANDORA FMS ENTERPRISE ONLY).
#repl_dbpass pandora
# Number of retries for connection attempts to HA databases.
#ha_connect_retries 2
# Enable (1) or disable (0) Pandora FMS Alert Server. # Enable (1) or disable (0) Pandora FMS Alert Server.
alertserver 0 alertserver 0

View File

@ -46,7 +46,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.769"; my $pandora_version = "7.0NG.769";
my $pandora_build = "230322"; my $pandora_build = "230327";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -144,6 +144,12 @@ sub pandora_get_sharedconfig ($$) {
$pa_config->{"netflow_interval"} = pandora_get_tconfig_token ($dbh, 'netflow_interval', 300); $pa_config->{"netflow_interval"} = pandora_get_tconfig_token ($dbh, 'netflow_interval', 300);
$pa_config->{"netflow_daemon"} = pandora_get_tconfig_token ($dbh, 'netflow_daemon', '/usr/bin/nfcapd'); $pa_config->{"netflow_daemon"} = pandora_get_tconfig_token ($dbh, 'netflow_daemon', '/usr/bin/nfcapd');
# Sflow configuration options
$pa_config->{"activate_sflow"} = pandora_get_tconfig_token ($dbh, 'activate_sflow', 0);
$pa_config->{"sflow_path"} = pandora_get_tconfig_token ($dbh, 'sflow_path', '/var/spool/pandora/data_in/sflow');
$pa_config->{"sflow_interval"} = pandora_get_tconfig_token ($dbh, 'sflow_interval', 300);
$pa_config->{"sflow_daemon"} = pandora_get_tconfig_token ($dbh, 'sflow_daemon', '/usr/bin/nfcapd');
# Log module configuration # Log module configuration
$pa_config->{"log_dir"} = pandora_get_tconfig_token ($dbh, 'log_dir', '/var/spool/pandora/data_in/log'); $pa_config->{"log_dir"} = pandora_get_tconfig_token ($dbh, 'log_dir', '/var/spool/pandora/data_in/log');
$pa_config->{"log_interval"} = pandora_get_tconfig_token ($dbh, 'log_interval', 3600); $pa_config->{"log_interval"} = pandora_get_tconfig_token ($dbh, 'log_interval', 3600);
@ -553,6 +559,25 @@ sub pandora_load_config {
$pa_config->{"unknown_block_size"} = 1000; # 7.0.769 $pa_config->{"unknown_block_size"} = 1000; # 7.0.769
$pa_config->{"ha_mode"} = "pacemaker"; # 7.0.770
$pa_config->{"ha_file"} = undef; # 7.0.770
$pa_config->{"ha_hosts_file"} = '/var/spool/pandora/data_in/conf/pandora_ha_hosts.conf'; # 7.0.770
$pa_config->{"ha_connect_retries"} = 2; # 7.0.770
$pa_config->{"ha_connect_delay"} = 1; # 7.0.770
$pa_config->{"ha_dbuser"} = undef; # 7.0.770
$pa_config->{"ha_dbpass"} = undef; # 7.0.770
$pa_config->{"ha_hosts"} = undef; # 7.0.770
$pa_config->{"ha_resync"} = '/usr/share/pandora_server/util/pandora_ha_resync_slave.sh'; # 7.0.770
$pa_config->{"ha_resync_log"} = '/var/log/pandora/pandora_ha_resync.log'; # 7.0.770
$pa_config->{"ha_sshuser"} = 'pandora'; # 7.0.770
$pa_config->{"ha_sshport"} = 22; # 7.0.770
$pa_config->{"ha_max_splitbrain_retries"} = 2;
$pa_config->{"ha_resync_sleep"} = 10;
$pa_config->{"repl_dbuser"} = undef; # 7.0.770
$pa_config->{"repl_dbpass"} = undef; # 7.0.770
# Check for UID0 # Check for UID0
if ($pa_config->{"quiet"} != 0){ if ($pa_config->{"quiet"} != 0){
if ($> == 0){ if ($> == 0){
@ -1283,9 +1308,36 @@ sub pandora_load_config {
} }
# Pandora HA extra # Pandora HA extra
elsif ($parametro =~ m/^ha_mode\s(.*)/i) {
$pa_config->{'ha_mode'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_file\s(.*)/i) { elsif ($parametro =~ m/^ha_file\s(.*)/i) {
$pa_config->{'ha_file'} = clean_blank($1); $pa_config->{'ha_file'} = clean_blank($1);
} }
elsif ($parametro =~ m/^ha_hosts_file\s(.*)/i) {
$pa_config->{'ha_hosts_file'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_dbuser\s(.*)/i) {
$pa_config->{'ha_dbuser'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_dbpass\s(.*)/i) {
$pa_config->{'ha_dbpass'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_sshuser\s(.*)/i) {
$pa_config->{'ha_sshuser'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_sshport\s(.*)/i) {
$pa_config->{'ha_sshport'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_hosts\s(.*)/i) {
$pa_config->{'ha_hosts'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_resync\s(.*)/i) {
$pa_config->{'ha_resync'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_resync_log\s(.*)/i) {
$pa_config->{'ha_resync_log'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_pid_file\s(.*)/i) { elsif ($parametro =~ m/^ha_pid_file\s(.*)/i) {
$pa_config->{'ha_pid_file'} = clean_blank($1); $pa_config->{'ha_pid_file'} = clean_blank($1);
} }
@ -1313,9 +1365,42 @@ sub pandora_load_config {
elsif ($parametro =~ m/^dataserver_smart_queue\s([0-1])/i) { elsif ($parametro =~ m/^dataserver_smart_queue\s([0-1])/i) {
$pa_config->{'dataserver_smart_queue'} = clean_blank($1); $pa_config->{'dataserver_smart_queue'} = clean_blank($1);
} }
elsif ($parametro =~ m/^ha_connect_retries\s+([0-9]*)/i) {
$pa_config->{'ha_connect_retries'} = clean_blank($1);
}
elsif ($parametro =~ m/^ha_connect_delay\s+([0-9]*)/i) {
$pa_config->{'ha_connect_delay'} = clean_blank($1);
}
elsif ($parametro =~ m/^repl_dbuser\s(.*)/i) {
$pa_config->{'repl_dbuser'} = clean_blank($1);
}
elsif ($parametro =~ m/^repl_dbpass\s(.*)/i) {
$pa_config->{'repl_dbpass'} = clean_blank($1);
}
} # end of loop for parameter # } # end of loop for parameter #
# The DB host was overridden by pandora_ha.
if (-f $pa_config->{'ha_hosts_file'}) {
eval {
open(my $fh, '<', $pa_config->{'ha_hosts_file'}) or return;
my $dbhost = <$fh>;
chomp($dbhost);
if (defined($dbhost) && $dbhost ne '') {
$pa_config->{'dbhost'} = $dbhost;
}
close($fh);
};
}
print " [*] DB Host is " . $pa_config->{'dbhost'} . "\n";
# ha_dbuser and ha_dbpass default to dbuser and dbpass respectively.
$pa_config->{'ha_dbuser'} = $pa_config->{'dbuser'} unless defined($pa_config->{'ha_dbuser'});
$pa_config->{'ha_dbpass'} = $pa_config->{'dbpass'} unless defined($pa_config->{'ha_dbpass'});
# repl_dbuser and repl_dbpass default to dbuser and dbpass respectively.
$pa_config->{'repl_dbuser'} = $pa_config->{'dbuser'} unless defined($pa_config->{'repl_dbuser'});
$pa_config->{'repl_dbpass'} = $pa_config->{'dbpass'} unless defined($pa_config->{'repl_dbpass'});
# Generate the encryption key after reading the passphrase. # Generate the encryption key after reading the passphrase.
$pa_config->{"encryption_key"} = enterprise_hook('pandora_get_encryption_key', [$pa_config, $pa_config->{"encryption_passphrase"}]); $pa_config->{"encryption_key"} = enterprise_hook('pandora_get_encryption_key', [$pa_config, $pa_config->{"encryption_passphrase"}]);

View File

@ -54,6 +54,8 @@ Exported Functions:
=item * C<pandora_event> =item * C<pandora_event>
=item * C<pandora_timed_event>
=item * C<pandora_execute_alert> =item * C<pandora_execute_alert>
=item * C<pandora_execute_action> =item * C<pandora_execute_action>
@ -194,6 +196,7 @@ our @EXPORT = qw(
pandora_evaluate_alert pandora_evaluate_alert
pandora_evaluate_snmp_alerts pandora_evaluate_snmp_alerts
pandora_event pandora_event
pandora_timed_event
pandora_extended_event pandora_extended_event
pandora_execute_alert pandora_execute_alert
pandora_execute_action pandora_execute_action
@ -3996,7 +3999,8 @@ Generate an event.
=cut =cut
########################################################################## ##########################################################################
sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$$) { #sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$$) {
sub pandora_event {
my ($pa_config, $evento, $id_grupo, $id_agente, $severity, my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
$source, $user_name, $comment, $id_extra, $tags, $source, $user_name, $comment, $id_extra, $tags,
@ -4113,6 +4117,28 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$$) {
return $event_id; return $event_id;
} }
##########################################################################
=head2 C<< pandora_timed_event (I<$time_limit>, I<@event>) >>
Generate an event, but no more than one every $time_limit seconds.
=cut
##########################################################################
my %TIMED_EVENTS :shared;
sub pandora_timed_event ($@) {
my ($time_limit, @event) = @_;
# Match events by message.
my $event_msg = $event[1];
# Do not generate more than one event every $time_limit seconds.
my $now = time();
if (!defined($TIMED_EVENTS{$event_msg}) || $TIMED_EVENTS{$event_msg} + $time_limit < $now) {
$TIMED_EVENTS{$event_msg} = $now;
pandora_event(@event);
}
}
########################################################################## ##########################################################################
=head2 C<< pandora_extended_event (I<$pa_config>, I<$dbh>, I<$event_id>, I<$description>) >> =head2 C<< pandora_extended_event (I<$pa_config>, I<$dbh>, I<$event_id>, I<$description>) >>

View File

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

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230322 %define release 230327
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}
@ -55,6 +55,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/conf
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/md5 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/md5
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/collections mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/collections
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/
@ -237,5 +238,6 @@ exit 0
%{_localstatedir}/spool/pandora/data_in/collections %{_localstatedir}/spool/pandora/data_in/collections
%{_localstatedir}/spool/pandora/data_in/conf %{_localstatedir}/spool/pandora/data_in/conf
%{_localstatedir}/spool/pandora/data_in/netflow %{_localstatedir}/spool/pandora/data_in/netflow
%{_localstatedir}/spool/pandora/data_in/sflow
%{_localstatedir}/spool/pandora/data_in/trans %{_localstatedir}/spool/pandora/data_in/trans
%{_localstatedir}/spool/pandora/data_in/commands %{_localstatedir}/spool/pandora/data_in/commands

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.769 %define version 7.0NG.769
%define release 230322 %define release 230327
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}
@ -62,6 +62,7 @@ mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/conf
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/md5 mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/md5
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/collections mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/collections
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/netflow mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/netflow
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/sflow
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/trans mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/commands mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_in/commands
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/ mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
@ -235,6 +236,7 @@ rm -Rf /usr/share/man/man1/tentacle_server.1.gz
/var/spool/pandora/data_in/md5 /var/spool/pandora/data_in/md5
/var/spool/pandora/data_in/collections /var/spool/pandora/data_in/collections
/var/spool/pandora/data_in/netflow /var/spool/pandora/data_in/netflow
/var/spool/pandora/data_in/sflow
/var/spool/pandora/data_in/conf /var/spool/pandora/data_in/conf
/var/spool/pandora/data_in/trans /var/spool/pandora/data_in/trans
/var/spool/pandora/data_in/commands /var/spool/pandora/data_in/commands

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230322" PI_BUILD="230327"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
@ -308,6 +308,8 @@ install () {
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/collections chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/collections
mkdir $DESTDIR$PANDORA_SPOOL/data_in/netflow 2> /dev/null mkdir $DESTDIR$PANDORA_SPOOL/data_in/netflow 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/netflow chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/netflow
mkdir $DESTDIR$PANDORA_SPOOL/data_in/sflow 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/sflow
mkdir $DESTDIR$PANDORA_SPOOL/data_in/trans 2> /dev/null mkdir $DESTDIR$PANDORA_SPOOL/data_in/trans 2> /dev/null
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans
mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null mkdir $DESTDIR$PANDORA_SPOOL/data_in/commands 2> /dev/null

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.769 Build 230322"; my $version = "7.0NG.769 Build 230327";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -354,6 +354,23 @@ sub pandora_purgedb ($$$) {
log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.'); log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.');
} }
# Delete old sflow data
if ($conf->{'_sflow_max_lifetime'} > 0) {
log_message ('PURGE', "Deleting old sflow data.");
if (! defined ($conf->{'_sflow_path'}) || ! -d $conf->{'_sflow_path'}) {
log_message ('!', "sflow data directory does not exist, skipping.");
}
elsif (! -x $conf->{'_sflow_nfexpire'}) {
log_message ('!', "Cannot execute " . $conf->{'_sflow_nfexpire'} . ", skipping.");
}
else {
`yes 2>/dev/null | $conf->{'_sflow_nfexpire'} -r "$conf->{'_sflow_path'}" -t $conf->{'_sflow_max_lifetime'}d`;
}
}
else {
log_message ('PURGE', 'sflow_max_lifetime is set to 0. Old sflow data will not be deleted.');
}
# Delete old log data # Delete old log data
log_message ('PURGE', "Deleting old log data."); log_message ('PURGE', "Deleting old log data.");
if (defined($conf->{'_days_purge_old_information'}) && $conf->{'_days_purge_old_information'} > 0) { if (defined($conf->{'_days_purge_old_information'}) && $conf->{'_days_purge_old_information'} > 0) {
@ -629,6 +646,21 @@ sub pandora_load_config_pdb ($) {
$conf->{'errorlogfile'} = $conf->{'errorlog_file'}; $conf->{'errorlogfile'} = $conf->{'errorlog_file'};
$conf->{'errorlogfile'} = "/var/log/pandora_server.error" unless defined ($conf->{'errorlogfile'}); $conf->{'errorlogfile'} = "/var/log/pandora_server.error" unless defined ($conf->{'errorlogfile'});
# The DB host was overridden by pandora_ha.
$conf->{'ha_hosts_file'} = '/var/spool/pandora/data_in/conf/pandora_ha_hosts.conf' unless defined($conf->{'ha_hosts_file'});
if (-f $conf->{'ha_hosts_file'}) {
eval {
open(my $fh, '<', $conf->{'ha_hosts_file'}) or return;
my $dbhost = <$fh>;
chomp($dbhost);
if (defined($dbhost) && $dbhost ne '') {
$conf->{'dbhost'} = $dbhost;
}
close($fh);
};
}
print " [*] DB Host is " . $conf->{'dbhost'} . "\n";
# Read additional tokens from the DB # Read additional tokens from the DB
my $dbh = db_connect ($conf->{'dbengine'}, $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'}); my $dbh = db_connect ($conf->{'dbengine'}, $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'});

View File

@ -34,15 +34,27 @@ my %Opts;
# Run as a daemon. # Run as a daemon.
my $DAEMON = 0; my $DAEMON = 0;
# Timeout for the HA DB lock.
my $LOCK_TIMEOUT = 300;
# Avoid retry old processing orders. # Avoid retry old processing orders.
my $First_Cleanup = 1; my $First_Cleanup = 1;
# List of known HA DB hosts.
my @HA_DB_Hosts;
# Current master node.
my $DB_Host = '';
# PID file. # PID file.
my $PID_FILE = '/var/run/pandora_ha.pid'; my $PID_FILE = '/var/run/pandora_ha.pid';
# Server service handler. # Server service handler.
my $Pandora_Service; my $Pandora_Service;
# Restart the Pandora FMS Server.
my $Restart = 0;
# Controlled exit # Controlled exit
my $Running = 0; my $Running = 0;
@ -55,6 +67,10 @@ sub log_message($$$;$) {
my $level = $verbosity_level; my $level = $verbosity_level;
$level = 5 unless defined($level); $level = 5 unless defined($level);
if ($source eq 'DEBUG' && !defined($ENV{'PANDORA_DEBUG'})) {
return;
}
if (ref($conf) eq "HASH") { if (ref($conf) eq "HASH") {
logger($conf, 'HA (' . $source . ') ' . "$message", $level); logger($conf, 'HA (' . $source . ') ' . "$message", $level);
} }
@ -169,6 +185,17 @@ sub ha_keep_pandora_running($$) {
my ($conf, $dbh) = @_; my ($conf, $dbh) = @_;
my $OSNAME = $^O; my $OSNAME = $^O;
my $control_command; my $control_command;
$Pandora_Service = $conf->{'pandora_service_cmd'};
# A restart was requested.
if ($Restart == 1) {
$Restart = 0;
log_message($conf, 'LOG', 'Restarting Pandora service');
$control_command = $^O eq "freebsd" ? "restart_server" : 'restart-server';
`$Pandora_Service $control_command $ENV{'PANDORA_DBHOST'} 2>/dev/null`;
return;
}
# Check if all servers are running # Check if all servers are running
# Restart if crashed or keep interval is over. # Restart if crashed or keep interval is over.
@ -185,8 +212,6 @@ sub ha_keep_pandora_running($$) {
my $nservers = get_db_value ($dbh, 'SELECT count(*) FROM tserver where name = ?', $conf->{'servername'}); my $nservers = get_db_value ($dbh, 'SELECT count(*) FROM tserver where name = ?', $conf->{'servername'});
$Pandora_Service = $conf->{'pandora_service_cmd'};
# Check if service is running # Check if service is running
$control_command = "status-server"; $control_command = "status-server";
if ($OSNAME eq "freebsd") { if ($OSNAME eq "freebsd") {
@ -308,6 +333,37 @@ sub ha_update_server($$) {
} }
################################################################################
# Dump the list of known databases to disk.
################################################################################
sub ha_dump_databases($) {
my ($conf) = @_;
# HA is not configured.
return unless defined($conf->{'ha_hosts'});
eval {
open(my $fh, '>', $conf->{'ha_hosts_file'});
print $fh $DB_Host; # The console only needs the master DB.
close($fh);
log_message($conf, 'DEBUG', "Dumped master database $DB_Host to disk");
};
log_message($conf, 'WARNING', $@) if ($@);
}
################################################################################
# Read the list of known databases from disk.
################################################################################
sub ha_load_databases($) {
my ($conf) = @_;
# HA is not configured.
return unless defined($conf->{'ha_hosts'});
@HA_DB_Hosts = grep { !/^#/ } map { s/^\s+|\s+$//g; $_; } split(/,/, $conf->{'ha_hosts'});
log_message($conf, 'DEBUG', "Loaded databases from disk (@HA_DB_Hosts)");
}
############################################################################### ###############################################################################
# Connect to ha database, falling back to direct connection to db. # Connect to ha database, falling back to direct connection to db.
############################################################################### ###############################################################################
@ -324,9 +380,111 @@ sub ha_database_connect($) {
} }
############################################################################### ###############################################################################
# Main # Connect to ha database, falling back to direct connection to db.
############################################################################### ###############################################################################
sub ha_main($) { sub ha_database_connect_pandora($) {
my $conf = shift;
my $dbhost = $conf->{'dbhost'};
# Load the list of HA databases.
ha_load_databases($conf);
# Select a new master database.
my ($dbh, $utimestamp, $max_utimestamp) = (undef, undef, -1);
foreach my $ha_dbhost (@HA_DB_Hosts) {
# Retry each database ha_connect_retries times.
for (my $i = 0; $i < $conf->{'ha_connect_retries'}; $i++) {
eval {
log_message($conf, 'DEBUG', "Trying database $ha_dbhost...");
$dbh= db_connect('mysql',
$conf->{'dbname'},
$ha_dbhost,
$conf->{'dbport'},
$conf->{'ha_dbuser'},
$conf->{'ha_dbpass'});
log_message($conf, 'DEBUG', "Connected to database $ha_dbhost");
};
log_message($conf, 'WARNING', $@) if ($@);
# Connection successful.
last if defined($dbh);
# Wait for the next retry.
sleep($conf->{'ha_connect_delay'});
}
# No luck. Try the next database.
next unless defined($dbh);
eval {
# Get the most recent utimestamp from the database.
$utimestamp = get_db_value($dbh, 'SELECT UNIX_TIMESTAMP(MAX(keepalive)) FROM tserver');
db_disconnect($dbh);
# Did we find a more recent database?
$utimestamp = 0 unless defined($utimestamp);
if ($utimestamp > $max_utimestamp) {
$dbhost = $ha_dbhost;
$max_utimestamp = $utimestamp;
}
};
log_message($conf, 'WARNING', $@) if ($@);
}
# Return a connection to the selected master.
eval {
log_message($conf, 'DEBUG', "Connecting to selected master $dbhost...");
$dbh = db_connect('mysql',
$conf->{'dbname'},
$dbhost,
$conf->{'dbport'},
$conf->{'ha_dbuser'},
$conf->{'ha_dbpass'});
# Restart if a new master was selected.
if ($dbhost ne $DB_Host) {
log_message($conf, 'DEBUG', "Setting master database to $dbhost");
$DB_Host = $dbhost;
$Restart = 1;
}
};
log_message($conf, 'WARNING', $@) if ($@);
# Save the list of HA databases.
ha_dump_databases($conf);
return $dbh;
}
###############################################################################
# Return 1 if the given DB is read-only, 0 otherwise.
###############################################################################
sub ha_read_only($$) {
my ($conf, $dbh) = @_;
my $read_only = get_db_value($dbh, 'SELECT @@global.read_only');
return 1 if (defined($read_only) && $read_only == 1);
return 0;
}
###############################################################################
# Restart the Pandora FMS Server.
###############################################################################
sub ha_restart_pandora($) {
my ($config) = @_;
my $control_command = $^O eq 'freebsd' ?
'restart_server' :
'restart-server';
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
}
###############################################################################
# Main (Pacemaker)
###############################################################################
sub ha_main_pacemaker($) {
my ($conf) = @_; my ($conf) = @_;
# Set the PID file. # Set the PID file.
@ -404,6 +562,100 @@ sub ha_main($) {
} }
} }
###############################################################################
# Main (Pandora)
###############################################################################
sub ha_main_pandora($) {
my ($conf) = @_;
# Set the PID file.
$conf->{'PID'} = $PID_FILE;
# Log to a separate file if needed.
$conf->{'log_file'} = $conf->{'ha_log_file'} if defined ($conf->{'ha_log_file'});
# Run in the background.
ha_daemonize($conf) if ($DAEMON == 1);
# Main loop.
$Running = 1;
while ($Running) {
my $dbh = undef;
eval {
# Connect to a DB.
log_message($conf, 'LOG', "Looking for databases");
$dbh = ha_database_connect_pandora($conf);
if (!defined($dbh)) {
log_message($conf, 'LOG', 'No databases available');
return;
}
# Make the DB host available to the Pandora FMS Server.
$ENV{'PANDORA_DBHOST'} = $DB_Host;
# Needed for the Enterprise module.
$conf->{'dbhost'} = $DB_Host;
# Enterprise capabilities need access to the DB.
eval {
local $SIG{__DIE__};
# Load enterprise components.
enterprise_load($conf, 1);
# Register Enterprise logger
enterprise_hook('pandoraha_logger', [\&log_message]);
log_message($conf, 'LOG', 'Enterprise capabilities loaded');
};
log_message($conf, 'LOG', "No enterprise capabilities: $@") if ($@);
log_message($conf, 'LOG', "Connected to database $DB_Host");
enterprise_hook('pandoraha_stop_slave', [$conf, $dbh]);
if (ha_read_only($conf, $dbh) == 1) {
log_message($conf, 'LOG', "The database is read-only.");
return;
}
# Check if there are updates pending.
ha_update_server($conf, $dbh);
# Keep pandora running
ha_keep_pandora_running($conf, $dbh);
# Keep Tentacle running
ha_keep_tentacle_running($conf, $dbh);
# Are we the master?
pandora_set_master($conf, $dbh);
if (!pandora_is_master($conf)) {
log_message($conf, 'LOG', $conf->{'servername'} . ' is not the current master. Skipping DB-HA actions and monitoring.');
return;
}
# Check the status of slave databases.
enterprise_hook('pandoraha_check_slaves', [$conf, $dbh, $DB_Host, \@HA_DB_Hosts]);
# Update the status of HA databases.
enterprise_hook('pandoraha_update_dbs', [$conf, $dbh, $DB_Host, \@HA_DB_Hosts]);
# Execute resync actions.
enterprise_hook('pandoraha_resync_dbs', [$conf, $dbh, $DB_Host, \@HA_DB_Hosts]);
};
log_message($conf, 'WARNING', $@) if ($@);
# Cleanup.
eval {
db_disconnect($dbh) if defined($dbh);
};
# Go to sleep.
log_message($conf, 'LOG', "Sleep.");
sleep($conf->{'ha_interval'});
}
}
################################################################################ ################################################################################
# Stop pandora server # Stop pandora server
################################################################################ ################################################################################
@ -429,7 +681,6 @@ END {
stop(); stop();
} }
$SIG{INT} = \&stop; $SIG{INT} = \&stop;
$SIG{TERM} = \&stop; $SIG{TERM} = \&stop;
@ -440,6 +691,10 @@ ha_init_pandora(\%Conf);
ha_load_pandora_conf (\%Conf); ha_load_pandora_conf (\%Conf);
# Main # Main
ha_main(\%Conf); if (defined($Conf{'ha_mode'}) && lc($Conf{'ha_mode'}) eq 'pandora') {
ha_main_pandora(\%Conf);
} else {
ha_main_pacemaker(\%Conf);
}
exit 0; exit 0;

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.769 Build 230322"; my $version = "7.0NG.769 Build 230327";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);