Merge remote-tracking branch 'origin/develop' into ent-3105-comportamiento-public_url

This commit is contained in:
fbsanchez 2019-07-12 09:38:28 +02:00
commit c386a29b80
108 changed files with 3667 additions and 9148 deletions

View File

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

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

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.736 %define version 7.0NG.736
%define release 190702 %define release 190712
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.736" PI_VERSION="7.0NG.736"
PI_BUILD="190702" PI_BUILD="190712"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

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

View File

@ -1,17 +1,34 @@
<?php <?php
/**
* Ajax handler.
*
* @category Ajax handler.
* @package Pandora FMS.
* @subpackage OpenSource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
define('AJAX', true);
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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 Lesser General Public License
// as published by the Free Software Foundation; 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.
// Enable profiler for testing
if (!defined('__PAN_XHPROF__')) { if (!defined('__PAN_XHPROF__')) {
define('__PAN_XHPROF__', 0); define('__PAN_XHPROF__', 0);
} }
@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
$public_hash = get_parameter('hash', false); $public_hash = get_parameter('hash', false);
// Check user // Check user.
if ($public_hash == false) { if ($public_hash == false) {
check_login(); check_login();
} else { } else {
@ -68,9 +85,9 @@ if ($public_hash == false) {
} }
} }
define('AJAX', true);
// Enterprise support
// Enterprise support.
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
include_once ENTERPRISE_DIR.'/load_enterprise.php'; include_once ENTERPRISE_DIR.'/load_enterprise.php';
} }
@ -86,11 +103,9 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]); $config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
} }
if (isset($config['metaconsole'])) { if (is_metaconsole()) {
// Not cool way of know if we are executing from metaconsole or normal console // Backward compatibility.
if ($config['metaconsole']) { define('METACONSOLE', true);
define('METACONSOLE', true);
}
} }
if (file_exists($page)) { if (file_exists($page)) {

View File

@ -270,6 +270,12 @@ function mainModuleGroups()
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';
if ($config['style'] === 'pandora_black') {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups'); $head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;'; $headstyle[0] = 'width: 20%; font-weight: bolder;';
foreach ($array_module_group as $key => $value) { foreach ($array_module_group as $key => $value) {
@ -314,7 +320,7 @@ function mainModuleGroups()
$data[$i][$j] .= $array_data[$key][$k]['total_count']; $data[$i][$j] .= $array_data[$key][$k]['total_count'];
$data[$i][$j] .= '</a></div>'; $data[$i][$j] .= '</a></div>';
} else { } else {
$data[$i][$j] = "<div style='background:white;".$cell_style."'>"; $data[$i][$j] = "<div style='background:".$background_color.';'.$cell_style."'>";
$data[$i][$j] .= 0; $data[$i][$j] .= 0;
$data[$i][$j] .= '</div>'; $data[$i][$j] .= '</div>';
} }
@ -323,7 +329,7 @@ function mainModuleGroups()
} }
} else { } else {
foreach ($value['gm'] as $k => $v) { foreach ($value['gm'] as $k => $v) {
$data[$i][$j] = "<div style='background:white; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>"; $data[$i][$j] = "<div style='background:".$background_color."; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
$data[$i][$j] .= 0; $data[$i][$j] .= 0;
$data[$i][$j] .= '</div>'; $data[$i][$j] .= '</div>';
$j++; $j++;

View File

@ -0,0 +1,13 @@
START TRANSACTION;
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
COMMIT;

View File

@ -362,7 +362,7 @@ if ($console_mode == 1) {
true true
); );
echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>"; echo "<table id='diagnostic_info' width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>'; echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
} }

View File

@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
@ -1239,13 +1241,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 29); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '736'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1442,11 +1444,14 @@ ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicy_module` -- Table `tpolicy_module`
@ -2209,3 +2214,8 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
`extra_2` text, `extra_2` text,
PRIMARY KEY (`identifier`) PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `treport_content_sla_combined`
-- ---------------------------------------------------------------------
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;

View File

@ -0,0 +1,164 @@
<html>
<head>
<style>
#alert_messages_na{
z-index:2;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
width:650px;
height: 400px;
background:white;
background-image:url('images/imagen-no-acceso.jpg');
background-repeat:no-repeat;
justify-content: center;
display: flex;
flex-direction: column;
box-shadow:4px 5px 10px 3px rgba(0, 0, 0, 0.4);
}
.modalheade{
text-align:center;
width:100%;
position:absolute;
top:0;
}
.modalheadertex{
color:#000;
font-family:Nunito;
line-height: 40px;
font-size: 23pt;
margin-bottom:30px;
}
.modalclose{
cursor:pointer;
display:inline;
float:right;
margin-right:10px;
margin-top:10px;
}
.modalconten{
color:black;
width:300px;
margin-left: 30px;
}
.modalcontenttex{
text-align:left;
color:black;
font-size: 11pt;
line-height:13pt;
margin-bottom:30px;
}
.modalokbutto{
cursor:pointer;
text-align:center;
display: inline-block;
padding: 6px 45px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalokbuttontex{
color:#82b92e;
font-family:Nunito;
font-size:13pt;
}
.modalgobutto{
cursor:pointer;
text-align:center;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalgobuttontex{
color:#82b92e;
font-family:Nunito;
font-size:10pt;
}
#opacidad{
position:fixed;
background:black;
opacity:0.6;
z-index:-1;
left:0px;
top:0px;
width:100%;
height:100%;
}
/*
.textodialog{
margin-left: 0px;
color:#333;
padding:20px;
font-size:9pt;
}
.cargatextodialog{
max-width:58.5%;
width:58.5%;
min-width:58.5%;
float:left;
margin-left: 0px;
font-size:18pt;
padding:20px;
text-align:center;
}
.cargatextodialog p, .cargatextodialog b, .cargatextodialog a{
font-size:18pt;
}
*/
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
<img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/input_cross.png'>
</div>
<div class='modalconten'>
<div class='modalheadertex'>
<?php echo __("You don't have access to this page"); ?>
</div>
<div class='modalcontenttex'>
<?php
echo __('Access to this page is restricted to authorized users SAML only, please contact system administrator if you need assistance.');
echo '<br/> <br/>';
echo __('Please make sure you have SAML authentication properly configured. For more information the error to access this page are recorded in security logs of %s System Database', get_product_name());
?>
</div>
<div class='modalokbutto cerrar'>
<span class='modalokbuttontex'>OK</span>
</div>
</div>
</div>
<div id="opacidad"></div>
</body>
</html>
<script>
$(".cerrar").click(function(){
window.location=".";
});
$('div#page').css('background-color','#d3d3d3');
</script>

View File

@ -122,7 +122,6 @@ if (is_ajax()) {
exit(); exit();
} }
ui_require_css_file('register'); ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true $initial = isset($config['initial_wizard']) !== true
@ -150,26 +149,27 @@ if ($initial && users_is_admin()) {
); );
} }
if ($registration && users_is_admin()) { if (!$config['disabled_newsletter']) {
// Prepare registration wizard, not launch. leave control to flow. if ($registration && users_is_admin()) {
registration_wiz_modal( // Prepare registration wizard, not launch. leave control to flow.
false, registration_wiz_modal(
// Launch only if not being launch from 'initial'.
!$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
);
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false, false,
// Launch only if not being call from 'registration'. // Launch only if not being launch from 'initial'.
!$registration && !$initial !$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
); );
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
);
}
} }
} }
$newsletter = null; $newsletter = null;
?> ?>

View File

@ -23,7 +23,6 @@ $idAgent = (int) get_parameter('id_agente', 0);
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent); $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
check_login(); check_login();
$ip_target = (string) get_parameter('ip_target', $ipAgent); $ip_target = (string) get_parameter('ip_target', $ipAgent);
$use_agent = get_parameter('use_agent'); $use_agent = get_parameter('use_agent');
$snmp_community = (string) get_parameter('snmp_community', 'public'); $snmp_community = (string) get_parameter('snmp_community', 'public');
@ -469,6 +468,9 @@ if (enterprise_installed()) {
if ($row['server_type'] != 13) { if ($row['server_type'] != 13) {
$s_type = ' (Standard)'; $s_type = ' (Standard)';
} else { } else {
// Check if satellite server has remote configuration enabled
$satellite_remote = config_agents_has_remote_configuration($id_agent);
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)'; $s_type = ' (Satellite)';
} }
@ -477,7 +479,17 @@ if (enterprise_installed()) {
} }
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'; $table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true); $table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
$table->data[1][4] = html_print_select(
$servers_to_exec,
'server_to_exec',
$server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')
',
'',
'',
true
);
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
@ -607,8 +619,12 @@ ui_require_jquery_file('bgiframe');
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
var inputActive = true; var inputActive = true;
$('#server_to_exec option').trigger('change');
$(document).data('text_for_module', $("#none_text").html()); $(document).data('text_for_module', $("#none_text").html());
$("#id_snmp").change(snmp_changed_by_multiple_snmp); $("#id_snmp").change(snmp_changed_by_multiple_snmp);
@ -628,6 +644,7 @@ $(document).ready (function () {
$("#no_snmp").hide (); $("#no_snmp").hide ();
$("#form_interfaces").hide (); $("#form_interfaces").hide ();
}); });
}); });
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
@ -682,5 +699,20 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
"json"); "json");
} }
function satellite_remote_warn(id_satellite, remote)
{
if(!remote)
{
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
$('#satellite_remote_tip').removeAttr("style").show();
}
else
{
$('#satellite_remote_tip').removeAttr("style").hide();
}
}
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -1276,18 +1276,10 @@ if ($update_module || $create_module) {
$m_hide = $m['hide']; $m_hide = $m['hide'];
} }
if ($update_module) { if ($m_hide == '1') {
if ($m_hide == '1') { $macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
} else { } else {
if ($m_hide == '1') { $macros[$k]['value'] = get_parameter($m['macro'], '');
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
} }
} }

View File

@ -163,7 +163,7 @@ echo '<td>';
echo __('Group').'&nbsp;'; echo __('Group').'&nbsp;';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && check_acl($config['id_user'], 0, 'AW')) { if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false; $return_all_group = false;
} else { } else {
$return_all_group = true; $return_all_group = true;
@ -680,7 +680,7 @@ if ($agents !== false) {
} }
echo '</table>'; echo '</table>';
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
echo "<table width='100%'><tr><td align='right'>"; echo "<table width='100%'><tr><td align='right'>";
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);

View File

