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
Version: 7.0NG.736-190704
Version: 7.0NG.736-190730
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
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
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.736"
PI_BUILD="190704"
PI_BUILD="190730"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190704}
{190730}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#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_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
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"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.736-190704
Version: 7.0NG.736-190730
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,17 +1,34 @@
<?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__')) {
define('__PAN_XHPROF__', 0);
}
@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
$public_hash = get_parameter('hash', false);
// Check user
// Check user.
if ($public_hash == false) {
check_login();
} else {
@ -68,9 +85,9 @@ if ($public_hash == false) {
}
}
define('AJAX', true);
// Enterprise support
// Enterprise support.
if (file_exists(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']]);
}
if (isset($config['metaconsole'])) {
// Not cool way of know if we are executing from metaconsole or normal console
if ($config['metaconsole']) {
define('METACONSOLE', true);
}
if (is_metaconsole()) {
// Backward compatibility.
define('METACONSOLE', true);
}
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->width = '100%';
if ($config['style'] === 'pandora_black') {
$background_color = '#333';
} else {
$background_color = '#fff';
}
$head[0] = __('Groups');
$headstyle[0] = 'width: 20%; font-weight: bolder;';
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] .= '</a></div>';
} 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] .= '</div>';
}
@ -323,7 +329,7 @@ function mainModuleGroups()
}
} else {
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] .= '</div>';
$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
);
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>';
}

View File

@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`type` varchar(30) default 'simple_graph',
`period` int(11) NOT NULL default 0,
`order` int (11) NOT NULL default 0,
`description` mediumtext,
`description` mediumtext,
`text_agent` text,
`text` 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_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 `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)
@ -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 ('small_operation_step_datos_purge', '1000');
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_support_logo', 'default_support.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';
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');
-- ---------------------------------------------------------------------
@ -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_min_value` 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`
-- ---------------------------------------------------------------------
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`
@ -2209,3 +2215,49 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
`extra_2` text,
PRIMARY KEY (`identifier`)
) 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
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');
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 () {
if(autorefresh_draw == true) {
var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
var until_time='';
function events_refresh() {
until_time = new Date();
until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#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 = href + refr_time;
$(document).attr ("location", href);
}
});
}
<?php
}
?>
@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') {
$("#combo_refr").toggle ();
$("select#ref").change (function () {
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;
});

View File

