Merge remote-tracking branch 'origin/develop' into 4319-parser-xml

This commit is contained in:
fbsanchez 2019-07-30 19:34:46 +02:00
commit f97429fb46
151 changed files with 6638 additions and 10655 deletions

49
pandora_agents/Dockerfile Normal file
View File

@ -0,0 +1,49 @@
FROM centos:centos7
MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Add Pandora FMS agent installer
ADD unix /tmp/pandora_agent/unix
# Install dependencies
RUN yum -y install \
epel-release \
unzip \
perl \
sed \
"perl(Sys::Syslog)"
# Install Pandora FMS agent
RUN cd /tmp/pandora_agent/unix \
&& ./pandora_agent_installer --install
# Set default variables
ENV SERVER_IP '127.0.0.1'
ENV REMOTE_CONFIG '0'
ENV GROUP 'Servers'
ENV DEBUG '0'
ENV AGENT_NAME 'agent_docker'
ENV AGENT_ALIAS 'agent_docker'
ENV TIMEZONE 'UTC'
ENV SECONDARY_GROUPS ''
# Create the entrypoint script.
RUN echo -e '#/bin/bash\n \
sed -i "s/^server_ip.*$/server_ip $SERVER_IP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^remote_config.*$/remote_config $REMOTE_CONFIG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^group.*$/group $GROUP/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^debug.*$/debug $DEBUG/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_name.*$/agent_name $AGENT_NAME/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^#agent_alias.*$/agent_alias $AGENT_ALIAS/g" /etc/pandora/pandora_agent.conf\n \
sed -i "s/^# secondary_groups.*$/secondary_groups $SECONDARY_GROUPS/g" /etc/pandora/pandora_agent.conf\n \
if [ $TIMEZONE != "" ]; then\n \
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
fi\n \
/etc/init.d/pandora_agent_daemon start\n \
rm -f $0\n \
bash' \
>> /entrypoint.sh && \
chmod +x /entrypoint.sh
# Entrypoint + CMD
ENTRYPOINT ["bash"]
CMD ["/entrypoint.sh"]

View File

@ -0,0 +1,18 @@
#!/bin/bash
source /root/code/pandorafms/extras/build_vars.sh
# Set tag for docker build
if [ "$1" == "nightly" ]; then
LOCAL_VERSION="latest"
else
LOCAL_VERSION=$VERSION
fi
# Build image with code
docker build --rm=true --pull --no-cache -t pandorafms/pandorafms-agent:$LOCAL_VERSION -f $CODEHOME/pandora_agents/Dockerfile $CODEHOME/pandora_agents/
# Push image
docker push pandorafms/pandorafms-agent:$LOCAL_VERSION
# Delete local image
docker image rm -f pandorafms/pandorafms-agent:$LOCAL_VERSION

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190704} {190730}
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 190704)") #define PANDORA_VERSION ("7.0NG.736(Build 190730)")
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 190704))" VALUE "ProductVersion", "(7.0NG.736(Build 190730))"
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-190704 Version: 7.0NG.736-190730
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-190704" pandora_version="7.0NG.736-190730"
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 @@
operation/servers/recon_view.php

View File

@ -0,0 +1,51 @@
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';
ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
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