@ -78,6 +78,13 @@ function push_table_advanced($row, $id=false)
function add_component_selection($id_network_component_type) function add_component_selection($id_network_component_type)
{ {
global $table_simple; global $table_simple;
global $config;
if ($config['style'] === 'pandora_black') {
$background_row = 'background-color: #444';
} else {
$background_row = 'background-color: #cfcfcf';
}
$data = []; $data = [];
$data[0] = __('Using module component').' '; $data[0] = __('Using module component').' ';
@ -116,7 +123,7 @@ function add_component_selection($id_network_component_type)
$data[1] .= '</span>'; $data[1] .= '</span>';
$table_simple->colspan['module_component'][1] = 3; $table_simple->colspan['module_component'][1] = 3;
$table_simple->rowstyle['module_component'] = 'background-color: #cfcfcf'; $table_simple->rowstyle['module_component'] = $background_row;
prepend_table_simple($data, 'module_component'); prepend_table_simple($data, 'module_component');
} }
@ -1101,9 +1108,8 @@ $macro_count++;
html_print_input_hidden('module_macro_count', $macro_count); html_print_input_hidden('module_macro_count', $macro_count);
/* // Advanced form part.
Advanced form part */ // Add relationships.
// Add relationships
$table_new_relations = new stdClass(); $table_new_relations = new stdClass();
$table_new_relations->id = 'module_new_relations'; $table_new_relations->id = 'module_new_relations';
$table_new_relations->width = '100%'; $table_new_relations->width = '100%';
@ -1114,7 +1120,8 @@ $table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[1] = 'width: 25%; text-align: center;'; $table_new_relations->style[1] = 'width: 25%; text-align: center;';
$table_new_relations->style[2] = 'width: 10%; font-weight: bold;'; $table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[3] = 'width: 25%; text-align: center;'; $table_new_relations->style[3] = 'width: 25%; text-align: center;';
$table_new_relations->style[4] = 'width: 30%; text-align: center;'; $table_new_relations->style[4] = 'width: 10%; font-weight: bold;';
$table_new_relations->style[5] = 'width: 25%; text-align: center;';
$table_new_relations->data[0][0] = __('Agent'); $table_new_relations->data[0][0] = __('Agent');
$params = []; $params = [];
@ -1128,10 +1135,35 @@ $params['javascript_function_action_after_select_js_call'] = 'change_modules_aut
$table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params); $table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params);
$table_new_relations->data[0][2] = __('Module'); $table_new_relations->data[0][2] = __('Module');
$table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>"; $table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>";
$table_new_relations->data[0][4] = html_print_button(__('Add relationship'), 'add_relation', false, 'javascript: add_new_relation();', 'class="sub add"', true);
$table_new_relations->data[0][4] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
// Relationship list $array_rel_type = [];
$array_rel_type['direct'] = __('Direct');
$array_rel_type['failover'] = __('Failover');
$table_new_relations->data[0][4] = __('Rel. type');
$table_new_relations->data[0][5] = html_print_select(
$array_rel_type,
'relation_type',
'',
'',
'',
0,
true,
false,
true,
''
);
$table_new_relations->data[0][6] = html_print_button(
__('Add relationship'),
'add_relation',
false,
'javascript: add_new_relation();',
'class="sub add"',
true
);
$table_new_relations->data[0][6] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
// Relationship list.
$table_relations = new stdClass(); $table_relations = new stdClass();
$table_relations->id = 'module_relations'; $table_relations->id = 'module_relations';
$table_relations->width = '100%'; $table_relations->width = '100%';
@ -1141,19 +1173,26 @@ $table_relations->data = [];
$table_relations->rowstyle = []; $table_relations->rowstyle = [];
$table_relations->rowstyle[-1] = 'display: none;'; $table_relations->rowstyle[-1] = 'display: none;';
$table_relations->style = []; $table_relations->style = [];
$table_relations->style[2] = 'width: 10%; text-align: center;';
$table_relations->style[3] = 'width: 10%; text-align: center;'; $table_relations->style[3] = 'width: 10%; text-align: center;';
$table_relations->style[4] = 'width: 10%; text-align: center;';
$table_relations->head[0] = __('Agent'); $table_relations->head[0] = __('Agent');
$table_relations->head[1] = __('Module'); $table_relations->head[1] = __('Module');
$table_relations->head[2] = __('Changes').ui_print_help_tip(__('Activate this to prevent the relation from being updated or deleted'), true); $table_relations->head[2] = __('Type');
$table_relations->head[3] = __('Delete'); $table_relations->head[3] = __('Changes').ui_print_help_tip(
__('Activate this to prevent the relation from being updated or deleted'),
true
);
$table_relations->head[4] = __('Delete');
// Create an invisible row to use their html to add new rows // Create an invisible row to use their html to add new rows.
$table_relations->data[-1][0] = ''; $table_relations->data[-1][0] = '';
$table_relations->data[-1][1] = ''; $table_relations->data[-1][1] = '';
$table_relations->data[-1][2] = '<a id="disable_updates_button" class="alpha50" href="">'.html_print_image('images/lock.png', true).'</a>'; $table_relations->data[-1][2] = '';
$table_relations->data[-1][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>'; $table_relations->data[-1][3] = '<a id="disable_updates_button" class="alpha50" href="">';
$table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>';
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
$module_relations = modules_get_relations(['id_module' => $id_agent_module]); $module_relations = modules_get_relations(['id_module' => $id_agent_module]);
if (!$module_relations) { if (!$module_relations) {
@ -1164,10 +1203,14 @@ $relations_count = 0;
foreach ($module_relations as $key => $module_relation) { foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) { if ($module_relation['module_a'] == $id_agent_module) {
$module_id = $module_relation['module_b']; $module_id = $module_relation['module_b'];
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_b']); $agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_b']
);
} else { } else {
$module_id = $module_relation['module_a']; $module_id = $module_relation['module_a'];
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_a']); $agent_id = modules_give_agent_id_from_module_id(
$module_relation['module_a']
);
} }
$agent_name = ui_print_agent_name($agent_id, true); $agent_name = ui_print_agent_name($agent_id, true);
@ -1183,14 +1226,16 @@ foreach ($module_relations as $key => $module_relation) {
$disabled_update_class = 'alpha50'; $disabled_update_class = 'alpha50';
} }
// Agent name // Agent name.
$table_relations->data[$relations_count][0] = $agent_name; $table_relations->data[$relations_count][0] = $agent_name;
// Module name // Module name.
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>'; $table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>';
// Lock relationship updates // Type.
$table_relations->data[$relations_count][2] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>'; $table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Delete relationship // Lock relationship updates.
$table_relations->data[$relations_count][3] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>'; $table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
// Delete relationship.
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
$relations_count++; $relations_count++;
} }
@ -1198,7 +1243,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
ui_require_jquery_file('json'); ui_require_jquery_file('json');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -1343,8 +1387,6 @@ $(document).ready (function () {
'width=800,height=600' 'width=800,height=600'
); );
} }
} }
if(type_name_selected == 'web_data' || if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' || type_name_selected == 'web_proc' ||
@ -1365,8 +1407,6 @@ $(document).ready (function () {
'width=800,height=600' 'width=800,height=600'
); );
} }
} }
} }
@ -1386,7 +1426,7 @@ $(document).ready (function () {
$('#minmax_warning').hide(); $('#minmax_warning').hide();
$('#svg_dinamic').hide(); $('#svg_dinamic').hide();
} }
if (type_name_selected.match(/async/) == null) { if (type_name_selected.match(/async/) == null) {
$('#ff_timeout').hide(); $('#ff_timeout').hide();
$('#ff_timeout_disable').show(); $('#ff_timeout_disable').show();
@ -1396,16 +1436,16 @@ $(document).ready (function () {
$('#ff_timeout_disable').hide(); $('#ff_timeout_disable').hide();
} }
}); });
$("#id_module_type").trigger('change'); $("#id_module_type").trigger('change');
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs // Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
$("#text-autocomplete_agent_name").keydown(function(event) { $("#text-autocomplete_agent_name").keydown(function(event) {
if(event.keyCode == 13) { // key code 13 is the enter button if(event.keyCode == 13) { // key code 13 is the enter button
event.preventDefault(); event.preventDefault();
} }
}); });
//validate post_process. Change ',' by '.' //validate post_process. Change ',' by '.'
$("#submit-updbutton").click (function () { $("#submit-updbutton").click (function () {
validate_post_process(); validate_post_process();
@ -1512,7 +1552,6 @@ function advanced_option_dynamic() {
} else { } else {
$('.hide_dinamic').show(); $('.hide_dinamic').show();
} }
} }
@ -1524,11 +1563,9 @@ function change_modules_autocomplete_input () {
var module_autocomplete = $("#module_autocomplete"); var module_autocomplete = $("#module_autocomplete");
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>'; var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>'; var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
if (!module_autocomplete.hasClass('working')) { if (!module_autocomplete.hasClass('working')) {
module_autocomplete.addClass('working'); module_autocomplete.addClass('working');
module_autocomplete.html(load_icon); module_autocomplete.html(load_icon);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
@ -1563,22 +1600,26 @@ function change_modules_autocomplete_input () {
// Add a new relation // Add a new relation
function add_new_relation () { function add_new_relation () {
var module_a_id = parseInt($("#hidden-id_agent_module").val()); var module_a_id = parseInt(
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val()); $("#hidden-id_agent_module").val()
);
var module_b_id = parseInt(
$("#hidden-autocomplete_module_name_hidden").val()
);
var module_b_name = $("#text-autocomplete_module_name").val(); var module_b_name = $("#text-autocomplete_module_name").val();
var agent_b_name = $("#text-autocomplete_agent_name").val(); var agent_b_name = $("#text-autocomplete_agent_name").val();
var relation_type = $("#relation_type").val();
var hiddenRow = $("#module_relations--1"); var hiddenRow = $("#module_relations--1");
var button = $("#button-add_relation"); var button = $("#button-add_relation");
var iconPlaceholder = $("#add_relation_status"); var iconPlaceholder = $("#add_relation_status");
var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>'; var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>';
var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>'; var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>'; var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
if (!button.hasClass('working')) { if (!button.hasClass('working')) {
button.addClass('working'); button.addClass('working');
iconPlaceholder.html(load_icon); iconPlaceholder.html(load_icon);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
@ -1588,7 +1629,8 @@ function add_new_relation () {
add_module_relation: true, add_module_relation: true,
id_module_a: module_a_id, id_module_a: module_a_id,
id_module_b: module_b_id, id_module_b: module_b_id,
name_module_b: module_b_name name_module_b: module_b_name,
relation_type: relation_type
}, },
success: function (data) { success: function (data) {
button.removeClass('working'); button.removeClass('working');
@ -1599,29 +1641,30 @@ function add_new_relation () {
else { else {
iconPlaceholder.html(suc_icon); iconPlaceholder.html(suc_icon);
setTimeout( function() { iconPlaceholder.html(''); }, 2000); setTimeout( function() { iconPlaceholder.html(''); }, 2000);
// Add the new row // Add the new row
var relationsCount = parseInt($("#hidden-module_relations_count").val()); var relationsCount = parseInt($("#hidden-module_relations_count").val());
var rowClass = "datos"; var rowClass = "datos";
if (relationsCount % 2 != 0) { if (relationsCount % 2 != 0) {
rowClass = "datos2"; rowClass = "datos2";
} }
var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' + var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' +
'<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' + '<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
'<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' + '<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
'<td id="module_relations-' + relationsCount + '-2" style="width: 10%; text-align: center;">' + '<td id="module_relations-' + relationsCount + '-2">' + relation_type + '</td>' +
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' + '<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<?php echo html_print_image('images/lock.png', true); ?>' + '<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
'</a>' + '<?php echo html_print_image('images/lock.png', true); ?>' +
'</td>' + '</a>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' + '</td>' +
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' + '<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
'<?php echo html_print_image('images/cross.png', true); ?>' + '<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
'</a>' + '<?php echo html_print_image('images/cross.png', true); ?>' +
'</td>' + '</a>' +
'</tr>'; '</td>' +
'</tr>';
$("#module_relations").find("tbody").append(rowHTML); $("#module_relations").find("tbody").append(rowHTML);
$("#hidden-module_relations_count").val(relationsCount + 1); $("#hidden-module_relations_count").val(relationsCount + 1);

View File

@ -534,8 +534,8 @@ echo '</div>';
$('#div-extra_1').hide(); $('#div-extra_1').hide();
$('#div-extra_2').hide(); $('#div-extra_2').hide();
} else if ($('#product :selected').val() == "AZURE") { } else if ($('#product :selected').val() == "AZURE") {
$('#div-username label').text('<?php echo __('Account ID'); ?>'); $('#div-username label').text('<?php echo __('Client ID'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>'); $('#div-password label').text('<?php echo __('Application secret'); ?>');
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>'); $('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>'); $('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
$('#div-extra_1').show(); $('#div-extra_1').show();

View File

@ -177,6 +177,9 @@ $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, tru
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true); $table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>'; $table->data['operations'][1] .= '</span>';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->data[1][0] = __('Modules'); $table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'; $table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select( $table->data[1][1] .= html_print_select(
@ -302,6 +305,8 @@ echo '<h3 class="error invisible" id="message">&nbsp;</h3>';
ui_require_jquery_file('form'); ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('pandora.controls');
?> ?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
var module_alerts; var module_alerts;
@ -478,6 +483,9 @@ $(document).ready (function () {
} }
$("#fieldset_targets").show (); $("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable (); $("#target_modules, #target_alerts").enable ();
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
}, },
"json" "json"
); );

View File

@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
); );
$table->data['form_modules_3'][3] = ''; $table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->rowstyle['form_modules_2'] = 'vertical-align: top;'; $table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules'); $table->data['form_modules_2'][0] = __('Modules');
@ -571,6 +576,7 @@ if ($selection_mode == 'modules') {
} }
?> ?>
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
@ -650,6 +656,9 @@ $(document).ready (function () {
}); });
$("#module_loading").hide(); $("#module_loading").hide();
$("#module_name").removeAttr ("disabled"); $("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
}, },
"json" "json"
); );

View File

@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
true true
); );
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->rowstyle['form_modules_2'] = 'vertical-align: top;'; $table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules'); $table->data['form_modules_2'][0] = __('Modules');
@ -1247,6 +1252,9 @@ $(document).ready (function () {
}); });
$("#module_loading").hide (); $("#module_loading").hide ();
$("#module_name").removeAttr ("disabled"); $("#module_name").removeAttr ("disabled");
//Filter modules. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
}, },
"json" "json"
); );

View File