@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
}
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 class="content_alert">';
echo '<div class="icon_message_alert">';
@ -386,6 +389,9 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>';
echo '</div>';
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>';
@ -680,5 +686,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
$("#final_process_correct").dialog('close');
});
});
/* ]]> */
</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();
}
ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true
@ -150,26 +149,27 @@ if ($initial && users_is_admin()) {
);
}
if ($registration && users_is_admin()) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
// 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(
if (!$config['disabled_newsletter']) {
if ($registration && users_is_admin()) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
// 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,
// Launch only if not being call from 'registration'.
!$registration && !$initial
);
}
}
}
$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_common_modules = (bool) get_parameter('get_common_modules', 1);
if ($get_modules_json_for_multiple_snmp) {
include_once 'include/graphs/functions_utils.php';
@ -100,7 +101,16 @@ if (is_ajax()) {
if ($out === false) {
$out = $oid_snmp;
} 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 = [];
@ -201,7 +211,7 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
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 .= html_print_image(
'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">';
if ($new_agent) {
// 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);
$server_name = reset($array_keys_servers_get_names);
}
$table_server .= html_print_select(
servers_get_names(),
$servers,
'server_name',
$server_name,
'',
@ -514,8 +524,10 @@ if (enterprise_installed()) {
);
$safe_mode_modules = [];
$safe_mode_modules[0] = __('Any');
foreach ($sql_modules as $m) {
$safe_mode_modules[$m['id_module']] = $m['name'];
if (is_array($sql_modules)) {
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(
@ -1162,6 +1174,19 @@ ui_require_jquery_file('bgiframe');
}
$(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 ();
var checked = $("#checkbox-cascade_protection").is(":checked");
@ -1210,7 +1235,7 @@ ui_require_jquery_file('bgiframe');
128,
128
);
$("#text-agente").prop('disabled', true);
$("#text-agente").prop('readonly', true);
});
</script>

View File

@ -1,16 +1,32 @@
<?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;
require_once $config['homedir'].'/include/functions_agents.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'));
$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;
// Get passed variables
// Get passed variables.
$snmpwalk = (int) get_parameter('snmpwalk', 0);
$create_modules = (int) get_parameter('create_modules', 0);
@ -47,7 +63,7 @@ $interfaces = [];
$interfaces_ip = [];
if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces
// OID Used is for SNMP MIB-2 Interfaces.
$snmpis = get_snmpwalk(
$ip_target,
$snmp_version,
@ -63,7 +79,7 @@ if ($snmpwalk) {
$tcp_port,
$server_to_exec
);
// ifXTable is also used
// IfXTable is also used.
$ifxitems = get_snmpwalk(
$ip_target,
$snmp_version,
@ -80,7 +96,7 @@ if ($snmpwalk) {
$server_to_exec
);
// Get the interfaces IPV4/IPV6
// Get the interfaces IPV4/IPV6.
$snmp_int_ip = get_snmpwalk(
$ip_target,
$snmp_version,
@ -97,12 +113,12 @@ if ($snmpwalk) {
$server_to_exec
);
// Build a [<interface id>] => [<interface ip>] array
// Build a [<interface id>] => [<interface ip>] array.
if (!empty($snmp_int_ip)) {
foreach ($snmp_int_ip as $key => $value) {
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>"
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>"
// The value is something like INTEGER: <interface id>
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
// The value is something like INTEGER: <interface id>.
$data = explode(': ', $value);
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
@ -110,7 +126,7 @@ if ($snmpwalk) {
$interface_ip = $matches[1];
}
// Get the first ip
// Get the first ip.
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
$interfaces_ip[$interface_id] = $interface_ip;
}
@ -119,17 +135,17 @@ if ($snmpwalk) {
unset($snmp_int_ip);
}
$snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems));
$snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
$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) {
$data = explode(': ', $snmp, 2);
$keydata = explode('::', $key);
$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])) {
continue;
}
@ -239,24 +255,22 @@ if ($create_modules) {
$oid_array[(count($oid_array) - 1)] = $id;
$oid = implode('.', $oid_array);
// Get the name
// Get the name.
$name_array = explode('::', $oid_array[0]);
$name = $ifname.'_'.$name_array[1];
// Clean the name
// Clean the name.
$name = str_replace('"', '', $name);
// Proc moduletypes
// Proc moduletypes.
if (preg_match('/Status/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/Present/', $name_array[1])) {
$module_type = 18;
} else if (preg_match('/PromiscuousMode/', $name_array[1])) {
$module_type = 18;
}
// String moduletypes
else if (preg_match('/Alias/', $name_array[1])) {
} else if (preg_match('/Alias/', $name_array[1])) {
// String moduletypes.
$module_type = 17;
} else if (preg_match('/Address/', $name_array[1])) {
$module_type = 17;
@ -266,15 +280,11 @@ if ($create_modules) {
$module_type = 17;
} else if (preg_match('/Descr/', $name_array[1])) {
$module_type = 17;
}
// Specific counters (ends in s)
else if (preg_match('/s$/', $name_array[1])) {
} else if (preg_match('/s$/', $name_array[1])) {
// Specific counters (ends in s).
$module_type = 16;
}
// Otherwise, numeric
else {
} else {
// Otherwise, numeric.
$module_type = 15;
}
@ -330,7 +340,7 @@ if ($create_modules) {
$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];
$oid = $conf_oid;
@ -397,7 +407,9 @@ if ($create_modules) {
}
if ($done > 0) {
ui_print_success_message(__('Successfully modules created')." ($done)");
ui_print_success_message(
__('Successfully modules created').' ('.$done.')'
);
}
if (!empty($errors)) {
@ -407,17 +419,17 @@ if ($create_modules) {
foreach ($errors as $code => $number) {
switch ($code) {
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;
case ERR_INCOMPLETE:
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)";
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
break;
case ERR_DB:
case ERR_GENERIC:
default:
$msg .= '<br>'.__('Processing error')." ($number)";
$msg .= '<br>'.__('Processing error').' ('.$number.')';
break;
}
}
@ -426,10 +438,10 @@ if ($create_modules) {
}
}
// Create the interface list for the interface
// Create the interface list for the interface.
$interfaces_list = [];
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'] != '') {
$ifname = $interface['ifDescr']['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 "<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->cellpadding = 0;
@ -464,12 +476,14 @@ if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php');
$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) {
if ($row['server_type'] != 13) {
$s_type = ' (Standard)';
} else {
// Check if satellite server has remote configuration enabled
$satellite_remote = config_agents_has_remote_configuration($id_agent);
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)';
}
@ -484,8 +498,7 @@ $table->data[1][4] = html_print_select(
$servers_to_exec,
'server_to_exec',
$server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')
',
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
'',
'',
true
@ -509,7 +522,7 @@ html_print_table($table);
unset($table);
// SNMP3 OPTIONS
// SNMP3 OPTIONS.
$table->width = '100%';
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
@ -564,7 +577,7 @@ echo '</form>';
if (!empty($interfaces_list)) {
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">';
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@ -589,13 +602,30 @@ if (!empty($interfaces_list)) {
$table->width = '100%';
// Agent selector
// Agent selector.
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$table->data[0][1] = '';
$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][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_input_hidden('agent', $id_agent, true);
@ -619,12 +649,10 @@ ui_require_jquery_file('bgiframe');
/* <![CDATA[ */
$(document).ready (function () {
var inputActive = true;
$('#server_to_exec option').trigger('change');
$(document).data('text_for_module', $("#none_text").html());
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
@ -645,10 +673,16 @@ $(document).ready (function () {
$("#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) {
var idSNMP = Array();
var get_common_modules = $("#modules_selection_mode option:selected").val();
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
idSNMP.push($(val).val());
@ -660,6 +694,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
jQuery.post ('ajax.php',
{"page" : "godmode/agentes/agent_manager",
"get_modules_json_for_multiple_snmp": 1,
"get_common_modules" : get_common_modules,
"id_snmp[]": idSNMP,
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
},

View File

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

View File

@ -78,6 +78,13 @@ function push_table_advanced($row, $id=false)
function add_component_selection($id_network_component_type)
{
global $table_simple;
global $config;
if ($config['style'] === 'pandora_black') {
$background_row = 'background-color: #444';
} else {
$background_row = 'background-color: #cfcfcf';
}
$data = [];
$data[0] = __('Using module component').' ';
@ -116,7 +123,7 @@ function add_component_selection($id_network_component_type)
$data[1] .= '</span>';
$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');
}
@ -134,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
$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 (policies_is_module_linked($id_agent_module) == 1) {
$disabledBecauseInPolicy = 1;
@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
$disabledBecauseInPolicy
);
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
}
$in_policy = strstr($page, 'policy_modules');
if (!$in_policy) {
// 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] .= 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) {
$sql = sprintf(
'SELECT id_tipo, nombre
@ -1101,9 +1105,8 @@ $macro_count++;
html_print_input_hidden('module_macro_count', $macro_count);
/*
Advanced form part */
// Add relationships
// Advanced form part.
// Add relationships.
$table_new_relations = new stdClass();
$table_new_relations->id = 'module_new_relations';
$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[2] = 'width: 10%; font-weight: bold;';
$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');
$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][2] = __('Module');
$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->id = 'module_relations';
$table_relations->width = '100%';
@ -1141,19 +1170,26 @@ $table_relations->data = [];
$table_relations->rowstyle = [];
$table_relations->rowstyle[-1] = 'display: none;';
$table_relations->style = [];
$table_relations->style[2] = '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[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[3] = __('Delete');
$table_relations->head[2] = __('Type');
$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][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][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>';
$table_relations->data[-1][2] = '';
$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]);
if (!$module_relations) {
@ -1164,10 +1200,14 @@ $relations_count = 0;
foreach ($module_relations as $key => $module_relation) {
if ($module_relation['module_a'] == $id_agent_module) {
$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 {
$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);
@ -1183,14 +1223,16 @@ foreach ($module_relations as $key => $module_relation) {
$disabled_update_class = 'alpha50';
}
// Agent name
// 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>';
// Lock relationship updates
$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>';
// Delete relationship
$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>';
// Type.
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
// Lock relationship updates.
$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++;
}
@ -1198,7 +1240,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
ui_require_jquery_file('json');
?>
<script type="text/javascript">
@ -1343,8 +1384,6 @@ $(document).ready (function () {
'width=800,height=600'
);
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
@ -1365,8 +1404,6 @@ $(document).ready (function () {
'width=800,height=600'
);
}
}
}
@ -1386,7 +1423,7 @@ $(document).ready (function () {
$('#minmax_warning').hide();
$('#svg_dinamic').hide();
}
if (type_name_selected.match(/async/) == null) {
$('#ff_timeout').hide();
$('#ff_timeout_disable').show();
@ -1396,16 +1433,16 @@ $(document).ready (function () {
$('#ff_timeout_disable').hide();
}
});
$("#id_module_type").trigger('change');
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
$("#text-autocomplete_agent_name").keydown(function(event) {
if(event.keyCode == 13) { // key code 13 is the enter button
event.preventDefault();
}
});
//validate post_process. Change ',' by '.'
$("#submit-updbutton").click (function () {
validate_post_process();
@ -1512,7 +1549,6 @@ function advanced_option_dynamic() {
} else {
$('.hide_dinamic').show();
}
}
@ -1524,11 +1560,9 @@ function change_modules_autocomplete_input () {
var module_autocomplete = $("#module_autocomplete");
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
if (!module_autocomplete.hasClass('working')) {
module_autocomplete.addClass('working');
module_autocomplete.html(load_icon);
$.ajax({
type: "POST",
url: "ajax.php",
@ -1563,22 +1597,26 @@ function change_modules_autocomplete_input () {
// Add a new relation
function add_new_relation () {
var module_a_id = parseInt($("#hidden-id_agent_module").val());
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val());
var module_a_id = parseInt(
$("#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 agent_b_name = $("#text-autocomplete_agent_name").val();
var relation_type = $("#relation_type").val();
var hiddenRow = $("#module_relations--1");
var button = $("#button-add_relation");
var iconPlaceholder = $("#add_relation_status");
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 error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
if (!button.hasClass('working')) {
button.addClass('working');
iconPlaceholder.html(load_icon);
$.ajax({
type: "POST",
url: "ajax.php",
@ -1588,7 +1626,8 @@ function add_new_relation () {
add_module_relation: true,
id_module_a: module_a_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) {
button.removeClass('working');
@ -1599,29 +1638,30 @@ function add_new_relation () {
else {
iconPlaceholder.html(suc_icon);
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
// Add the new row
var relationsCount = parseInt($("#hidden-module_relations_count").val());
var rowClass = "datos";
if (relationsCount % 2 != 0) {
rowClass = "datos2";
}
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 + '-1">' + module_b_name + '</td>' +
'<td id="module_relations-' + relationsCount + '-2" style="width: 10%; text-align: center;">' +
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/lock.png', true); ?>' +
'</a>' +
'</td>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/cross.png', true); ?>' +
'</a>' +
'</td>' +
'</tr>';
'<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 + '-2">' + relation_type + '</td>' +
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/lock.png', true); ?>' +
'</a>' +
'</td>' +
'<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
'<?php echo html_print_image('images/cross.png', true); ?>' +
'</a>' +
'</td>' +
'</tr>';
$("#module_relations").find("tbody").append(rowHTML);
$("#hidden-module_relations_count").val(relationsCount + 1);

View File

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

View File

@ -273,6 +273,9 @@ $table->data[1][1] = html_print_select(
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] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
@ -354,6 +357,11 @@ $(document).ready (function () {
/* Hide source agent */
var selected_agent = $("#source_id_agent").val();
$("#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 ();
$("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 {
if (no_modules) {
$("span.without_modules").show ();
$("span.with_modules").hide ();
$("#checkbox-copy_modules").uncheck ();
$("#target_table-form_modules_filter").hide ();
}
else {
$("span.without_modules").hide ();
@ -479,7 +488,7 @@ $(document).ready (function () {
$("span.with_alerts").show ();
$("#checkbox-copy_alerts").check ();
}
$("#fieldset_destiny, #target_table-operations").show ();
$("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
}
$("#fieldset_targets").show ();
$("#target_modules, #target_alerts").enable ();

View File

@ -501,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
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->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
@ -763,6 +768,9 @@ $(document).ready (function () {
.html (value["alias"]);
$("#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"
);

View File

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

View File

@ -170,6 +170,8 @@ if ($update_agents) {
$n_edited = 0;
$result = false;
foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) {
$group_old = false;
$disabled_old = false;
@ -196,6 +198,18 @@ if ($update_agents) {
$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']) {
enterprise_hook(
'config_agents_update_config_token',

View File

@ -473,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
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->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
@ -1638,6 +1643,9 @@ $(document).ready (function () {
.html(value["alias"]);
$("#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"
);

View File

@ -24,9 +24,24 @@ $menu_godmode['class'] = 'godmode';
if (check_acl($config['id_user'], 0, 'PM')) {
$sub = [];
$sub['godmode/servers/discovery']['text'] = __('Discovery');
$sub['godmode/servers/discovery']['id'] = 'Discovery';
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
$sub['godmode/servers/discovery&wiz=main']['id'] = '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.
$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';
enterprise_hook('inventory_submenu');
enterprise_hook('autoconfiguration_menu');
enterprise_hook('agent_repository_menu');
}
if (check_acl($config['id_user'], 0, 'AW')) {

View File

@ -1,17 +1,32 @@
<?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;
check_login();
@ -29,7 +44,7 @@ $data[1] = html_print_select_from_sql(
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[2] = __('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');
// 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[0] = 'macro_desc';
$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');
// If there are $macros, we create the form fields
// If there are $macros, we create the form fields.
if (!empty($macros)) {
$macros = json_decode($macros, true);
@ -68,9 +83,23 @@ if (!empty($macros)) {
}
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 {
$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;

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>',
];
if ($is_enterprise && $vconsoles_manage) {
if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [
'active' => false,
'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;
$hide_notinit_agents = 0;
$priority_mode = REPORT_PRIORITY_MODE_OK;
$failover_mode = 0;
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
$server_name = '';
$server_id = 0;
$dyn_height = 230;
@ -314,6 +316,8 @@ switch ($action) {
$sla_sorted_by = $item['top_n'];
$period = $item['period'];
$current_month = $item['current_month'];
$failover_mode = $item['failover_mode'];
$failover_type = $item['failover_type'];
break;
case 'module_histogram_graph':
@ -566,7 +570,6 @@ switch ($action) {
$include_extended_events = $item['show_extended_events'];
$filter_search = $style['event_filter_search'];
break;
case 'event_report_group':
@ -850,7 +853,10 @@ $class = 'databox filters';
}
?>
<?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>';
?>
</td>
@ -862,7 +868,18 @@ $class = 'databox filters';
</td>
<td style="">
<?php
html_print_input_text('name', $name, '', 80, 100);
html_print_input_text(
'name',
$name,
'',
80,
100,
false,
false,
false,
'',
'fullwidth'
);
?>
</td>
</tr>
@ -920,7 +937,18 @@ $class = 'databox filters';
</td>
<td style="">
<?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>
</tr>
@ -2238,6 +2266,7 @@ $class = 'databox filters';
?>
</td>
</tr>
<tr id="row_select_fields2" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;">
<?php
@ -2609,6 +2638,59 @@ $class = 'databox filters';
</td>
</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">
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
<td>
@ -2772,6 +2854,13 @@ function print_SLA_list($width, $action, $idItem=null)
'id_rc',
$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%">
<thead>
@ -2784,8 +2873,23 @@ function print_SLA_list($width, $action, $idItem=null)
<th class="header sla_list_module_col" scope="col">
<?php
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 class="header sla_list_module_failover" scope="col">
<?php
echo __('Module Failover');
?>
</th>
<?php
}
?>
<th class="header sla_list_service_col" scope="col">
<?php
echo __('Service');
@ -2831,6 +2935,7 @@ function print_SLA_list($width, $action, $idItem=null)
case 'update':
case 'edit':
echo '<tbody id="list_sla">';
$itemsSLA = db_get_all_rows_filter(
'treport_content_sla_combined',
['id_report_content' => $idItem]
@ -2865,6 +2970,25 @@ function print_SLA_list($width, $action, $idItem=null)
['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 = '';
if ($meta && $server_name != '') {
$server_name_element .= ' ('.$server_name.')';
@ -2878,6 +3002,17 @@ function print_SLA_list($width, $action, $idItem=null)
echo printSmallFont($nameModule);
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()
&& $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_module_col module_name"></td>
<?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()
&& $report_item_type == 'SLA_services'
) {
@ -2982,6 +3126,44 @@ function print_SLA_list($width, $action, $idItem=null)
</select>
</td>
<?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()
&& $report_item_type == 'SLA_services'
) {
@ -3002,23 +3184,23 @@ function print_SLA_list($width, $action, $idItem=null)
],
]
);
if (!empty($services_tmp)
&& $services_tmp != ENTERPRISE_NOT_HOOK
if (!empty($services_tmp)
&& $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) {
$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'];
}
}
$services[$service['id']] = $service['name'];
}
}
}
echo '<td class="sla_list_service_col">';
echo html_print_select(
@ -3617,11 +3799,18 @@ $(document).ready (function () {
$("#checkbox-checkbox_show_resume").change(function(){
if($(this).is(":checked")){
$("#row_select_fields2").show();
$("#row_select_fields3").show();
}
else{
$("#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() {
var nameAgent = $("input[name=agent_sla]").val();
var nameAgentFailover = $("input[name=agent_failover]").val();
var idAgent = $("input[name=id_agent_sla]").val();
var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_sla").val();
var idModuleFailover = $("#id_agent_module_failover").val();
var nameModule = $("#id_agent_module_sla :selected").text();
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
var slaMin = $("input[name=sla_min]").val();
var slaMax = $("input[name=sla_max]").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 = [];
params.push("add_sla=1");
params.push("id=" + $("input[name=id_item]").val());
params.push("id_module=" + idModule);
params.push("id_module_failover=" + idModuleFailover);
params.push("sla_min=" + slaMin);
params.push("sla_max=" + slaMax);
params.push("sla_limit=" + slaLimit);
@ -4015,6 +4260,8 @@ function addSLARow() {
$("#row", row).attr('id', 'sla_' + data['id']);
$(".agent_name", row).html(nameAgent);
$(".module_name", row).html(nameModule);
$(".agent_name_failover", row).html(nameAgentFailover);
$(".module_name_failover", row).html(nameModuleFailover);
$(".service_name", row).html(serviceName);
$(".sla_min", row).html(slaMin);
$(".sla_max", row).html(slaMax);
@ -4025,14 +4272,22 @@ function addSLARow() {
);
$("#list_sla").append($(row).html());
$("input[name=id_agent_sla]").val('');
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');
$("#id_agent_module_sla").append(
$("<option></option>")
.attr ("value", 0)
.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_max]").val('');
$("input[name=sla_limit]").val('');
@ -4161,7 +4416,6 @@ function addGeneralRow() {
success: function (data) {
if (data['correct']) {
row = $("#general_template").clone();
$("#row", row).show();
$("#row", row).attr('id', 'general_' + data['id']);
$(".agent_name", row).html(nameAgent);
@ -4211,6 +4465,8 @@ function chooseType() {
$("#row_custom_example").hide();
$("#row_group").hide();
$("#row_current_month").hide();
$("#row_failover_mode").hide();
$("#row_failover_type").hide();
$("#row_working_time").hide();
$("#row_only_display_wrong").hide();
$("#row_combo_module").hide();
@ -4384,6 +4640,11 @@ function chooseType() {
$("#row_working_time").show();
$("#row_historical_db_check").hide();
$("#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;
case 'module_histogram_graph':

View File

@ -774,14 +774,14 @@ switch ($action) {
$table->head[1] = __('Description');
$table->head[2] = __('HTML');
$table->head[3] = __('XML');
$table->size[0] = '60%';
$table->size[0] = '50%';
$table->size[1] = '20%';
$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->headstyle[3] = 'min-width: 35px;text-align: center;';
$table->headstyle[3] = 'min-width: 35px;text-align: left;';
$table->size[4] = '2%';
$table->headstyle[4] = 'min-width: 35px;text-align: center;';
$table->headstyle[4] = 'min-width: 35px;text-align: left;';
$next = 4;
// Calculate dinamically the number of the column.
@ -790,15 +790,16 @@ switch ($action) {
}
$table->size[$next] = '2%';
$table->style[$next] = 'text-align: center;';
$table->style[$next] = 'text-align: left;';
$table->headstyle[($next + 2)] = 'min-width: 100px;';
$table->style[($next + 2)] = 'text-align: center;';
$table->headstyle[($next + 2)] = 'min-width: 130px; text-align:right;';
$table->style[($next + 2)] = 'text-align: right;';
// Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[$next] = __('Private');
$table->headstyle[$next] = 'min-width: 40px;text-align: left;';
$table->size[$next] = '2%';
if (defined('METACONSOLE')) {
$table->align[$next] = '';
@ -808,7 +809,9 @@ switch ($action) {
$next++;
$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++;
$op_column = false;
@ -826,7 +829,7 @@ switch ($action) {
// $table->size = array ();
$table->size[$next] = '10%';
$table->align[$next] = 'left';
$table->align[$next] = 'right';
}
$columnview = false;
@ -1341,6 +1344,16 @@ switch ($action) {
switch ($action) {
case 'update':
$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['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
@ -1349,14 +1362,36 @@ switch ($action) {
$label = get_parameter('label', '');
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
// 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');
$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(
$items_label,
$name_it
@ -1441,6 +1476,14 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'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;
break;
@ -1704,13 +1747,6 @@ switch ($action) {
);
$values['id_group'] = get_parameter('combo_group');
$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'] == '') {
$values['server_name'] = get_parameter(
@ -1967,22 +2003,11 @@ switch ($action) {
$values['style'] = io_safe_input(json_encode($style));
if (is_metaconsole()) {
metaconsole_restore_db();
}
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(
'treport_content',
$values,
@ -1995,21 +2020,62 @@ switch ($action) {
case 'save':
$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['type'] = get_parameter('type', null);
$values['description'] = get_parameter('description');
$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['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(
$items_label,
$name_it
@ -2214,18 +2280,6 @@ switch ($action) {
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'] == '') {
$values['server_name'] = get_parameter(
'combo_server'
@ -2398,6 +2452,16 @@ switch ($action) {
$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['show_in_same_row'] = get_parameter(
'show_in_same_row',

View File

@ -171,7 +171,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)]['icon'] = html_print_image(
'images/camera.png',
true,
['title' => __('Static Graph')]
['title' => __('Static Image')]
);
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>',
];
if ($is_enterprise && $vconsoles_manage) {
if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
$buttons['visual_console_template'] = [
'active' => false,
'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';
default:
// Ignore.
// Main, show header.
ui_print_page_header(
__('Discovery'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
''
);
return null;
}
}
@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
if (enterprise_installed()) {
$ent_classes = glob(
$config['homedir'].'/enterprise/godmode/wizards/*.class.php'
$config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
);
if ($ent_classes === false) {
$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)) {
ui_require_css_file('discovery-hint');
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[1] = __('Module');
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']
).'</a>';
@ -1215,4 +1215,3 @@ ui_require_javascript_file('pandora_modules');
</script>

View File

@ -152,12 +152,12 @@ foreach ($servers as $server) {
$data[8] = '';
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(
'images/firts_task/icono_grande_reconserver.png',
true,
[
'title' => __('Manage recon tasks'),
'title' => __('Manage Discovery tasks'),
'style' => 'width:21px;height:21px;',
]
);
@ -165,7 +165,7 @@ foreach ($servers as $server) {
}
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(
'images/target.png',
true,
@ -173,7 +173,7 @@ foreach ($servers as $server) {
);
$data[8] .= '</a>';
} 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(
'images/target.png',
true,
@ -182,7 +182,7 @@ foreach ($servers as $server) {
$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(
'images/config.png',
true,
@ -191,7 +191,7 @@ foreach ($servers as $server) {
$data[8] .= '</a>';
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(
'images/remote_configuration.png',
true,
@ -201,7 +201,7 @@ foreach ($servers as $server) {
$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(
'images/cross.png',
true,

View File

@ -86,7 +86,7 @@ $buttons = [];
// Draws header.
$buttons['general'] = [
'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()) {
@ -95,37 +95,37 @@ if (enterprise_installed()) {
$buttons['auth'] = [
'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'] = [
'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'] = [
'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 ($config['activate_netflow']) {
$buttons['net'] = [
'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'] = [
'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
$buttons['notifications'] = [
'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 = '';

View File

@ -1,5 +1,13 @@
<?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;
check_login();
$table = new StdClass();
@ -33,35 +69,18 @@ $table->style[0] = 'font-weight:bold';
$table->size[1] = '70%';
// Current config["language"] could be set by user, not taken from global setup !
switch ($config['dbtype']) {
case 'mysql':
$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;
}
$current_system_lang = db_get_sql(
'SELECT `value` FROM tconfig WHERE `token` = "language"'
);
if ($current_system_lang == '') {
$current_system_lang = 'en';
}
$table->data[0][0] = __('Language code');
$table->data[0][1] = html_print_select_from_sql(
$i = 0;
$table->data[$i][0] = __('Language code');
$table->data[$i++][1] = html_print_select_from_sql(
'SELECT id_language, name FROM tlanguage',
'language',
$current_system_lang,
@ -71,68 +90,67 @@ $table->data[0][1] = html_print_select_from_sql(
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[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');
$table->data[$i][0] = __('Time source');
$sources['system'] = __('System');
$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[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
$table->data[$i][0] = __('Automatic check for updates');
$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 "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
echo '</div>';
$table->data[11][0] = __('Enforce https');
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
$table->data[$i][0] = __('Enforce https');
$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[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->data[$i][0] = __('Use cert of SSL');
$table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
$table->rowstyle[13] = '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->data[13][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
$table->rowstyle[$i] = 'display: none;';
$table->rowid[$i] = 'ssl-path-tr';
$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[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
$table->data[$i][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), 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'])) {
$list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
} else {
$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[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, 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[$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[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
$table->data[$i][0] = __('Enable GIS features');
$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;
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$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[21][1] = html_print_switch(
$table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[$i++][1] = html_print_switch(
[
'name' => '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.'),
true
);
$table->data[23][1] = html_print_input_text_extended(
$table->data[$i][1] = html_print_input_text_extended(
'timezone_text',
$config['timezone'],
'text-timezone_text',
@ -187,47 +205,63 @@ $table->data[23][1] = html_print_input_text_extended(
'readonly',
true
);
$table->data[23][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[23][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
$table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
$table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
$sounds = get_sounds();
$table->data[24][0] = __('Sound for Alert fired');
$table->data[24][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[24][1] .= '<div id="layer_sound_alert"></div>';
$table->data[$i][0] = __('Sound for Alert fired');
$table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
$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[$i++][1] .= '<div id="layer_sound_alert"></div>';
$table->data[25][0] = __('Sound for Monitor critical');
$table->data[25][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[25][1] .= '<div id="layer_sound_critical"></div>';
$table->data[$i][0] = __('Sound for Monitor critical');
$table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
$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[$i++][1] .= '<div id="layer_sound_critical"></div>';
$table->data[26][0] = __('Sound for Monitor warning');
$table->data[26][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[26][1] .= '<div id="layer_sound_warning"></div>';
$table->data[$i][0] = __('Sound for Monitor warning');
$table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
$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[$i++][1] .= '<div id="layer_sound_warning"></div>';
$table->data[28][0] = __('Public URL');
$table->data[28][0] .= ui_print_help_tip(
$table->data[$i][0] = __('Public URL');
$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/'),
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[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
$table->data[$i][0] = __('Force use Public URL');
$table->data[$i][0] .= ui_print_help_tip(__('Force using defined public URL).', get_product_name()), true);
$table->data[$i++][1] = html_print_switch(
[
'name' => 'force_public_url',
'value' => $config['force_public_url'],
]
);
$table->data[30][0] = __('Event storm protection');
$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);
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
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[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
$table->data[$i][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), 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[32][1] = html_print_input_text(
$table->data[$i][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
$table->data[$i++][1] = html_print_input_text(
'server_log_dir',
$config['server_log_dir'],
'',
@ -236,8 +270,8 @@ $table->data[32][1] = html_print_input_text(
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[33][1] = html_print_input_text(
$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[$i++][1] = html_print_input_text(
'max_log_size',
$config['max_log_size'],
'',
@ -251,8 +285,8 @@ $modes_tutorial = [
'on_demand' => __('On demand'),
'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['tutorial_mode'][1] = html_print_select(
$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[$i++][1] = html_print_select(
$modes_tutorial,
'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;
$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[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], 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[$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[35][1] = html_print_input_text(
$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[$i++][1] = html_print_input_text(
'limit_parameters_massive',
$config['limit_parameters_massive'],
'',
@ -276,17 +310,17 @@ $table->data[35][1] = html_print_input_text(
true
);
$table->data[36][0] = __('Include agents manually disabled');
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
$table->data[$i][0] = __('Include agents manually disabled');
$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[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[$i][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), 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[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[$i][0] = __('Set alias as name by default in agent creation');
$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[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], 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[$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'].'">';
@ -352,44 +386,50 @@ $(document).ready (function () {
});
if ($("input[name=use_cert]").is(':checked')) {
$('#setup_general-13').show();
$('#ssl-path-tr').show();
}
$("input[name=use_cert]").change(function () {
if( $(this).is(":checked") )
$('#setup_general-13').show();
$('#ssl-path-tr').show();
else
$('#setup_general-13').hide();
$('#ssl-path-tr').hide();
});
$("input[name=https]").change(function (){
if($("input[name=https]").prop('checked')) {
$("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({
$("#dialog").dialog({
modal: true,
buttons:{
"<?php echo __('Close'); ?>": function(){
$(this).dialog("close");
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");
}
}
}
]
});
}
})
$("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>
<?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);
$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);
$backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0);
$backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0);
@ -1495,7 +1505,7 @@ $(document).ready (function () {
.prop('checked');
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
@ -1635,6 +1645,17 @@ $("#button-status_set_preview").click (function (e) {
$icon_bad_ball = $("<img src=\"" + icon_path + "agent_critical_ball.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 {
$dialog
.hide()

View File

@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['not_login'] = false;
$user_info['strict_acl'] = false;
$user_info['session_time'] = 0;
$user_info['middlename'] = 0;
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$user_info['id_skin'] = '';
}
@ -218,6 +220,7 @@ if ($create_user) {
}
$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['session_time'] = (int) get_parameter('session_time', 0);
@ -317,12 +320,13 @@ if ($update_user) {
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
$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_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);
$dashboard = get_parameter('dashboard', '');
$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][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']) {
$table->data[17][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][0] = __('eHorus user');
$table->data[19][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_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
$table->data[18][0] = __('eHorus user acces enabled');
$table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
$table->data[19][0] = __('eHorus user');
$table->data[20][0] = __('eHorus password');
$table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 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';
foreach ($recon_tasks as $task) {
$no_operations = false;
$data = [];
$server_name = servers_get_name($task['id_recon_server']);
@ -501,41 +502,71 @@ class DiscoveryTaskList extends Wizard
$data[5] = __('Pending');
}
if ($task['id_recon_script'] == 0) {
// Internal discovery task.
switch ($task['type']) {
case DISCOVERY_CLOUD_AWS_RDS:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Cloud RDS')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
switch ($task['type']) {
case DISCOVERY_CLOUD_AZURE_COMPUTE:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/plugin.png',
true,
['title' => __('Discovery Cloud Azure Compute')]
).'&nbsp;&nbsp;';
$data[6] .= __('Cloud.Azure.Compute');
break;
case DISCOVERY_APP_MYSQL:
// 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_CLOUD_AWS_EC2:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/plugin.png',
true,
['title' => __('Discovery Cloud AWS EC2')]
).'&nbsp;&nbsp;';
$data[6] .= __('Cloud.AWS.EC2');
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_CLOUD_AWS_RDS:
// Discovery Cloud RDS.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Cloud RDS')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
case DISCOVERY_HOSTDEVICES:
default:
case DISCOVERY_APP_MYSQL:
// 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.
$data[6] = html_print_image(
'images/network.png',
@ -550,15 +581,15 @@ class DiscoveryTaskList extends Wizard
} else {
$data[6] .= __('Discovery.NetScan');
}
break;
}
} else {
// APP recon task.
$data[6] = html_print_image(
'images/plugin.png',
true
).'&nbsp;&nbsp;';
$data[6] .= $recon_script_name;
} else {
// APP or external script recon task.
$data[6] = html_print_image(
'images/plugin.png',
true
).'&nbsp;&nbsp;';
$data[6] .= $recon_script_name;
}
break;
}
if ($task['status'] <= 0 || $task['status'] > 100) {
@ -576,71 +607,75 @@ class DiscoveryTaskList extends Wizard
$data[8] = __('Not executed yet');
}
if ($task['disabled'] != 2) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/eye.png',
true
);
$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',
if (!$no_operations) {
if ($task['disabled'] != 2) {
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/eye.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',
);
$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
).'</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 {
// 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>';
$data[9] = '';
}
} else {
$data[9] = '';
$data[9] = '-';
}
$table->cellclass[][9] = 'action_buttons';
@ -699,7 +734,16 @@ class DiscoveryTaskList extends Wizard
if ($script !== false) {
switch ($script['type']) {
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:
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';
enterprise_include_once('include/class/CSVImportAgents.class.php');
enterprise_include_once('include/class/DeploymentCenter.class.php');
enterprise_include_once('include/functions_hostdevices.php');
/**
@ -127,6 +128,12 @@ class HostDevices extends Wizard
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'),
];
$buttons[] = [
'url' => $this->url.'&mode=deploy',
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
'label' => __('Agent deployment'),
];
}
$buttons[] = [
@ -149,11 +156,30 @@ class HostDevices extends Wizard
),
'label' => __('Discovery'),
],
[
'link' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
),
'label' => __('Host & Devices'),
'selected' => 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);
return;
@ -167,6 +193,14 @@ class HostDevices extends Wizard
);
return $csv_importer->runCSV();
}
if ($mode === 'deploy') {
$deployObject = new DeploymentCenter(
$this->page,
$this->breadcrum
);
return $deployObject->run();
}
}
if ($mode === 'customnetscan') {
@ -785,6 +819,7 @@ class HostDevices extends Wizard
}).change();';
$this->printFormAsGrid($form);
$this->printGoBackButton($this->url.'&page='.($this->page - 1));
}
}
@ -877,6 +912,7 @@ class HostDevices extends Wizard
];
$this->printFormAsList($form);
$this->printGoBackButton($this->url.'&mode=netscan&task='.$this->task['id_rt'].'&page='.($this->page - 1));
}
if ($this->page == 2) {

View File

@ -296,241 +296,20 @@ class Wizard
*/
public function printInput($data)
{
global $config;
include_once $config['homedir'].'/include/functions_html.php';
if (is_array($data) === false) {
return '';
}
switch ($data['type']) {
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'] : 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;
$input = html_print_input(($data + ['return' => true]), 'div', true);
if ($input === false) {
return '';
}
return '';
return $input;
}
@ -556,6 +335,7 @@ class Wizard
],
'inputs' => [
[
'class' => 'w100p',
'arguments' => [
'name' => 'submit',
'label' => __('Go back'),
@ -594,13 +374,24 @@ class Wizard
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
$output .= '<ul class="wizard">';
if ($input['wrapper']) {
$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) {
$output .= $this->printBlock($input, $return);
}
$output .= '</ul></li>';
// Close block.
if ($input['wrapper']) {
$output .= '</ul></'.$input['wrapper'].'>';
} else {
$output .= '</ul></li>';
}
} else {
if ($input['arguments']['type'] != 'hidden') {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
@ -648,7 +439,7 @@ class Wizard
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$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) {
$output .= $this->printBlockAsGrid($input, $return);
}
@ -751,7 +542,7 @@ class Wizard
if (is_array($input['block_content']) === true) {
// Print independent block of inputs.
$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) {
$output .= $this->printBlockAsList($input, $return);
}
@ -797,10 +588,11 @@ class Wizard
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$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'].'>';
if ($return === false) {
@ -844,6 +636,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
echo $output;
@ -869,10 +664,11 @@ class Wizard
$rows = $data['rows'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$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'].'>';
if ($return === false) {
@ -895,45 +691,47 @@ class Wizard
$first_block_printed = false;
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
$output .= '<div class="white_box" style="margin-top: 30px;">';
} else {
$output .= '<div class="white_box">';
if (is_array($rows)) {
foreach ($rows as $row) {
if ($row['new_form_block'] == true) {
if ($first_block_printed === true) {
// If first form block has been placed, then close it before starting a new one.
$output .= '</div>';
$output .= '<div class="white_box" style="margin-top: 30px;">';
} 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) {
$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.'">';
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsGrid($input, true);
foreach ($column['inputs'] as $input) {
if (is_array($input)) {
if ($input['arguments']['type'] != 'submit') {
$output .= $this->printBlockAsGrid($input, true);
} else {
$output_submit .= $this->printBlockAsGrid($input, true);
}
} else {
$output_submit .= $this->printBlockAsGrid($input, true);
$output .= $input;
}
} else {
$output .= $input;
}
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
}
$output .= '</div>';
@ -941,6 +739,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
echo $output;
@ -964,10 +765,11 @@ class Wizard
$form = $data['form'];
$inputs = $data['inputs'];
$js = $data['js'];
$rawjs = $data['js_block'];
$cb_function = $data['cb_function'];
$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'].'>';
if ($return === false) {
@ -1001,6 +803,9 @@ class Wizard
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>';
$output .= '<script>'.$js.'</script>';
if ($rawjs) {
$output .= $rawjs;
}
if ($return === false) {
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);
$get_event_filters = get_parameter('get_event_filters', 0);
$get_comments = get_parameter('get_comments', 0);
$get_events_fired = (bool) get_parameter('get_events_fired');
if ($get_comments) {
$event = get_parameter('event', false);
@ -1139,6 +1140,7 @@ if ($get_extended_event) {
$dialog_page = get_parameter('dialog_page', 'general');
$filter = get_parameter('filter', []);
$similar_ids = get_parameter('similar_ids', $event_id);
$group_rep = $filter['group_rep'];
$event_rep = $event['event_rep'];
$timestamp_first = $event['min_timestamp'];
@ -1146,6 +1148,8 @@ if ($get_extended_event) {
$server_id = $event['server_id'];
$comments = $event['comments'];
$event['similar_ids'] = $similar_ids;
if (!isset($comments)) {
$comments = $event['user_comment'];
}
@ -1692,3 +1696,118 @@ if ($get_table_response_command) {
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;
$id_module_a = (int) get_parameter('id_module_a');
$id_module_b = (int) get_parameter('id_module_b');
$type = (string) get_parameter('relation_type');
if ($id_module_a < 1) {
$name_module_a = get_parameter('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 {
echo json_encode($result);
return;
@ -486,7 +492,12 @@ if (check_login()) {
if ($id_module_b < 1) {
$name_module_b = get_parameter('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 {
echo json_encode($result);
return;
@ -494,7 +505,7 @@ if (check_login()) {
}
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);
@ -1011,7 +1022,7 @@ if (check_login()) {
$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) {
$show_context_help_first_time = true;

View File

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

View File

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

View File

@ -1263,6 +1263,7 @@ class ConsoleSupervisor
$PHPdisable_functions = ini_get('disable_functions');
$PHPupload_max_filesize_min = config_return_in_bytes('800M');
$PHPmemory_limit_min = config_return_in_bytes('500M');
$PHPSerialize_precision = ini_get('serialize_precision');
// PhantomJS status.
$result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version');
@ -1438,6 +1439,30 @@ class ConsoleSupervisor
} else {
$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',
$config['id_user']
);
if (license_free() === true
if (!$config['disabled_newsletter']
&& $newsletter != 1
&& $login === false
) {

View File

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

View File

@ -527,14 +527,6 @@ define('NODE_MODULE', 1);
define('NODE_PANDORA', 2);
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.
define('STATUS_OK', 0);
define('STATUS_ERROR', 1);
@ -590,6 +582,8 @@ define('DISCOVERY_APP_MYSQL', 4);
define('DISCOVERY_APP_ORACLE', 5);
define('DISCOVERY_CLOUD_AWS_EC2', 6);
define('DISCOVERY_CLOUD_AWS_RDS', 7);
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
define('DISCOVERY_DEPLOY_AGENTS', 9);
// Discovery types matching definition.
@ -602,6 +596,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3);
define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
// Discovery task descriptions.
define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute');
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');

View File

@ -5413,3 +5413,27 @@ function get_help_info($section_name)
// hd($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).
*
* @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.
*/
function agents_get_alias($id_agent, $case='none')
{
global $config;
// Prepare cache
// Prepare cache.
static $cache = [];
if (empty($case)) {
$case = 'none';
}
// Check cache
// Check cache.
if (isset($cache[$case][$id_agent])) {
return $cache[$case][$id_agent];
}
if ($config['dbconnection_cache'] == null && is_metaconsole()) {
$alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
} else {
$alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent);
}
$alias = (string) db_get_value(
'alias',
'tagente',
'id_agente',
(int) $id_agent
);
switch ($case) {
case 'upper':
@ -1545,6 +1546,10 @@ function agents_get_alias($id_agent, $case='none')
case 'lower':
$alias = mb_strtolower($alias, 'UTF-8');
break;
default:
// Not posible.
break;
}
$cache[$case][$id_agent] = $alias;
@ -3391,11 +3396,22 @@ function agents_get_image_status($status)
*/
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) {
case true:
default:
return html_print_image(
'images/heartbeat_green.gif',
$heartbeat_green,
true,
[
'width' => '170',
@ -3405,7 +3421,7 @@ function agents_get_status_animation($up=true)
case false:
return html_print_image(
'images/heartbeat_red.gif',
$heartbeat_red,
true,
[
'width' => '170',

View File

@ -15059,17 +15059,18 @@ function remove_agent_from_policy($id_policy, $use_agent_name, $params)
if (is_metaconsole()) {
if ($use_agent_name === false) {
$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 {
$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_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)) {
returnError('error_policy', __('This policy does not exist.'));

View File

@ -266,6 +266,14 @@ function config_update_config()
$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'))) {
$error_update[] = __('Referer security');
}
@ -395,6 +403,10 @@ function config_update_config()
$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'))) {
$error_update[] = __('Ipam Ocuppied Manager Critical');
}
@ -652,6 +664,42 @@ function config_update_config()
$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'))) {
$error_update[] = __('Double authentication');
}
@ -1687,6 +1735,10 @@ function config_process_config()
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'])) {
config_update_value('ipam_ocuppied_critical_treshold', 90);
}
@ -2364,6 +2416,42 @@ function config_process_config()
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'])) {
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.
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']);

View File

@ -56,8 +56,6 @@ function credentials_get_all(
global $config;
$user_is_admin = users_is_admin();
if (!is_array($filter)) {
error_log('[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".');
}
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'])) {
$sql_filters[] = vsprintf(
' AND (lower(cs.username) like lower("%%%s%%")
@ -163,7 +165,7 @@ function credentials_get_all(
%s
%s',
join(',', $fields),
join(',', $sql_filters),
join(' ', $sql_filters),
$order_by,
$pagination
);
@ -291,9 +293,9 @@ function print_inputs($values=null)
'type' => 'select',
'script' => 'calculate_inputs()',
'fields' => [
// 'CUSTOM' => __('Custom'),
'AWS' => __('Aws'),
// 'AZURE' => __('Azure'),
'CUSTOM' => __('Custom'),
'AWS' => __('Aws'),
'AZURE' => __('Azure'),
// 'GOOGLE' => __('Google'),
],
'selected' => $values['product'],
@ -319,7 +321,7 @@ function print_inputs($values=null)
case 'AZURE':
$user_label = __('Account ID');
$pass_label = __('Password');
$pass_label = __('Application secret');
$extra_1_label = __('Tenant or domain name');
$extra_2_label = __('Subscription id');
break;
@ -327,6 +329,10 @@ function print_inputs($values=null)
case 'GOOGLE':
// Need further investigation.
case 'CUSTOM':
$user_label = __('Account ID');
$pass_label = __('Password');
$extra1 = false;
$extra2 = false;
default:
// Use defaults.
break;
@ -358,7 +364,7 @@ function print_inputs($values=null)
'label' => $extra_1_label,
'name' => 'extra_1',
'input_class' => 'flex-row',
'type' => 'password',
'type' => 'text',
'value' => $values['extra_1'],
'return' => true,
]
@ -371,7 +377,7 @@ function print_inputs($values=null)
'label' => $extra_2_label,
'name' => 'extra_2',
'input_class' => 'flex-row',
'type' => 'password',
'type' => 'text',
'value' => $values['extra_2'],
'return' => true,
'display' => $extra2,

View File

@ -25,13 +25,17 @@
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_tags.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_agents_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 = '';
if (is_metaconsole()) {
$server_join = ' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id';
$server_join = ' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.server_name = ta.server_name';
if (!empty($filter['server_id'])) {
$server_join = sprintf(
' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.id= %d',
' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.server_name = ta.server_name AND ts.id= %d',
$filter['server_id']
);
}
@ -1687,7 +1691,7 @@ function events_change_status(
$ack_user = $config['id_user'];
} else {
$acl_utimestamp = 0;
$ack_user = '';
$ack_user = $config['id_user'];
}
switch ($new_status) {
@ -4398,6 +4402,8 @@ function events_page_general($event)
$data[1] = $user_owner;
}
$table_general->cellclass[3][1] = 'general_owner';
$table_general->data[] = $data;
$data = [];
@ -4465,6 +4471,8 @@ function events_page_general($event)
$data[1] = '<i>'.__('N/A').'</i>';
}
$table_general->cellclass[7][1] = 'general_status';
$table_general->data[] = $data;
$data = [];
@ -4848,10 +4856,6 @@ function events_get_count_events_by_agent(
$tagente = 'tagente';
$tevento = 'tevento';
if ($dbmeta) {
$tagente = 'tmetaconsole_agent';
$tevento = 'tmetaconsole_event';
}
$sql = sprintf(
'SELECT id_agente,
@ -4861,7 +4865,7 @@ function events_get_count_events_by_agent(
COUNT(*) AS count
FROM %s t3
WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s) %s
AND id_grupo IN (%s)
GROUP BY id_agente',
$tagente,
$tevento,
@ -5028,9 +5032,6 @@ function events_get_count_events_validated_by_user(
}
$tevento = 'tevento';
if ($dbmeta) {
$tevento = 'tmetaconsole_event';
}
$sql = sprintf(
'SELECT id_usuario,
@ -5206,9 +5207,6 @@ function events_get_count_events_by_criticity(
}
$tevento = 'tevento';
if ($dbmeta) {
$tevento = 'tmetaconsole_event';
}
$sql = sprintf(
'SELECT criticity,
@ -5414,9 +5412,6 @@ function events_get_count_events_validated(
}
$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);

View File

@ -1277,12 +1277,34 @@ function graphic_combined_module(
array_push($modules, $source['id_agent_module']);
array_push($weights, $source['weight']);
if ($source['label'] != '' || $params_combined['labels']) {
$item['type'] = 'custom_graph';
$item['id_agent'] = agents_get_module_id(
$id_agent = agents_get_module_id(
$source['id_agent_module']
);
$item['id_agent_module'] = $source['id_agent_module'];
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
$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(
$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;
if (!$params['vconsole']) {
$width = 1024;
$width = $width;
$height = 500;
}
@ -2235,7 +2257,6 @@ function combined_graph_summatory_average(
$data_array_pop[$key_reverse] = array_pop(
$data_array_reverse[$key_reverse]
);
$count_data_array_reverse--;
}
}
@ -2287,6 +2308,7 @@ function combined_graph_summatory_average(
}
$count++;
$count_data_array_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);
fclose($f);
} else {
echo '<pre>'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info.'</pre>';
echo '<pre>';
echo '<pre style="z-index: 10000; background: #fff; padding: 1em;">'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info."\n";
print_r($var);
echo '</pre>';
}
@ -3071,11 +3070,13 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
/**
* 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.
*/
function html_print_input($data)
function html_print_input($data, $wrapper='div', $input_only=false)
{
if (is_array($data) === false) {
return '';
@ -3083,8 +3084,8 @@ function html_print_input($data)
$output = '';
if ($data['label']) {
$output = '<div id="div-'.$data['name'].'" ';
if ($data['label'] && $input_only === false) {
$output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
$output .= ' class="'.$data['input_class'].'">';
$output .= '<label class="'.$data['label_class'].'">';
$output .= $data['label'];
@ -3172,17 +3173,6 @@ function html_print_input($data)
);
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':
$output .= html_print_input_hidden(
$data['name'],
@ -3287,13 +3277,13 @@ function html_print_input($data)
break;
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['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>';
).'</'.$wrapper.'>';
break;
case 'checkbox':
@ -3336,20 +3326,33 @@ function html_print_input($data)
((isset($data['return']) === true) ? $data['return'] : false),
((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:
// Ignore.
break;
}
if ($data['label']) {
$output .= '</div>';
if ($data['label'] && $input_only === false) {
$output .= '</'.$wrapper.'>';
if (!$data['return']) {
echo '</div>';
echo '</'.$wrapper.'>';
}
}
return $output;
}

View File

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

View File

@ -566,11 +566,11 @@ function modules_update_agent_module(
/**
* Creates a module in an agent.
*
* @param int Agent id.
* @param int Module name id.
* @param array Extra values for the module.
* @param bool Disable the ACL checking, for default false.
* @param mixed Array with tag's ids or false.
* @param integer $id_agent Agent id.
* @param integer $name Module name id.
* @param array $values Extra values for the module.
* @param boolean $disableACL Disable the ACL checking, for default false.
* @param mixed $tags Array with tag's ids or false.
*
* @return New module id if the module was created. False if not.
*/
@ -584,7 +584,9 @@ function modules_create_agent_module(
global $config;
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;
}
}
@ -593,7 +595,7 @@ function modules_create_agent_module(
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) {
return ERR_GENERIC;
}
@ -605,23 +607,33 @@ function modules_create_agent_module(
$values['nombre'] = $name;
$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) {
return ERR_EXIST;
}
// Encrypt passwords
// Encrypt passwords.
if (isset($values['plugin_pass'])) {
$values['plugin_pass'] = io_input_password($values['plugin_pass']);
}
// Encrypt SNMPv3 passwords
if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15 && $values['id_tipo_modulo'] <= 18)
// Encrypt SNMPv3 passwords.
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['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);
@ -645,25 +657,33 @@ function modules_create_agent_module(
}
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;
} else {
// Sync modules start in unknown status
// Sync modules start in unknown status.
$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(
'tagente_estado',
[
'id_agente_modulo' => $id_agent_module,
'datos' => 0,
'datos' => '',
'timestamp' => '01-01-1970 00:00:00',
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => (time() - (int) $values['interval']),
'utimestamp' => $time,
'status_changes' => 0,
'last_status' => $status,
'last_known_status' => $status,
@ -680,12 +700,20 @@ function modules_create_agent_module(
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 ($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 {
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;
}
switch ($status) {
case AGENT_MODULE_STATUS_NORMAL:
case AGENT_STATUS_NORMAL:
switch ((string) $status) {
case (string) AGENT_MODULE_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;
case AGENT_MODULE_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;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
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;
case AGENT_MODULE_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;
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED:
case STATUS_ALERT_FIRED_BALL:
return COL_ALERTFIRED;
case AGENT_MODULE_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;
case STATUS_SERVER_DOWN:
case STATUS_SERVER_DOWN_BALL:
return '#444';
default:
// Ignored.
break;
@ -2596,7 +2659,7 @@ function modules_get_relations($params=[])
}
$sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
tmr.disable_update
tmr.disable_update, tmr.type
FROM tmodule_relationship tmr,
tagente_modulo tam,
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.
*
* @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.
*/
function modules_add_relation($id_module_a, $id_module_b)
function modules_add_relation($id_module_a, $id_module_b, $type='direct')
{
$result = false;
@ -2711,6 +2776,7 @@ function modules_add_relation($id_module_a, $id_module_b)
$values = [
'module_a' => $id_module_a,
'module_b' => $id_module_b,
'type' => $type,
];
$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_HID', 24);
define('NETFLOW_RES_ULTRAD', 30);
define('NETFLOW_RES_HOURLY', 'hourly');
define('NETFLOW_RES_DAILY', 'daily');
define('NETFLOW_RES_HOURLY', -1);
define('NETFLOW_RES_DAILY', -2);
define('NETFLOW_MAX_DATA_CIRCULAR_MESH', 10000);
@ -473,7 +473,7 @@ function netflow_get_data(
// Put all points into an array.
$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);
}

View File

@ -450,14 +450,26 @@ function networkmap_generate_dot(
$nodes[$node_count] = $module;
}
} else {
$have_relations_a = db_get_value('id', 'tmodule_relationship', 'module_a', $module['id_agente_modulo']);
$have_relations_b = db_get_value('id', 'tmodule_relationship', 'module_b', $module['id_agente_modulo']);
$sql_a = sprintf(
'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) {
// Save node parent information to define edges later
// Save node parent information to define edges later.
$parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node
// Add node.
$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;
if ($config['style'] === 'pandora_black') {
$background_color = '#222';
} else {
$background_color = '#f5f5f5';
}
$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>
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
</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)
{
if ($report_info == 1) {
@ -155,7 +170,38 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$table->rowstyle = [];
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 {
$label = '';
}
@ -174,7 +220,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
$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'];
}
@ -753,7 +802,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table1->size[10] = '2%';
$table1->data[0][10] = '<img src ="'.$src.'images/square_light_gray.png">';
$table1->size[11] = '15%';
$table1->data[0][11] = '<span>'.__('Ignore time').'</span>';
$table1->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
if ($pdf === 0) {
$table->colspan['legend']['cell'] = 2;
@ -3252,53 +3301,111 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$tables_chart = '';
$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%';
foreach ($item['charts'] as $chart) {
$checks_resume = '';
$sla_value = '';
if (reporting_sla_is_not_init_from_array($chart)) {
$color = COL_NOTINIT;
$sla_value = __('Not init');
} else if (reporting_sla_is_ignored_from_array($chart)) {
$color = COL_IGNORED;
$sla_value = __('No data');
} else {
switch ($chart['sla_status']) {
case REPORT_STATUS_ERR:
$color = COL_CRITICAL;
break;
if (isset($item['failed']) === true && empty($item['failed']) === false) {
$tables_chart .= $item['failed'];
} else {
foreach ($item['charts'] as $k_chart => $chart) {
$checks_resume = '';
$sla_value = '';
if (reporting_sla_is_not_init_from_array($chart)) {
$color = COL_NOTINIT;
$sla_value = __('Not init');
} else if (reporting_sla_is_ignored_from_array($chart)) {
$color = COL_IGNORED;
$sla_value = __('No data');
} else {
switch ($chart['sla_status']) {
case REPORT_STATUS_ERR:
$color = COL_CRITICAL;
break;
case REPORT_STATUS_OK:
$color = COL_NORMAL;
break;
case REPORT_STATUS_OK:
$color = COL_NORMAL;
break;
default:
$color = COL_UNKNOWN;
break;
default:
$color = COL_UNKNOWN;
break;
}
$sla_value = sla_truncate(
$chart['sla_value'],
$config['graph_precision']
).'%';
$checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
}
$sla_value = sla_truncate(
$chart['sla_value'],
$config['graph_precision']
).'%';
$checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
}
// Check failover availability report.
if ($item['data'][$k_chart]['failover'] === '') {
$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'];
$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'];
$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
);
$title = '';
$checks_resume_text = $checks_resume;
$sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
switch ($item['data'][$k_chart]['failover']) {
case 'primary':
$title = '<b>'.__('Primary').'</b>';
$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') {
@ -3335,7 +3442,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table2->size[10] = '2%';
$table2->data[0][10] = '<img src ="'.$src.$hack_metaconsole.'images/square_light_gray.png">';
$table2->size[11] = '15%';
$table2->data[0][11] = '<span>'.__('Ignore time').'</span>';
$table2->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
}
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) {
// Id used to expand leafs.
$sub_id = time().rand(0, getrandmax());
// Display the branch.
$output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
@ -174,7 +173,6 @@ function snmp_browser_get_html_tree(
$last_array,
$sufix,
$checked,
$return,
$descriptive_ids,
$previous_id
);
@ -225,7 +223,6 @@ function snmp_browser_print_tree(
$last_array,
$sufix,
$checked,
$return,
$descriptive_ids,
$previous_id
);

View File

@ -1755,6 +1755,12 @@ function ui_process_page_head($string, $bitfield)
// Add the dialog styles 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 ($exists_css) {
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.
$config['css'] = array_merge(
[
'common' => 'include/styles/common.css',
'menu' => 'include/styles/menu.css',
'tables' => 'include/styles/tables.css',
$config['style'] => 'include/styles/'.$config['style'].'.css',
'common' => 'include/styles/common.css',
'menu' => 'include/styles/menu.css',
'tables' => 'include/styles/tables.css',
'general' => 'include/styles/pandora.css',
],
$config['css']
);
@ -2049,7 +2055,7 @@ function ui_pagination(
$actual_page = floor($offset / $pagination);
$ini_page = (floor($actual_page / $block_limit) * $block_limit);
$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);
}
@ -2598,12 +2604,12 @@ function ui_get_status_images_path()
/**
* Prints an image representing a status.
*
* @param string $type Type.
* @param string $title Title.
* @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 string $path Path of the image, if not provided use the status path.
* @param boolean $rounded_image Round.
* @param string $type Type.
* @param string $title Title.
* @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 string $path Path of the image, if not provided use the status path.
* @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.
*/
@ -2613,37 +2619,8 @@ function ui_print_status_image(
$return=false,
$options=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) {
$imagepath_array = ui_get_status_images_path();
$imagepath = $imagepath_array[0];
@ -2651,35 +2628,112 @@ function ui_print_status_image(
$imagepath = $path;
}
$imagepath .= '/'.$type;
if ($options === false) {
$options = [];
if ($imagepath == 'images/status_sets/default') {
$image_with_css = true;
}
$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.
*
* @param string $status Module status.
* @param string $title Title.
* @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 boolean $rounded_image Round.
* @param string $status Module status.
* @param string $title Title.
* @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.
*
* @return string HTML.
*/
function ui_print_module_status(
function ui_print_status_sets(
$status,
$title='',
$return=false,
$options=false,
$rounded_image=false
$options=false
) {
global $config;
@ -2687,21 +2741,26 @@ function ui_print_module_status(
$options = [];
}
$options['style'] .= 'width: 50px;';
$options['style'] .= 'height: 2em;';
$options['style'] .= '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;';
if (isset($options['style'])) {
$options['style'] .= ' background: '.modules_get_color_status($status).'; display: inline-block;';
} else {
$options['style'] = 'background: '.modules_get_color_status($status).'; display: inline-block;';
}
$options['title'] = $title;
$options['data-title'] = $title;
$options['data-use_title_for_force_title'] = 1;
$options['class'] = 'forced_title';
if (isset($options['class'])) {
$options['class'] = $options['class'];
}
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 ';
foreach ($options as $k => $v) {
@ -3035,38 +3094,7 @@ function ui_print_datatable(array $parameters)
$filter .= '<ul class="datatable_filter content">';
foreach ($parameters['form']['inputs'] as $input) {
$filter .= '<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 .= html_print_input(($input + ['return' => true]), '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)
*
@ -3717,12 +3763,18 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
}
if (!$no_proxy) {
// Check if the PandoraFMS runs across the proxy like as
// mod_proxy of Apache
// and check if public_url is set.
if (!empty($config['public_url'])
// Check proxy.
$proxy = false;
if (ui_forced_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']))
) {
// Forced to use public url when being forwarder by a reverse proxy.
$fullurl = $config['public_url'];
$proxy = true;
} else {
@ -3754,7 +3806,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
$url = $config['homeurl_static'].'/';
}
if (defined('METACONSOLE') && $metaconsole_root) {
if (is_metaconsole() && $metaconsole_root) {
$url .= 'enterprise/meta/';
}
} 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'].'/';
}
if (defined('METACONSOLE') && $metaconsole_root) {
if (is_metaconsole() && $metaconsole_root) {
$fullurl .= 'enterprise/meta/';
}
} else {
@ -3776,7 +3828,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
} else {
$fullurl .= $config['homeurl_static'].'/';
if (defined('METACONSOLE') && $metaconsole_root) {
if (is_metaconsole() && $metaconsole_root) {
$fullurl .= 'enterprise/meta/';
}
}

View File

@ -617,16 +617,21 @@ function users_save_login()
$user_list = json_decode($user_list_json, true);
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']] = [
'name' => $user['fullname'],
'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
@ -704,17 +709,7 @@ function users_save_logout($user=false, $delete=false)
$user_list = [];
}
if ($delete) {
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']]);
}
}
unset($user_list[$user['id_user']]);
// Clean the file
ftruncate($fp_user_list, 0);
@ -1052,6 +1047,13 @@ function users_check_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';
// First lock the file
@ -1082,13 +1084,32 @@ function users_check_users()
$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 = [];
foreach ($user_list as $user) {
$user_name_list[] = $user['name'];
foreach ($user_list as $key => $user) {
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['users'] = implode('<br />', $user_name_list);
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:
$text = __('Static graph').' - '.$image;
$text = __('Static Image').' - '.$image;
break;
case 'simple_value':

View File

@ -1294,7 +1294,7 @@ function visual_map_editor_print_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('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);

View File

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

View File

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

View File

@ -740,6 +740,8 @@ function print_donut_narrow_graph(
array $data,
$data_total
) {
global $config;
if (empty($data)) {
return graph_nodata_image($width, $height, 'pie');
}
@ -754,10 +756,31 @@ function print_donut_narrow_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 .= include_javascript_d3(true);
$out .= "<script type='text/javascript'>
donutNarrowGraph($colors, $width, $height, $data_total)
donutNarrowGraph($colors, $width, $height, $data_total, $textColor, $strokeColor)
.donutbody(d3.select($graph_id))
.data($data)
.render();

View File

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

View File

@ -1870,3 +1870,100 @@ function logo_preview(icon_name, icon_path, incoming_options) {
// 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 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");
$("#response_loading").show();
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",
url: $("#hidden-ajax_file").val(),
async: true,
@ -457,12 +456,21 @@ function event_change_status(event_ids) {
success: function(data) {
$("#button-status_button").removeAttr("disabled");
$("#response_loading").hide();
show_event_dialog(
event_id,
$("#hidden-group_rep").val(),
"responses",
data
);
if ($("#notification_status_success").length) {
$("#notification_status_success").hide();
}
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;
@ -475,19 +483,18 @@ function event_change_owner() {
var meta = $("#hidden-meta").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");
$("#response_loading").show();
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",
url: $("#hidden-ajax_file").val(),
async: true,
@ -496,12 +503,29 @@ function event_change_owner() {
$("#button-owner_button").removeAttr("disabled");
$("#response_loading").hide();
show_event_dialog(
event_id,
$("#hidden-group_rep").val(),
"responses",
data
);
if ($("#notification_owner_success").length) {
$("#notification_owner_success").hide();
}
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"]);
$.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"];
// Change the carriage returns by html returns <br> in help
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 />")
.html(macro["value"])
.text();
var macro_hide = macro["hide"];
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
$macro_field.attr("id", row_id);
$macro_field.attr("class", "macro_field");
// 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
if (macro_help == "") {
$("#" + row_id)
@ -850,16 +863,29 @@ function add_macro_field(macro, row_model_id) {
}
// Change the text box id and value
$("#" + row_id)
.children()
.eq(1)
.attr("id", "text-" + macro_macro);
$("#" + row_id)
.children()
.eq(1)
.attr("name", macro_macro);
if (type_copy == "td") {
$("#" + row_id)
.children()
.eq(1)
.children()
.attr("id", "text-" + macro_macro);
$("#" + row_id)
.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 (macro["hide"].length == 0) {
macro_field_hide = false;
@ -872,16 +898,33 @@ function add_macro_field(macro, row_model_id) {
}
}
if (macro_field_hide) {
$("#" + row_id)
.children()
.eq(1)
.attr("type", "password");
if (type_copy == "td") {
if (macro_field_hide) {
$("#" + row_id)
.children()
.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();
}
@ -908,7 +951,7 @@ function load_plugin_macros_fields(row_model_id) {
$("#hidden-macros").val(data["base64"]);
jQuery.each(data["array"], function(i, macro) {
if (macro["desc"] != "") {
add_macro_field(macro, row_model_id);
add_macro_field(macro, row_model_id, "td");
}
});
//Plugin text can be larger

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