@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`type` varchar(30) default 'simple_graph', `type` varchar(30) default 'simple_graph',
`period` int(11) NOT NULL default 0, `period` int(11) NOT NULL default 0,
`order` int (11) NOT NULL default 0, `order` int (11) NOT NULL default 0,
`description` mediumtext, `description` mediumtext,
`text_agent` text, `text_agent` text,
`text` TEXT, `text` TEXT,
`external_source` Text, `external_source` Text,
@ -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,15 @@ 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';
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- 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 +2215,49 @@ 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;
-- ---------------------------------------------------------------------
-- Table `tagent_repository`
-- ---------------------------------------------------------------------
CREATE TABLE `tagent_repository` (
`id` SERIAL,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`version` VARCHAR(10) DEFAULT '',
`path` text,
`uploaded_by` VARCHAR(100) DEFAULT '',
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tdeployment_hosts`
-- ----------------------------------------------------------------------
CREATE TABLE `tdeployment_hosts` (
`id` SERIAL,
`id_cs` VARCHAR(100),
`ip` VARCHAR(100) NOT NULL UNIQUE,
`id_os` INT(10) UNSIGNED DEFAULT 0,
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
`target_agent_version_id` BIGINT UNSIGNED,
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
`last_err` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -670,21 +670,49 @@ if ($config['menu_type'] == 'classic') {
<?php <?php
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr'] || $do_refresh === true) {
if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true;
}
?> ?>
var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
$("#header_autorefresh").css('padding-right', '5px'); $("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>; if(autorefresh_draw == true) {
var t = new Date(); var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); var until_time='';
$("#refrcounter").countdown ({
until: t, function events_refresh() {
layout: '%M%nn%M:%S%nn%S', until_time = new Date();
labels: ['', '', '', '', '', '', ''], until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
onExpiry: function () {
$("#refrcounter").countdown ({
until: until_time,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
dt_events.draw(false);
}
});
}
// Start the countdown when page is loaded (first time).
events_refresh();
// Repeat countdown according to refresh_interval.
setInterval(events_refresh, refresh_interval);
} else {
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({
until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
href = href + refr_time; href = href + refr_time;
$(document).attr ("location", href); $(document).attr ("location", href);
} }
}); });
}
<?php <?php
} }
?> ?>
@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') {
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("select#ref").change (function () { $("select#ref").change (function () {
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + this.value);
}); if(autorefresh_draw == true){
inputs = $("#events_form :input");
values = {};
inputs.each(function() {
values[this.name] = $(this).val();
})
var newValue = btoa(JSON.stringify(values));
<?php
// Check if the url has the parameter fb64.
if ($_GET['fb64']) {
$fb64 = $_GET['fb64'];
?>
var fb64 = '<?php echo $fb64; ?>';
// Check if the filters have changed.
if(fb64 !== newValue){
href = href.replace(fb64, newValue);
}
$(document).attr("location", href+ '&refr=' + this.value);
<?php
} else {
?>
$(document).attr("location", href+'&fb64=' + newValue + '&refr=' + this.value);
<?php
}
?>
} else {
$(document).attr ("location", href + this.value);
}
});
return false; return false;
}); });

View File

@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
} }
if (isset($login_failed)) { if (isset($login_failed)) {
$nick = get_parameter_post('nick');
$fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
$attemps = ($config['number_attempts'] - $fails);
echo '<div id="login_failed" title="'.__('Login failed').'">'; echo '<div id="login_failed" title="'.__('Login failed').'">';
echo '<div class="content_alert">'; echo '<div class="content_alert">';
echo '<div class="icon_message_alert">'; echo '<div class="icon_message_alert">';
@ -386,6 +389,9 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>'; echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>'; echo '<p>'.$config['auth_error'].'</p>';
echo '</div>'; echo '</div>';
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>'; echo '</div>';
@ -680,5 +686,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#final_process_correct").dialog('close'); $("#final_process_correct").dialog('close');
}); });
}); });
/* ]]> */ /* ]]> */
</script> </script>

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

@ -77,6 +77,7 @@ if (is_ajax()) {
} }
$get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0); $get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
$get_common_modules = (bool) get_parameter('get_common_modules', 1);
if ($get_modules_json_for_multiple_snmp) { if ($get_modules_json_for_multiple_snmp) {
include_once 'include/graphs/functions_utils.php'; include_once 'include/graphs/functions_utils.php';
@ -100,7 +101,16 @@ if (is_ajax()) {
if ($out === false) { if ($out === false) {
$out = $oid_snmp; $out = $oid_snmp;
} else { } else {
$out = array_intersect($out, $oid_snmp); $commons = array_intersect($out, $oid_snmp);
if ($get_common_modules) {
// Common modules is selected (default)
$out = $commons;
} else {
// All modules is selected
$array1 = array_diff($out, $oid_snmp);
$array2 = array_diff($oid_snmp, $out);
$out = array_merge($commons, $array1, $array2);
}
} }
$oid_snmp = []; $oid_snmp = [];
@ -201,7 +211,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">'; $table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
if ($id_agente) { if ($id_agente) {
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />'; $table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" readonly value="'.$id_agente.'" />';
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'; $table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
$table_agent_name .= html_print_image( $table_agent_name .= html_print_image(
'images/zoom.png', 'images/zoom.png',
@ -372,13 +382,13 @@ $table_server = '<div class="label_select"><p class="input_label">'.__('Server')
$table_server .= '<div class="label_select_parent">'; $table_server .= '<div class="label_select_parent">';
if ($new_agent) { if ($new_agent) {
// Set first server by default. // Set first server by default.
$servers_get_names = servers_get_names(); $servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names); $array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names); $server_name = reset($array_keys_servers_get_names);
} }
$table_server .= html_print_select( $table_server .= html_print_select(
servers_get_names(), $servers,
'server_name', 'server_name',
$server_name, $server_name,
'', '',
@ -514,8 +524,10 @@ if (enterprise_installed()) {
); );
$safe_mode_modules = []; $safe_mode_modules = [];
$safe_mode_modules[0] = __('Any'); $safe_mode_modules[0] = __('Any');
foreach ($sql_modules as $m) { if (is_array($sql_modules)) {
$safe_mode_modules[$m['id_module']] = $m['name']; foreach ($sql_modules as $m) {
$safe_mode_modules[$m['id_module']] = $m['name'];
}
} }
$table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip( $table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip(
@ -1162,6 +1174,19 @@ ui_require_jquery_file('bgiframe');
} }
$(document).ready (function() { $(document).ready (function() {
var previous_primary_group_select;
$("#grupo").on('focus', function () {
previous_primary_group_select = this.value;
}).change(function() {
if ($("#secondary_groups_selected option[value="+$("#grupo").val()+"]").length) {
alert("<?php echo __('Secondary group cannot be primary too.'); ?>");
$("#grupo").val(previous_primary_group_select);
} else {
previous_primary_group_select = this.value;
}
});
$("select#id_os").pandoraSelectOS (); $("select#id_os").pandoraSelectOS ();
var checked = $("#checkbox-cascade_protection").is(":checked"); var checked = $("#checkbox-cascade_protection").is(":checked");
@ -1210,7 +1235,7 @@ ui_require_jquery_file('bgiframe');
128, 128,
128 128
); );
$("#text-agente").prop('disabled', true); $("#text-agente").prop('readonly', true);
}); });
</script> </script>

View File

@ -1,16 +1,32 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category SNMP interfaces.
* @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-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; global $config;
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once 'include/functions_modules.php'; require_once 'include/functions_modules.php';
@ -36,10 +52,10 @@ $snmp3_privacy_method = get_parameter('snmp3_privacy_method');
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass')); $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
$tcp_port = (string) get_parameter('tcp_port'); $tcp_port = (string) get_parameter('tcp_port');
// See if id_agente is set (either POST or GET, otherwise -1 // See if id_agente is set (either POST or GET, otherwise -1.
$id_agent = $idAgent; $id_agent = $idAgent;
// Get passed variables // Get passed variables.
$snmpwalk = (int) get_parameter('snmpwalk', 0); $snmpwalk = (int) get_parameter('snmpwalk', 0);
$create_modules = (int) get_parameter('create_modules', 0); $create_modules = (int) get_parameter('create_modules', 0);
@ -47,7 +63,7 @@ $interfaces = [];
$interfaces_ip = []; $interfaces_ip = [];
if ($snmpwalk) { if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces // OID Used is for SNMP MIB-2 Interfaces.
$snmpis = get_snmpwalk( $snmpis = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -63,7 +79,7 @@ if ($snmpwalk) {
$tcp_port, $tcp_port,
$server_to_exec $server_to_exec
); );
// ifXTable is also used // IfXTable is also used.
$ifxitems = get_snmpwalk( $ifxitems = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -80,7 +96,7 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Get the interfaces IPV4/IPV6 // Get the interfaces IPV4/IPV6.
$snmp_int_ip = get_snmpwalk( $snmp_int_ip = get_snmpwalk(
$ip_target, $ip_target,
$snmp_version, $snmp_version,
@ -97,12 +113,12 @@ if ($snmpwalk) {
$server_to_exec $server_to_exec
); );
// Build a [<interface id>] => [<interface ip>] array // Build a [<interface id>] => [<interface ip>] array.
if (!empty($snmp_int_ip)) { if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) { foreach ($snmp_int_ip as $key => $value) {
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>" // The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>" // or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
// The value is something like INTEGER: <interface id> // The value is something like INTEGER: <interface id>.
$data = explode(': ', $value); $data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false; $interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@ -110,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1]; $interface_ip = $matches[1];
} }
// Get the first ip // Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) { if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip; $interfaces_ip[$interface_id] = $interface_ip;
} }
@ -119,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip); unset($snmp_int_ip);
} }
$snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems)); $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$interfaces = []; $interfaces = [];
// We get here only the interface part of the MIB, not full mib // We get here only the interface part of the MIB, not full mib.
foreach ($snmpis as $key => $snmp) { foreach ($snmpis as $key => $snmp) {
$data = explode(': ', $snmp, 2); $data = explode(': ', $snmp, 2);
$keydata = explode('::', $key); $keydata = explode('::', $key);
$keydata2 = explode('.', $keydata[1]); $keydata2 = explode('.', $keydata[1]);
// Avoid results without index and interfaces without name // Avoid results without index and interfaces without name.
if (!isset($keydata2[1]) || !isset($data[1])) { if (!isset($keydata2[1]) || !isset($data[1])) {
continue; continue;
} }
@ -239,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id; $oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array); $oid = implode('.', $oid_array);
// Get the name // Get the name.
$name_array = explode('::', $oid_array[0]); $name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1]; $name = $ifname.'_'.$name_array[1];
// Clean the name // Clean the name.
$name = str_replace('"', '', $name); $name = str_replace('"', '', $name);
// Proc moduletypes // Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) { if (preg_match('/Status/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) { } else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) { } else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18; $module_type = 18;
} } else if (preg_match('/Alias/', $name_array[1])) {
// String moduletypes.
// String moduletypes
else if (preg_match('/Alias/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) { } else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17; $module_type = 17;
@ -266,15 +280,11 @@ if ($create_modules) {
$module_type = 17; $module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) { } else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17; $module_type = 17;
} } else if (preg_match('/s$/', $name_array[1])) {
// Specific counters (ends in s).
// Specific counters (ends in s)
else if (preg_match('/s$/', $name_array[1])) {
$module_type = 16; $module_type = 16;
} } else {
// Otherwise, numeric.
// Otherwise, numeric
else {
$module_type = 15; $module_type = 15;
} }
@ -330,7 +340,7 @@ if ($create_modules) {
$output_oid = ''; $output_oid = '';
exec('ssh pandora_exec_proxy@'.$row['ip_address'].' snmptranslate -On '.$oid, $output_oid, $rc); exec('snmptranslate -On '.$oid, $output_oid, $rc);
$conf_oid = $output_oid[0]; $conf_oid = $output_oid[0];
$oid = $conf_oid; $oid = $conf_oid;
@ -397,7 +407,9 @@ if ($create_modules) {
} }
if ($done > 0) { if ($done > 0) {
ui_print_success_message(__('Successfully modules created')." ($done)"); ui_print_success_message(
__('Successfully modules created').' ('.$done.')'
);
} }
if (!empty($errors)) { if (!empty($errors)) {
@ -407,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) { foreach ($errors as $code => $number) {
switch ($code) { switch ($code) {
case ERR_EXIST: case ERR_EXIST:
$msg .= '<br>'.__('Another module already exists with the same name')." ($number)"; $msg .= '<br>'.__('Another module already exists with the same name').' ('.$number.')';
break; break;
case ERR_INCOMPLETE: case ERR_INCOMPLETE:
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)"; $msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break; break;
case ERR_DB: case ERR_DB:
case ERR_GENERIC: case ERR_GENERIC:
default: default:
$msg .= '<br>'.__('Processing error')." ($number)"; $msg .= '<br>'.__('Processing error').' ('.$number.')';
break; break;
} }
} }
@ -426,10 +438,10 @@ if ($create_modules) {
} }
} }
// Create the interface list for the interface // Create the interface list for the interface.
$interfaces_list = []; $interfaces_list = [];
foreach ($interfaces as $interface) { foreach ($interfaces as $interface) {
// Get the interface name, removing " " characters and avoid "blank" interfaces // Get the interface name, removing " " characters and avoid "blank" interfaces.
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') { if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
$ifname = $interface['ifDescr']['value']; $ifname = $interface['ifDescr']['value'];
} else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') { } else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
@ -442,7 +454,7 @@ foreach ($interfaces as $interface) {
} }
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>"; echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
$table->width = '100%'; $table->width = '100%';
$table->cellpadding = 0; $table->cellpadding = 0;
@ -464,12 +476,14 @@ if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php'); enterprise_include_once('include/functions_satellite.php');
$rows = get_proxy_servers(); $rows = get_proxy_servers();
// Check if satellite server has remote configuration enabled.
$satellite_remote = config_agents_has_remote_configuration($id_agent);
foreach ($rows as $row) { foreach ($rows as $row) {
if ($row['server_type'] != 13) { if ($row['server_type'] != 13) {
$s_type = ' (Standard)'; $s_type = ' (Standard)';
} else { } else {
// Check if satellite server has remote configuration enabled
$satellite_remote = config_agents_has_remote_configuration($id_agent);
$id_satellite = $row['id_server']; $id_satellite = $row['id_server'];
$s_type = ' (Satellite)'; $s_type = ' (Satellite)';
} }
@ -484,8 +498,7 @@ $table->data[1][4] = html_print_select(
$servers_to_exec, $servers_to_exec,
'server_to_exec', 'server_to_exec',
$server_to_exec, $server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.') 'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
',
'', '',
'', '',
true true
@ -509,7 +522,7 @@ html_print_table($table);
unset($table); unset($table);
// SNMP3 OPTIONS // SNMP3 OPTIONS.
$table->width = '100%'; $table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>'; $table->data[2][1] = '<b>'.__('Auth user').'</b>';
@ -564,7 +577,7 @@ echo '</form>';
if (!empty($interfaces_list)) { if (!empty($interfaces_list)) {
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>'; echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>"; echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
echo '<span id="form_interfaces">'; echo '<span id="form_interfaces">';
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp'); $id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@ -589,13 +602,30 @@ if (!empty($interfaces_list)) {
$table->width = '100%'; $table->width = '100%';
// Agent selector // Agent selector.
$table->data[0][0] = '<b>'.__('Interfaces').'</b>'; $table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$table->data[0][1] = ''; $table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>'; $table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;'); $table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
$table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][1] = __('When selecting interfaces');
$table->data[1][1] .= '<br>';
$table->data[1][1] .= html_print_select(
[
1 => __('Show common modules'),
0 => __('Show all modules'),
],
'modules_selection_mode',
1,
false,
'',
'',
true,
false,
false
);
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
@ -619,12 +649,10 @@ 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'); $('#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);
@ -645,10 +673,16 @@ $(document).ready (function () {
$("#form_interfaces").hide (); $("#form_interfaces").hide ();
}); });
// When select interfaces changes
$("#modules_selection_mode").change (function() {
$("#id_snmp").trigger('change');
});
}); });
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
var idSNMP = Array(); var idSNMP = Array();
var get_common_modules = $("#modules_selection_mode option:selected").val();
jQuery.each ($("#id_snmp option:selected"), function (i, val) { jQuery.each ($("#id_snmp option:selected"), function (i, val) {
idSNMP.push($(val).val()); idSNMP.push($(val).val());
@ -660,6 +694,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
jQuery.post ('ajax.php', jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager", {"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1, "get_modules_json_for_multiple_snmp": 1,
"get_common_modules" : get_common_modules,
"id_snmp[]": idSNMP, "id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val() "id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
}, },

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

@ -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');
} }
@ -134,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
$page = get_parameter('page', ''); $page = get_parameter('page', '');
if (strstr($page, 'policy_modules') === false && $id_agent_module) { $in_policies_page = strstr($page, 'policy_modules');
if ($in_policies_page === false && $id_agent_module) {
if ($config['enterprise_installed']) { if ($config['enterprise_installed']) {
if (policies_is_module_linked($id_agent_module) == 1) { if (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1; $disabledBecauseInPolicy = 1;
@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
$disabledBecauseInPolicy $disabledBecauseInPolicy
); );
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
}
$in_policy = strstr($page, 'policy_modules'); $in_policy = strstr($page, 'policy_modules');
if (!$in_policy) { if (!$in_policy) {
// Cannot select the current module to be itself parent // Cannot select the current module to be itself parent
@ -273,17 +288,6 @@ if (!$in_policy) {
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help'); $table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true); $table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
if (isset($id_agent_module)) {
if ($id_agent_module) {
$edit = false;
} else {
$edit = true;
}
} else {
// Run into a policy
$edit = true;
}
if (!$edit) { if (!$edit) {
$sql = sprintf( $sql = sprintf(
'SELECT id_tipo, nombre 'SELECT id_tipo, nombre
@ -1101,9 +1105,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 +1117,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 +1132,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 +1170,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 +1200,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 +1223,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 +1240,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 +1384,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 +1404,6 @@ $(document).ready (function () {
'width=800,height=600' 'width=800,height=600'
); );
} }
} }
} }
@ -1386,7 +1423,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 +1433,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 +1549,6 @@ function advanced_option_dynamic() {
} else { } else {
$('.hide_dinamic').show(); $('.hide_dinamic').show();
} }
} }
@ -1524,11 +1560,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 +1597,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 +1626,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 +1638,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

@ -369,7 +369,7 @@ echo '</div>';
text = err.message; text = err.message;
failed = 1; failed = 1;
} }
if (!failed && data['error']) { if (!failed && data['error'] != undefined) {
title = "<?php echo __('Failed'); ?>"; title = "<?php echo __('Failed'); ?>";
text = data['error']; text = data['error'];
failed = 1; failed = 1;
@ -522,20 +522,18 @@ echo '</div>';
function calculate_inputs() { function calculate_inputs() {
if ($('#product :selected').val() == "CUSTOM") { if ($('#product :selected').val() == "CUSTOM") {
$('#div-username label').text('<?php echo __('Username'); ?>'); $('#div-username label').text('<?php echo __('User'); ?>');
$('#div-password label').text('<?php echo __('Password'); ?>'); $('#div-password label').text('<?php echo __('Password'); ?>');
$('#div-extra_1 label').text('<?php echo __('Extra'); ?>'); $('#div-extra_1').hide();
$('#div-extra_2 label').text('<?php echo __('Extra (2)'); ?>'); $('#div-extra_2').hide();
$('#div-extra_1').show();
$('#div-extra_2').show();
} else if ($('#product :selected').val() == "AWS") { } else if ($('#product :selected').val() == "AWS") {
$('#div-username label').text('<?php echo __('Access key ID'); ?>'); $('#div-username label').text('<?php echo __('Access key ID'); ?>');
$('#div-password label').text('<?php echo __('Secret access key'); ?>'); $('#div-password label').text('<?php echo __('Secret access key'); ?>');
$('#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();
@ -557,8 +555,8 @@ echo '</div>';
success: function(data) { success: function(data) {
$('#form_new').html(data); $('#form_new').html(data);
$('#id_group').val(0); $('#id_group').val(0);
// By default AWS. // By default CUSTOM.
$('#product').val('AWS'); $('#product').val('CUSTOM');
calculate_inputs(); calculate_inputs();
$('#product').on('change', function() { $('#product').on('change', function() {
@ -590,9 +588,6 @@ echo '</div>';
text: 'OK', text: 'OK',
click: function(e) { click: function(e) {
var values = {}; var values = {};
console.log($('#form_new'));
$('#form_new :input').each(function() { $('#form_new :input').each(function() {
values[this.name] = btoa($(this).val()); values[this.name] = btoa($(this).val());
}); });

View File

@ -84,7 +84,9 @@ if ($create_profiles) {
); );
} }
html_print_table($table); if ($table !== null) {
html_print_table($table);
}
unset($table); unset($table);

View File

@ -273,6 +273,9 @@ $table->data[1][1] = html_print_select(
true true
); );
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent'); $table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">'; $table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true); $table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -354,6 +357,11 @@ $(document).ready (function () {
/* Hide source agent */ /* Hide source agent */
var selected_agent = $("#source_id_agent").val(); var selected_agent = $("#source_id_agent").val();
$("#destiny_id_agent option[value='" + selected_agent + "']").remove(); $("#destiny_id_agent option[value='" + selected_agent + "']").remove();
},
callbackAfter:function() {
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#destiny_id_agent'), $("#text-filter_agents"), textNoData);
} }
}); });
@ -455,13 +463,14 @@ $(document).ready (function () {
$("#fieldset_destiny").hide (); $("#fieldset_destiny").hide ();
$("span.without_modules, span.without_alerts").show (); $("span.without_modules, span.without_alerts").show ();
$("span.with_modules, span.with_alerts, #target_table-operations").hide (); $("span.with_modules, span.with_alerts, #target_table-operations, #target_table-form_modules_filter").hide ();
} }
else { else {
if (no_modules) { if (no_modules) {
$("span.without_modules").show (); $("span.without_modules").show ();
$("span.with_modules").hide (); $("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck (); $("#checkbox-copy_modules").uncheck ();
$("#target_table-form_modules_filter").hide ();
} }
else { else {
$("span.without_modules").hide (); $("span.without_modules").hide ();
@ -479,7 +488,7 @@ $(document).ready (function () {
$("span.with_alerts").show (); $("span.with_alerts").show ();
$("#checkbox-copy_alerts").check (); $("#checkbox-copy_alerts").check ();
} }
$("#fieldset_destiny, #target_table-operations").show (); $("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
} }
$("#fieldset_targets").show (); $("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable (); $("#target_modules, #target_alerts").enable ();

View File

@ -501,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true true
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;'; $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $table->data['form_agents_3'][0] = __('Agents');
@ -763,6 +768,9 @@ $(document).ready (function () {
.html (value["alias"]); .html (value["alias"]);
$("#id_agents").append (option); $("#id_agents").append (option);
}); });
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
}, },
"json" "json"
); );

View File

@ -92,7 +92,9 @@ if ($delete_profiles) {
); );
} }
html_print_table($table); if ($table !== null) {
html_print_table($table);
}
unset($table); unset($table);

View File

@ -170,6 +170,8 @@ if ($update_agents) {
$n_edited = 0; $n_edited = 0;
$result = false; $result = false;
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) { if (!empty($values)) {
$group_old = false; $group_old = false;
$disabled_old = false; $disabled_old = false;
@ -196,6 +198,18 @@ if ($update_agents) {
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name); $result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
} }
// Update the configuration files.
if ($result && ($old_interval_value != $values['intervalo'])) {
enterprise_hook(
'config_agents_update_config_token',
[
$id_agent,
'interval',
$values['intervalo'],
]
);
}
if ($disabled_old !== false && $disabled_old != $values['disabled']) { if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook( enterprise_hook(
'config_agents_update_config_token', 'config_agents_update_config_token',

View File

@ -473,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
true true
); );
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;'; $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents'); $table->data['form_agents_3'][0] = __('Agents');
@ -1638,6 +1643,9 @@ $(document).ready (function () {
.html(value["alias"]); .html(value["alias"]);
$("#id_agents").append (option); $("#id_agents").append (option);
}); });
//Filter agents. Call the function when the select is fully loaded.
var textNoData = "<?php echo __('None'); ?>";
filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
}, },
"json" "json"
); );

View File

@ -24,9 +24,24 @@ $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'] = __('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';
$sub2 = [];
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
enterprise_hook('hostdevices_submenu');
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
enterprise_hook('applications_menu');
enterprise_hook('cloud_menu');
enterprise_hook('console_task_menu');
// Add to menu. // Add to menu.
$menu_godmode['discovery']['text'] = __('Discovery'); $menu_godmode['discovery']['text'] = __('Discovery');
@ -114,6 +129,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub['godmode/modules/manage_network_templates']['id'] = 'Module templates'; $sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
enterprise_hook('inventory_submenu'); enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu'); enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
} }
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {

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':
@ -850,7 +853,10 @@ $class = 'databox filters';
} }
?> ?>
<?php <?php
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.'); if (!isset($text)) {
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
}
echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>'; echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>';
?> ?>
</td> </td>
@ -862,7 +868,18 @@ $class = 'databox filters';
</td> </td>
<td style=""> <td style="">
<?php <?php
html_print_input_text('name', $name, '', 80, 100); html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
?> ?>
</td> </td>
</tr> </tr>
@ -920,7 +937,18 @@ $class = 'databox filters';
</td> </td>
<td style=""> <td style="">
<?php <?php
echo html_print_input_text('label', $label, '', 50, 255, true); echo html_print_input_text(
'label',
$label,
'',
50,
255,
true,
false,
false,
'',
'fullwidth'
);
?> ?>
</td> </td>
</tr> </tr>
@ -2238,6 +2266,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 +2638,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 +2854,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 +2873,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 +2935,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 +2970,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 +3002,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 +3061,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 +3126,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 +3184,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 +3799,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 +4104,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 +4171,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 +4260,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 +4272,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 +4416,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 +4465,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 +4640,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

@ -774,14 +774,14 @@ switch ($action) {
$table->head[1] = __('Description'); $table->head[1] = __('Description');
$table->head[2] = __('HTML'); $table->head[2] = __('HTML');
$table->head[3] = __('XML'); $table->head[3] = __('XML');
$table->size[0] = '60%'; $table->size[0] = '50%';
$table->size[1] = '20%'; $table->size[1] = '20%';
$table->size[2] = '2%'; $table->size[2] = '2%';
$table->headstyle[2] = 'min-width: 35px;text-align: center;'; $table->headstyle[2] = 'min-width: 35px;text-align: left;';
$table->size[3] = '2%'; $table->size[3] = '2%';
$table->headstyle[3] = 'min-width: 35px;text-align: center;'; $table->headstyle[3] = 'min-width: 35px;text-align: left;';
$table->size[4] = '2%'; $table->size[4] = '2%';
$table->headstyle[4] = 'min-width: 35px;text-align: center;'; $table->headstyle[4] = 'min-width: 35px;text-align: left;';
$next = 4; $next = 4;
// Calculate dinamically the number of the column. // Calculate dinamically the number of the column.
@ -790,15 +790,16 @@ switch ($action) {
} }
$table->size[$next] = '2%'; $table->size[$next] = '2%';
$table->style[$next] = 'text-align: center;'; $table->style[$next] = 'text-align: left;';
$table->headstyle[($next + 2)] = 'min-width: 100px;'; $table->headstyle[($next + 2)] = 'min-width: 130px; text-align:right;';
$table->style[($next + 2)] = 'text-align: center;'; $table->style[($next + 2)] = 'text-align: right;';
// Admin options only for RM flag. // Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[$next] = __('Private'); $table->head[$next] = __('Private');
$table->headstyle[$next] = 'min-width: 40px;text-align: left;';
$table->size[$next] = '2%'; $table->size[$next] = '2%';
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$table->align[$next] = ''; $table->align[$next] = '';
@ -808,7 +809,9 @@ switch ($action) {
$next++; $next++;
$table->head[$next] = __('Group'); $table->head[$next] = __('Group');
$table->size[$next] = '15%'; $table->headstyle[$next] = 'min-width: 40px;text-align: left;';
$table->size[$next] = '2%';
$table->align[$next] = 'left';
$next++; $next++;
$op_column = false; $op_column = false;
@ -826,7 +829,7 @@ switch ($action) {
// $table->size = array (); // $table->size = array ();
$table->size[$next] = '10%'; $table->size[$next] = '10%';
$table->align[$next] = 'left'; $table->align[$next] = 'right';
} }
$columnview = false; $columnview = false;
@ -1341,6 +1344,16 @@ switch ($action) {
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = []; $values = [];
$server_name = get_parameter('server_id');
if (is_metaconsole() && $server_name != '') {
$id_meta = metaconsole_get_id_server($server_name);
$connection = metaconsole_get_connection_by_id(
$id_meta
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
@ -1349,14 +1362,36 @@ switch ($action) {
$label = get_parameter('label', ''); $label = get_parameter('label', '');
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name. // Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name'); $name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro( $values['name'] = reporting_label_macro(
$items_label, $items_label,
$name_it $name_it
@ -1441,6 +1476,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;
@ -1704,13 +1747,6 @@ switch ($action) {
); );
$values['id_group'] = get_parameter('combo_group'); $values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter('server_name'); $values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') { if ($values['server_name'] == '') {
$values['server_name'] = get_parameter( $values['server_name'] = get_parameter(
@ -1967,22 +2003,11 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
if (is_metaconsole()) {
metaconsole_restore_db();
}
if ($good_format) { if ($good_format) {
switch ($config['dbtype']) {
case 'oracle':
if (isset($values['type'])) {
$values[db_escape_key_identifier(
'type'
)] = $values['type'];
unset($values['type']);
}
break;
default:
// Default.
break;
}
$resultOperationDB = db_process_sql_update( $resultOperationDB = db_process_sql_update(
'treport_content', 'treport_content',
$values, $values,
@ -1995,21 +2020,62 @@ switch ($action) {
case 'save': case 'save':
$values = []; $values = [];
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
metaconsole_connect($connection);
$values['server_name'] = $connection['server_name'];
}
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
$values['type'] = get_parameter('type', null); $values['type'] = get_parameter('type', null);
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$label = get_parameter('label', ''); $label = get_parameter('label', '');
// Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
$items_label['id_agent_module'] = get_parameter(
'id_agent_module'
);
$name_it = (string) get_parameter('name');
$values['recursion'] = get_parameter('recursion', null); $values['recursion'] = get_parameter('recursion', null);
$values['show_extended_events'] = get_parameter('include_extended_events', null); $values['show_extended_events'] = get_parameter(
'include_extended_events',
null
);
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// Add macros name.
$name_it = (string) get_parameter('name');
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
if (is_metaconsole()) {
metaconsole_restore_db();
}
$items_label = [
'type' => get_parameter('type'),
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$values['name'] = reporting_label_macro( $values['name'] = reporting_label_macro(
$items_label, $items_label,
$name_it $name_it
@ -2214,18 +2280,6 @@ switch ($action) {
break; break;
} }
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
$connection = metaconsole_get_connection_by_id(
$server_id
);
$values['server_name'] = $connection['server_name'];
}
if ($values['server_name'] == '') { if ($values['server_name'] == '') {
$values['server_name'] = get_parameter( $values['server_name'] = get_parameter(
'combo_server' 'combo_server'
@ -2398,6 +2452,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

@ -171,7 +171,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)]['icon'] = html_print_image( $table->data[($i + 1)]['icon'] = html_print_image(
'images/camera.png', 'images/camera.png',
true, true,
['title' => __('Static Graph')] ['title' => __('Static Image')]
); );
break; break;

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

@ -42,7 +42,19 @@ function get_wiz_class($str)
return 'ConsoleTasks'; return 'ConsoleTasks';
default: default:
// Ignore. // Main, show header.
ui_print_page_header(
__('Discovery'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
''
);
return null; return null;
} }
} }
@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php'); $classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
if (enterprise_installed()) { if (enterprise_installed()) {
$ent_classes = glob( $ent_classes = glob(
$config['homedir'].'/enterprise/godmode/wizards/*.class.php' $config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
); );
if ($ent_classes === false) { if ($ent_classes === false) {
$ent_classes = []; $ent_classes = [];
@ -130,7 +142,7 @@ if ($classname_selected === null) {
} }
} }
// Show hints if there is no task // Show hints if there is no task.
if (get_parameter('discovery_hint', 0)) { if (get_parameter('discovery_hint', 0)) {
ui_require_css_file('discovery-hint'); ui_require_css_file('discovery-hint');
ui_print_info_message(__('You must create a task first')); ui_print_info_message(__('You must create a task first'));

View File

@ -70,7 +70,7 @@ if (is_ajax()) {
$table->head[0] = __('Agent'); $table->head[0] = __('Agent');
$table->head[1] = __('Module'); $table->head[1] = __('Module');
foreach ($modules as $mod) { foreach ($modules as $mod) {
$agent_name = '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente'].'">'.modules_get_agentmodule_agent_name( $agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
$mod['id_agente_modulo'] $mod['id_agente_modulo']
).'</a>'; ).'</a>';
@ -1215,4 +1215,3 @@ ui_require_javascript_file('pandora_modules');
</script> </script>

View File

@ -152,12 +152,12 @@ foreach ($servers as $server) {
$data[8] = ''; $data[8] = '';
if ($server['type'] == 'recon') { if ($server['type'] == 'recon') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=operation/servers/recon_view">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/firts_task/icono_grande_reconserver.png', 'images/firts_task/icono_grande_reconserver.png',
true, true,
[ [
'title' => __('Manage recon tasks'), 'title' => __('Manage Discovery tasks'),
'style' => 'width:21px;height:21px;', 'style' => 'width:21px;height:21px;',
] ]
); );
@ -165,7 +165,7 @@ foreach ($servers as $server) {
} }
if ($server['type'] == 'data') { if ($server['type'] == 'data') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
true, true,
@ -173,7 +173,7 @@ foreach ($servers as $server) {
); );
$data[8] .= '</a>'; $data[8] .= '</a>';
} else if ($server['type'] == 'enterprise snmp') { } else if ($server['type'] == 'enterprise snmp') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/target.png', 'images/target.png',
true, true,
@ -182,7 +182,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
} }
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/config.png', 'images/config.png',
true, true,
@ -191,7 +191,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>'; $data[8] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) { if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/remote_configuration.png', 'images/remote_configuration.png',
true, true,
@ -201,7 +201,7 @@ foreach ($servers as $server) {
$names_servers[$safe_server_name] = false; $names_servers[$safe_server_name] = false;
} }
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">'; $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/cross.png', 'images/cross.png',
true, true,

View File

@ -86,7 +86,7 @@ $buttons = [];
// Draws header. // Draws header.
$buttons['general'] = [ $buttons['general'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general').'">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
]; ];
if (enterprise_installed()) { if (enterprise_installed()) {
@ -95,37 +95,37 @@ if (enterprise_installed()) {
$buttons['auth'] = [ $buttons['auth'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth').'">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
]; ];
$buttons['perf'] = [ $buttons['perf'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf').'">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
]; ];
$buttons['vis'] = [ $buttons['vis'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis').'">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
]; ];
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
if ($config['activate_netflow']) { if ($config['activate_netflow']) {
$buttons['net'] = [ $buttons['net'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net').'">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
]; ];
} }
} }
$buttons['ehorus'] = [ $buttons['ehorus'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
]; ];
// FIXME: Not definitive icon // FIXME: Not definitive icon
$buttons['notifications'] = [ $buttons['notifications'] = [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>', 'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
]; ];
$help_header = ''; $help_header = '';

View File

@ -1,5 +1,13 @@
<?php <?php
/** /**
* General setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________ * ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ | * | __/| _ | | _ || _ | _| _ | | ___| |__ |
@ -18,8 +26,36 @@
* ============================================================================ * ============================================================================
*/ */
// File begin.
/**
* Return sounds path.
*
* @return string Path.
*/
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}
// Begin.
global $config; global $config;
check_login(); check_login();
$table = new StdClass(); $table = new StdClass();
@ -33,35 +69,18 @@ $table->style[0] = 'font-weight:bold';
$table->size[1] = '70%'; $table->size[1] = '70%';
// Current config["language"] could be set by user, not taken from global setup ! // Current config["language"] could be set by user, not taken from global setup !
switch ($config['dbtype']) { $current_system_lang = db_get_sql(
case 'mysql': 'SELECT `value` FROM tconfig WHERE `token` = "language"'
$current_system_lang = db_get_sql( );
'SELECT `value`
FROM tconfig WHERE `token` = "language"'
);
break;
case 'postgresql':
$current_system_lang = db_get_sql(
'SELECT "value"
FROM tconfig WHERE "token" = \'language\''
);
break;
case 'oracle':
$current_system_lang = db_get_sql(
'SELECT value
FROM tconfig WHERE token = \'language\''
);
break;
}
if ($current_system_lang == '') { if ($current_system_lang == '') {
$current_system_lang = 'en'; $current_system_lang = 'en';
} }
$table->data[0][0] = __('Language code'); $i = 0;
$table->data[0][1] = html_print_select_from_sql(
$table->data[$i][0] = __('Language code');
$table->data[$i++][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage', 'SELECT id_language, name FROM tlanguage',
'language', 'language',
$current_system_lang, $current_system_lang,
@ -71,68 +90,67 @@ $table->data[0][1] = html_print_select_from_sql(
true true
); );
$table->data[1][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true); $table->data[$i][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
$table->data[$i++][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
$table->data[1][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true); $table->data[$i][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[2][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true); $table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[2][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true); $table->data[$i][0] = __('Time source');
$table->data[6][0] = __('Auto login (hash) password');
$table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[9][0] = __('Time source');
$sources['system'] = __('System'); $sources['system'] = __('System');
$sources['sql'] = __('Database'); $sources['sql'] = __('Database');
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true); $table->data[$i++][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
$table->data[10][0] = __('Automatic check for updates'); $table->data[$i][0] = __('Automatic check for updates');
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true); $table->data[$i++][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>"; echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>'; echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>'; echo '</div>';
$table->data[11][0] = __('Enforce https'); $table->data[$i][0] = __('Enforce https');
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[12][0] = __('Use cert of SSL'); $table->data[$i][0] = __('Use cert of SSL');
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->rowstyle[13] = 'display: none;'; $table->rowstyle[$i] = 'display: none;';
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true); $table->rowid[$i] = 'ssl-path-tr';
$table->data[13][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true); $table->data[$i][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
$table->data[$i++][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true); $table->data[$i][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
$table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true); $table->data[$i++][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[15][0] = __('IP list with API access'); $table->data[$i][0] = __('IP list with API access');
if (isset($_POST['list_ACL_IPs_for_API'])) { if (isset($_POST['list_ACL_IPs_for_API'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else { } else {
$list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API'])); $list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']));
} }
$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); $table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true); $table->data[$i][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); $table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[17][0] = __('Enable GIS features'); $table->data[$i][0] = __('Enable GIS features');
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true); $table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[19][0] = __('Enable Netflow'); $table->data[$i][0] = __('Enable Netflow');
$rbt_disabled = false; $rbt_disabled = false;
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$rbt_disabled = true; $rbt_disabled = true;
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true); $table->data[$i][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
} }
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true); $table->data[$i++][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
$table->data[21][0] = __('Enable Network Traffic Analyzer'); $table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[21][1] = html_print_switch( $table->data[$i++][1] = html_print_switch(
[ [
'name' => 'activate_nta', 'name' => 'activate_nta',
'value' => $config['activate_nta'], 'value' => $config['activate_nta'],
@ -171,11 +189,11 @@ foreach ($timezones as $timezone) {
} }
} }
$table->data[23][0] = __('Timezone setup').' '.ui_print_help_tip( $table->data[$i][0] = __('Timezone setup').' '.ui_print_help_tip(
__('Must have the same time zone as the system or database to avoid mismatches of time.'), __('Must have the same time zone as the system or database to avoid mismatches of time.'),
true true
); );
$table->data[23][1] = html_print_input_text_extended( $table->data[$i][1] = html_print_input_text_extended(
'timezone_text', 'timezone_text',
$config['timezone'], $config['timezone'],
'text-timezone_text', 'text-timezone_text',
@ -187,47 +205,63 @@ $table->data[23][1] = html_print_input_text_extended(
'readonly', 'readonly',
true true
); );
$table->data[23][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>'; $table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true); $table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true); $table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$sounds = get_sounds(); $sounds = get_sounds();
$table->data[24][0] = __('Sound for Alert fired'); $table->data[$i][0] = __('Sound for Alert fired');
$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$table->data[24][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[24][1] .= '<div id="layer_sound_alert"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_alert"></div>';
$table->data[25][0] = __('Sound for Monitor critical'); $table->data[$i][0] = __('Sound for Monitor critical');
$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$table->data[25][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[25][1] .= '<div id="layer_sound_critical"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_critical"></div>';
$table->data[26][0] = __('Sound for Monitor warning'); $table->data[$i][0] = __('Sound for Monitor warning');
$table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true); $table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>'; $table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
$table->data[26][1] .= '<div id="layer_sound_warning"></div>'; $table->data[$i++][1] .= '<div id="layer_sound_warning"></div>';
$table->data[28][0] = __('Public URL'); $table->data[$i][0] = __('Public URL');
$table->data[28][0] .= ui_print_help_tip( $table->data[$i][0] .= ui_print_help_tip(
__('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'), __('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'),
true true
); );
$table->data[28][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true); $table->data[$i++][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
$table->data[29][0] = __('Referer security'); $table->data[$i][0] = __('Force use Public URL');
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true); $table->data[$i][0] .= ui_print_help_tip(__('Force using defined public URL).', get_product_name()), true);
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true); $table->data[$i++][1] = html_print_switch(
[
'name' => 'force_public_url',
'value' => $config['force_public_url'],
]
);
$table->data[30][0] = __('Event storm protection'); echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true); echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true); echo '</div>';
$table->data[$i][0] = __('Public URL host exclusions');
$table->data[$i++][1] = html_print_textarea('public_url_exclusions', 2, 25, $config['public_url_exclusions'], 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('Referer security');
$table->data[$i][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
$table->data[$i++][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i][0] = __('Event storm protection');
$table->data[$i][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
$table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true); $table->data[$i][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true); $table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true); $table->data[$i][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
$table->data[32][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'server_log_dir', 'server_log_dir',
$config['server_log_dir'], $config['server_log_dir'],
'', '',
@ -236,8 +270,8 @@ $table->data[32][1] = html_print_input_text(
true true
); );
$table->data[33][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true); $table->data[$i][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
$table->data[33][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'max_log_size', 'max_log_size',
$config['max_log_size'], $config['max_log_size'],
'', '',
@ -251,8 +285,8 @@ $modes_tutorial = [
'on_demand' => __('On demand'), 'on_demand' => __('On demand'),
'expert' => __('Expert'), 'expert' => __('Expert'),
]; ];
$table->data['tutorial_mode'][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true); $table->data[$i][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
$table->data['tutorial_mode'][1] = html_print_select( $table->data[$i++][1] = html_print_select(
$modes_tutorial, $modes_tutorial,
'tutorial_mode', 'tutorial_mode',
$config['tutorial_mode'], $config['tutorial_mode'],
@ -263,11 +297,11 @@ $table->data['tutorial_mode'][1] = html_print_select(
); );
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1; $config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true); $table->data[$i][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true); $table->data[$i++][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true); $table->data[$i][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
$table->data[35][1] = html_print_input_text( $table->data[$i++][1] = html_print_input_text(
'limit_parameters_massive', 'limit_parameters_massive',
$config['limit_parameters_massive'], $config['limit_parameters_massive'],
'', '',
@ -276,17 +310,17 @@ $table->data[35][1] = html_print_input_text(
true true
); );
$table->data[36][0] = __('Include agents manually disabled'); $table->data[$i][0] = __('Include agents manually disabled');
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true); $table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true); $table->data[$i][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true); $table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[38][0] = __('Set alias as name by default in agent creation'); $table->data[$i][0] = __('Set alias as name by default in agent creation');
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); $table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true); $table->data[$i][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); $table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">'; echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
@ -352,44 +386,50 @@ $(document).ready (function () {
}); });
if ($("input[name=use_cert]").is(':checked')) { if ($("input[name=use_cert]").is(':checked')) {
$('#setup_general-13').show(); $('#ssl-path-tr').show();
} }
$("input[name=use_cert]").change(function () { $("input[name=use_cert]").change(function () {
if( $(this).is(":checked") ) if( $(this).is(":checked") )
$('#setup_general-13').show(); $('#ssl-path-tr').show();
else else
$('#setup_general-13').hide(); $('#ssl-path-tr').hide();
}); });
$("input[name=https]").change(function (){ $("input[name=https]").change(function (){
if($("input[name=https]").prop('checked')) { if($("input[name=https]").prop('checked')) {
$("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({ $("#dialog").dialog({
modal: true, modal: true,
buttons:{ width: 500,
"<?php echo __('Close'); ?>": function(){ buttons:[
$(this).dialog("close"); {
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
} }
} ]
});
}
})
$("input[name=force_public_url]").change(function (){
if($("input[name=force_public_url]").prop('checked')) {
$("#force_public_url_dialog").dialog({
modal: true,
width: 500,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
text: "<?php echo __('OK'); ?>",
click: function(){
$(this).dialog("close");
}
}
]
}); });
} }
}) })
}); });
</script> </script>
<?php
function get_sounds()
{
global $config;
$return = [];
$files = scandir($config['homedir'].'/include/sounds');
foreach ($files as $file) {
if (strstr($file, 'wav') !== false) {
$return['include/sounds/'.$file] = $file;
}
}
return $return;
}

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);
@ -1495,7 +1505,7 @@ $(document).ready (function () {
.prop('checked'); .prop('checked');
display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id')); display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id'));
}); });
$(".databox.filters").css('margin-bottom','-10px'); $(".databox.filters").css('margin-bottom','0px');
}); });
// Change the favicon preview when is changed // Change the favicon preview when is changed
@ -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

@ -418,6 +418,7 @@ class DiscoveryTaskList extends Wizard
$table->align[9] = 'left'; $table->align[9] = 'left';
foreach ($recon_tasks as $task) { foreach ($recon_tasks as $task) {
$no_operations = false;
$data = []; $data = [];
$server_name = servers_get_name($task['id_recon_server']); $server_name = servers_get_name($task['id_recon_server']);
@ -501,41 +502,71 @@ 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_DEPLOY_AGENTS:
// Internal deployment task.
$no_operations = true;
$data[6] = html_print_image(
'images/deploy.png',
true,
['title' => __('Agent deployment')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Agent.Deployment');
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 +581,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) {
@ -576,71 +607,75 @@ class DiscoveryTaskList extends Wizard
$data[8] = __('Not executed yet'); $data[8] = __('Not executed yet');
} }
if ($task['disabled'] != 2) { if (!$no_operations) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">'; if ($task['disabled'] != 2) {
$data[9] .= html_print_image( $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
'images/eye.png', $data[9] .= html_print_image(
true 'images/eye.png',
);
$data[9] .= '</a>';
}
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
);
$data[9] .= '</a>';
}
if (check_acl(
$config['id_user'],
$task['id_group'],
'PM'
)
) {
if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
$tipam_task_id
)
).'">'.html_print_image(
'images/config.png',
true true
).'</a>'; );
$data[9] .= '<a href="'.ui_get_full_url( $data[9] .= '</a>';
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id }
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png', if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true true
).'</a>'; );
$data[9] .= '</a>';
}
if (check_acl(
$config['id_user'],
$task['id_group'],
'PM'
)
) {
if ($ipam === true) {
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
$tipam_task_id
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
} else {
// Check if is a H&D, Cloud or Application or IPAM.
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
}
} else { } else {
// Check if is a H&D, Cloud or Application or IPAM. $data[9] = '';
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
'images/config.png',
true
).'</a>';
$data[9] .= '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
'images/cross.png',
true
).'</a>';
} }
} else { } else {
$data[9] = ''; $data[9] = '-';
} }
$table->cellclass[][9] = 'action_buttons'; $table->cellclass[][9] = 'action_buttons';
@ -699,7 +734,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';

View File

@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php'; require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
enterprise_include_once('include/class/CSVImportAgents.class.php'); enterprise_include_once('include/class/CSVImportAgents.class.php');
enterprise_include_once('include/class/DeploymentCenter.class.php');
enterprise_include_once('include/functions_hostdevices.php'); enterprise_include_once('include/functions_hostdevices.php');
/** /**
@ -127,6 +128,12 @@ class HostDevices extends Wizard
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png', 'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'), 'label' => __('Import CSV'),
]; ];
$buttons[] = [
'url' => $this->url.'&mode=deploy',
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
'label' => __('Agent deployment'),
];
} }
$buttons[] = [ $buttons[] = [
@ -149,11 +156,30 @@ class HostDevices extends Wizard
), ),
'label' => __('Discovery'), 'label' => __('Discovery'),
], ],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
),
'label' => __('Host & Devices'),
'selected' => true,
],
], ],
true true
); );
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(
__('Host & devices'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
$this->printBigButtonsList($buttons); $this->printBigButtonsList($buttons);
return; return;
@ -167,6 +193,14 @@ class HostDevices extends Wizard
); );
return $csv_importer->runCSV(); return $csv_importer->runCSV();
} }
if ($mode === 'deploy') {
$deployObject = new DeploymentCenter(
$this->page,
$this->breadcrum
);
return $deployObject->run();
}
} }
if ($mode === 'customnetscan') { if ($mode === 'customnetscan') {
@ -785,6 +819,7 @@ class HostDevices extends Wizard
}).change();'; }).change();';
$this->printFormAsGrid($form); $this->printFormAsGrid($form);
$this->printGoBackButton($this->url.'&page='.($this->page - 1));
} }
} }
@ -877,6 +912,7 @@ class HostDevices extends Wizard
]; ];
$this->printFormAsList($form); $this->printFormAsList($form);
$this->printGoBackButton($this->url.'&mode=netscan&task='.$this->task['id_rt'].'&page='.($this->page - 1));
} }
if ($this->page == 2) { if ($this->page == 2) {

View File

@ -296,241 +296,20 @@ class Wizard
*/ */
public function printInput($data) public function printInput($data)
{ {
global $config;
include_once $config['homedir'].'/include/functions_html.php';
if (is_array($data) === false) { if (is_array($data) === false) {
return ''; return '';
} }
switch ($data['type']) { $input = html_print_input(($data + ['return' => true]), 'div', true);
case 'text': if ($input === false) {
return html_print_input_text( return '';
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : true),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
);
case 'image':
return html_print_input_image(
$data['name'],
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'text_extended':
return html_print_input_text_extended(
$data['name'],
$data['value'],
$data['id'],
$data['alt'],
$data['size'],
$data['maxlength'],
$data['disabled'],
$data['script'],
$data['attributes'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['password']) === true) ? $data['password'] : false),
((isset($data['function']) === true) ? $data['function'] : '')
);
case 'password':
return html_print_input_password(
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['class']) === true) ? $data['class'] : '')
);
case 'text':
return html_print_input_text(
$data['name'],
$data['value'],
((isset($data['alt']) === true) ? $data['alt'] : ''),
((isset($data['size']) === true) ? $data['size'] : 50),
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
);
case 'image':
return html_print_input_image(
$data['name'],
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'hidden':
return html_print_input_hidden(
$data['name'],
$data['value'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : false)
);
case 'hidden_extended':
return html_print_input_hidden_extended(
$data['name'],
$data['value'],
$data['id'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : false)
);
case 'color':
return html_print_input_color(
$data['name'],
$data['value'],
((isset($data['class']) === true) ? $data['class'] : false),
((isset($data['return']) === true) ? $data['return'] : false)
);
case 'file':
return html_print_input_file(
$data['name'],
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
case 'select':
return html_print_select(
$data['fields'],
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['option_style']) === true) ? $data['option_style'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['modal']) === true) ? $data['modal'] : false),
((isset($data['message']) === true) ? $data['message'] : ''),
((isset($data['select_all']) === true) ? $data['select_all'] : false)
);
case 'select_from_sql':
return html_print_select_from_sql(
$data['sql'],
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
);
case 'select_groups':
return html_print_select_groups(
((isset($data['id_user']) === true) ? $data['id_user'] : false),
((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
$data['name'],
((isset($data['selected']) === true) ? $data['selected'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['multiple']) === true) ? $data['multiple'] : false),
((isset($data['sort']) === true) ? $data['sort'] : true),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['style']) === true) ? $data['style'] : false),
((isset($data['option_style']) === true) ? $data['option_style'] : false),
((isset($data['id_group']) === true) ? $data['id_group'] : false),
((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
);
case 'submit':
return '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false)
).'</div>';
case 'checkbox':
return html_print_checkbox(
$data['name'],
$data['value'],
((isset($data['checked']) === true) ? $data['checked'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
);
case 'switch':
return html_print_switch($data);
case 'interval':
return html_print_extended_select_for_time(
$data['name'],
$data['value'],
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['style']) === true) ? $data['selected'] : false),
((isset($data['unique']) === true) ? $data['unique'] : false)
);
case 'textarea':
return html_print_textarea(
$data['name'],
$data['rows'],
$data['columns'],
((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : '')
);
default:
// Ignore.
break;
} }
return ''; return $input;
} }
@ -556,6 +335,7 @@ class Wizard
], ],
'inputs' => [ 'inputs' => [
[ [
'class' => 'w100p',
'arguments' => [ 'arguments' => [
'name' => 'submit', 'name' => 'submit',
'label' => __('Go back'), 'label' => __('Go back'),
@ -594,13 +374,24 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; if ($input['wrapper']) {
$output .= '<ul class="wizard">'; $output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
} else {
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
}
$output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlock($input, $return); $output .= $this->printBlock($input, $return);
} }
$output .= '</ul></li>'; // Close block.
if ($input['wrapper']) {
$output .= '</ul></'.$input['wrapper'].'>';
} else {
$output .= '</ul></li>';
}
} else { } else {
if ($input['arguments']['type'] != 'hidden') { if ($input['arguments']['type'] != 'hidden') {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['id'].'" class="'.$class.'">';
@ -648,7 +439,7 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsGrid($input, $return); $output .= $this->printBlockAsGrid($input, $return);
} }
@ -751,7 +542,7 @@ class Wizard
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlockAsList($input, $return); $output .= $this->printBlockAsList($input, $return);
} }
@ -797,10 +588,11 @@ class Wizard
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -844,6 +636,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;
@ -869,10 +664,11 @@ class Wizard
$rows = $data['rows']; $rows = $data['rows'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -895,45 +691,47 @@ class Wizard
$first_block_printed = false; $first_block_printed = false;
foreach ($rows as $row) { if (is_array($rows)) {
if ($row['new_form_block'] == true) { foreach ($rows as $row) {
if ($first_block_printed === true) { if ($row['new_form_block'] == true) {
// If first form block has been placed, then close it before starting a new one. if ($first_block_printed === true) {
$output .= '</div>'; // If first form block has been placed, then close it before starting a new one.
$output .= '<div class="white_box" style="margin-top: 30px;">'; $output .= '</div>';
} else { $output .= '<div class="white_box" style="margin-top: 30px;">';
$output .= '<div class="white_box">'; } else {
$output .= '<div class="white_box">';
}
$first_block_printed = true;
} }
$first_block_printed = true; $output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
}
$output .= '<div class="edit_discovery_info" style="'.$row['style'].'">'; foreach ($row['columns'] as $column) {
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
foreach ($row['columns'] as $column) { $output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
$extra_styles = isset($column['style']) ? $column['style'] : '';
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">'; foreach ($column['inputs'] as $input) {
if (is_array($input)) {
foreach ($column['inputs'] as $input) { if ($input['arguments']['type'] != 'submit') {
if (is_array($input)) { $output .= $this->printBlockAsGrid($input, true);
if ($input['arguments']['type'] != 'submit') { } else {
$output .= $this->printBlockAsGrid($input, true); $output_submit .= $this->printBlockAsGrid($input, true);
}
} else { } else {
$output_submit .= $this->printBlockAsGrid($input, true); $output .= $input;
} }
} else {
$output .= $input;
} }
$output .= '</div>';
} }
$output .= '</div>'; $output .= '</div>';
} }
$output .= '</div>';
} }
$output .= '</div>'; $output .= '</div>';
@ -941,6 +739,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;
@ -964,10 +765,11 @@ class Wizard
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
$js = $data['js']; $js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function']; $cb_function = $data['cb_function'];
$cb_args = $data['cb_args']; $cb_args = $data['cb_args'];
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
$output_head .= '" '.$form['extra'].'>'; $output_head .= '" '.$form['extra'].'>';
if ($return === false) { if ($return === false) {
@ -1001,6 +803,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>'; $output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) { if ($return === false) {
echo $output; echo $output;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

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: 546 B

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 926 B

View File

@ -83,6 +83,7 @@ $validate_event = get_parameter('validate_event', 0);
$delete_event = get_parameter('delete_event', 0); $delete_event = get_parameter('delete_event', 0);
$get_event_filters = get_parameter('get_event_filters', 0); $get_event_filters = get_parameter('get_event_filters', 0);
$get_comments = get_parameter('get_comments', 0); $get_comments = get_parameter('get_comments', 0);
$get_events_fired = (bool) get_parameter('get_events_fired');
if ($get_comments) { if ($get_comments) {
$event = get_parameter('event', false); $event = get_parameter('event', false);
@ -1139,6 +1140,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 +1148,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'];
} }
@ -1692,3 +1696,118 @@ if ($get_table_response_command) {
return; return;
} }
if ($get_events_fired) {
$id = get_parameter('id_row');
$idGroup = get_parameter('id_group');
$agents = get_parameter('agents', null);
$query = ' AND id_evento > '.$id;
$type = [];
$alert = get_parameter('alert_fired');
if ($alert == 'true') {
$resultAlert = alerts_get_event_status_group(
$idGroup,
[
'alert_fired',
'alert_ceased',
],
$query,
$agents
);
}
$critical = get_parameter('critical');
if ($critical == 'true') {
$resultCritical = alerts_get_event_status_group(
$idGroup,
'going_up_critical',
$query,
$agents
);
}
$warning = get_parameter('warning');
if ($warning == 'true') {
$resultWarning = alerts_get_event_status_group(
$idGroup,
'going_up_warning',
$query,
$agents
);
}
$unknown = get_parameter('unknown');
if ($unknown == 'true') {
$resultUnknown = alerts_get_event_status_group(
$idGroup,
'going_unknown',
$query,
$agents
);
}
if ($resultAlert) {
$return = [
'fired' => $resultAlert,
'sound' => $config['sound_alert'],
];
$event = events_get_event($resultAlert);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$agent_name = agents_get_alias($event['id_agente']);
$return['message'] = io_safe_output($agent_name).' - ';
$return['message'] .= __('Alert fired in module ');
$return['message'] .= io_safe_output($module_name).' - ';
$return['message'] .= $event['timestamp'];
} else if ($resultCritical) {
$return = [
'fired' => $resultCritical,
'sound' => $config['sound_critical'],
];
$event = events_get_event($resultCritical);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$agent_name = agents_get_alias($event['id_agente']);
$return['message'] = io_safe_output($agent_name).' - ';
$return['message'] .= __('Module ').io_safe_output($module_name);
$return['message'] .= __(' is going to critical').' - ';
$return['message'] .= $event['timestamp'];
} else if ($resultWarning) {
$return = [
'fired' => $resultWarning,
'sound' => $config['sound_warning'],
];
$event = events_get_event($resultWarning);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$agent_name = agents_get_alias($event['id_agente']);
$return['message'] = io_safe_output($agent_name).' - ';
$return['message'] .= __('Module ').io_safe_output($module_name);
$return['message'] .= __(' is going to warning').' - ';
$return['message'] .= $event['timestamp'];
} else if ($resultUnknown) {
$return = [
'fired' => $resultUnknown,
'sound' => $config['sound_alert'],
];
$event = events_get_event($resultUnknown);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$agent_name = agents_get_alias($event['id_agente']);
$return['message'] = io_safe_output($agent_name).' - ';
$return['message'] .= __('Module ').io_safe_output($module_name);
$return['message'] .= __(' is going to unknown').' - ';
$return['message'] .= $event['timestamp'];
} else {
$return = ['fired' => 0];
}
echo io_json_mb_encode($return);
}

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

@ -1263,6 +1263,7 @@ class ConsoleSupervisor
$PHPdisable_functions = ini_get('disable_functions'); $PHPdisable_functions = ini_get('disable_functions');
$PHPupload_max_filesize_min = config_return_in_bytes('800M'); $PHPupload_max_filesize_min = config_return_in_bytes('800M');
$PHPmemory_limit_min = config_return_in_bytes('500M'); $PHPmemory_limit_min = config_return_in_bytes('500M');
$PHPSerialize_precision = ini_get('serialize_precision');
// PhantomJS status. // PhantomJS status.
$result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version'); $result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version');
@ -1438,6 +1439,30 @@ class ConsoleSupervisor
} else { } else {
$this->cleanNotifications('NOTIF.PHP.VERSION'); $this->cleanNotifications('NOTIF.PHP.VERSION');
} }
if ($PHPSerialize_precision != -1) {
$url = 'https://www.php.net/manual/en/ini.core.php#ini.serialize-precision';
if ($config['language'] == 'es') {
$url = 'https://www.php.net/manual/es/ini.core.php#ini.serialize-precision';
}
$this->notify(
[
'type' => 'NOTIF.PHP.SERIALIZE_PRECISION',
'title' => sprintf(
__("Not recommended '%s' value in PHP configuration"),
'serialze_precision'
), 'message' => sprintf(
__('Recommended value is: %s'),
sprintf('-1')
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
'url' => $url,
]
);
} else {
$this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
}
} }
@ -1976,7 +2001,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 = 'PC190704'; $build_version = 'PC190730';
$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,8 @@ 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);
define('DISCOVERY_DEPLOY_AGENTS', 9);
// Discovery types matching definition. // Discovery types matching definition.
@ -602,6 +596,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

@ -5413,3 +5413,27 @@ function get_help_info($section_name)
// hd($result); // hd($result);
return $result; return $result;
} }
if (!function_exists('getallheaders')) {
/**
* Fix for php-fpm
*
* @return array
*/
function getallheaders()
{
$headers = [];
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}

View File

@ -1513,29 +1513,30 @@ function agents_get_name($id_agent, $case='none')
* Get alias of an agent (cached function). * Get alias of an agent (cached function).
* *
* @param integer $id_agent Agent id. * @param integer $id_agent Agent id.
* @param string $case Case (upper, lower, none) * @param string $case Case (upper, lower, none).
* *
* @return string Alias of the given agent. * @return string Alias of the given agent.
*/ */
function agents_get_alias($id_agent, $case='none') function agents_get_alias($id_agent, $case='none')
{ {
global $config; global $config;
// Prepare cache // Prepare cache.
static $cache = []; static $cache = [];
if (empty($case)) { if (empty($case)) {
$case = 'none'; $case = 'none';
} }
// Check cache // Check cache.
if (isset($cache[$case][$id_agent])) { if (isset($cache[$case][$id_agent])) {
return $cache[$case][$id_agent]; return $cache[$case][$id_agent];
} }
if ($config['dbconnection_cache'] == null && is_metaconsole()) { $alias = (string) db_get_value(
$alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent); 'alias',
} else { 'tagente',
$alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent); 'id_agente',
} (int) $id_agent
);
switch ($case) { switch ($case) {
case 'upper': case 'upper':
@ -1545,6 +1546,10 @@ function agents_get_alias($id_agent, $case='none')
case 'lower': case 'lower':
$alias = mb_strtolower($alias, 'UTF-8'); $alias = mb_strtolower($alias, 'UTF-8');
break; break;
default:
// Not posible.
break;
} }
$cache[$case][$id_agent] = $alias; $cache[$case][$id_agent] = $alias;
@ -3391,11 +3396,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',
@ -3405,7 +3421,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

@ -266,6 +266,14 @@ function config_update_config()
$error_update[] = __('Public URL'); $error_update[] = __('Public URL');
} }
if (!config_update_value('force_public_url', get_parameter_switch('force_public_url'))) {
$error_update[] = __('Force use Public URL');
}
if (!config_update_value('public_url_exclusions', get_parameter('public_url_exclusions'))) {
$error_update[] = __('Public URL host exclusions');
}
if (!config_update_value('referer_security', get_parameter('referer_security'))) { if (!config_update_value('referer_security', get_parameter('referer_security'))) {
$error_update[] = __('Referer security'); $error_update[] = __('Referer security');
} }
@ -395,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');
} }
@ -652,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');
} }
@ -1687,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);
} }
@ -2364,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);
} }
@ -2879,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

@ -56,8 +56,6 @@ function credentials_get_all(
global $config; global $config;
$user_is_admin = users_is_admin();
if (!is_array($filter)) { if (!is_array($filter)) {
error_log('[credential_get_all] Filter must be an array.'); error_log('[credential_get_all] Filter must be an array.');
throw new Exception('[credential_get_all] Filter must be an array.'); throw new Exception('[credential_get_all] Filter must be an array.');
@ -72,6 +70,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 +165,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
); );
@ -291,9 +293,9 @@ function print_inputs($values=null)
'type' => 'select', 'type' => 'select',
'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 +321,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;
@ -327,6 +329,10 @@ function print_inputs($values=null)
case 'GOOGLE': case 'GOOGLE':
// Need further investigation. // Need further investigation.
case 'CUSTOM': case 'CUSTOM':
$user_label = __('Account ID');
$pass_label = __('Password');
$extra1 = false;
$extra2 = false;
default: default:
// Use defaults. // Use defaults.
break; break;
@ -358,7 +364,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 +377,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

@ -25,13 +25,17 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* ============================================================================ * ============================================================================
*/ */
global $config;
require_once $config['homedir'].'/include/functions_ui.php'; require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_reporting.php';
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('meta/include/functions_events_meta.php'); enterprise_include_once('meta/include/functions_events_meta.php');
enterprise_include_once('meta/include/functions_agents_meta.php'); enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_include_once('meta/include/functions_modules_meta.php'); enterprise_include_once('meta/include/functions_modules_meta.php');
enterprise_include_once('meta/include/functions_events_meta.php');
/** /**
@ -1206,12 +1210,12 @@ function events_get_all(
$server_join = ''; $server_join = '';
if (is_metaconsole()) { if (is_metaconsole()) {
$server_join = ' LEFT JOIN tmetaconsole_setup ts $server_join = ' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id'; ON ts.id = te.server_id AND ts.server_name = ta.server_name';
if (!empty($filter['server_id'])) { if (!empty($filter['server_id'])) {
$server_join = sprintf( $server_join = sprintf(
' LEFT JOIN tmetaconsole_setup ts ' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.id= %d', ON ts.id = te.server_id AND ts.server_name = ta.server_name AND ts.id= %d',
$filter['server_id'] $filter['server_id']
); );
} }
@ -1687,7 +1691,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 +4402,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 +4471,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 = [];
@ -4848,10 +4856,6 @@ function events_get_count_events_by_agent(
$tagente = 'tagente'; $tagente = 'tagente';
$tevento = 'tevento'; $tevento = 'tevento';
if ($dbmeta) {
$tagente = 'tmetaconsole_agent';
$tevento = 'tmetaconsole_event';
}
$sql = sprintf( $sql = sprintf(
'SELECT id_agente, 'SELECT id_agente,
@ -4861,7 +4865,7 @@ function events_get_count_events_by_agent(
COUNT(*) AS count COUNT(*) AS count
FROM %s t3 FROM %s t3
WHERE utimestamp > %d AND utimestamp <= %d WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s) %s AND id_grupo IN (%s)
GROUP BY id_agente', GROUP BY id_agente',
$tagente, $tagente,
$tevento, $tevento,
@ -5028,9 +5032,6 @@ function events_get_count_events_validated_by_user(
} }
$tevento = 'tevento'; $tevento = 'tevento';
if ($dbmeta) {
$tevento = 'tmetaconsole_event';
}
$sql = sprintf( $sql = sprintf(
'SELECT id_usuario, 'SELECT id_usuario,
@ -5206,9 +5207,6 @@ function events_get_count_events_by_criticity(
} }
$tevento = 'tevento'; $tevento = 'tevento';
if ($dbmeta) {
$tevento = 'tmetaconsole_event';
}
$sql = sprintf( $sql = sprintf(
'SELECT criticity, 'SELECT criticity,
@ -5414,9 +5412,6 @@ function events_get_count_events_validated(
} }
$tevento = 'tevento'; $tevento = 'tevento';
if ($dbmeta) {
$tevento = 'tmetaconsole_event';
}
$sql = sprintf('SELECT estado, COUNT(*) AS count FROM %s WHERE %s %s GROUP BY estado', $tevento, $sql_filter, $sql_where); $sql = sprintf('SELECT estado, COUNT(*) AS count FROM %s WHERE %s %s GROUP BY estado', $tevento, $sql_filter, $sql_where);

View File

@ -1277,12 +1277,34 @@ function graphic_combined_module(
array_push($modules, $source['id_agent_module']); array_push($modules, $source['id_agent_module']);
array_push($weights, $source['weight']); array_push($weights, $source['weight']);
if ($source['label'] != '' || $params_combined['labels']) { if ($source['label'] != '' || $params_combined['labels']) {
$item['type'] = 'custom_graph'; $id_agent = agents_get_module_id(
$item['id_agent'] = agents_get_module_id(
$source['id_agent_module'] $source['id_agent_module']
); );
$item['id_agent_module'] = $source['id_agent_module']; $agent_description = agents_get_description($id_agent);
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']); $agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$source['id_agent_module']
);
$module_description = modules_get_agentmodule_descripcion(
$source['id_agent_module']
);
$items_label = [
'type' => 'custom_graph',
'id_agent' => $id_agent,
'id_agent_module' => $source['id_agent_module'],
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($items_label, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
} }
} }
} }
@ -2161,7 +2183,7 @@ function graphic_combined_module(
$graph_values = $temp; $graph_values = $temp;
if (!$params['vconsole']) { if (!$params['vconsole']) {
$width = 1024; $width = $width;
$height = 500; $height = 500;
} }
@ -2235,7 +2257,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 +2308,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

@ -77,8 +77,7 @@ function html_debug_print($var, $file='', $oneline=false)
fprintf($f, '%s', $output); fprintf($f, '%s', $output);
fclose($f); fclose($f);
} else { } else {
echo '<pre>'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info.'</pre>'; echo '<pre style="z-index: 10000; background: #fff; padding: 1em;">'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info."\n";
echo '<pre>';
print_r($var); print_r($var);
echo '</pre>'; echo '</pre>';
} }
@ -3071,11 +3070,13 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
/** /**
* Print input using functions html lib. * Print input using functions html lib.
* *
* @param array $data Input definition. * @param array $data Input definition.
* @param string $wrapper Wrapper 'div' or 'li'.
* @param boolean $input_only Return or print only input or also label.
* *
* @return string HTML code for desired input. * @return string HTML code for desired input.
*/ */
function html_print_input($data) function html_print_input($data, $wrapper='div', $input_only=false)
{ {
if (is_array($data) === false) { if (is_array($data) === false) {
return ''; return '';
@ -3083,8 +3084,8 @@ function html_print_input($data)
$output = ''; $output = '';
if ($data['label']) { if ($data['label'] && $input_only === false) {
$output = '<div id="div-'.$data['name'].'" '; $output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
$output .= ' class="'.$data['input_class'].'">'; $output .= ' class="'.$data['input_class'].'">';
$output .= '<label class="'.$data['label_class'].'">'; $output .= '<label class="'.$data['label_class'].'">';
$output .= $data['label']; $output .= $data['label'];
@ -3172,17 +3173,6 @@ function html_print_input($data)
); );
break; break;
case 'image':
$output .= html_print_input_image(
$data['name'],
$data['src'],
$data['value'],
((isset($data['style']) === true) ? $data['style'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['options']) === true) ? $data['options'] : false)
);
break;
case 'hidden': case 'hidden':
$output .= html_print_input_hidden( $output .= html_print_input_hidden(
$data['name'], $data['name'],
@ -3287,13 +3277,13 @@ function html_print_input($data)
break; break;
case 'submit': case 'submit':
$output .= '<div class="action-buttons" style="width: 100%">'.html_print_submit_button( $output .= '<'.$wrapper.' class="action-buttons" style="width: 100%">'.html_print_submit_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'), ((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''), ((isset($data['name']) === true) ? $data['name'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false), ((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['attributes']) === true) ? $data['attributes'] : ''), ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false) ((isset($data['return']) === true) ? $data['return'] : false)
).'</div>'; ).'</'.$wrapper.'>';
break; break;
case 'checkbox': case 'checkbox':
@ -3336,20 +3326,33 @@ function html_print_input($data)
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : '') ((isset($data['class']) === true) ? $data['class'] : '')
); );
break;
case 'button':
$output .= html_print_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['imageButton']) === true) ? $data['imageButton'] : false),
((isset($data['modal']) === true) ? $data['modal'] : false),
((isset($data['message']) === true) ? $data['message'] : '')
);
break;
default: default:
// Ignore. // Ignore.
break; break;
} }
if ($data['label']) { if ($data['label'] && $input_only === false) {
$output .= '</div>'; $output .= '</'.$wrapper.'>';
if (!$data['return']) { if (!$data['return']) {
echo '</div>'; echo '</'.$wrapper.'>';
} }
} }
return $output; return $output;
} }

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

@ -566,11 +566,11 @@ function modules_update_agent_module(
/** /**
* Creates a module in an agent. * Creates a module in an agent.
* *
* @param int Agent id. * @param integer $id_agent Agent id.
* @param int Module name id. * @param integer $name Module name id.
* @param array Extra values for the module. * @param array $values Extra values for the module.
* @param bool Disable the ACL checking, for default false. * @param boolean $disableACL Disable the ACL checking, for default false.
* @param mixed Array with tag's ids or false. * @param mixed $tags Array with tag's ids or false.
* *
* @return New module id if the module was created. False if not. * @return New module id if the module was created. False if not.
*/ */
@ -584,7 +584,9 @@ function modules_create_agent_module(
global $config; global $config;
if (!$disableACL) { if (!$disableACL) {
if (!users_is_admin() && (empty($id_agent) || ! users_access_to_agent($id_agent, 'AW'))) { if (!users_is_admin() && (empty($id_agent)
|| !users_access_to_agent($id_agent, 'AW'))
) {
return false; return false;
} }
} }
@ -593,7 +595,7 @@ function modules_create_agent_module(
return ERR_INCOMPLETE; return ERR_INCOMPLETE;
} }
// Check for non valid characters in module name // Check for non valid characters in module name.
if (mb_ereg_match('[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]', io_safe_output($name)) !== false) { if (mb_ereg_match('[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]', io_safe_output($name)) !== false) {
return ERR_GENERIC; return ERR_GENERIC;
} }
@ -605,23 +607,33 @@ function modules_create_agent_module(
$values['nombre'] = $name; $values['nombre'] = $name;
$values['id_agente'] = (int) $id_agent; $values['id_agente'] = (int) $id_agent;
$exists = (bool) db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['nombre' => $name, 'id_agente' => (int) $id_agent]); $exists = (bool) db_get_value_filter(
'id_agente_modulo',
'tagente_modulo',
[
'nombre' => $name,
'id_agente' => (int) $id_agent,
]
);
if ($exists) { if ($exists) {
return ERR_EXIST; return ERR_EXIST;
} }
// Encrypt passwords // Encrypt passwords.
if (isset($values['plugin_pass'])) { if (isset($values['plugin_pass'])) {
$values['plugin_pass'] = io_input_password($values['plugin_pass']); $values['plugin_pass'] = io_input_password($values['plugin_pass']);
} }
// Encrypt SNMPv3 passwords // Encrypt SNMPv3 passwords.
if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15 && $values['id_tipo_modulo'] <= 18) if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15
&& $values['id_tipo_modulo'] <= 18)
&& isset($values['tcp_send']) && ($values['tcp_send'] == 3) && isset($values['tcp_send']) && ($values['tcp_send'] == 3)
&& isset($values['custom_string_2']) && isset($values['custom_string_2'])
) { ) {
$values['custom_string_2'] = io_input_password($values['custom_string_2']); $values['custom_string_2'] = io_input_password(
$values['custom_string_2']
);
} }
$id_agent_module = db_process_sql_insert('tagente_modulo', $values); $id_agent_module = db_process_sql_insert('tagente_modulo', $values);
@ -645,25 +657,33 @@ function modules_create_agent_module(
} }
if (isset($values['id_tipo_modulo']) if (isset($values['id_tipo_modulo'])
&& ($values['id_tipo_modulo'] == 21 || $values['id_tipo_modulo'] == 22 || $values['id_tipo_modulo'] == 23) && ($values['id_tipo_modulo'] == 21
|| $values['id_tipo_modulo'] == 22
|| $values['id_tipo_modulo'] == 23)
) { ) {
// Async modules start in normal status // Async modules start in normal status.
$status = AGENT_MODULE_STATUS_NORMAL; $status = AGENT_MODULE_STATUS_NORMAL;
} else { } else {
// Sync modules start in unknown status // Sync modules start in unknown status.
$status = AGENT_MODULE_STATUS_NO_DATA; $status = AGENT_MODULE_STATUS_NO_DATA;
} }
// Condition for cron modules. Don't touch.
$time = 0;
if (empty($values['interval']) === false) {
$time = (time() - (int) $values['interval']);
}
$result = db_process_sql_insert( $result = db_process_sql_insert(
'tagente_estado', 'tagente_estado',
[ [
'id_agente_modulo' => $id_agent_module, 'id_agente_modulo' => $id_agent_module,
'datos' => 0, 'datos' => '',
'timestamp' => '01-01-1970 00:00:00', 'timestamp' => '01-01-1970 00:00:00',
'estado' => $status, 'estado' => $status,
'known_status' => $status, 'known_status' => $status,
'id_agente' => (int) $id_agent, 'id_agente' => (int) $id_agent,
'utimestamp' => (time() - (int) $values['interval']), 'utimestamp' => $time,
'status_changes' => 0, 'status_changes' => 0,
'last_status' => $status, 'last_status' => $status,
'last_known_status' => $status, 'last_known_status' => $status,
@ -680,12 +700,20 @@ function modules_create_agent_module(
return ERR_DB; return ERR_DB;
} }
// Update module status count if the module is not created disabled // Update module status count if the module is not created disabled.
if (!isset($values['disabled']) || $values['disabled'] == 0) { if (!isset($values['disabled']) || $values['disabled'] == 0) {
if ($status == 0) { if ($status == 0) {
db_process_sql('UPDATE tagente SET total_count=total_count+1, normal_count=normal_count+1 WHERE id_agente='.(int) $id_agent); db_process_sql(
'UPDATE tagente
SET total_count=total_count+1, normal_count=normal_count+1
WHERE id_agente='.(int) $id_agent
);
} else { } else {
db_process_sql('UPDATE tagente SET total_count=total_count+1, notinit_count=notinit_count+1 WHERE id_agente='.(int) $id_agent); db_process_sql(
'UPDATE tagente
SET total_count=total_count+1, notinit_count=notinit_count+1
WHERE id_agente='.(int) $id_agent
);
} }
} }
@ -2308,32 +2336,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 +2659,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 +2762,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 +2776,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

@ -35,8 +35,8 @@ define('NETFLOW_RES_LOWD', 6);
define('NETFLOW_RES_MEDD', 12); define('NETFLOW_RES_MEDD', 12);
define('NETFLOW_RES_HID', 24); define('NETFLOW_RES_HID', 24);
define('NETFLOW_RES_ULTRAD', 30); define('NETFLOW_RES_ULTRAD', 30);
define('NETFLOW_RES_HOURLY', 'hourly'); define('NETFLOW_RES_HOURLY', -1);
define('NETFLOW_RES_DAILY', 'daily'); define('NETFLOW_RES_DAILY', -2);
define('NETFLOW_MAX_DATA_CIRCULAR_MESH', 10000); define('NETFLOW_MAX_DATA_CIRCULAR_MESH', 10000);
@ -473,7 +473,7 @@ function netflow_get_data(
// Put all points into an array. // Put all points into an array.
$intervals = [($start_date - $multiplier_time)]; $intervals = [($start_date - $multiplier_time)];
while ((end($intervals) < $end_date) === true) { while (($next = (end($intervals) + $multiplier_time) < $end_date) === true) {
$intervals[] = (end($intervals) + $multiplier_time); $intervals[] = (end($intervals) + $multiplier_time);
} }

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>
@ -135,6 +141,15 @@ function html_do_report_info($report)
} }
/**
* Print html report.
*
* @param array $report Info.
* @param boolean $mini Type.
* @param integer $report_info Show info.
*
* @return array
*/
function reporting_html_print_report($report, $mini=false, $report_info=1) function reporting_html_print_report($report, $mini=false, $report_info=1)
{ {
if ($report_info == 1) { if ($report_info == 1) {
@ -155,7 +170,38 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$table->rowstyle = []; $table->rowstyle = [];
if (isset($item['label']) && $item['label'] != '') { if (isset($item['label']) && $item['label'] != '') {
$label = reporting_label_macro($item, $item['label']); $id_agent = $item['id_agent'];
$id_agent_module = $item['id_agent_module'];
// Add macros name.
$agent_description = agents_get_description($id_agent);
$agent_group = agents_get_agent_group($id_agent);
$agent_address = agents_get_address($id_agent);
$agent_alias = agents_get_alias($id_agent);
$module_name = modules_get_agentmodule_name(
$id_agent_module
);
$module_description = modules_get_agentmodule_descripcion(
$id_agent_module
);
$items_label = [
'type' => $item['type'],
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'agent_description' => $agent_description,
'agent_group' => $agent_group,
'agent_address' => $agent_address,
'agent_alias' => $agent_alias,
'module_name' => $module_name,
'module_description' => $module_description,
];
$label = reporting_label_macro(
$items_label,
$item['label']
);
} else { } else {
$label = ''; $label = '';
} }
@ -174,7 +220,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$table->data['description_row']['description'] = $item['description']; $table->data['description_row']['description'] = $item['description'];
if ($item['type'] == 'event_report_agent' || $item['type'] == 'event_report_group' || $item['type'] == 'event_report_module') { if ($item['type'] == 'event_report_agent'
|| $item['type'] == 'event_report_group'
|| $item['type'] == 'event_report_module'
) {
$table->data['count_row']['count'] = 'Total events: '.$item['total_events']; $table->data['count_row']['count'] = 'Total events: '.$item['total_events'];
} }
@ -753,7 +802,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table1->size[10] = '2%'; $table1->size[10] = '2%';
$table1->data[0][10] = '<img src ="'.$src.'images/square_light_gray.png">'; $table1->data[0][10] = '<img src ="'.$src.'images/square_light_gray.png">';
$table1->size[11] = '15%'; $table1->size[11] = '15%';
$table1->data[0][11] = '<span>'.__('Ignore time').'</span>'; $table1->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
if ($pdf === 0) { if ($pdf === 0) {
$table->colspan['legend']['cell'] = 2; $table->colspan['legend']['cell'] = 2;
@ -3252,53 +3301,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') {
@ -3335,7 +3442,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table2->size[10] = '2%'; $table2->size[10] = '2%';
$table2->data[0][10] = '<img src ="'.$src.$hack_metaconsole.'images/square_light_gray.png">'; $table2->data[0][10] = '<img src ="'.$src.$hack_metaconsole.'images/square_light_gray.png">';
$table2->size[11] = '15%'; $table2->size[11] = '15%';
$table2->data[0][11] = '<span>'.__('Ignore time').'</span>'; $table2->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
} }
if ($pdf !== 0) { if ($pdf !== 0) {

File diff suppressed because it is too large Load Diff

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

@ -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']
); );
@ -2049,7 +2055,7 @@ function ui_pagination(
$actual_page = floor($offset / $pagination); $actual_page = floor($offset / $pagination);
$ini_page = (floor($actual_page / $block_limit) * $block_limit); $ini_page = (floor($actual_page / $block_limit) * $block_limit);
$end_page = ($ini_page + $block_limit - 1); $end_page = ($ini_page + $block_limit - 1);
if ($end_page > $number_of_pages) { if ($end_page >= $number_of_pages) {
$end_page = ($number_of_pages - 1); $end_page = ($number_of_pages - 1);
} }
@ -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) {
@ -3035,38 +3094,7 @@ function ui_print_datatable(array $parameters)
$filter .= '<ul class="datatable_filter content">'; $filter .= '<ul class="datatable_filter content">';
foreach ($parameters['form']['inputs'] as $input) { foreach ($parameters['form']['inputs'] as $input) {
$filter .= '<li>'; $filter .= html_print_input(($input + ['return' => true]), 'li');
$filter .= '<label>'.$input['label'].'</label>';
if ($input['type'] != 'select') {
$filter .= '<input type="'.$input['type'].'" ';
$filter .= ' style="'.$input['style'].'" ';
$filter .= ' class="'.$input['class'].'" ';
$filter .= ' value="'.$input['value'].'" ';
$filter .= ' name="'.$input['name'].'" id="'.$input['id'].'" />';
} else {
// Select.
$filter .= '<select class="'.$input['class'].'"';
$filter .= ' style="'.$input['style'].'" ';
$filter .= ' name="'.$input['name'].'" ';
$filter .= 'id="'.$input['id'].'">';
foreach ($input['options'] as $key => $opt) {
if (is_array($opt)) {
$filter .= '<option value="'.$opt['value'].'"';
if ($opt['selected']) {
$filter .= ' selected="yes" >';
}
$filter .= __($opt['text']).'</option>';
} else {
$filter .= '<option value="'.$key.'">'.$opt.'</option>';
}
}
$filter .= '</select>';
}
$filter .= '</li>';
} }
$filter .= '<li>'; $filter .= '<li>';
@ -3671,6 +3699,24 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
} }
/**
* Checks if public_url usage is being forced to target 'visitor'.
*
* @return boolean
*/
function ui_forced_public_url()
{
global $config;
$exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions']));
if (in_array($_SERVER['REMOTE_ADDR'], $exclusions)) {
return false;
}
return (bool) $config['force_public_url'];
}
/** /**
* Returns a full URL in Pandora. (with the port and https in some systems) * Returns a full URL in Pandora. (with the port and https in some systems)
* *
@ -3717,12 +3763,18 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
} }
if (!$no_proxy) { if (!$no_proxy) {
// Check if the PandoraFMS runs across the proxy like as // Check proxy.
// mod_proxy of Apache $proxy = false;
// and check if public_url is set. if (ui_forced_public_url()) {
if (!empty($config['public_url']) $proxy = true;
$fullurl = $config['public_url'];
if ($url == 'index.php' && is_metaconsole()) {
$fullurl .= '/'.ENTERPRISE_DIR.'/meta';
}
} else if (!empty($config['public_url'])
&& (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) && (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
) { ) {
// Forced to use public url when being forwarder by a reverse proxy.
$fullurl = $config['public_url']; $fullurl = $config['public_url'];
$proxy = true; $proxy = true;
} else { } else {
@ -3754,7 +3806,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
$url = $config['homeurl_static'].'/'; $url = $config['homeurl_static'].'/';
} }
if (defined('METACONSOLE') && $metaconsole_root) { if (is_metaconsole() && $metaconsole_root) {
$url .= 'enterprise/meta/'; $url .= 'enterprise/meta/';
} }
} else if (!strstr($url, '.php')) { } else if (!strstr($url, '.php')) {
@ -3764,7 +3816,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
$fullurl .= $config['homeurl_static'].'/'; $fullurl .= $config['homeurl_static'].'/';
} }
if (defined('METACONSOLE') && $metaconsole_root) { if (is_metaconsole() && $metaconsole_root) {
$fullurl .= 'enterprise/meta/'; $fullurl .= 'enterprise/meta/';
} }
} else { } else {
@ -3776,7 +3828,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
} else { } else {
$fullurl .= $config['homeurl_static'].'/'; $fullurl .= $config['homeurl_static'].'/';
if (defined('METACONSOLE') && $metaconsole_root) { if (is_metaconsole() && $metaconsole_root) {
$fullurl .= 'enterprise/meta/'; $fullurl .= 'enterprise/meta/';
} }
} }

View File

@ -617,16 +617,21 @@ function users_save_login()
$user_list = json_decode($user_list_json, true); $user_list = json_decode($user_list_json, true);
if (empty($user_list)) { if (empty($user_list)) {
$user_list = [];
}
if (isset($user_list[$config['id_user']])) {
$user_list[$config['id_user']]['count']++;
} else {
$user_list[$config['id_user']] = [ $user_list[$config['id_user']] = [
'name' => $user['fullname'], 'name' => $user['fullname'],
'count' => 1, 'count' => 1,
]; ];
} else if (isset($user_list[$config['id_user']])) {
$user_list[$config['id_user']] = [
'name' => $user['fullname'],
'count' => $user_list[$config['id_user']]['count'],
];
} else {
$users_count = count($user_list);
$user_list[$config['id_user']] = [
'name' => $user['fullname'],
'count' => ++$users_count,
];
} }
// Clean the file // Clean the file
@ -704,17 +709,7 @@ function users_save_logout($user=false, $delete=false)
$user_list = []; $user_list = [];
} }
if ($delete) { unset($user_list[$user['id_user']]);
unset($user_list[$user['id_user']]);
} else {
if (isset($user_list[$config['id_user']])) {
$user_list[$config['id_user']]['count']--;
}
if ($user_list[$config['id_user']]['count'] <= 0) {
unset($user_list[$user['id_user']]);
}
}
// Clean the file // Clean the file
ftruncate($fp_user_list, 0); ftruncate($fp_user_list, 0);
@ -1052,6 +1047,13 @@ function users_check_users()
'users' => '', 'users' => '',
]; ];
$users_with_session = db_get_all_rows_sql('SELECT tsessions_php.data FROM pandora.tsessions_php;');
$users_logged_now = [];
foreach ($users_with_session as $user_with_session) {
$tmp_id_user = explode('"', $user_with_session['data']);
array_push($users_logged_now, $tmp_id_user[1]);
}
$file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt'; $file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt';
// First lock the file // First lock the file
@ -1082,13 +1084,32 @@ function users_check_users()
$user_list = []; $user_list = [];
} }
fclose($fp_user_list); // Compare both user list. Meanwhile the user from chat file have an active
// session, his continue in the list of active chat users
$user_name_list = []; $user_name_list = [];
foreach ($user_list as $user) { foreach ($user_list as $key => $user) {
$user_name_list[] = $user['name']; if (in_array($key, $users_logged_now)) {
array_push($user_name_list, $user['name']);
} else {
unset($user_list[$key]);
}
} }
// Clean the file
ftruncate($fp_user_list, 0);
// Update the file with the correct list of users
$status = fwrite($fp_user_list, json_encode($user_list));
/*
if ($status === false) {
fclose($fp_user_list);
return;
} */
// Closing the resource
fclose($fp_user_list);
$return['correct'] = true; $return['correct'] = true;
$return['users'] = implode('<br />', $user_name_list); $return['users'] = implode('<br />', $user_name_list);
echo json_encode($return); echo json_encode($return);

View File

@ -4271,7 +4271,7 @@ function visual_map_create_internal_name_item($label=null, $type, $image, $agent
case 'static_graph': case 'static_graph':
case STATIC_GRAPH: case STATIC_GRAPH:
$text = __('Static graph').' - '.$image; $text = __('Static Image').' - '.$image;
break; break;
case 'simple_value': case 'simple_value':

View File

@ -1294,7 +1294,7 @@ function visual_map_editor_print_toolbox()
} }
echo '<div id="toolbox">'; echo '<div id="toolbox">';
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('static_graph', __('Static Image'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true); visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true);

View File

@ -21,6 +21,7 @@ if (empty($config['homedir'])) {
} }
require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/graphs/functions_flot.php';
$ttl = get_parameter('ttl', 1); $ttl = get_parameter('ttl', 1);
$graph_type = get_parameter('graph_type', ''); $graph_type = get_parameter('graph_type', '');

View File

@ -2791,14 +2791,16 @@ function pandoraFlotArea(
if (short_data) { if (short_data) {
formatted = number_format(v, force_integer, "", short_data); formatted = number_format(v, force_integer, "", short_data);
} else { } else {
// It is an integer // It is an integer.
if (v - Math.floor(v) == 0) { if (v - Math.floor(v) == 0) {
formatted = number_format(v, force_integer, "", 2); formatted = number_format(v, force_integer, "", 2);
} }
} }
// Get only two decimals // Get only two decimals.
formatted = round_with_decimals(formatted, 100); if (typeof formatted != "string") {
formatted = Math.round(formatted * 100) / 100;
}
return formatted; return formatted;
} }

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

@ -1870,3 +1870,100 @@ function logo_preview(icon_name, icon_path, incoming_options) {
// console.log(err); // console.log(err);
} }
} }
// Advanced Form control.
/* global $ */
/* exported load_modal */
function load_modal(settings) {
var AJAX_RUNNING = 0;
var data = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined) data.append(item.name, item.value);
});
}
data.append("page", settings.onshow.page);
data.append("method", settings.onshow.method);
var width = 630;
if (settings.onshow.width) {
width = settings.onshow.width;
}
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: data,
success: function(data) {
settings.target.html(data);
settings.target.dialog({
resizable: true,
draggable: true,
modal: true,
title: settings.modal.title,
width: width,
overlay: {
opacity: 0.5,
background: "black"
},
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
text: settings.modal.cancel,
click: function() {
$(this).dialog("close");
settings.cleanup();
}
},
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: settings.modal.ok,
click: function() {
if (AJAX_RUNNING) return;
AJAX_RUNNING = 1;
var formdata = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined)
formdata.append(item.name, item.value);
});
}
formdata.append("page", settings.onsubmit.page);
formdata.append("method", settings.onsubmit.method);
$("#" + settings.form + " :input").each(function() {
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
}
} else {
formdata.append(this.name, $(this).val());
}
});
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
success: function(data) {
settings.ajax_callback(data);
AJAX_RUNNING = 0;
}
});
}
}
],
closeOnEscape: false,
open: function() {
$(".ui-dialog-titlebar-close").hide();
}
});
}
});
}

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

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