@ -24,9 +24,23 @@ $menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) { if (check_acl($config['id_user'], 0, 'PM')) {
$sub = []; $sub = [];
$sub['godmode/servers/discovery']['text'] = __('Discovery'); $sub['godmode/servers/discovery&wiz=main']['text'] = __('Discovery Main');
$sub['godmode/servers/discovery']['id'] = 'Discovery'; $sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
$sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications');
$sub['godmode/servers/discovery&wiz=app']['id'] = 'app';
$sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud');
$sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud';
$sub['godmode/servers/discovery&wiz=ctask']['text'] = __('Console task');
$sub['godmode/servers/discovery&wiz=ctask']['id'] = 'ctask';
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
// Add to menu. // Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery'); $menu_godmode['discovery']['text'] = __('Discovery');

View File

@ -1,17 +1,32 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Network components Plugins
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global variables
global $config; global $config;
check_login(); check_login();
@ -29,7 +44,7 @@ $data[1] = html_print_select_from_sql(
false, false,
false false
); );
// Store the macros in base64 into a hidden control to move between pages // Store the macros in base64 into a hidden control to move between pages.
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true); $data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
$data[2] = __('Post process'); $data[2] = __('Post process');
$data[3] = html_print_extended_select_for_post_process( $data[3] = html_print_extended_select_for_post_process(
@ -46,7 +61,7 @@ $data[3] = html_print_extended_select_for_post_process(
push_table_row($data, 'plugin_1'); push_table_row($data, 'plugin_1');
// A hidden "model row" to clone it from javascript to add fields dynamicly // A hidden "model row" to clone it from javascript to add fields dynamicly.
$data = []; $data = [];
$data[0] = 'macro_desc'; $data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip('macro_help', true); $data[0] .= ui_print_help_tip('macro_help', true);
@ -56,7 +71,7 @@ $table->rowstyle['macro_field'] = 'display:none';
push_table_row($data, 'macro_field'); push_table_row($data, 'macro_field');
// If there are $macros, we create the form fields // If there are $macros, we create the form fields.
if (!empty($macros)) { if (!empty($macros)) {
$macros = json_decode($macros, true); $macros = json_decode($macros, true);
@ -68,9 +83,23 @@ if (!empty($macros)) {
} }
if ($m['hide'] == 1) { if ($m['hide'] == 1) {
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true); $data[1] = html_print_input_text(
$m['macro'],
io_output_password($m['value']),
'',
100,
1024,
true
);
} else { } else {
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true); $data[1] = html_print_input_text(
$m['macro'],
$m['value'],
'',
100,
1024,
true
);
} }
$table->colspan['macro'.$m['macro']][1] = 3; $table->colspan['macro'.$m['macro']][1] = 3;

View File

@ -61,7 +61,7 @@ $buttons['visual_console_favorite'] = [
'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>', 'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
]; ];
if ($is_enterprise && $vconsoles_manage) { if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [ $buttons['visual_console_template'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>', 'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',

View File

@ -165,6 +165,8 @@ switch ($action) {
$show_in_landscape = 0; $show_in_landscape = 0;
$hide_notinit_agents = 0; $hide_notinit_agents = 0;
$priority_mode = REPORT_PRIORITY_MODE_OK; $priority_mode = REPORT_PRIORITY_MODE_OK;
$failover_mode = 0;
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
$server_name = ''; $server_name = '';
$server_id = 0; $server_id = 0;
$dyn_height = 230; $dyn_height = 230;
@ -314,6 +316,8 @@ switch ($action) {
$sla_sorted_by = $item['top_n']; $sla_sorted_by = $item['top_n'];
$period = $item['period']; $period = $item['period'];
$current_month = $item['current_month']; $current_month = $item['current_month'];
$failover_mode = $item['failover_mode'];
$failover_type = $item['failover_type'];
break; break;
case 'module_histogram_graph': case 'module_histogram_graph':
@ -566,7 +570,6 @@ switch ($action) {
$include_extended_events = $item['show_extended_events']; $include_extended_events = $item['show_extended_events'];
$filter_search = $style['event_filter_search']; $filter_search = $style['event_filter_search'];
break; break;
case 'event_report_group': case 'event_report_group':
@ -2238,6 +2241,7 @@ $class = 'databox filters';
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_select_fields2" style="" class="datos"> <tr id="row_select_fields2" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;"> <td style="font-weight:bold;margin-right:150px;">
<?php <?php
@ -2609,6 +2613,59 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_failover_mode" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Failover mode').ui_print_help_tip(
__('SLA calculation must be performed taking into account the failover modules assigned to the primary module'),
true
);
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'failover_mode',
1,
$failover_mode
);
?>
</td>
</tr>
<tr id="row_failover_type" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Failover type');
?>
</td>
<td>
<?php
echo __('Failover normal');
echo '<span style="margin-left:5px;"></span>';
html_print_radio_button(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL,
'',
$failover_type == REPORT_FAILOVER_TYPE_NORMAL,
''
);
echo '<span style="margin:30px;"></span>';
echo __('Failover simple');
echo '<span style="margin-left:5px;"></span>';
html_print_radio_button(
'failover_type',
REPORT_FAILOVER_TYPE_SIMPLE,
'',
$failover_type == REPORT_FAILOVER_TYPE_SIMPLE,
''
);
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos"> <tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td> <td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
<td> <td>
@ -2772,6 +2829,13 @@ function print_SLA_list($width, $action, $idItem=null)
'id_rc', 'id_rc',
$idItem $idItem
); );
$failover_mode = db_get_value(
'failover_mode',
'treport_content',
'id_rc',
$idItem
);
?> ?>
<table class="databox data" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="100%"> <table class="databox data" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="100%">
<thead> <thead>
@ -2784,8 +2848,23 @@ function print_SLA_list($width, $action, $idItem=null)
<th class="header sla_list_module_col" scope="col"> <th class="header sla_list_module_col" scope="col">
<?php <?php
echo __('Module'); echo __('Module');
?> if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<th class="header sla_list_agent_failover" scope="col">
<?php
echo __('Agent Failover');
?>
</th> </th>
<th class="header sla_list_module_failover" scope="col">
<?php
echo __('Module Failover');
?>
</th>
<?php
}
?>
<th class="header sla_list_service_col" scope="col"> <th class="header sla_list_service_col" scope="col">
<?php <?php
echo __('Service'); echo __('Service');
@ -2831,6 +2910,7 @@ function print_SLA_list($width, $action, $idItem=null)
case 'update': case 'update':
case 'edit': case 'edit':
echo '<tbody id="list_sla">'; echo '<tbody id="list_sla">';
$itemsSLA = db_get_all_rows_filter( $itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined', 'treport_content_sla_combined',
['id_report_content' => $idItem] ['id_report_content' => $idItem]
@ -2865,6 +2945,25 @@ function print_SLA_list($width, $action, $idItem=null)
['id_agente_modulo' => $item['id_agent_module']] ['id_agente_modulo' => $item['id_agent_module']]
); );
if (isset($item['id_agent_module_failover']) === true
&& $item['id_agent_module_failover'] !== 0
) {
$idAgentFailover = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
$nameAgentFailover = agents_get_alias(
$idAgentFailover
);
$nameModuleFailover = db_get_value_filter(
'nombre',
'tagente_modulo',
['id_agente_modulo' => $item['id_agent_module_failover']]
);
}
$server_name_element = ''; $server_name_element = '';
if ($meta && $server_name != '') { if ($meta && $server_name != '') {
$server_name_element .= ' ('.$server_name.')'; $server_name_element .= ' ('.$server_name.')';
@ -2878,6 +2977,17 @@ function print_SLA_list($width, $action, $idItem=null)
echo printSmallFont($nameModule); echo printSmallFont($nameModule);
echo '</td>'; echo '</td>';
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
echo '<td class="sla_list_agent_failover">';
echo printSmallFont($nameAgentFailover).$server_name_element;
echo '</td>';
echo '<td class="sla_list_module_failover">';
echo printSmallFont($nameModuleFailover);
echo '</td>';
}
if (enterprise_installed() if (enterprise_installed()
&& $report_item_type == 'SLA_services' && $report_item_type == 'SLA_services'
) { ) {
@ -2926,6 +3036,15 @@ function print_SLA_list($width, $action, $idItem=null)
<td class="sla_list_agent_col agent_name"></td> <td class="sla_list_agent_col agent_name"></td>
<td class="sla_list_module_col module_name"></td> <td class="sla_list_module_col module_name"></td>
<?php <?php
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<td class="sla_list_agent_failover agent_name_failover"></td>
<td class="sla_list_module_failover module_name_failover"></td>
<?php
}
if (enterprise_installed() if (enterprise_installed()
&& $report_item_type == 'SLA_services' && $report_item_type == 'SLA_services'
) { ) {
@ -2982,6 +3101,44 @@ function print_SLA_list($width, $action, $idItem=null)
</select> </select>
</td> </td>
<?php <?php
if ($report_item_type == 'availability_graph'
&& $failover_mode
) {
?>
<td class="sla_list_agent_failover_col">
<input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
<input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
<?php
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'agent_failover';
$params['value'] = '';
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
$params['disabled_javascript_on_blur_function'] = true;
}
ui_print_agent_autocomplete_input($params);
?>
</td>
<td class="sla_list_module_failover_col">
<select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
<option value="0">
<?php
echo __('Select an Agent first');
?>
</option>
</select>
</td>
<?php
}
if (enterprise_installed() if (enterprise_installed()
&& $report_item_type == 'SLA_services' && $report_item_type == 'SLA_services'
) { ) {
@ -3002,23 +3159,23 @@ function print_SLA_list($width, $action, $idItem=null)
], ],
] ]
); );
if (!empty($services_tmp) if (!empty($services_tmp)
&& $services_tmp != ENTERPRISE_NOT_HOOK && $services_tmp != ENTERPRISE_NOT_HOOK
) {
foreach ($services_tmp as $service) {
$check_module_sla = modules_check_agentmodule_exists(
$service['sla_id_module']
);
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla
&& $check_module_sla_value
) { ) {
foreach ($services_tmp as $service) { $services[$service['id']] = $service['name'];
$check_module_sla = modules_check_agentmodule_exists(
$service['sla_id_module']
);
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla
&& $check_module_sla_value
) {
$services[$service['id']] = $service['name'];
}
}
} }
}
}
echo '<td class="sla_list_service_col">'; echo '<td class="sla_list_service_col">';
echo html_print_select( echo html_print_select(
@ -3617,11 +3774,18 @@ $(document).ready (function () {
$("#checkbox-checkbox_show_resume").change(function(){ $("#checkbox-checkbox_show_resume").change(function(){
if($(this).is(":checked")){ if($(this).is(":checked")){
$("#row_select_fields2").show(); $("#row_select_fields2").show();
$("#row_select_fields3").show();
} }
else{ else{
$("#row_select_fields2").hide(); $("#row_select_fields2").hide();
$("#row_select_fields3").hide(); }
});
$("#checkbox-failover_mode").change(function(){
if($(this).is(":checked")){
$("#row_failover_type").show();
}
else{
$("#row_failover_type").hide();
} }
}); });
}); });
@ -3915,10 +4079,13 @@ function deleteGeneralRow(id_row) {
function addSLARow() { function addSLARow() {
var nameAgent = $("input[name=agent_sla]").val(); var nameAgent = $("input[name=agent_sla]").val();
var nameAgentFailover = $("input[name=agent_failover]").val();
var idAgent = $("input[name=id_agent_sla]").val(); var idAgent = $("input[name=id_agent_sla]").val();
var serverId = $("input[name=id_server]").val(); var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_sla").val(); var idModule = $("#id_agent_module_sla").val();
var idModuleFailover = $("#id_agent_module_failover").val();
var nameModule = $("#id_agent_module_sla :selected").text(); var nameModule = $("#id_agent_module_sla :selected").text();
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
var slaMin = $("input[name=sla_min]").val(); var slaMin = $("input[name=sla_min]").val();
var slaMax = $("input[name=sla_max]").val(); var slaMax = $("input[name=sla_max]").val();
var slaLimit = $("input[name=sla_limit]").val(); var slaLimit = $("input[name=sla_limit]").val();
@ -3979,10 +4146,63 @@ function addSLARow() {
}); });
} }
if (nameAgentFailover != '') {
//Truncate nameAgentFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameAgentFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameAgentFailover = data;
}
});
//Truncate nameModuleFailover
var params = [];
params.push("truncate_text=1");
params.push("text=" + nameModuleFailover);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
+ "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
nameModuleFailover = data;
}
});
}
var params = []; var params = [];
params.push("add_sla=1"); params.push("add_sla=1");
params.push("id=" + $("input[name=id_item]").val()); params.push("id=" + $("input[name=id_item]").val());
params.push("id_module=" + idModule); params.push("id_module=" + idModule);
params.push("id_module_failover=" + idModuleFailover);
params.push("sla_min=" + slaMin); params.push("sla_min=" + slaMin);
params.push("sla_max=" + slaMax); params.push("sla_max=" + slaMax);
params.push("sla_limit=" + slaLimit); params.push("sla_limit=" + slaLimit);
@ -4015,6 +4235,8 @@ function addSLARow() {
$("#row", row).attr('id', 'sla_' + data['id']); $("#row", row).attr('id', 'sla_' + data['id']);
$(".agent_name", row).html(nameAgent); $(".agent_name", row).html(nameAgent);
$(".module_name", row).html(nameModule); $(".module_name", row).html(nameModule);
$(".agent_name_failover", row).html(nameAgentFailover);
$(".module_name_failover", row).html(nameModuleFailover);
$(".service_name", row).html(serviceName); $(".service_name", row).html(serviceName);
$(".sla_min", row).html(slaMin); $(".sla_min", row).html(slaMin);
$(".sla_max", row).html(slaMax); $(".sla_max", row).html(slaMax);
@ -4025,14 +4247,22 @@ function addSLARow() {
); );
$("#list_sla").append($(row).html()); $("#list_sla").append($(row).html());
$("input[name=id_agent_sla]").val(''); $("input[name=id_agent_sla]").val('');
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val(''); $("input[name=id_server]").val('');
$("input[name=agent_sla]").val(''); $("input[name=agent_sla]").val('');
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty(); $("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true'); $("#id_agent_module_sla").attr('disabled', 'true');
$("#id_agent_module_sla").append( $("#id_agent_module_sla").append(
$("<option></option>") $("<option></option>")
.attr ("value", 0) .attr ("value", 0)
.html ($("#module_sla_text").html())); .html ($("#module_sla_text").html()));
$("#id_agent_module_failover").empty();
$("#id_agent_module_failover").attr('disabled', 'true');
$("#id_agent_module_failover").append(
$("<option></option>")
.attr ("value", 0)
.html ($("#module_sla_text").html()));
$("input[name=sla_min]").val(''); $("input[name=sla_min]").val('');
$("input[name=sla_max]").val(''); $("input[name=sla_max]").val('');
$("input[name=sla_limit]").val(''); $("input[name=sla_limit]").val('');
@ -4161,7 +4391,6 @@ function addGeneralRow() {
success: function (data) { success: function (data) {
if (data['correct']) { if (data['correct']) {
row = $("#general_template").clone(); row = $("#general_template").clone();
$("#row", row).show(); $("#row", row).show();
$("#row", row).attr('id', 'general_' + data['id']); $("#row", row).attr('id', 'general_' + data['id']);
$(".agent_name", row).html(nameAgent); $(".agent_name", row).html(nameAgent);
@ -4211,6 +4440,8 @@ function chooseType() {
$("#row_custom_example").hide(); $("#row_custom_example").hide();
$("#row_group").hide(); $("#row_group").hide();
$("#row_current_month").hide(); $("#row_current_month").hide();
$("#row_failover_mode").hide();
$("#row_failover_type").hide();
$("#row_working_time").hide(); $("#row_working_time").hide();
$("#row_only_display_wrong").hide(); $("#row_only_display_wrong").hide();
$("#row_combo_module").hide(); $("#row_combo_module").hide();
@ -4384,6 +4615,11 @@ function chooseType() {
$("#row_working_time").show(); $("#row_working_time").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_priority_mode").show(); $("#row_priority_mode").show();
$("#row_failover_mode").show();
var failover_checked = $("input[name='failover_mode']").prop("checked");
if(failover_checked){
$("#row_failover_type").show();
}
break; break;
case 'module_histogram_graph': case 'module_histogram_graph':

View File

@ -1441,6 +1441,14 @@ switch ($action) {
$values['show_graph'] = get_parameter( $values['show_graph'] = get_parameter(
'combo_graph_options' 'combo_graph_options'
); );
$values['failover_mode'] = get_parameter(
'failover_mode',
0
);
$values['failover_type'] = get_parameter(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL
);
$good_format = true; $good_format = true;
break; break;
@ -2398,6 +2406,16 @@ switch ($action) {
$values['current_month'] = get_parameter('current_month'); $values['current_month'] = get_parameter('current_month');
$values['failover_mode'] = get_parameter(
'failover_mode',
0
);
$values['failover_type'] = get_parameter(
'failover_type',
REPORT_FAILOVER_TYPE_NORMAL
);
$style = []; $style = [];
$style['show_in_same_row'] = get_parameter( $style['show_in_same_row'] = get_parameter(
'show_in_same_row', 'show_in_same_row',

View File

@ -54,7 +54,7 @@ $buttons['visual_console_favorite'] = [
'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>', 'text' => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
]; ];
if ($is_enterprise && $vconsoles_manage) { if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [ $buttons['visual_console_template'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>', 'text' => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',

View File

@ -159,6 +159,16 @@ $table_styles->data[$row][1] = html_print_select(
$table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'status_set_preview', false, '', 'class="sub camera logo_preview"', true); $table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'status_set_preview', false, '', 'class="sub camera logo_preview"', true);
$row++; $row++;
// Divs to show icon status Colours (Default)
$icon_unknown_ball = ui_print_status_image(STATUS_AGENT_UNKNOWN_BALL, '', true);
$icon_unknown = ui_print_status_image(STATUS_AGENT_UNKNOWN, '', true);
$icon_ok_ball = ui_print_status_image(STATUS_AGENT_OK_BALL, '', true);
$icon_ok = ui_print_status_image(STATUS_AGENT_OK, '', true);
$icon_warning_ball = ui_print_status_image(STATUS_AGENT_WARNING_BALL, '', true);
$icon_warning = ui_print_status_image(STATUS_AGENT_WARNING, '', true);
$icon_bad_ball = ui_print_status_image(STATUS_AGENT_CRITICAL_BALL, '', true);
$icon_bad = ui_print_status_image(STATUS_AGENT_CRITICAL, '', true);
// End - Divs to show icon status Colours (Default)
$table_styles->data[$row][0] = __('Login background').ui_print_help_tip(__('You can place your custom images into the folder images/backgrounds/'), true); $table_styles->data[$row][0] = __('Login background').ui_print_help_tip(__('You can place your custom images into the folder images/backgrounds/'), true);
$backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0); $backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0);
$backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0); $backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0);
@ -1635,6 +1645,17 @@ $("#button-status_set_preview").click (function (e) {
$icon_bad_ball = $("<img src=\"" + icon_path + "agent_critical_ball.png\">"); $icon_bad_ball = $("<img src=\"" + icon_path + "agent_critical_ball.png\">");
$icon_bad = $("<img src=\"" + icon_path + "agent_critical.png\">"); $icon_bad = $("<img src=\"" + icon_path + "agent_critical.png\">");
if(icon_dir == 'default'){
$icon_unknown_ball = '<?php echo $icon_unknown_ball; ?>';
$icon_unknown = '<?php echo $icon_unknown; ?>';
$icon_ok_ball = '<?php echo $icon_ok_ball; ?>';
$icon_ok = '<?php echo $icon_ok; ?>';
$icon_warning_ball = '<?php echo $icon_warning_ball; ?>';
$icon_warning = '<?php echo $icon_warning; ?>';
$icon_bad_ball = '<?php echo $icon_bad_ball; ?>';
$icon_bad = '<?php echo $icon_bad; ?>';
}
try { try {
$dialog $dialog
.hide() .hide()

View File

@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['not_login'] = false; $user_info['not_login'] = false;
$user_info['strict_acl'] = false; $user_info['strict_acl'] = false;
$user_info['session_time'] = 0; $user_info['session_time'] = 0;
$user_info['middlename'] = 0;
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$user_info['id_skin'] = ''; $user_info['id_skin'] = '';
} }
@ -218,6 +220,7 @@ if ($create_user) {
} }
$values['not_login'] = (bool) get_parameter('not_login', false); $values['not_login'] = (bool) get_parameter('not_login', false);
$values['middlename'] = get_parameter('middlename', 0);
$values['strict_acl'] = (bool) get_parameter('strict_acl', false); $values['strict_acl'] = (bool) get_parameter('strict_acl', false);
$values['session_time'] = (int) get_parameter('session_time', 0); $values['session_time'] = (int) get_parameter('session_time', 0);
@ -317,12 +320,13 @@ if ($update_user) {
$values['timezone'] = (string) get_parameter('timezone'); $values['timezone'] = (string) get_parameter('timezone');
$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');
// eHorus user level conf
// eHorus user level conf.
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false); $values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user'); $values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass'); $values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);
$dashboard = get_parameter('dashboard', ''); $dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', ''); $visual_console = get_parameter('visual_console', '');
@ -869,13 +873,27 @@ foreach ($event_filter_data as $filter) {
$table->data[16][0] = __('Default event filter'); $table->data[16][0] = __('Default event filter');
$table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false); $table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false);
$table->data[17][0] = __('Disabled newsletter');
if ($user_info['middlename'] >= 0) {
$middlename = false;
} else {
$middlename = true;
}
$table->data[17][1] = html_print_checkbox(
'middlename',
-1,
$middlename,
true
);
if ($config['ehorus_user_level_conf']) { if ($config['ehorus_user_level_conf']) {
$table->data[17][0] = __('eHorus user acces enabled'); $table->data[18][0] = __('eHorus user acces enabled');
$table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true); $table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
$table->data[18][0] = __('eHorus user'); $table->data[19][0] = __('eHorus user');
$table->data[19][0] = __('eHorus password'); $table->data[20][0] = __('eHorus password');
$table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true); $table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
$table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true); $table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
} }

View File

@ -501,41 +501,60 @@ class DiscoveryTaskList extends Wizard
$data[5] = __('Pending'); $data[5] = __('Pending');
} }
if ($task['id_recon_script'] == 0) { switch ($task['type']) {
// Internal discovery task. case DISCOVERY_CLOUD_AZURE_COMPUTE:
switch ($task['type']) { // Discovery Applications MySQL.
case DISCOVERY_CLOUD_AWS_RDS: $data[6] = html_print_image(
// Discovery Applications MySQL. 'images/plugin.png',
$data[6] = html_print_image( true,
'images/network.png', ['title' => __('Discovery Cloud Azure Compute')]
true, ).'&nbsp;&nbsp;';
['title' => __('Discovery Cloud RDS')] $data[6] .= __('Cloud.Azure.Compute');
).'&nbsp;&nbsp;'; break;
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
case DISCOVERY_APP_MYSQL: case DISCOVERY_CLOUD_AWS_EC2:
// Discovery Applications MySQL. // Discovery Applications MySQL.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/network.png', 'images/plugin.png',
true, true,
['title' => __('Discovery Applications MySQL')] ['title' => __('Discovery Cloud AWS EC2')]
).'&nbsp;&nbsp;'; ).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.MySQL'); $data[6] .= __('Cloud.AWS.EC2');
break; break;
case DISCOVERY_APP_ORACLE: case DISCOVERY_CLOUD_AWS_RDS:
// Discovery Applications Oracle. // Discovery Cloud RDS.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/network.png', 'images/network.png',
true, true,
['title' => __('Discovery Applications Oracle')] ['title' => __('Discovery Cloud RDS')]
).'&nbsp;&nbsp;'; ).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.Oracle'); $data[6] .= __('Discovery.Cloud.Aws.RDS');
break; break;
case DISCOVERY_HOSTDEVICES: case DISCOVERY_APP_MYSQL:
default: // Discovery Applications MySQL.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications MySQL')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.MySQL');
break;
case DISCOVERY_APP_ORACLE:
// Discovery Applications Oracle.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications Oracle')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.Oracle');
break;
case DISCOVERY_HOSTDEVICES:
default:
if ($task['id_recon_script'] == 0) {
// Discovery NetScan. // Discovery NetScan.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/network.png', 'images/network.png',
@ -550,15 +569,15 @@ class DiscoveryTaskList extends Wizard
} else { } else {
$data[6] .= __('Discovery.NetScan'); $data[6] .= __('Discovery.NetScan');
} }
break; } else {
} // APP or external script recon task.
} else { $data[6] = html_print_image(
// APP recon task. 'images/plugin.png',
$data[6] = html_print_image( true
'images/plugin.png', ).'&nbsp;&nbsp;';
true $data[6] .= $recon_script_name;
).'&nbsp;&nbsp;'; }
$data[6] .= $recon_script_name; break;
} }
if ($task['status'] <= 0 || $task['status'] > 100) { if ($task['status'] <= 0 || $task['status'] > 100) {
@ -699,7 +718,16 @@ class DiscoveryTaskList extends Wizard
if ($script !== false) { if ($script !== false) {
switch ($script['type']) { switch ($script['type']) {
case DISCOVERY_SCRIPT_CLOUD_AWS: case DISCOVERY_SCRIPT_CLOUD_AWS:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1'; switch ($task['type']) {
case DISCOVERY_CLOUD_AWS_EC2:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
case DISCOVERY_CLOUD_AZURE_COMPUTE:
return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0';
default:
return 'wiz=cloud';
}
case DISCOVERY_SCRIPT_APP_VMWARE: case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0'; return 'wiz=app&mode=vmware&page=0';

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1139,6 +1139,7 @@ if ($get_extended_event) {
$dialog_page = get_parameter('dialog_page', 'general'); $dialog_page = get_parameter('dialog_page', 'general');
$filter = get_parameter('filter', []); $filter = get_parameter('filter', []);
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = $filter['group_rep']; $group_rep = $filter['group_rep'];
$event_rep = $event['event_rep']; $event_rep = $event['event_rep'];
$timestamp_first = $event['min_timestamp']; $timestamp_first = $event['min_timestamp'];
@ -1146,6 +1147,8 @@ if ($get_extended_event) {
$server_id = $event['server_id']; $server_id = $event['server_id'];
$comments = $event['comments']; $comments = $event['comments'];
$event['similar_ids'] = $similar_ids;
if (!isset($comments)) { if (!isset($comments)) {
$comments = $event['user_comment']; $comments = $event['user_comment'];
} }

View File

@ -472,11 +472,17 @@ if (check_login()) {
$result = false; $result = false;
$id_module_a = (int) get_parameter('id_module_a'); $id_module_a = (int) get_parameter('id_module_a');
$id_module_b = (int) get_parameter('id_module_b'); $id_module_b = (int) get_parameter('id_module_b');
$type = (string) get_parameter('relation_type');
if ($id_module_a < 1) { if ($id_module_a < 1) {
$name_module_a = get_parameter('name_module_a', ''); $name_module_a = get_parameter('name_module_a', '');
if ($name_module_a) { if ($name_module_a) {
$id_module_a = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_a); $id_module_a = (int) db_get_value(
'id_agente_modulo',
'tagente_modulo',
'nombre',
$name_module_a
);
} else { } else {
echo json_encode($result); echo json_encode($result);
return; return;
@ -486,7 +492,12 @@ if (check_login()) {
if ($id_module_b < 1) { if ($id_module_b < 1) {
$name_module_b = get_parameter('name_module_b', ''); $name_module_b = get_parameter('name_module_b', '');
if ($name_module_b) { if ($name_module_b) {
$id_module_b = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_b); $id_module_b = (int) db_get_value(
'id_agente_modulo',
'tagente_modulo',
'nombre',
$name_module_b
);
} else { } else {
echo json_encode($result); echo json_encode($result);
return; return;
@ -494,7 +505,7 @@ if (check_login()) {
} }
if ($id_module_a > 0 && $id_module_b > 0) { if ($id_module_a > 0 && $id_module_b > 0) {
$result = modules_add_relation($id_module_a, $id_module_b); $result = modules_add_relation($id_module_a, $id_module_b, $type);
} }
echo json_encode($result); echo json_encode($result);
@ -1011,7 +1022,7 @@ if (check_login()) {
$title $title
); );
$data[5] = ui_print_module_status($module['estado'], $title, true, false, true); $data[5] = ui_print_status_image($status, $title, true);
if (!$show_context_help_first_time) { if (!$show_context_help_first_time) {
$show_context_help_first_time = true; $show_context_help_first_time = true;

View File

@ -65,6 +65,7 @@ if ($add_sla) {
$sla_max = get_parameter('sla_max', 0); $sla_max = get_parameter('sla_max', 0);
$sla_min = get_parameter('sla_min', 0); $sla_min = get_parameter('sla_min', 0);
$server_id = (int) get_parameter('server_id', 0); $server_id = (int) get_parameter('server_id', 0);
$id_module_failover = (int) get_parameter('id_module_failover', 0);
$id_service = (int) get_parameter('id_service'); $id_service = (int) get_parameter('id_service');
if (empty($id_module) && !empty($id_service)) { if (empty($id_module) && !empty($id_service)) {
@ -85,12 +86,13 @@ if ($add_sla) {
$result = db_process_sql_insert( $result = db_process_sql_insert(
'treport_content_sla_combined', 'treport_content_sla_combined',
[ [
'id_report_content' => $id, 'id_report_content' => $id,
'id_agent_module' => $id_module, 'id_agent_module' => $id_module,
'sla_max' => $sla_max, 'id_agent_module_failover' => $id_module_failover,
'sla_min' => $sla_min, 'sla_max' => $sla_max,
'sla_limit' => $sla_limit, 'sla_min' => $sla_min,
'server_name' => $connection['server_name'], 'sla_limit' => $sla_limit,
'server_name' => $connection['server_name'],
] ]
); );

View File

@ -163,6 +163,7 @@ if ($install_package) {
unlink($files_copied); unlink($files_copied);
} }
if (file_exists($package)) { if (file_exists($package)) {
if ($files_h = fopen($files_total, 'r')) { if ($files_h = fopen($files_total, 'r')) {
while ($line = stream_get_line($files_h, 65535, "\n")) { while ($line = stream_get_line($files_h, 65535, "\n")) {

View File

@ -1976,7 +1976,7 @@ class ConsoleSupervisor
'id_user', 'id_user',
$config['id_user'] $config['id_user']
); );
if (license_free() === true if (!$config['disabled_newsletter']
&& $newsletter != 1 && $newsletter != 1
&& $login === false && $login === false
) { ) {

View File

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

View File

@ -527,14 +527,6 @@ define('NODE_MODULE', 1);
define('NODE_PANDORA', 2); define('NODE_PANDORA', 2);
define('NODE_GENERIC', 3); define('NODE_GENERIC', 3);
// SAML attributes constants.
define('SAML_ROLE_AND_TAG', 'eduPersonEntitlement');
define('SAML_USER_DESC', 'commonName');
define('SAML_ID_USER_IN_PANDORA', 'eduPersonTargetedId');
define('SAML_GROUP_IN_PANDORA', 'schacHomeOrganization');
define('SAML_MAIL_IN_PANDORA', 'mail');
define('SAML_DEFAULT_PROFILES_AND_TAGS_FORM', 'urn:mace:rediris.es:entitlement:monitoring:');
// Other constants. // Other constants.
define('STATUS_OK', 0); define('STATUS_OK', 0);
define('STATUS_ERROR', 1); define('STATUS_ERROR', 1);
@ -590,6 +582,7 @@ define('DISCOVERY_APP_MYSQL', 4);
define('DISCOVERY_APP_ORACLE', 5); define('DISCOVERY_APP_ORACLE', 5);
define('DISCOVERY_CLOUD_AWS_EC2', 6); define('DISCOVERY_CLOUD_AWS_EC2', 6);
define('DISCOVERY_CLOUD_AWS_RDS', 7); define('DISCOVERY_CLOUD_AWS_RDS', 7);
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
// Discovery types matching definition. // Discovery types matching definition.
@ -602,6 +595,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3);
define('DISCOVERY_SCRIPT_IPMI_RECON', 4); define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
// Discovery task descriptions. // Discovery task descriptions.
define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute');
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2'); define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware'); define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');

View File

@ -1531,7 +1531,7 @@ function agents_get_alias($id_agent, $case='none')
return $cache[$case][$id_agent]; return $cache[$case][$id_agent];
} }
if ($config['dbconnection_cache'] == null && is_metaconsole()) { if (is_metaconsole()) {
$alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent); $alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
} else { } else {
$alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent); $alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent);
@ -1554,7 +1554,13 @@ function agents_get_alias($id_agent, $case='none')
function agents_get_alias_by_name($name, $case='none') function agents_get_alias_by_name($name, $case='none')
{ {
$alias = (string) db_get_value('alias', 'tagente', 'nombre', $name); if (is_metaconsole()) {
$table = 'tmetaconsole_agent';
} else {
$table = 'tagente';
}
$alias = (string) db_get_value('alias', $table, 'nombre', $name);
switch ($case) { switch ($case) {
case 'upper': case 'upper':
@ -3385,11 +3391,22 @@ function agents_get_image_status($status)
*/ */
function agents_get_status_animation($up=true) function agents_get_status_animation($up=true)
{ {
global $config;
// Gif with black background or white background
if ($config['style'] === 'pandora_black') {
$heartbeat_green = 'images/heartbeat_green_black.gif';
$heartbeat_red = 'images/heartbeat_red_black.gif';
} else {
$heartbeat_green = 'images/heartbeat_green.gif';
$heartbeat_red = 'images/heartbeat_red.gif';
}
switch ($up) { switch ($up) {
case true: case true:
default: default:
return html_print_image( return html_print_image(
'images/heartbeat_green.gif', $heartbeat_green,
true, true,
[ [
'width' => '170', 'width' => '170',
@ -3399,7 +3416,7 @@ function agents_get_status_animation($up=true)
case false: case false:
return html_print_image( return html_print_image(
'images/heartbeat_red.gif', $heartbeat_red,
true, true,
[ [
'width' => '170', 'width' => '170',

View File

@ -15059,17 +15059,18 @@ function remove_agent_from_policy($id_policy, $use_agent_name, $params)
if (is_metaconsole()) { if (is_metaconsole()) {
if ($use_agent_name === false) { if ($use_agent_name === false) {
$id_node = $params[1]; $id_node = $params[1];
$id_agent = db_get_value_filter('id_agente', 'tmetaconsole_agent', ['id_tagente' => $params[0], 'id_tmetaconsole_setup' => $id_node]); $id_agent = $params[0];
} else { } else {
$id_agent = db_get_value_filter('id_agente', 'tmetaconsole_agent', ['nombre' => $params[0]]); $id_node = db_get_value_filter('id_tmetaconsole_setup', 'tmetaconsole_agent', ['nombre' => $params[0]]);
$id_agent = db_get_value_filter('id_tagente', 'tmetaconsole_agent', ['nombre' => $params[0]]);
} }
$agent = db_get_row_filter('tmetaconsole_agent', ['id_agente' => $id_agent]); $agent = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $id_node]);
} }
$policy = policies_get_policy($id_policy, false, false); $policy = policies_get_policy($id_policy, false, false);
$policy_agent = db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent]); $policy_agent = (is_metaconsole()) ? db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent, 'id_node' => $id_node]) : db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent]);
if (empty($policy)) { if (empty($policy)) {
returnError('error_policy', __('This policy does not exist.')); returnError('error_policy', __('This policy does not exist.'));

View File

@ -403,6 +403,10 @@ function config_update_config()
$error_update[] = __('Enable Update Manager'); $error_update[] = __('Enable Update Manager');
} }
if (!config_update_value('disabled_newsletter', get_parameter('disabled_newsletter'))) {
$error_update[] = __('Disabled newsletter');
}
if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) { if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) {
$error_update[] = __('Ipam Ocuppied Manager Critical'); $error_update[] = __('Ipam Ocuppied Manager Critical');
} }
@ -660,6 +664,42 @@ function config_update_config()
$error_update[] = __('Saml path'); $error_update[] = __('Saml path');
} }
if (!config_update_value('saml_source', get_parameter('saml_source'))) {
$error_update[] = __('Saml source');
}
if (!config_update_value('saml_user_id', get_parameter('saml_user_id'))) {
$error_update[] = __('Saml user id parameter');
}
if (!config_update_value('saml_mail', get_parameter('saml_mail'))) {
$error_update[] = __('Saml mail parameter');
}
if (!config_update_value('saml_group_name', get_parameter('saml_group_name'))) {
$error_update[] = __('Saml group name parameter');
}
if (!config_update_value('saml_attr_type', (bool) get_parameter('saml_attr_type'))) {
$error_update[] = __('Saml attr type parameter');
}
if (!config_update_value('saml_profiles_and_tags', get_parameter('saml_profiles_and_tags'))) {
$error_update[] = __('Saml profiles and tags parameter');
}
if (!config_update_value('saml_profile', get_parameter('saml_profile'))) {
$error_update[] = __('Saml profile parameters');
}
if (!config_update_value('saml_tag', get_parameter('saml_tag'))) {
$error_update[] = __('Saml tag parameter');
}
if (!config_update_value('saml_profile_tag_separator', get_parameter('saml_profile_tag_separator'))) {
$error_update[] = __('Saml profile and tag separator');
}
if (!config_update_value('double_auth_enabled', get_parameter('double_auth_enabled'))) { if (!config_update_value('double_auth_enabled', get_parameter('double_auth_enabled'))) {
$error_update[] = __('Double authentication'); $error_update[] = __('Double authentication');
} }
@ -1695,6 +1735,10 @@ function config_process_config()
config_update_value('enable_update_manager', 1); config_update_value('enable_update_manager', 1);
} }
if (!isset($config['disabled_newsletter'])) {
config_update_value('disabled_newsletter', 0);
}
if (!isset($config['ipam_ocuppied_critical_treshold'])) { if (!isset($config['ipam_ocuppied_critical_treshold'])) {
config_update_value('ipam_ocuppied_critical_treshold', 90); config_update_value('ipam_ocuppied_critical_treshold', 90);
} }
@ -2372,6 +2416,42 @@ function config_process_config()
config_update_value('saml_path', '/opt/'); config_update_value('saml_path', '/opt/');
} }
if (!isset($config['saml_source'])) {
config_update_value('saml_source', '');
}
if (!isset($config['saml_user_id'])) {
config_update_value('saml_user_id', '');
}
if (!isset($config['saml_mail'])) {
config_update_value('saml_mail', '');
}
if (!isset($config['saml_group_name'])) {
config_update_value('saml_group_name', '');
}
if (!isset($config['saml_attr_type'])) {
config_update_value('saml_attr_type', false);
}
if (!isset($config['saml_profiles_and_tags'])) {
config_update_value('saml_profiles_and_tags', '');
}
if (!isset($config['saml_profile'])) {
config_update_value('saml_profile', '');
}
if (!isset($config['saml_tag'])) {
config_update_value('saml_tag', '');
}
if (!isset($config['saml_profile_tag_separator'])) {
config_update_value('saml_profile_tag_separator', '');
}
if (!isset($config['autoupdate'])) { if (!isset($config['autoupdate'])) {
config_update_value('autoupdate', 1); config_update_value('autoupdate', 1);
} }
@ -2887,7 +2967,17 @@ function config_prepare_session()
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID. // Reset the expiration time upon page load //session_name() is default name of session PHPSESSID.
if (isset($_COOKIE[session_name()])) { if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), $_COOKIE[session_name()], (time() + $sessionCookieExpireTime), '/'); $update_cookie = true;
if (is_ajax()) {
// Avoid session upadte while processing ajax responses - notifications.
if (get_parameter('check_new_notifications', false)) {
$update_cookie = false;
}
}
if ($update_cookie === true) {
setcookie(session_name(), $_COOKIE[session_name()], (time() + $sessionCookieExpireTime), '/');
}
} }
ini_set('post_max_size', $config['max_file_size']); ini_set('post_max_size', $config['max_file_size']);

View File

@ -72,6 +72,10 @@ function credentials_get_all(
throw new Exception('[credential_get_all] Fields must be an array or "count".'); throw new Exception('[credential_get_all] Fields must be an array or "count".');
} }
if (isset($filter['product']) && !empty($filter['product'])) {
$sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
}
if (isset($filter['free_search']) && !empty($filter['free_search'])) { if (isset($filter['free_search']) && !empty($filter['free_search'])) {
$sql_filters[] = vsprintf( $sql_filters[] = vsprintf(
' AND (lower(cs.username) like lower("%%%s%%") ' AND (lower(cs.username) like lower("%%%s%%")
@ -163,7 +167,7 @@ function credentials_get_all(
%s %s
%s', %s',
join(',', $fields), join(',', $fields),
join(',', $sql_filters), join(' ', $sql_filters),
$order_by, $order_by,
$pagination $pagination
); );
@ -292,8 +296,8 @@ function print_inputs($values=null)
'script' => 'calculate_inputs()', 'script' => 'calculate_inputs()',
'fields' => [ 'fields' => [
// 'CUSTOM' => __('Custom'), // 'CUSTOM' => __('Custom'),
'AWS' => __('Aws'), 'AWS' => __('Aws'),
// 'AZURE' => __('Azure'), 'AZURE' => __('Azure'),
// 'GOOGLE' => __('Google'), // 'GOOGLE' => __('Google'),
], ],
'selected' => $values['product'], 'selected' => $values['product'],
@ -319,7 +323,7 @@ function print_inputs($values=null)
case 'AZURE': case 'AZURE':
$user_label = __('Account ID'); $user_label = __('Account ID');
$pass_label = __('Password'); $pass_label = __('Application secret');
$extra_1_label = __('Tenant or domain name'); $extra_1_label = __('Tenant or domain name');
$extra_2_label = __('Subscription id'); $extra_2_label = __('Subscription id');
break; break;
@ -358,7 +362,7 @@ function print_inputs($values=null)
'label' => $extra_1_label, 'label' => $extra_1_label,
'name' => 'extra_1', 'name' => 'extra_1',
'input_class' => 'flex-row', 'input_class' => 'flex-row',
'type' => 'password', 'type' => 'text',
'value' => $values['extra_1'], 'value' => $values['extra_1'],
'return' => true, 'return' => true,
] ]
@ -371,7 +375,7 @@ function print_inputs($values=null)
'label' => $extra_2_label, 'label' => $extra_2_label,
'name' => 'extra_2', 'name' => 'extra_2',
'input_class' => 'flex-row', 'input_class' => 'flex-row',
'type' => 'password', 'type' => 'text',
'value' => $values['extra_2'], 'value' => $values['extra_2'],
'return' => true, 'return' => true,
'display' => $extra2, 'display' => $extra2,

View File

@ -1687,7 +1687,7 @@ function events_change_status(
$ack_user = $config['id_user']; $ack_user = $config['id_user'];
} else { } else {
$acl_utimestamp = 0; $acl_utimestamp = 0;
$ack_user = ''; $ack_user = $config['id_user'];
} }
switch ($new_status) { switch ($new_status) {
@ -4398,6 +4398,8 @@ function events_page_general($event)
$data[1] = $user_owner; $data[1] = $user_owner;
} }
$table_general->cellclass[3][1] = 'general_owner';
$table_general->data[] = $data; $table_general->data[] = $data;
$data = []; $data = [];
@ -4465,6 +4467,8 @@ function events_page_general($event)
$data[1] = '<i>'.__('N/A').'</i>'; $data[1] = '<i>'.__('N/A').'</i>';
} }
$table_general->cellclass[7][1] = 'general_status';
$table_general->data[] = $data; $table_general->data[] = $data;
$data = []; $data = [];

View File

@ -2235,7 +2235,6 @@ function combined_graph_summatory_average(
$data_array_pop[$key_reverse] = array_pop( $data_array_pop[$key_reverse] = array_pop(
$data_array_reverse[$key_reverse] $data_array_reverse[$key_reverse]
); );
$count_data_array_reverse--;
} }
} }
@ -2287,6 +2286,7 @@ function combined_graph_summatory_average(
} }
$count++; $count++;
$count_data_array_reverse--;
} }
if ($summatory && isset($array_sum_reverse) if ($summatory && isset($array_sum_reverse)

View File

@ -52,6 +52,9 @@ function menu_print_menu(&$menu)
$sec2 = (string) get_parameter('sec2'); $sec2 = (string) get_parameter('sec2');
if ($sec2 == 'operation/agentes/ver_agente') { if ($sec2 == 'operation/agentes/ver_agente') {
$sec2 = 'godmode/agentes/configurar_agente'; $sec2 = 'godmode/agentes/configurar_agente';
} else if ($sec2 == 'godmode/servers/discovery') {
$wiz = (string) get_parameter('wiz');
$sec2 = 'godmode/servers/discovery&wiz='.$wiz;
} else { } else {
$sec2 = (string) get_parameter('sec2'); $sec2 = (string) get_parameter('sec2');
} }

View File

@ -383,7 +383,7 @@ function messages_get_count(
} }
$sql = sprintf( $sql = sprintf(
'SELECT count(*) as "n" FROM ( 'SELECT count(distinct id_mensaje) as "n" FROM (
SELECT SELECT
tm.*, tm.*,
utimestamp_read > 0 as "read" utimestamp_read > 0 as "read"

View File

@ -2308,32 +2308,67 @@ function modules_get_color_status($status)
return COL_UNKNOWN; return COL_UNKNOWN;
} }
switch ($status) { switch ((string) $status) {
case AGENT_MODULE_STATUS_NORMAL: case (string) AGENT_MODULE_STATUS_NORMAL:
case AGENT_STATUS_NORMAL: case (string) AGENT_STATUS_NORMAL:
case STATUS_MODULE_OK:
case STATUS_AGENT_OK:
case STATUS_ALERT_NOT_FIRED:
case STATUS_SERVER_OK:
case STATUS_MODULE_OK_BALL:
case STATUS_AGENT_OK_BALL:
case STATUS_ALERT_NOT_FIRED_BALL:
return COL_NORMAL; return COL_NORMAL;
case AGENT_MODULE_STATUS_NOT_INIT: case AGENT_MODULE_STATUS_NOT_INIT:
case AGENT_STATUS_NOT_INIT: case AGENT_STATUS_NOT_INIT:
case STATUS_MODULE_NO_DATA:
case STATUS_AGENT_NOT_INIT:
case STATUS_AGENT_NO_DATA:
case STATUS_MODULE_NO_DATA_BALL:
case STATUS_AGENT_NO_DATA_BALL:
case STATUS_AGENT_NO_MONITORS_BALL:
return COL_NOTINIT; return COL_NOTINIT;
case AGENT_MODULE_STATUS_CRITICAL_BAD: case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_STATUS_CRITICAL: case AGENT_STATUS_CRITICAL:
case STATUS_MODULE_CRITICAL:
case STATUS_AGENT_CRITICAL:
case STATUS_MODULE_CRITICAL_BALL:
case STATUS_AGENT_CRITICAL_BALL:
return COL_CRITICAL; return COL_CRITICAL;
case AGENT_MODULE_STATUS_WARNING: case AGENT_MODULE_STATUS_WARNING:
case AGENT_STATUS_WARNING: case AGENT_STATUS_WARNING:
case STATUS_MODULE_WARNING:
case STATUS_AGENT_WARNING:
case STATUS_MODULE_WARNING_BALL:
case STATUS_AGENT_WARNING_BALL:
return COL_WARNING; return COL_WARNING;
case AGENT_MODULE_STATUS_CRITICAL_ALERT: case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT: case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_STATUS_ALERT_FIRED: case AGENT_STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED_BALL:
return COL_ALERTFIRED; return COL_ALERTFIRED;
case AGENT_MODULE_STATUS_UNKNOWN: case AGENT_MODULE_STATUS_UNKNOWN:
case AGENT_STATUS_UNKNOWN: case AGENT_STATUS_UNKNOWN:
case STATUS_MODULE_UNKNOWN:
case STATUS_AGENT_UNKNOWN:
case STATUS_AGENT_DOWN:
case STATUS_ALERT_DISABLED:
case STATUS_MODULE_UNKNOWN_BALL:
case STATUS_AGENT_UNKNOWN_BALL:
case STATUS_AGENT_DOWN_BALL:
case STATUS_ALERT_DISABLED_BALL:
return COL_UNKNOWN; return COL_UNKNOWN;
case STATUS_SERVER_DOWN:
case STATUS_SERVER_DOWN_BALL:
return '#444';
default: default:
// Ignored. // Ignored.
break; break;
@ -2596,7 +2631,7 @@ function modules_get_relations($params=[])
} }
$sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b, $sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
tmr.disable_update tmr.disable_update, tmr.type
FROM tmodule_relationship tmr, FROM tmodule_relationship tmr,
tagente_modulo tam, tagente_modulo tam,
tagente ta, tagente ta,
@ -2699,11 +2734,13 @@ function modules_relation_exists($id_module, $id_module_other=false)
/** /**
* Change the 'disabled_update' value of a relation row. * Change the 'disabled_update' value of a relation row.
* *
* @param int Relation id. * @param integer $id_module_a Id agent module a.
* @param integer $id_module_b Id agent module b.
* @param string $type Type direct or failover.
* *
* @return boolean True if the 'disabled_update' changes to 1, false otherwise. * @return boolean True if the 'disabled_update' changes to 1, false otherwise.
*/ */
function modules_add_relation($id_module_a, $id_module_b) function modules_add_relation($id_module_a, $id_module_b, $type='direct')
{ {
$result = false; $result = false;
@ -2711,6 +2748,7 @@ function modules_add_relation($id_module_a, $id_module_b)
$values = [ $values = [
'module_a' => $id_module_a, 'module_a' => $id_module_a,
'module_b' => $id_module_b, 'module_b' => $id_module_b,
'type' => $type,
]; ];
$result = db_process_sql_insert('tmodule_relationship', $values); $result = db_process_sql_insert('tmodule_relationship', $values);
} }

View File

@ -450,14 +450,26 @@ function networkmap_generate_dot(
$nodes[$node_count] = $module; $nodes[$node_count] = $module;
} }
} else { } else {
$have_relations_a = db_get_value('id', 'tmodule_relationship', 'module_a', $module['id_agente_modulo']); $sql_a = sprintf(
$have_relations_b = db_get_value('id', 'tmodule_relationship', 'module_b', $module['id_agente_modulo']); 'SELECT id
FROM tmodule_relationship
WHERE module_a = %d AND type = "direct"',
$module['id_agente_modulo']
);
$sql_b = sprintf(
'SELECT id
FROM tmodule_relationship
WHERE module_b = %d AND type = "direct"',
$module['id_agente_modulo']
);
$have_relations_a = db_get_value_sql($sql_a);
$have_relations_b = db_get_value_sql($sql_b);
if ($have_relations_a || $have_relations_b) { if ($have_relations_a || $have_relations_b) {
// Save node parent information to define edges later // Save node parent information to define edges later.
$parents[$node_count] = $module['parent'] = $agent['id_node']; $parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node // Add node.
$nodes[$node_count] = $module; $nodes[$node_count] = $module;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -107,9 +107,15 @@ function html_do_report_info($report)
{ {
global $config; global $config;
if ($config['style'] === 'pandora_black') {
$background_color = '#222';
} else {
$background_color = '#f5f5f5';
}
$date_today = date($config['date_format']); $date_today = date($config['date_format']);
$html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: #f5f5f5;margin-top:20px;margin-bottom:20px;"><table> $html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: '.$background_color.';margin-top:20px;margin-bottom:20px;"><table>
<tr> <tr>
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td> <td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
</tr> </tr>
@ -3252,53 +3258,111 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$tables_chart = ''; $tables_chart = '';
$table1 = new stdClass(); if (isset($item['failed']) === true && empty($item['failed']) === false) {
$table1->width = '99%'; $tables_chart .= $item['failed'];
$table1->data = []; } else {
$table1->size = []; foreach ($item['charts'] as $k_chart => $chart) {
$table1->size[0] = '10%'; $checks_resume = '';
$table1->size[1] = '80%'; $sla_value = '';
$table1->size[2] = '5%'; if (reporting_sla_is_not_init_from_array($chart)) {
$table1->size[3] = '5%'; $color = COL_NOTINIT;
foreach ($item['charts'] as $chart) { $sla_value = __('Not init');
$checks_resume = ''; } else if (reporting_sla_is_ignored_from_array($chart)) {
$sla_value = ''; $color = COL_IGNORED;
if (reporting_sla_is_not_init_from_array($chart)) { $sla_value = __('No data');
$color = COL_NOTINIT; } else {
$sla_value = __('Not init'); switch ($chart['sla_status']) {
} else if (reporting_sla_is_ignored_from_array($chart)) { case REPORT_STATUS_ERR:
$color = COL_IGNORED; $color = COL_CRITICAL;
$sla_value = __('No data'); break;
} else {
switch ($chart['sla_status']) {
case REPORT_STATUS_ERR:
$color = COL_CRITICAL;
break;
case REPORT_STATUS_OK: case REPORT_STATUS_OK:
$color = COL_NORMAL; $color = COL_NORMAL;
break; break;
default: default:
$color = COL_UNKNOWN; $color = COL_UNKNOWN;
break; break;
}
$sla_value = sla_truncate(
$chart['sla_value'],
$config['graph_precision']
).'%';
$checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
} }
$sla_value = sla_truncate( // Check failover availability report.
$chart['sla_value'], if ($item['data'][$k_chart]['failover'] === '') {
$config['graph_precision'] $table1 = new stdClass();
).'%'; $table1->width = '99%';
$checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')'; $table1->data = [];
} $table1->size = [];
$table1->size[0] = '10%';
$table1->size[1] = '80%';
$table1->size[2] = '5%';
$table1->size[3] = '5%';
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
$table1->data[0][1] = $chart['chart'];
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$table1->data[0][3] = $checks_resume;
$tables_chart .= html_print_table(
$table1,
true
);
} else {
if ($item['data'][$k_chart]['failover'] === 'primary'
|| $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE
) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = [];
$table1->size = [];
$table1->size[0] = '10%';
$table1->size[1] = '80%';
$table1->size[2] = '5%';
$table1->size[3] = '5%';
}
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module']; $title = '';
$table1->data[0][1] = $chart['chart']; $checks_resume_text = $checks_resume;
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>'; $sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$table1->data[0][3] = $checks_resume; switch ($item['data'][$k_chart]['failover']) {
$tables_chart .= html_print_table( case 'primary':
$table1, $title = '<b>'.__('Primary').'</b>';
true $title .= '<br />'.$chart['agent'];
); $title .= '<br />'.$chart['module'];
break;
case (preg_match('/failover.*/', $item['data'][$k_chart]['failover']) ? true : false):
$title = '<b>'.__('Failover').'</b>';
$title .= '<br />'.$chart['agent'];
$title .= '<br />'.$chart['module'];
break;
case 'result':
default:
$title = '<b>'.__('Result').'</b>';
$sla_value_text = "<span style = 'font: bold 3em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: 12pt;">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
break;
}
$table1->data[$item['data'][$k_chart]['failover']][0] = $title;
$table1->data[$item['data'][$k_chart]['failover']][1] = $chart['chart'];
$table1->data[$item['data'][$k_chart]['failover']][2] = $sla_value_text;
$table1->data[$item['data'][$k_chart]['failover']][3] = $checks_resume_text;
if ($item['data'][$k_chart]['failover'] === 'result') {
$tables_chart .= html_print_table(
$table1,
true
);
}
}
}
} }
if ($item['type'] == 'availability_graph') { if ($item['type'] == 'availability_graph') {
@ -3496,7 +3560,8 @@ function reporting_html_general($table, $item, $pdf=0)
$table1->head = array_merge([__('Agent')], $list_modules); $table1->head = array_merge([__('Agent')], $list_modules);
foreach ($item['data'] as $agent => $modules) { foreach ($item['data'] as $agent => $modules) {
$row = []; $row = [];
$row['agent'] = $agent; $alias = agents_get_alias_by_name($agent);
$row['agent'] = $alias;
$table1->style['agent'] = 'text-align: center;'; $table1->style['agent'] = 'text-align: center;';
foreach ($list_modules as $name) { foreach ($list_modules as $name) {
$table1->style[$name] = 'text-align: center;'; $table1->style[$name] = 'text-align: center;';

View File

@ -96,7 +96,6 @@ function snmp_browser_get_html_tree(
foreach ($tree['__LEAVES__'] as $level => $sub_level) { foreach ($tree['__LEAVES__'] as $level => $sub_level) {
// Id used to expand leafs. // Id used to expand leafs.
$sub_id = time().rand(0, getrandmax()); $sub_id = time().rand(0, getrandmax());
// Display the branch. // Display the branch.
$output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">'; $output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
@ -174,7 +173,6 @@ function snmp_browser_get_html_tree(
$last_array, $last_array,
$sufix, $sufix,
$checked, $checked,
$return,
$descriptive_ids, $descriptive_ids,
$previous_id $previous_id
); );
@ -225,7 +223,6 @@ function snmp_browser_print_tree(
$last_array, $last_array,
$sufix, $sufix,
$checked, $checked,
$return,
$descriptive_ids, $descriptive_ids,
$previous_id $previous_id
); );

View File

@ -444,7 +444,7 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
AND times_fired > 0 "; AND times_fired > 0 AND talert_template_modules.disabled = 0";
$count = db_get_sql($sql); $count = db_get_sql($sql);
return $count; return $count;
@ -456,7 +456,7 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro
WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
AND times_fired > 0" AND times_fired > 0 AND talert_template_modules.disabled = 0"
); );
} }

View File

@ -1755,6 +1755,12 @@ function ui_process_page_head($string, $bitfield)
// Add the dialog styles CSS. // Add the dialog styles CSS.
$config['css']['dialog'] = 'include/styles/js/introjs.css'; $config['css']['dialog'] = 'include/styles/js/introjs.css';
// If the theme is the default, we don't load it twice.
if ($config['style'] !== 'pandora') {
// It loads the last of all.
$config['css']['theme'] = 'include/styles/'.$config['style'].'.css';
}
// If skin's css files exists then add them. // If skin's css files exists then add them.
if ($exists_css) { if ($exists_css) {
foreach ($skin_styles as $filename => $name) { foreach ($skin_styles as $filename => $name) {
@ -1766,10 +1772,10 @@ function ui_process_page_head($string, $bitfield)
// User style should go last so it can rewrite common styles. // User style should go last so it can rewrite common styles.
$config['css'] = array_merge( $config['css'] = array_merge(
[ [
'common' => 'include/styles/common.css', 'common' => 'include/styles/common.css',
'menu' => 'include/styles/menu.css', 'menu' => 'include/styles/menu.css',
'tables' => 'include/styles/tables.css', 'tables' => 'include/styles/tables.css',
$config['style'] => 'include/styles/'.$config['style'].'.css', 'general' => 'include/styles/pandora.css',
], ],
$config['css'] $config['css']
); );
@ -2598,12 +2604,12 @@ function ui_get_status_images_path()
/** /**
* Prints an image representing a status. * Prints an image representing a status.
* *
* @param string $type Type. * @param string $type Type.
* @param string $title Title. * @param string $title Title.
* @param boolean $return Whether to return an output string or echo now (optional, echo by default). * @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param array $options Options to set image attributes: I.E.: style. * @param array $options Options to set image attributes: I.E.: style.
* @param string $path Path of the image, if not provided use the status path. * @param string $path Path of the image, if not provided use the status path.
* @param boolean $rounded_image Round. * @param boolean $image_with_css Don't use an image. Draw an image with css styles.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -2613,37 +2619,8 @@ function ui_print_status_image(
$return=false, $return=false,
$options=false, $options=false,
$path=false, $path=false,
$rounded_image=false $image_with_css=false
) { ) {
// This is for the List of Modules in Agent View.
if ($rounded_image === true) {
switch ($type) {
case 'module_ok.png':
$type = 'module_ok_rounded.png';
break;
case 'module_critical.png':
$type = 'module_critical_rounded.png';
break;
case 'module_warning.png':
$type = 'module_warning_rounded.png';
break;
case 'module_no_data.png':
$type = 'module_no_data_rounded.png';
break;
case 'module_unknown.png':
$type = 'module_unknown_rounded.png';
break;
default:
$type = $type;
break;
}
}
if ($path === false) { if ($path === false) {
$imagepath_array = ui_get_status_images_path(); $imagepath_array = ui_get_status_images_path();
$imagepath = $imagepath_array[0]; $imagepath = $imagepath_array[0];
@ -2651,35 +2628,112 @@ function ui_print_status_image(
$imagepath = $path; $imagepath = $path;
} }
$imagepath .= '/'.$type; if ($imagepath == 'images/status_sets/default') {
$image_with_css = true;
if ($options === false) {
$options = [];
} }
$options['title'] = $title; $imagepath .= '/'.$type;
return html_print_image($imagepath, $return, $options, false, false, false, true); if ($image_with_css === true) {
$shape_status = get_shape_status_set($type);
return ui_print_status_sets($type, $title, $return, $shape_status);
} else {
if ($options === false) {
$options = [];
}
$options['title'] = $title;
return html_print_image($imagepath, $return, $options, false, false, false, true);
}
}
/**
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
*
* @param string $type Module/Agent/Alert status.
*
* @return array With CSS class.
*/
function get_shape_status_set($type)
{
switch ($type) {
// Small rectangles.
case STATUS_ALERT_NOT_FIRED:
case STATUS_ALERT_FIRED:
case STATUS_ALERT_DISABLED:
$return = ['class' => 'status_small_rectangles'];
break;
// Rounded rectangles.
case STATUS_MODULE_OK:
case STATUS_AGENT_OK:
case STATUS_MODULE_NO_DATA:
case STATUS_AGENT_NO_DATA:
case STATUS_MODULE_CRITICAL:
case STATUS_AGENT_CRITICAL:
case STATUS_MODULE_WARNING:
case STATUS_AGENT_WARNING:
case STATUS_MODULE_UNKNOWN:
case STATUS_AGENT_UNKNOWN:
case STATUS_AGENT_DOWN:
$return = ['class' => 'status_rounded_rectangles'];
break;
// Small squares.
case STATUS_SERVER_OK:
case STATUS_SERVER_DOWN:
$return = ['class' => 'status_small_squares'];
break;
// Balls.
case STATUS_AGENT_CRITICAL_BALL:
case STATUS_AGENT_WARNING_BALL:
case STATUS_AGENT_DOWN_BALL:
case STATUS_AGENT_UNKNOWN_BALL:
case STATUS_AGENT_OK_BALL:
case STATUS_AGENT_NO_DATA_BALL:
case STATUS_AGENT_NO_MONITORS_BALL:
$return = ['class' => 'status_balls'];
break;
// Small Balls.
case STATUS_MODULE_OK_BALL:
case STATUS_MODULE_CRITICAL_BALL:
case STATUS_MODULE_WARNING_BALL:
case STATUS_MODULE_NO_DATA_BALL:
case STATUS_MODULE_UNKNOWN_BALL:
case STATUS_ALERT_FIRED_BALL:
case STATUS_ALERT_NOT_FIRED_BALL:
case STATUS_ALERT_DISABLED_BALL:
$return = ['class' => 'status_small_balls'];
break;
default:
// Ignored.
break;
}
return $return;
} }
/** /**
* Prints an image representing a status. * Prints an image representing a status.
* *
* @param string $status Module status. * @param string $status Module status.
* @param string $title Title. * @param string $title Title.
* @param boolean $return Whether to return an output string or echo now (optional, echo by default). * @param boolean $return Whether to return an output string or echo now (optional, echo by default).
* @param array $options Options to set image attributes: I.E.: style. * @param array $options Options to set image attributes: I.E.: style.
* @param boolean $rounded_image Round.
* *
* @return string HTML. * @return string HTML.
*/ */
function ui_print_module_status( function ui_print_status_sets(
$status, $status,
$title='', $title='',
$return=false, $return=false,
$options=false, $options=false
$rounded_image=false
) { ) {
global $config; global $config;
@ -2687,21 +2741,26 @@ function ui_print_module_status(
$options = []; $options = [];
} }
$options['style'] .= 'width: 50px;'; if (isset($options['style'])) {
$options['style'] .= 'height: 2em;'; $options['style'] .= ' background: '.modules_get_color_status($status).'; display: inline-block;';
$options['style'] .= 'display: inline-block;'; } else {
$options['style'] = 'background: '.modules_get_color_status($status).'; display: inline-block;';
include_once __DIR__.'/functions_modules.php';
$options['style'] .= 'background: '.modules_get_color_status($status).';';
if ($rounded_image === true) {
$options['style'] .= 'border-radius: 5px;';
} }
$options['title'] = $title; if (isset($options['class'])) {
$options['data-title'] = $title; $options['class'] = $options['class'];
$options['data-use_title_for_force_title'] = 1; }
$options['class'] = 'forced_title';
if ($title != '') {
$options['title'] = $title;
$options['data-title'] = $title;
$options['data-use_title_for_force_title'] = 1;
if (isset($options['class'])) {
$options['class'] .= ' forced_title';
} else {
$options['class'] = 'forced_title';
}
}
$output = '<div '; $output = '<div ';
foreach ($options as $k => $v) { foreach ($options as $k => $v) {

View File

@ -293,7 +293,7 @@ function users_get_groups(
} }
// Per-group permissions. // Per-group permissions.
else { else {
$query = 'SELECT * FROM tgrupo ORDER BY parent,id_grupo DESC'; $query = 'SELECT * FROM tgrupo ORDER BY nombre';
$raw_groups = db_get_all_rows_sql($query); $raw_groups = db_get_all_rows_sql($query);
$query = sprintf( $query = sprintf(

View File

@ -740,6 +740,8 @@ function print_donut_narrow_graph(
array $data, array $data,
$data_total $data_total
) { ) {
global $config;
if (empty($data)) { if (empty($data)) {
return graph_nodata_image($width, $height, 'pie'); return graph_nodata_image($width, $height, 'pie');
} }
@ -754,10 +756,31 @@ function print_donut_narrow_graph(
$graph_id = uniqid('graph_'); $graph_id = uniqid('graph_');
// This is for "Style template" in visual styles.
switch ($config['style']) {
case 'pandora':
$textColor = '#000';
$strokeColor = '#fff';
break;
case 'pandora_black':
$textColor = '#fff';
$strokeColor = '#222';
break;
default:
$textColor = '#000';
$strokeColor = '#fff';
break;
}
$textColor = json_encode($textColor);
$strokeColor = json_encode($strokeColor);
$out = "<div id='$graph_id'></div>"; $out = "<div id='$graph_id'></div>";
$out .= include_javascript_d3(true); $out .= include_javascript_d3(true);
$out .= "<script type='text/javascript'> $out .= "<script type='text/javascript'>
donutNarrowGraph($colors, $width, $height, $data_total) donutNarrowGraph($colors, $width, $height, $data_total, $textColor, $strokeColor)
.donutbody(d3.select($graph_id)) .donutbody(d3.select($graph_id))
.data($data) .data($data)
.render(); .render();

View File

@ -2762,7 +2762,14 @@ function valueToBytes(value) {
return value.toFixed(2) + shorts[pos] + "B"; return value.toFixed(2) + shorts[pos] + "B";
} }
function donutNarrowGraph(colores, width, height, total) { function donutNarrowGraph(
colores,
width,
height,
total,
textColor,
strokeColor
) {
// Default settings // Default settings
var donutbody = d3.select("body"); var donutbody = d3.select("body");
var data = {}; var data = {};
@ -2848,7 +2855,7 @@ function donutNarrowGraph(colores, width, height, total) {
this._current = d; this._current = d;
}) })
.attr("d", arc) .attr("d", arc)
.attr("stroke", "white") .attr("stroke", strokeColor)
.style("fill", function(d) { .style("fill", function(d) {
return color(d.data.key); return color(d.data.key);
}); });
@ -2872,7 +2879,7 @@ function donutNarrowGraph(colores, width, height, total) {
.attr("y", 0 + radius / 10) .attr("y", 0 + radius / 10)
.attr("class", "text-tooltip") .attr("class", "text-tooltip")
.style("text-anchor", "middle") .style("text-anchor", "middle")
//.attr("fill", "#82b92e") .attr("fill", textColor)
.style("font-size", function(d) { .style("font-size", function(d) {
if (normal_status) { if (normal_status) {
percentage_normal = (normal_status * 100) / total; percentage_normal = (normal_status * 100) / total;
@ -2902,6 +2909,7 @@ function donutNarrowGraph(colores, width, height, total) {
/* .attr("fill", function(d) { /* .attr("fill", function(d) {
return color(obj.data.key); return color(obj.data.key);
})*/ })*/
.attr("fill", textColor)
.style("font-size", function(d) { .style("font-size", function(d) {
percentage = (d[obj.data.key] * 100) / total; percentage = (d[obj.data.key] * 100) / total;
if (Number.isInteger(percentage)) { if (Number.isInteger(percentage)) {

View File

@ -437,19 +437,18 @@ function event_change_status(event_ids) {
var meta = $("#hidden-meta").val(); var meta = $("#hidden-meta").val();
var history = $("#hidden-history").val(); var history = $("#hidden-history").val();
var params = [];
params.push("page=include/ajax/events");
params.push("change_status=1");
params.push("event_ids=" + event_ids);
params.push("new_status=" + new_status);
params.push("meta=" + meta);
params.push("history=" + history);
$("#button-status_button").attr("disabled", "disabled"); $("#button-status_button").attr("disabled", "disabled");
$("#response_loading").show(); $("#response_loading").show();
jQuery.ajax({ jQuery.ajax({
data: params.join("&"), data: {
page: "include/ajax/events",
change_status: 1,
event_ids: event_ids,
new_status: new_status,
meta: meta,
history: history
},
type: "POST", type: "POST",
url: $("#hidden-ajax_file").val(), url: $("#hidden-ajax_file").val(),
async: true, async: true,
@ -457,12 +456,21 @@ function event_change_status(event_ids) {
success: function(data) { success: function(data) {
$("#button-status_button").removeAttr("disabled"); $("#button-status_button").removeAttr("disabled");
$("#response_loading").hide(); $("#response_loading").hide();
show_event_dialog(
event_id, if ($("#notification_status_success").length) {
$("#hidden-group_rep").val(), $("#notification_status_success").hide();
"responses", }
data
); if ($("#notification_status_error").length) {
$("#notification_status_error").hide();
}
if (data == "status_ok") {
dt_events.draw(false);
$("#notification_status_success").show();
} else {
$("#notification_status_error").show();
}
} }
}); });
return false; return false;
@ -475,19 +483,18 @@ function event_change_owner() {
var meta = $("#hidden-meta").val(); var meta = $("#hidden-meta").val();
var history = $("#hidden-history").val(); var history = $("#hidden-history").val();
var params = [];
params.push("page=include/ajax/events");
params.push("change_owner=1");
params.push("event_id=" + event_id);
params.push("new_owner=" + new_owner);
params.push("meta=" + meta);
params.push("history=" + history);
$("#button-owner_button").attr("disabled", "disabled"); $("#button-owner_button").attr("disabled", "disabled");
$("#response_loading").show(); $("#response_loading").show();
jQuery.ajax({ jQuery.ajax({
data: params.join("&"), data: {
page: "include/ajax/events",
change_owner: 1,
event_id: event_id,
new_owner: new_owner,
meta: meta,
history: history
},
type: "POST", type: "POST",
url: $("#hidden-ajax_file").val(), url: $("#hidden-ajax_file").val(),
async: true, async: true,
@ -496,12 +503,29 @@ function event_change_owner() {
$("#button-owner_button").removeAttr("disabled"); $("#button-owner_button").removeAttr("disabled");
$("#response_loading").hide(); $("#response_loading").hide();
show_event_dialog( if ($("#notification_owner_success").length) {
event_id, $("#notification_owner_success").hide();
$("#hidden-group_rep").val(), }
"responses",
data if ($("#notification_owner_error").length) {
); $("#notification_owner_error").hide();
}
if (data == "owner_ok") {
dt_events.draw(false);
$("#notification_owner_success").show();
if (new_owner == -1) {
$("#extended_event_general_page table td.general_owner").html(
"<i>N/A</i>"
);
} else {
$("#extended_event_general_page table td.general_owner").text(
new_owner
);
}
} else {
$("#notification_owner_error").show();
}
} }
}); });

View File

@ -536,7 +536,7 @@ function configure_modules_form() {
var obj = jQuery.parseJSON(data["macros"]); var obj = jQuery.parseJSON(data["macros"]);
$.each(obj, function(k, macro) { $.each(obj, function(k, macro) {
add_macro_field(macro, "simple-macro"); add_macro_field(macro, "simple-macro", "td", k);
}); });
} }
@ -791,7 +791,7 @@ function new_macro(prefix, callback) {
} }
} }
function add_macro_field(macro, row_model_id) { function add_macro_field(macro, row_model_id, type_copy, k) {
var macro_desc = macro["desc"]; var macro_desc = macro["desc"];
// Change the carriage returns by html returns <br> in help // Change the carriage returns by html returns <br> in help
var macro_help = macro["help"].replace(/&#x0d;/g, "<br>"); var macro_help = macro["help"].replace(/&#x0d;/g, "<br>");
@ -799,7 +799,6 @@ function add_macro_field(macro, row_model_id) {
var macro_value = $("<div />") var macro_value = $("<div />")
.html(macro["value"]) .html(macro["value"])
.text(); .text();
var macro_hide = macro["hide"];
macro_value.type = "password"; macro_value.type = "password";
@ -809,6 +808,7 @@ function add_macro_field(macro, row_model_id) {
// Change attributes to be unique and with identificable class // Change attributes to be unique and with identificable class
$macro_field.attr("id", row_id); $macro_field.attr("id", row_id);
$macro_field.attr("class", "macro_field"); $macro_field.attr("class", "macro_field");
// Get the number of fields already printed // Get the number of fields already printed
@ -828,6 +828,19 @@ function add_macro_field(macro, row_model_id) {
); );
} }
// Only for create module type plugin need rename
// td id "simple-macro_field" + k + "-1" is horrible.
if (k) {
$("#" + row_model_id + "_field" + k + "_ td:eq(0)").attr(
"id",
"simple-macro_field" + k + "-0"
);
$("#" + row_model_id + "_field" + k + "_ td:eq(1)").attr(
"id",
"simple-macro_field" + k + "-1"
);
}
// Change the label // Change the label
if (macro_help == "") { if (macro_help == "") {
$("#" + row_id) $("#" + row_id)
@ -850,16 +863,29 @@ function add_macro_field(macro, row_model_id) {
} }
// Change the text box id and value // Change the text box id and value
$("#" + row_id) if (type_copy == "td") {
.children() $("#" + row_id)
.eq(1) .children()
.attr("id", "text-" + macro_macro); .eq(1)
$("#" + row_id) .children()
.children() .attr("id", "text-" + macro_macro);
.eq(1) $("#" + row_id)
.attr("name", macro_macro); .children()
.eq(1)
.children()
.attr("name", macro_macro);
} else {
$("#" + row_id)
.children()
.eq(1)
.attr("id", "text-" + macro_macro);
$("#" + row_id)
.children()
.eq(1)
.attr("name", macro_macro);
}
macro_field_hide = false; var macro_field_hide = false;
if (typeof macro["hide"] == "string") { if (typeof macro["hide"] == "string") {
if (macro["hide"].length == 0) { if (macro["hide"].length == 0) {
macro_field_hide = false; macro_field_hide = false;
@ -872,16 +898,33 @@ function add_macro_field(macro, row_model_id) {
} }
} }
if (macro_field_hide) { if (type_copy == "td") {
$("#" + row_id) if (macro_field_hide) {
.children() $("#" + row_id)
.eq(1) .children()
.attr("type", "password"); .eq(1)
.children()
.attr("type", "password");
} else {
$("#" + row_id)
.children()
.eq(1)
.children()
.val(macro_value);
}
} else {
if (macro_field_hide) {
$("#" + row_id)
.children()
.eq(1)
.attr("type", "password");
} else {
$("#" + row_id)
.children()
.eq(1)
.val(macro_value);
}
} }
$("#" + row_id)
.children()
.eq(1)
.val(macro_value);
$("#" + row_id).show(); $("#" + row_id).show();
} }
@ -908,7 +951,7 @@ function load_plugin_macros_fields(row_model_id) {
$("#hidden-macros").val(data["base64"]); $("#hidden-macros").val(data["base64"]);
jQuery.each(data["array"], function(i, macro) { jQuery.each(data["array"], function(i, macro) {
if (macro["desc"] != "") { if (macro["desc"] != "") {
add_macro_field(macro, row_model_id); add_macro_field(macro, row_model_id, "td");
} }
}); });
//Plugin text can be larger //Plugin text can be larger
@ -1223,3 +1266,42 @@ function get_explanation_recon_script(id, id_rt, url) {
taskManager.addTask(xhr); taskManager.addTask(xhr);
} }
// Filter modules in a select (bulk operations)
function filterByText(selectbox, textbox, textNoData) {
return selectbox.each(function() {
var select = selectbox;
var options = [];
$(select)
.find("option")
.each(function() {
options.push({ value: $(this).val(), text: $(this).text() });
});
$(select).data("options", options);
$(textbox).bind("change keyup", function() {
var options = $(select)
.empty()
.scrollTop(0)
.data("options");
var search = $(this).val();
var regex = new RegExp(search, "gi");
$.each(options, function(i) {
var option = options[i];
if (option.text.match(regex) !== null) {
$(select).append(
$("<option>")
.text(option.text)
.val(option.value)
);
}
});
if ($(select)[0].length == 0) {
$(select).append(
$("<option>")
.text(textNoData)
.val(textNoData)
);
}
});
});
}

View File

@ -1,32 +1,75 @@
<?php <?php
/**
* Session manager.
*
* @category Session handler.
* @package Pandora FMS.
* @subpackage OpenSource.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list /**
// This program is free software; you can redistribute it and/or * Open session.
// modify it under the terms of the GNU Lesser General Public License *
// as published by the Free Software Foundation; version 2 * @param string $save_path Save path.
// This program is distributed in the hope that it will be useful, * @param string $session_name Session name.
// but WITHOUT ANY WARRANTY; without even the implied warranty of *
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * @return boolean
// GNU General Public License for more details. */
function pandora_session_open($save_path, $session_name) function pandora_session_open($save_path, $session_name)
{ {
return true; return true;
} }
/**
* Close session.
*
* @return boolean
*/
function pandora_session_close() function pandora_session_close()
{ {
return true; return true;
} }
/**
* Read a session.
*
* @param string $session_id Session ID.
*
* @return string Session data.
*/
function pandora_session_read($session_id) function pandora_session_read($session_id)
{ {
$session_id = addslashes($session_id); $session_id = addslashes($session_id);
$session_data = db_get_value('data', 'tsessions_php', 'id_session', $session_id); $session_data = db_get_value(
'data',
'tsessions_php',
'id_session',
$session_id
);
if (!empty($session_data)) { if (!empty($session_data)) {
return $session_data; return $session_data;
@ -36,10 +79,25 @@ function pandora_session_read($session_id)
} }
/**
* Write session data.
*
* @param string $session_id Session id.
* @param string $data Data.
*
* @return boolean
*/
function pandora_session_write($session_id, $data) function pandora_session_write($session_id, $data)
{ {
$session_id = addslashes($session_id); $session_id = addslashes($session_id);
if (is_ajax()) {
// Avoid session upadte while processing ajax responses - notifications.
if (get_parameter('check_new_notifications', false)) {
return true;
}
}
$values = []; $values = [];
$values['last_active'] = time(); $values['last_active'] = time();
@ -47,29 +105,55 @@ function pandora_session_write($session_id, $data)
$values['data'] = addslashes($data); $values['data'] = addslashes($data);
} }
$session_exists = (bool) db_get_value('COUNT(id_session)', 'tsessions_php', 'id_session', $session_id); $session_exists = (bool) db_get_value(
'COUNT(id_session)',
'tsessions_php',
'id_session',
$session_id
);
if (!$session_exists) { if (!$session_exists) {
$values['id_session'] = $session_id; $values['id_session'] = $session_id;
$retval_write = db_process_sql_insert('tsessions_php', $values); $retval_write = db_process_sql_insert('tsessions_php', $values);
} else { } else {
$retval_write = db_process_sql_update('tsessions_php', $values, ['id_session' => $session_id]); $retval_write = db_process_sql_update(
'tsessions_php',
$values,
['id_session' => $session_id]
);
} }
return $retval_write !== false; return $retval_write !== false;
} }
/**
* Destroy a session.
*
* @param string $session_id Session Id.
*
* @return boolean
*/
function pandora_session_destroy($session_id) function pandora_session_destroy($session_id)
{ {
$session_id = addslashes($session_id); $session_id = addslashes($session_id);
$retval = (bool) db_process_sql_delete('tsessions_php', ['id_session' => $session_id]); $retval = (bool) db_process_sql_delete(
'tsessions_php',
['id_session' => $session_id]
);
return $retval; return $retval;
} }
/**
* Session garbage collector.
*
* @param integer $max_lifetime Max lifetime.
*
* @return boolean.
*/
function pandora_session_gc($max_lifetime=300) function pandora_session_gc($max_lifetime=300)
{ {
global $config; global $config;
@ -80,7 +164,12 @@ function pandora_session_gc($max_lifetime=300)
$time_limit = (time() - $max_lifetime); $time_limit = (time() - $max_lifetime);
$retval = (bool) db_process_sql_delete('tsessions_php', ['last_active' => '<'.$time_limit]); $retval = (bool) db_process_sql_delete(
'tsessions_php',
[
'last_active' => '<'.$time_limit,
]
);
return $retval; return $retval;
} }
@ -88,5 +177,12 @@ function pandora_session_gc($max_lifetime=300)
// FIXME: SAML should work with pandora session handlers // FIXME: SAML should work with pandora session handlers
if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') { if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') {
$result_handler = session_set_save_handler('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc'); $result_handler = session_set_save_handler(
'pandora_session_open',
'pandora_session_close',
'pandora_session_read',
'pandora_session_write',
'pandora_session_destroy',
'pandora_session_gc'
);
} }

View File

@ -271,6 +271,7 @@ ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
margin: 0; margin: 0;
margin-bottom: -1px; margin-bottom: -1px;
border: none; border: none;
border-bottom: 1px solid #a9a9a9;
} }
ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
@ -298,9 +299,6 @@ li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab {
li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active { li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
} }
div.extended_event_pages.ui-tabs-panel.ui-corner-bottom.ui-widget-content {
border-top: 1px solid #a9a9a9;
}
tr.group { tr.group {
padding: 5px; padding: 5px;

View File

@ -5791,9 +5791,51 @@ div#status_pie {
grid-template-columns: 50px auto; grid-template-columns: 50px auto;
} }
/*
* ---------------------------------------------------------------------
* - IMAGES FOR STATUS. This replaces the images of /images/status_sets/default/
* - Don't delete this
* ---------------------------------------------------------------------
*/
.status_small_rectangles {
width: 20px;
height: 10px;
display: inline-block;
}
.status_rounded_rectangles {
width: 50px;
height: 2em;
display: inline-block;
border-radius: 5px;
}
.status_small_squares,
.status_balls {
width: 12px;
height: 12px;
display: inline-block;
}
.status_balls {
border-radius: 50%;
}
.status_small_balls {
width: 8px;
height: 8px;
display: inline-block;
border-radius: 50%;
}
/*
* ---------------------------------------------------------------------
* - END - IMAGES FOR STATUS. Don't delete this
* ---------------------------------------------------------------------
*/
/* Table for show more info in events and config menu in modules graphs. (This class exists in events.css too) */ /* Table for show more info in events and config menu in modules graphs. (This class exists in events.css too) */
.table_modal_alternate { .table_modal_alternate {
border-spacing: 0px; border-spacing: 0;
text-align: left; text-align: left;
} }

View File

@ -1,4 +1,6 @@
/** /**
* Exclude css from visual styles
*
* Extension to manage a list of gateways and the node address where they should * Extension to manage a list of gateways and the node address where they should
* point to. * point to.
* *

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -138,3 +138,7 @@ div#tree-controller-recipient {
width: 98%; width: 98%;
margin-top: 10px; margin-top: 10px;
} }
.tree-node > .node-content > div + div:not(.tree-node-counters) {
margin-left: 3px;
}

View File

@ -385,24 +385,30 @@ if (! isset($config['id_user'])) {
$nick_in_db = $_SESSION['prepared_login_da']['id_user']; $nick_in_db = $_SESSION['prepared_login_da']['id_user'];
$expired_pass = false; $expired_pass = false;
} else if (($config['auth'] == 'saml') && ($login_button_saml)) { } else if (($config['auth'] == 'saml') && ($login_button_saml)) {
include_once ENTERPRISE_DIR.'/include/auth/saml.php'; $saml_configured = include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/include/auth/saml.php';
if (!$saml_configured) {
include_once 'general/noaccesssaml.php';
}
$saml_user_id = saml_process_user_login(); $saml_user_id = saml_process_user_login();
if (!$saml_user_id) {
include_once 'general/noaccesssaml.php';
}
$nick_in_db = $saml_user_id; $nick_in_db = $saml_user_id;
if (!$nick_in_db) { if (!$nick_in_db) {
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('PandoraFMS'); $as = new SimpleSAML_Auth_Simple($config['saml_source']);
$as->logout(); $as->logout();
} }
} else { } else {
// Function process_user_login is a virtual function which should be // process_user_login is a virtual function which should be defined in each auth file.
// defined in each auth file. It accepts username and password. The // It accepts username and password. The rest should be internal to the auth file.
// rest should be internal to the auth file. The auth file can set // The auth file can set $config["auth_error"] to an informative error output or reference their internal error messages to it
// $config["auth_error"] to an informative error output or reference // process_user_login should return false in case of errors or invalid login, the nickname if correct
// their internal error messages to it process_user_login should
// return false in case of errors or invalid login, the nickname
// if correct.
$nick_in_db = process_user_login($nick, $pass); $nick_in_db = process_user_login($nick, $pass);
$expired_pass = false; $expired_pass = false;

View File

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

View File

@ -47,6 +47,8 @@ class ModuleGraph
private $module = null; private $module = null;
private $server_id = '';
function __construct() function __construct()
{ {
@ -68,6 +70,8 @@ class ModuleGraph
$this->id = (int) $system->getRequest('id', 0); $this->id = (int) $system->getRequest('id', 0);
$this->id_agent = (int) $system->getRequest('id_agent', 0); $this->id_agent = (int) $system->getRequest('id_agent', 0);
$this->server_id = $system->getRequest('server_id', '');
$this->module = modules_get_agentmodule($this->id); $this->module = modules_get_agentmodule($this->id);
$this->graph_type = return_graphtype($this->module['id_tipo_modulo']); $this->graph_type = return_graphtype($this->module['id_tipo_modulo']);
@ -124,6 +128,16 @@ class ModuleGraph
switch ($parameter2) { switch ($parameter2) {
case 'get_graph': case 'get_graph':
$this->getFilters(); $this->getFilters();
if ($system->getConfig('metaconsole')) {
$server_data = metaconsole_get_connection_by_id(
$this->server_id
);
// Establishes connection.
if (metaconsole_load_external_db($server_data) !== NOERR) {
return false;
}
}
$correct = 0; $correct = 0;
$graph = ''; $graph = '';
$correct = 1; $correct = 1;
@ -197,6 +211,10 @@ class ModuleGraph
break; break;
} }
if ($system->getConfig('metaconsole')) {
metaconsole_restore_db();
}
$graph = ob_get_clean().$graph; $graph = ob_get_clean().$graph;
echo json_encode(['correct' => $correct, 'graph' => $graph]); echo json_encode(['correct' => $correct, 'graph' => $graph]);
@ -252,7 +270,7 @@ class ModuleGraph
- $(".ui-collapsible").height() - $(".ui-collapsible").height()
- 55; - 55;
var width = $(document).width() - 25; var width = $(document).width() - 25;
ajax_get_graph($("#id_module").val(), heigth, width); ajax_get_graph($("#id_module").val(), heigth, width, $("#server_id").val());
} }
load_graph(); load_graph();
@ -264,7 +282,7 @@ class ModuleGraph
}); });
}); });
function ajax_get_graph(id, heigth_graph, width_graph) { function ajax_get_graph(id, heigth_graph, width_graph, server_id) {
postvars = {}; postvars = {};
postvars["action"] = "ajax"; postvars["action"] = "ajax";
postvars["parameter1"] = "module_graph"; postvars["parameter1"] = "module_graph";
@ -284,6 +302,8 @@ class ModuleGraph
postvars["id"] = id; postvars["id"] = id;
postvars["server_id"] = server_id;
$.ajax ({ $.ajax ({
type: "POST", type: "POST",
url: "index.php", url: "index.php",
@ -360,9 +380,18 @@ class ModuleGraph
] ]
) )
); );
$ui->contentAddHtml(
$ui->getInput(
[
'id' => 'server_id',
'value' => $this->server_id,
'type' => 'hidden',
]
)
);
$title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module['nombre']); $title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module['nombre']);
$ui->contentBeginCollapsible($title); $ui->contentBeginCollapsible($title);
$ui->beginForm('index.php?page=module_graph&id='.$this->id); $ui->beginForm('index.php?page=module_graph&id='.$this->id.'&server_id='.$this->server_id);
$options = [ $options = [
'name' => 'draw_alerts', 'name' => 'draw_alerts',
'value' => 1, 'value' => 1,

View File

@ -485,6 +485,8 @@ class Modules
$temp_modules = db_get_all_rows_sql($sql_select.$sql.$sql_limit); $temp_modules = db_get_all_rows_sql($sql_select.$sql.$sql_limit);
foreach ($temp_modules as $result_element_key => $result_element_value) { foreach ($temp_modules as $result_element_key => $result_element_value) {
$result_element_value['server_id'] = $server['id'];
$result_element_value['server_name'] = $server['server_name'];
array_push($modules_db, $result_element_value); array_push($modules_db, $result_element_value);
} }
@ -684,7 +686,19 @@ class Modules
$row[7] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;'; $row[7] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;';
} else { } else {
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].'&nbsp;&nbsp;</span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>'; if ($system->getConfig('metaconsole')) {
$row[__('Data')] = '<span style="white-space: nowrap;">';
$row[__('Data')] .= '<span style="display: none;" class="show_collapside">';
$row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[__('Data')] .= 'href="index.php?page=module_graph&id='.$module['id_agente_modulo'];
$row[__('Data')] .= '&server_id='.$module['server_id'];
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
$row[__('Data')] .= $output.'</a></span>';
$row[7] = $row[__('Data')];
} else {
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].'&nbsp;&nbsp;</span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>';
}
} }
if (!$ajax) { if (!$ajax) {

View File

@ -70,7 +70,7 @@ if (is_ajax()) {
if ($id_agente > 0) { if ($id_agente > 0) {
$last_contact = db_get_value_sql( $last_contact = db_get_value_sql(
sprintf( sprintf(
'SELECT intervalo - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) 'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
FROM `tagente` FROM `tagente`
WHERE id_agente = %d ', WHERE id_agente = %d ',
$id_agente $id_agente

View File

@ -334,6 +334,50 @@ if (is_ajax()) {
exit; exit;
} }
/*
* Load user default form.
*/
$user_filter = db_get_row_sql(
sprintf(
'SELECT f.id_filter, f.id_name
FROM tevent_filter f
INNER JOIN tusuario u
ON u.default_event_filter=f.id_filter
WHERE u.id_user = "%s" ',
$config['id_user']
)
);
if ($user_filter !== false) {
$filter = events_get_event_filter($user_filter['id_filter']);
if ($filter !== false) {
$id_group = $filter['id_group'];
$event_type = $filter['event_type'];
$severity = $filter['severity'];
$status = $filter['status'];
$search = $filter['search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
$group_rep = $filter['group_rep'];
$tag_with = json_decode(io_safe_output($filter['tag_with']));
$tag_without = json_decode(io_safe_output($filter['tag_without']));
$tag_with_base64 = base64_encode(json_encode($tag_with));
$tag_without_base64 = base64_encode(json_encode($tag_without));
$filter_only_alert = $filter['filter_only_alert'];
$id_group_filter = $filter['id_group_filter'];
$date_from = $filter['date_from'];
$date_to = $filter['date_to'];
$source = $filter['source'];
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
}
}
// TAGS. // TAGS.
// Get the tags where the user have permissions in Events reading tasks. // Get the tags where the user have permissions in Events reading tasks.
@ -736,47 +780,6 @@ if (is_metaconsole() !== true) {
} }
} }
/*
* Load user default form.
*/
$user_filter = db_get_row_sql(
sprintf(
'SELECT f.id_filter, f.id_name
FROM tevent_filter f
INNER JOIN tusuario u
ON u.default_event_filter=f.id_filter
WHERE u.id_user = "%s" ',
$config['id_user']
)
);
if ($user_filter !== false) {
$filter = events_get_event_filter($user_filter['id_filter']);
if ($filter !== false) {
$id_group = $filter['id_group'];
$event_type = $filter['event_type'];
$severity = $filter['severity'];
$status = $filter['status'];
$search = $filter['search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
$group_rep = $filter['group_rep'];
$tag_with = $filter['tag_with'];
$tag_without = $filter['tag_without'];
$filter_only_alert = $filter['filter_only_alert'];
$id_group_filter = $filter['id_group_filter'];
$date_from = $filter['date_from'];
$date_to = $filter['date_to'];
$source = $filter['source'];
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
}
}
/* /*
* Load filter form. * Load filter form.
*/ */

View File

@ -26,6 +26,7 @@ if ($searchGraphs) {
$usergraphs_id = array_keys($usergraphs); $usergraphs_id = array_keys($usergraphs);
if (empty($usergraphs_id)) { if (empty($usergraphs_id)) {
$totalGraphs = 0;
return; return;
} }
@ -37,6 +38,7 @@ if ($searchGraphs) {
'id_graph', 'id_graph',
'name', 'name',
'description', 'description',
]; ];
$totalGraphs = (int) db_get_value_filter('COUNT(id_graph) AS count', 'tgraph', $filter); $totalGraphs = (int) db_get_value_filter('COUNT(id_graph) AS count', 'tgraph', $filter);
@ -45,5 +47,7 @@ if ($searchGraphs) {
$filter['limit'] = $config['block_size']; $filter['limit'] = $config['block_size'];
$filter['offset'] = (int) get_parameter('offset'); $filter['offset'] = (int) get_parameter('offset');
$graphs = db_get_all_rows_filter('tgraph', $filter, $columns); $graphs = db_get_all_rows_filter('tgraph', $filter, $columns);
} else {
$totalGraphs = 0;
} }
} }

View File

@ -20,9 +20,10 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR');
$searchMaps = check_acl($config['id_user'], 0, 'RR'); $searchMaps = check_acl($config['id_user'], 0, 'RR');
$searchReports = check_acl($config['id_user'], 0, 'RR'); $searchReports = check_acl($config['id_user'], 0, 'RR');
$searchUsers = check_acl($config['id_user'], 0, 'UM'); $searchUsers = check_acl($config['id_user'], 0, 'UM');
$searchPolicies = check_acl($config['id_user'], 0, 'AW');
$searchHelps = true; $searchHelps = true;
echo '<br><div style="margin:auto; width:90%; padding: 10px; background: #fff">'; echo '<br><div style="margin:auto; width:90%; padding: 10px;">';
$anyfound = false; $anyfound = false;
@ -44,8 +45,12 @@ $table->style[9] = 'font-weight: bold; text-align: center;';
$table->style[10] = 'font-weight: bold; text-align: center;'; $table->style[10] = 'font-weight: bold; text-align: center;';
$table->style[11] = 'font-weight: bold; text-align: center;'; $table->style[11] = 'font-weight: bold; text-align: center;';
$table->style[13] = 'font-weight: bold; text-align: center;'; $table->style[13] = 'font-weight: bold; text-align: center;';
$table->style[14] = 'font-weight: bold; text-align: center;';
$table->style[15] = 'font-weight: bold; text-align: center;'; $table->style[15] = 'font-weight: bold; text-align: center;';
$table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]); $table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]);
$table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalAgents).'</a>'; $table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalAgents).'</a>';
$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]); $table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]);
@ -64,8 +69,10 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' =>
$table->data[0][11] = "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalReports).'</a>'; $table->data[0][11] = "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalReports).'</a>';
$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]); $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]);
$table->data[0][13] = "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalMaps).'</a>'; $table->data[0][13] = "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalMaps).'</a>';
$table->data[0][14] = html_print_image('images/help.png', true, ['title' => __('Helps found')]); if (enterprise_installed()) {
$table->data[0][15] = "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalHelps).'</a>'; $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]);
$table->data[0][15] = "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalPolicies).'</a>';
}
html_print_table($table); html_print_table($table);
@ -79,4 +86,5 @@ if ($searchAgents && $totalAgents > 0) {
).'</a>'; ).'</a>';
} }
echo '</div>'; echo '</div>';

View File

@ -0,0 +1,200 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
global $config;
enterprise_include_once('include/functions_policies.php');
$searchpolicies = check_acl($config['id'], 0, 'AW');
$selectpolicieIDUp = '';
$selectpolicieIDDown = '';
$selectNameUp = '';
$selectNameDown = '';
$selectDescriptionUp = '';
$selectDescriptionDown = '';
$selectId_groupUp = '';
$selectId_groupDown = '';
$selectStatusUp = '';
$selectStatusDown = '';
switch ($sortField) {
case 'id':
switch ($sort) {
case 'up':
$selectpolicieIDUp = $selected;
$order = [
'field' => 'id',
'order' => 'ASC',
];
break;
case 'down':
$selectpolicieIDDown = $selected;
$order = [
'field' => 'id',
'order' => 'DESC',
];
break;
}
break;
case 'name':
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = [
'field' => 'name',
'order' => 'ASC',
];
break;
case 'down':
$selectNameDown = $selected;
$order = [
'field' => 'name',
'order' => 'DESC',
];
break;
}
break;
case 'description':
switch ($sort) {
case 'up':
$selectId_groupUp = $selected;
$order = [
'field' => 'description',
'order' => 'ASC',
];
break;
case 'down':
$selectDescriptionDown = $selected;
$order = [
'field' => 'description',
'order' => 'DESC',
];
break;
}
break;
case 'last_contact':
switch ($sort) {
case 'up':
$selectId_groupUp = $selected;
$order = [
'field' => 'last_connect',
'order' => 'ASC',
];
break;
case 'down':
$selectId_groupDown = $selected;
$order = [
'field' => 'last_connect',
'order' => 'DESC',
];
break;
}
break;
case 'id_group':
switch ($sort) {
case 'up':
$selectId_groupUp = $selected;
$order = [
'field' => 'last_connect',
'order' => 'ASC',
];
break;
case 'down':
$selectId_groupDown = $selected;
$order = [
'field' => 'last_connect',
'order' => 'DESC',
];
break;
}
break;
case 'status':
switch ($sort) {
case 'up':
$selectStatusUp = $selected;
$order = [
'field' => 'is_admin',
'order' => 'ASC',
];
break;
case 'down':
$selectStatusDown = $selected;
$order = [
'field' => 'is_admin',
'order' => 'DESC',
];
break;
}
break;
default:
$selectpolicieIDUp = $selected;
$selectpolicieIDDown = '';
$selectNameUp = '';
$selectNameDown = '';
$selectDescriptionUp = '';
$selectDescriptionDown = '';
$selectId_groupUp = '';
$selectId_groupDown = '';
$selectStatusUp = '';
$selectStatusDown = '';
$order = [
'field' => 'id',
'order' => 'ASC',
];
break;
}
if ($searchpolicies == 0) {
/*
We take the user groups to get policies that meet the requirements of the search
and which the user have permission on this groups
*/
$user_groups = users_get_groups($config['id_user'], 'AR', false);
$id_user_groups = array_keys($user_groups);
$id_user_groups_str = implode(',', $id_user_groups);
$sql = "SELECT id, name, description, id_group, status
FROM tpolicies
WHERE name LIKE '$stringSearchSQL'
AND id_group IN ($id_user_groups_str)";
}
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
$policies = db_process_sql($sql);
if ($policies !== false) {
$totalPolicies = count($policies);
if ($only_count) {
unset($policies);
}
} else {
$totalPolicies = 0;
}

View File

@ -0,0 +1,90 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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; 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.
global $config;
enterprise_include_once('include/functions_policies.php');
require_once $config['homedir'].'/enterprise/include/functions_groups.php';
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
if (!$policies || !$searchpolicies) {
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
} else {
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '98%';
$table->class = 'databox';
$table->align = [];
$table->align[4] = 'center';
$table->head = [];
// $table->head[0] = __('ID').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).'</a>';
$table->head[0] = __('Name').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>';
$table->head[1] = __('Description').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).'</a>';
$table->head[2] = __('Id_group').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).'</a>';
$table->head[3] = __('Status').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).'</a>';
$table->data = [];
foreach ($policies as $policie) {
$policieIDCell = "<a href='?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=".$policies['id']."'>".$policies['id'].'</a>';
switch ($policie['status']) {
case POLICY_UPDATED:
$status = html_print_image(
'images/policies_ok.png',
true,
['title' => __('Policy updated')]
);
break;
case POLICY_PENDING_DATABASE:
$status = html_print_image(
'images/policies_error_db.png',
true,
['title' => __('Pending update policy only database')]
);
break;
case POLICY_PENDING_ALL:
$status = html_print_image(
'images/policies_error.png',
true,
['title' => __('Pending update policy')]
);
break;
}
$url = $config['homeurl'].'/index.php?'.'sec=gmodules&'.'sec2=enterprise/godmode/policies/policies&id='.$policie['id'].'';
array_push(
$table->data,
[
// $policie['id'],
'<a href= '.$url.'>'.$policie['name'].'',
$policie['description'],
ui_print_group_icon($policie['id_group'], true),
$status,
]
);
}
$totalPolicies = count($policies);
echo '<br />';
html_print_table($table);
unset($table);
ui_pagination($totalPolicies);
}

View File

@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
enterprise_include('operation/reporting/custom_reporting.php'); enterprise_include('operation/reporting/custom_reporting.php');
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR'); $searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
$searchUsers = check_acl($config['id_user'], 0, 'UM'); $searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AW');
$searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR'); $searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR');
$searchMain = true; $searchMain = true;
$searchHelps = true; $searchHelps = true;
@ -43,6 +43,7 @@ if ($config['search_category'] == 'all') {
// INI SECURITY ACL // INI SECURITY ACL
if ((!$searchAgents && !$searchUsers && !$searchMaps) if ((!$searchAgents && !$searchUsers && !$searchMaps)
|| (!$searchUsers && $searchTab == 'users') || (!$searchUsers && $searchTab == 'users')
|| (!$searchPolicies && $searchTab == 'policies')
|| (!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts')) || (!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts'))
|| (!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports')) || (!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports'))
) { ) {
@ -161,29 +162,29 @@ if ($searchModules) {
$modules_tab = ''; $modules_tab = '';
} }
if ($searchHelps) { if ($searchPolicies) {
$helps_tab = [ $policies_tab = [
'text' => "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image( 'text' => "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(
'images/help_w.png', 'images/policies.png',
true, true,
['title' => __('Helps')] ['title' => __('Policies')]
).'</a>', ).'</a>',
'active' => $searchTab == 'helps', 'active' => $searchTab == 'policies',
]; ];
} else { } else {
$helps_tab = ''; $policies_tab = '';
} }
$onheader = [ $onheader = [
'main' => $main_tab, 'main' => $main_tab,
'agents' => $agents_tab, 'agents' => $agents_tab,
'modules' => $modules_tab, 'modules' => $modules_tab,
'alerts' => $alerts_tab, 'alerts' => $alerts_tab,
'users' => $users_tab, 'users' => $users_tab,
'graphs' => $graphs_tab, 'graphs' => $graphs_tab,
'reports' => $reports_tab, 'reports' => $reports_tab,
'maps' => $maps_tab, 'maps' => $maps_tab,
'helps' => $helps_tab, 'policies' => $policies_tab,
]; ];
ui_print_page_header( ui_print_page_header(
@ -212,6 +213,7 @@ switch ($searchTab) {
include_once 'search_maps.getdata.php'; include_once 'search_maps.getdata.php';
include_once 'search_modules.getdata.php'; include_once 'search_modules.getdata.php';
include_once 'search_helps.getdata.php'; include_once 'search_helps.getdata.php';
include_once 'search_policies.getdata.php';
include_once 'search_main.php'; include_once 'search_main.php';
break; break;
@ -251,8 +253,9 @@ switch ($searchTab) {
include_once 'search_modules.php'; include_once 'search_modules.php';
break; break;
case 'helps': case 'policies':
include_once 'search_helps.getdata.php'; include_once 'search_policies.getdata.php';
include_once 'search_helps.php'; include_once 'search_policies.php';
break; break;
} }

View File

@ -426,24 +426,25 @@ if (check_acl($config['id_user'], 0, 'ER')) {
).'</div>'; ).'</div>';
} }
if (!$config['disabled_newsletter']) {
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>';
if ($user_info['middlename'] > 0) {
$newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
} else {
$newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
$newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
$newsletter_reminder .= html_print_switch(
[
'name' => 'newsletter_reminder',
'value' => $newsletter_reminder_value,
'disabled' => false,
]
);
}
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>'; $newsletter_reminder .= '</div>';
if ($user_info['middlename'] > 0) {
$newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
} else {
$newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
$newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
$newsletter_reminder .= html_print_switch(
[
'name' => 'newsletter_reminder',
'value' => $newsletter_reminder_value,
'disabled' => false,
]
);
} }
$newsletter_reminder .= '</div>';
$autorefresh_list_out = []; $autorefresh_list_out = [];

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.736 %define version 7.0NG.736
%define release 190702 %define release 190712
# 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.736 %define version 7.0NG.736
%define release 190702 %define release 190712
# 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.736 %define version 7.0NG.736
%define release 190702 %define release 190712
%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

@ -820,6 +820,7 @@ CREATE TABLE IF NOT EXISTS `tmodule_relationship` (
`module_a` int(10) unsigned NOT NULL, `module_a` int(10) unsigned NOT NULL,
`module_b` int(10) unsigned NOT NULL, `module_b` int(10) unsigned NOT NULL,
`disable_update` tinyint(1) unsigned NOT NULL default '0', `disable_update` tinyint(1) unsigned NOT NULL default '0',
`type` ENUM('direct', 'failover') DEFAULT 'direct',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
FOREIGN KEY (`module_a`) REFERENCES tagente_modulo(`id_agente_modulo`) FOREIGN KEY (`module_a`) REFERENCES tagente_modulo(`id_agente_modulo`)
ON DELETE CASCADE, ON DELETE CASCADE,
@ -1452,6 +1453,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`agent_max_value` TINYINT(1) DEFAULT '1', `agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1', `agent_min_value` TINYINT(1) DEFAULT '1',
`current_month` TINYINT(1) DEFAULT '1', `current_month` TINYINT(1) DEFAULT '1',
`failover_mode` tinyint(1) DEFAULT '1',
`failover_type` tinyint(1) DEFAULT '1',
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
@ -1464,6 +1467,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
`id` INTEGER UNSIGNED NOT NULL auto_increment, `id` INTEGER UNSIGNED NOT NULL auto_increment,
`id_report_content` INTEGER UNSIGNED NOT NULL, `id_report_content` INTEGER UNSIGNED NOT NULL,
`id_agent_module` int(10) unsigned NOT NULL, `id_agent_module` int(10) unsigned NOT NULL,
`id_agent_module_failover` int(10) unsigned NOT NULL,
`sla_max` double(18,2) NOT NULL default 0, `sla_max` double(18,2) NOT NULL default 0,
`sla_min` double(18,2) NOT NULL default 0, `sla_min` double(18,2) NOT NULL default 0,
`sla_limit` double(18,2) NOT NULL default 0, `sla_limit` double(18,2) NOT NULL default 0,
@ -2992,6 +2996,8 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`agent_max_value` TINYINT(1) DEFAULT '1', `agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1', `agent_min_value` TINYINT(1) DEFAULT '1',
`current_month` TINYINT(1) DEFAULT '1', `current_month` TINYINT(1) DEFAULT '1',
`failover_mode` tinyint(1) DEFAULT '1',
`failover_type` tinyint(1) DEFAULT '1',
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -114,10 +114,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''), ('custom_report_front_header', ''),
('custom_report_front_footer', ''), ('custom_report_front_footer', ''),
('MR', 29), ('MR', 30),
('identification_reminder', 1), ('identification_reminder', 1),
('identification_reminder_timestamp', 0), ('identification_reminder_timestamp', 0),
('current_package_enterprise', '736'), ('current_package_enterprise', '737'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'), ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'), ('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'), ('custom_support_logo', 'default_support.png'),

View File

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

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.736"; my $pandora_version = "7.0NG.736";
my $pandora_build = "190702"; my $pandora_build = "190712";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -56,15 +56,7 @@ my $TaskSem :shared;
use constant { use constant {
OS_OTHER => 10, OS_OTHER => 10,
OS_ROUTER => 17, OS_ROUTER => 17,
OS_SWITCH => 18, OS_SWITCH => 18
DISCOVERY_HOSTDEVICES => 0,
DISCOVERY_HOSTDEVICES_CUSTOM => 1,
DISCOVERY_CLOUD_AWS => 2,
DISCOVERY_APP_VMWARE => 3,
DISCOVERY_APP_MYSQL => 4,
DISCOVERY_APP_ORACLE => 5,
DISCOVERY_CLOUD_AWS_EC2 => 6,
DISCOVERY_CLOUD_AWS_RDS => 7
}; };
######################################################################################## ########################################################################################
@ -196,49 +188,11 @@ sub data_consumer ($$) {
my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh); my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh);
my %cnf_extra; my %cnf_extra;
if ($task->{'type'} == DISCOVERY_CLOUD_AWS_EC2
|| $task->{'type'} == DISCOVERY_CLOUD_AWS_RDS) { my $r = enterprise_hook('discovery_generate_extra_cnf',[$pa_config, $dbh, $task, \%cnf_extra]);
# auth_strings stores the crential identifier to be used. if (defined($r) && $r eq 'ERR') {
my $key = pandora_get_credential($dbh, $task->{'auth_strings'}); # Could not generate extra cnf, skip this task.
return;
if (ref($key) eq "HASH") {
$cnf_extra{'aws_access_key_id'} = $key->{'username'};
$cnf_extra{'aws_secret_access_key'} = $key->{'password'};
} else {
# Invalid credential.
return;
}
$cnf_extra{'cloud_util_path'} = pandora_get_config_value($dbh, 'cloud_util_path');
# Pass credentials by file due Perl limitations. We cannot update ENV here.
$cnf_extra{'creds_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time());
eval {
open(my $__file_cfg, '> '. $cnf_extra{'creds_file'}) or die($!);
print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n";
print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n";
close($__file_cfg);
set_file_permissions(
$pa_config,
$cnf_extra{'creds_file'},
"0600"
);
};
if ($@) {
logger(
$pa_config,
'Cannot instantiate configuration file for task: ' . safe_output($task->{'name'}),
5
);
# A server restart will override ENV definition (see run)
logger(
$pa_config,
'Cannot execute Discovery task: ' . safe_output($task->{'name'}) . '. Please restart the server.',
1
);
# Skip this task.
return;
}
} }
my $recon = new PandoraFMS::Recon::Base( my $recon = new PandoraFMS::Recon::Base(
@ -490,7 +444,7 @@ sub PandoraFMS::Recon::Base::connect_agents($$$$$) {
} }
# Connect the modules if they are not already connected. # Connect the modules if they are not already connected.
my $connection_id = get_db_value($self->{'dbh'}, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ?) OR (module_b = ? AND module_a = ?)', $module_id_1, $module_id_2, $module_id_1, $module_id_2); my $connection_id = get_db_value($self->{'dbh'}, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ? AND `type` = "direct") OR (module_b = ? AND module_a = ? AND `type` = "direct")', $module_id_1, $module_id_2, $module_id_1, $module_id_2);
if (! defined($connection_id)) { if (! defined($connection_id)) {
db_do($self->{'dbh'}, 'INSERT INTO tmodule_relationship (`module_a`, `module_b`, `id_rt`) VALUES(?, ?, ?)', $module_id_1, $module_id_2, $self->{'task_id'}); db_do($self->{'dbh'}, 'INSERT INTO tmodule_relationship (`module_a`, `module_b`, `id_rt`) VALUES(?, ?, ?)', $module_id_1, $module_id_2, $self->{'task_id'});
} }

View File

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

Some files were not shown because too many files have changed in this diff Show More