Merge remote-tracking branch 'origin/develop' into pandora_enterprise#2987

Former-commit-id: 8d8324be8f876974cc0e33f18e9f0a93a6aff1a8
This commit is contained in:
Kike 2019-01-16 17:49:10 +01:00
commit ab13faa788
126 changed files with 1728 additions and 1206 deletions

View File

@ -16,7 +16,7 @@ else
fi
VERSION=$2
if [ $# == 2 ]; then
BUILD=`date +%g%m%d`
BUILD=`date +%y%m%d`
else
BUILD=$3
fi

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, AIX version
# Version 7.0NG.730, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, FreeBSD Version
# Version 7.0NG.730, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, HP-UX Version
# Version 7.0NG.730, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, GNU/Linux
# Version 7.0NG.730, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, GNU/Linux
# Version 7.0NG.730, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, Solaris Version
# Version 7.0NG.730, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.729
# Version 7.0NG.730
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.729, AIX version
# Version 7.0NG.730, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.729
# Version 7.0NG.730
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.729, HPUX Version
# Version 7.0NG.730, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729
# Version 7.0NG.730
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729
# Version 7.0NG.730
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729
# Version 7.0NG.730
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.729, Solaris version
# Version 7.0NG.730, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, AIX version
# Version 7.0NG.730, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.729-181211
Version: 7.0NG.730-190116
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.729-181211"
pandora_version="7.0NG.730-190116"
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

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, GNU/Linux
# Version 7.0NG.730, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, FreeBSD Version
# Version 7.0NG.730, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, HP-UX Version
# Version 7.0NG.730, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, GNU/Linux
# Version 7.0NG.730, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, GNU/Linux
# Version 7.0NG.730, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, NetBSD Version
# Version 7.0NG.730, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.729, Solaris Version
# Version 7.0NG.730, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.729';
use constant AGENT_BUILD => '181211';
use constant AGENT_VERSION => '7.0NG.730';
use constant AGENT_BUILD => '190116';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -516,11 +516,18 @@ sub parse_conf_modules($) {
log_message ('setup', "Invalid regular expression in intensive condition: $line");
}
}
} elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) {
} elsif ($line =~ /^\s*module_crontab\s+(.*)$/) {
my $cron_text = $1;
chomp ($cron_text);
$cron_text =~ s/\s+$//;
# Get module name if is already read.
my $module_name_message = "";
$module_name_message = " (module $module->{'name'})" if defined($module->{'name'});
if (cron_check_syntax($cron_text)) {
$module->{'cron'} = $cron_text;
log_message('debug', "Cron '$module->{'cron'}' configured $module_name_message.");
} else {
log_message('setup', "Incorrect cron syntax '$cron_text'. This module$module_name_message will be executed always.");
}
} elsif ($line =~ /^\s*module_end\s*$/) {
@ -2397,6 +2404,7 @@ sub check_module_cron {
$interval
);
my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0;
$module->{'cron_utimestamp'} = $now + $time_to_next_execution;
$module->{'cron_interval'} = $time_to_next_execution;
@ -2405,7 +2413,7 @@ sub check_module_cron {
}
# On first execution checking if cron is valid is required
return 1 unless ($module->{'cron_utimestamp'} == 0);
return 1 unless ($is_first);
# Check if current timestamp is a valid cron date
my $next_execution = cron_next_execution_date(

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181211
%define version 7.0NG.730
%define release 190116
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
%define release 181211
%define version 7.0NG.730
%define release 190116
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.729"
PI_BUILD="181211"
PI_VERSION="7.0NG.730"
PI_BUILD="190116"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.729
# Version 7.0NG.730
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.729}
{Pandora FMS Windows Agent v7.0NG.730}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{181211}
{190116}
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.729(Build 181211)")
#define PANDORA_VERSION ("7.0NG.730(Build 190116)")
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.729(Build 181211))"
VALUE "ProductVersion", "(7.0NG.730(Build 190116))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.729-181211
Version: 7.0NG.730-190116
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.729-181211"
pandora_version="7.0NG.730-190116"
package_pear=0
package_pandora=1

View File

@ -14,6 +14,15 @@
// 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);
if (__PAN_XHPROF__ === 1) {
if (function_exists('tideways_xhprof_enable')) {
tideways_xhprof_enable();
}
}
if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"))) {
exit;
}
@ -88,4 +97,8 @@ if (file_exists ($page)) {
else {
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
}
if (__PAN_XHPROF__ === 1) {
pandora_xhprof_display_result("ajax", "console");
}
?>

View File

@ -61,17 +61,27 @@ function mainModuleGroups() {
$info = groupview_plain_groups($info);
$counter = count($info);
$offset = get_parameter('offset', 0);
$groups_view = $is_not_paginated
? $info
: array_slice($info, $offset, $config['block_size']);
$agents_counters = array_reduce($groups_view, function($carry, $item){
$carry[$item['id']] = $item;
return $carry;
}, array());
$agent_group_search = get_parameter('agent_group_search', '');
$module_group_search = get_parameter('module_group_search', '');
$ids_array = array_keys($agents_counters);
$info = array_filter($info, function($v, $k) use ($agent_group_search) {
return preg_match("/$agent_group_search/i", $v['name']);
}, ARRAY_FILTER_USE_BOTH);
$ids_group = implode(',', $ids_array);
if (!empty($info)) {
$groups_view = $is_not_paginated
? $info
: array_slice($info, $offset, $config['block_size']);
$agents_counters = array_reduce($groups_view, function($carry, $item){
$carry[$item['id']] = $item;
return $carry;
}, array());
$ids_array = array_keys($agents_counters);
$ids_group = implode(',', $ids_array);
} else
$ids_group = -1;
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
@ -90,6 +100,12 @@ function mainModuleGroups() {
$array_module_group[$value['id_mg']] = $value['name'];
}
$array_module_group[0] = 'Nothing';
$array_module_group = array_filter($array_module_group, function($v, $k) use ($module_group_search) {
return preg_match("/$module_group_search/i", $v);
}, ARRAY_FILTER_USE_BOTH);
foreach ($agents_counters as $key => $value) {
$array_for_defect[$key]['gm'] = $array_module_group;
$array_for_defect[$key]['data']['name'] = $value['name'];
@ -167,7 +183,26 @@ $sql =
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
if(count($array_for_defect) > 0){
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
<tr>";
echo "<form method='post'
action='index.php?sec=view&sec2=extensions/module_groups'>";
echo "<td>";
echo __('Search by agent group') . '&nbsp;';
html_print_input_text ("agent_group_search", $agent_group_search);
echo "</td><td>";
echo __('Search by module group') . '&nbsp;';
html_print_input_text ("module_group_search", $module_group_search);
echo "</td><td>";
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
echo "</form>";
echo "<td>";
echo "</tr></table>";
if(true){
$table = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
$table->width = '100%';

View File

@ -30,7 +30,7 @@
},
yaxis: {
tickFormatter: function (value, axis) {
return shortNumber(value);
return shortNumber(roundToTwo(value)) ;
}
},
series: {
@ -178,6 +178,9 @@
return number + " " + shorts[pos];
}
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}
$('#graph').change(function() {
$('form#realgraph').submit();

View File

@ -6,4 +6,6 @@ ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
COMMIT;

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
COMMIT;

View File

@ -48,8 +48,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
`dynamic_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0',
`dynamic_min` int(4) default '0',
`dynamic_next` bigint(20) NOT NULL default '0',
`dynamic_two_tailed` tinyint(1) unsigned default '0',
`prediction_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0,
@ -58,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- -----------------------------------------------------
-- Table `tpolicy_modules`
-- -----------------------------------------------------
@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
`dynamic_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0',
`dynamic_min` int(4) default '0',
`dynamic_next` bigint(20) NOT NULL default '0',
`dynamic_two_tailed` tinyint(1) unsigned default '0',
`prediction_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0,
`prediction_threshold` int(4) default 0,
@ -135,6 +134,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
UNIQUE (`id_policy`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tpolicies`
-- ---------------------------------------------------------------------
@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
UNIQUE (`id_policy`, `id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
-- -----------------------------------------------------
-- Table `tpolicy_groups`
-- -----------------------------------------------------
@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tpolicy_modules_inventory`
-- ---------------------------------------------------------------------
@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- -----------------------------------------------------
-- Table `tagente_datos_inventory`
-- -----------------------------------------------------
@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`id` int(10) NOT NULL auto_increment primary key,
`server_name` text,
`server_url` text,
`dbuser` text,
`dbpass` text,
`dbhost` text,
`dbport` text,
`dbname` text,
`meta_dbuser` text,
`meta_dbpass` text,
`meta_dbhost` text,
`meta_dbport` text,
`meta_dbname` text,
`server_name` text default '',
`server_url` text default '',
`dbuser` text default '',
`dbpass` text default '',
`dbhost` text default '',
`dbport` text default '',
`dbname` text default '',
`auth_token` text default '',
`id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL,
@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
COMMENT = 'Table to store metaconsole sources'
DEFAULT CHARSET=utf8;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
-- ---------------------------------------------------------------------
-- Table `tprofile_view`
-- ---------------------------------------------------------------------
@ -400,7 +410,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`id_template_alert_warning` int(10) unsigned NOT NULL default 0,
`id_template_alert_critical` int(10) unsigned NOT NULL default 0,
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor'
@ -548,6 +558,8 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
KEY `idx_id_event_alert` (`id_event_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
-- -----------------------------------------------------
-- Table `tevent_alert`
-- -----------------------------------------------------
@ -744,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_names` TEXT,
`module_free_text` TEXT,
`each_agent` tinyint(1) default 1,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
`lapse` int(11) UNSIGNED NOT NULL default '300',
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
`hide_no_data` tinyint(1) default 0,
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0';
-- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
-- -----------------------------------------------------
@ -860,6 +873,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
-- Criticity: 5 - Minor
-- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tmetaconsole_event_history`
-- ---------------------------------------------------------------------
@ -905,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
-- Criticity: 5 - Minor
-- Criticity: 6 - Major
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `textension_translate_string`
-- ---------------------------------------------------------------------
@ -957,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default '0',
`id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '',
`server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0',
`cascade_protection_module` int(10) unsigned default '0',
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
@ -977,8 +993,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_count` tinyint(1) NOT NULL default '0',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias` varchar(600) BINARY NOT NULL default '',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`),
@ -987,6 +1001,11 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
-- ---------------------------------------------------------------------
-- Table `ttransaction`
-- ---------------------------------------------------------------------
@ -1305,6 +1324,10 @@ ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL defau
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`
@ -1358,26 +1381,15 @@ ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
-- ---------------------------------------------------------------------
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
-- Table `tlocal_component`
-- ---------------------------------------------------------------------
ALTER TABLE tlocal_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- Table `tpolicy_module`
-- ---------------------------------------------------------------------
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
-- ---------------------------------------------------------------------
-- Table `tmetaconsole_agent`
-- ---------------------------------------------------------------------
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0;
@ -1542,6 +1554,8 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul
-- ---------------------------------------------------------------------
-- Table `tsnmp_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
@ -1732,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`name` varchar(600) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,
@ -1778,11 +1792,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
`linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default',
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_node_id` INT(10) NOT NULL default 0,
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tlog_graph_models`
-- ---------------------------------------------------------------------
@ -1804,6 +1822,7 @@ INSERT INTO tlog_graph_models VALUES (1, 'Apache&#x20;log&#x20;model',
-- -----------------------------------------------------
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
@ -1824,11 +1843,28 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`id_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '',
`module_search` varchar(600) default '',
`module_status` varchar(600) default '',
`recursion` int(1) unsigned default '0',
`group_search` int(10) unsigned default '0',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
-- ---------------------------------------------------------------------
-- Table `tevento`
-- ---------------------------------------------------------------------
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
-- -----------------------------------------------------
-- Table `tgis_map_layer_groups`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
`layer_id` INT NOT NULL,
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
PRIMARY KEY (`layer_id`, `group_id`),
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -484,7 +484,7 @@ $table->data[4][1] = __('Disabled') . ' ' .
$table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) {
$table->data[4][2] = __('Url address');
$table->data[4][2] = __('Url address') . ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true);
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}else{

View File

@ -573,18 +573,27 @@ ui_require_javascript_file ('pandora_modules');
?>
<script language="javascript">
/* <![CDATA[ */
var no_name_lang = "<?php echo __('No module name provided') ?>";
var no_target_lang = "<?php echo __('No target IP provided') ?>";
var no_oid_lang = "<?php echo __('No SNMP OID provided') ?>";
var no_prediction_module_lang = "<?php echo __('No module to predict') ?>";
var no_plugin_lang = "<?php echo __('No plug-in provided') ?>";
var no_execute_test_from = "<?php echo __('No server provided') ?>"
var no_name_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module name provided') ) ); ?>
`;
var no_target_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No target IP provided') ) ); ?>
`;
var no_oid_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No SNMP OID provided') ) ); ?>
`;
var no_prediction_module_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module to predict') ) ); ?>
`;
var no_plugin_lang =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No plug-in provided') ) ); ?>
`;
var no_execute_test_from =`
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No server provided') ) ); ?>
`;
$(document).ready (function () {
configure_modules_form ();
$("#module_form").submit(function() {
if (typeof(check_remote_conf) != 'undefined') {

View File

@ -249,29 +249,33 @@ else {
$idModuleType = '';
}
$sql = sprintf ('SELECT id_tipo, descripcion
//Removed web analysis and log4x from select
$sql = sprintf (
'SELECT id_tipo, descripcion, nombre
FROM ttipo_modulo
WHERE categoria IN (%s)
WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
ORDER BY descripcion',
implode (',', $categories));
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
// Store the relation between id and name of the types on a hidden field
$sql = sprintf ('SELECT id_tipo, nombre
FROM ttipo_modulo
WHERE categoria IN (%s)
ORDER BY descripcion',
implode (',', $categories));
implode (',', $categories)
);
$type_names = db_get_all_rows_sql($sql);
$type_names_hash = array();
foreach ($type_names as $tn) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
$type_description_hash = array();
if (isset($type_names) && is_array($type_names)) {
foreach ($type_names as $tn) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
$type_description_hash[$tn['id_tipo']] = $tn['descripcion'];
}
}
$table_simple->data[2][1] = html_print_select (
$type_description_hash, 'id_module_type', $idModuleType,
$disabledBecauseInPolicy, '', 0, true,
false, true, '', false, false, false, 100
);
// Store the relation between id and name of the types on a hidden field
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
}
@ -439,7 +443,7 @@ $table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletyp
$table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
$table_advanced->data[2][4] =
html_print_extended_select_for_post_process('post_process',
$post_process, '', '', '0', false, true, false, true,
$post_process, '', '', '0', false, true, false, false,
$disabledBecauseInPolicy);
$table_advanced->colspan[2][4] = 3;

View File

@ -65,6 +65,8 @@ if (! $id_agente) {
$params['selectbox_id'] = 'id_agent_module';
$params['javascript_is_function_select'] = true;
$params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params);
}
@ -137,20 +139,18 @@ if (check_acl ($config['id_user'], 0, "LM")) {
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
if (!isset($step) || $step!=5) {
if (!isset($step)) {
echo '<form class="add_alert_form" method="post">';
html_print_table ($table);
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if (!isset($step) || $step!=5) {
if (!isset($step)) {
if($id_cluster){
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
}
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
html_print_input_hidden ('create_alert', 1);
echo '</div></form>';
@ -223,7 +223,7 @@ $(document).ready (function () {
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
}
else {
$("#value", $value).append (parseInt(data));
$("#value", $value).append (data);
}
$loading.hide ();
$value.show ();

View File

@ -285,7 +285,7 @@ else {
$filter = false;
}
$names = agents_get_modules (array_keys ($agents),
'DISTINCT(tagente_modulo.nombre)', $filter, false);
'tagente_modulo.nombre', $filter, false);
foreach ($names as $name) {
$modules[$name['nombre']] = $name['nombre'];
}

View File

@ -51,31 +51,27 @@ if ($update) {
$agents_ = array();
$force = get_parameter('force_type', false);
if ($agents_select == false) {
$agents_select = array();
}
foreach ($agents_select as $agent_name) {
$agents_[] = agents_get_agent_id($agent_name);
}
$agents_ = $agents_select;
$modules_ = $module_name;
}
else if ($selection_mode == 'agents') {
$force = get_parameter('force_group', false);
$agents_ = $agents_id;
$modules_ = $modules_select;
}
$success = 0;
$count = 0;
if ($agents_ == false)
$agents_ = array();
// If the option to select all of one group or module type is checked
if ($force) {
if ($force == 'type') {

View File

@ -32,6 +32,7 @@ enterprise_include ('godmode/massive/massive_operations.php');
$tab = (string) get_parameter ('tab', 'massive_agents');
$option = (string) get_parameter ('option', '');
$options_alerts = array(
'add_alerts' => __('Bulk alert add'),
'delete_alerts' => __('Bulk alert delete'),
@ -224,6 +225,11 @@ if ((get_cfg_var("max_execution_time") != 0)
echo '</div>';
}
if ($tab == 'massive_policies' && is_central_policies_on_node()){
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
return;
}
// Catch all submit operations in this view to display Wait banner
$submit_action = get_parameter('go');
$submit_update = get_parameter('updbutton');

View File

@ -120,9 +120,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$sub2["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations');
}
$sub2["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
if ($config["centralized_management"] != 1) {
enterprise_hook('massivepolicies_submenu');
}
enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu');

View File

@ -60,8 +60,6 @@ if ($edit_graph) {
$stacked = $graphInTgraph['stacked'];
$period = $graphInTgraph['period'];
$id_group = $graphInTgraph['id_group'];
$width = $graphInTgraph['width'];
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series'];
@ -78,8 +76,6 @@ else {
$id_agent = 0;
$id_module = 0;
$id_group = 0;
$width = 550;
$height = 210;
$period = SECONDS_1DAY;
$factor = 1;
$stacked = 4;
@ -136,15 +132,6 @@ if ($stacked == CUSTOM_GRAPH_GAUGE)
$hidden = ' style="display:none;" ';
else
$hidden = '';
echo "<tr>";
echo "<td class='datos stacked' $hidden>";
echo "<b>".__('Width')."</b></td>";
echo "<td class='datos'>";
echo "<input type='text' name='width' value='$width' $hidden size=6></td>";
echo "<td class='datos2'>";
echo "<b>".__('Height')."</b></td>";
echo "<td class='datos2'>";
echo "<input type='text' name='height' value='$height' size=6></td></tr>";
echo "<tr>";
echo "<td class='datos'>";

View File

@ -81,8 +81,6 @@ if ($add_graph) {
$description = get_parameter_post ("description");
$module_number = get_parameter_post ("module_number");
$idGroup = get_parameter_post ('graph_id_group');
$width = get_parameter_post ("width");
$height = get_parameter_post ("height");
$stacked = get_parameter ("stacked", 0);
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
@ -102,8 +100,6 @@ if ($add_graph) {
'name' => $name,
'description' => $description,
'period' => $period,
'width' => $width,
'height' => $height,
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
@ -134,8 +130,6 @@ if ($update_graph) {
$name = get_parameter('name');
$id_group = get_parameter('graph_id_group');
$description = get_parameter('description');
$width = get_parameter('width');
$height = get_parameter('height');
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');

View File

@ -1082,13 +1082,15 @@ You can of course remove the warnings, that's why we include the source and do n
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
}
$all_agent_log = db_get_all_rows_sql($sql_log_report);
foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias'];
if(isset($all_agent_log) && is_array($all_agent_log)){
foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias'];
}
}
if ((empty($agents2)) || $agents2 == -1) $agents = array();
$agents_select = array();
if (is_array($id_agents) || is_object($id_agents)){
foreach ($id_agents as $id) {

View File

@ -119,7 +119,9 @@ if ($schedule_report != '') {
$time = date(TIME_FORMAT);
$parameters[0] = get_parameter('id_schedule_report');
//$parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_report);
$parameters[1] = get_parameter('schedule_email');
$parameters[1] = get_parameter('schedule_email_address');
$parameters[2] = get_parameter('schedule_subject', '');
$parameters[3] = get_parameter('schedule_email', '');
$parameters['first_execution'] = strtotime ($date.' '.$time);
$values = array(

View File

@ -145,7 +145,9 @@ function visual_map_main() {
}
});
bindColorRangeEvents();
draw_lines(lines, 'background', true);
draw_user_lines("", 0, 0, 0 , 0, 0, true);
@ -813,6 +815,25 @@ function readFields() {
values['clock_animation'] = $("select[name=clock_animation]").val();
values['show_last_value'] = $("select[name=last_value]").val();
// Color Cloud values
if (selectedItem == "color_cloud" || creationItem == "color_cloud") {
var diameter = $("input[name=diameter]").val();
values["diameter"] = values["width"] = values["height"] = diameter;
var defaultColor = $("input[name=default_color]").val();
values["default_color"] = defaultColor;
// Ranges
$('input[name="color_range_from_values[]"]').each(function (index, element) {
values["color_range_from_values[" + index + "]"] = $(element).val();
});
$('input[name="color_range_to_values[]"]').each(function (index, element) {
values["color_range_to_values[" + index + "]"] = $(element).val();
});
$('input[name="color_range_color_values[]"]').each(function (index, element) {
values["color_range_colors[" + index + "]"] = $(element).val();
});
}
if (is_metaconsole()) {
values['metaconsole'] = 1;
values['id_agent'] = $("#hidden-agent").val();
@ -1179,6 +1200,7 @@ function toggle_item_palette() {
activeToolboxButton('line_item', true);
activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true);
@ -1209,6 +1231,7 @@ function toggle_item_palette() {
activeToolboxButton('group_item', false);
activeToolboxButton('box_item', false);
activeToolboxButton('line_item', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false);
@ -1615,6 +1638,26 @@ function loadFieldsFromDB(item) {
.css('background-color', val);
}
// Color Cloud values
if (key === "diameter") $("input[name='diameter']").val(val);
if (key === "dynamic_data") {
if (val == null) val = {};
var defaultColor = val["default_color"] || "#FFFFFF";
$('input[name="default_color"]').val(defaultColor);
var colorRanges = val["color_ranges"] || [];
var $colorRangeCreationTable = $("table.color-range-creation");
if ($colorRangeCreationTable.length > 0) {
colorRanges.forEach(function (range) {
$colorRangeTable = getColorRangeTable(
$colorRangeCreationTable,
range
);
$colorRangeTable.insertBefore($colorRangeCreationTable);
});
}
}
});
$('#count_items').html(1);
@ -1896,6 +1939,14 @@ function hiddenFields(item) {
$("#line_case").css('display', 'none');
$("#line_case." + item).css('display', '');
// Color cloud rows
$("#color_cloud_diameter_row").hide();
$("#color_cloud_diameter_row." + item).show();
$("#color_cloud_def_color_row").hide();
$("#color_cloud_def_color_row." + item).show();
$("#color_cloud_color_ranges_row").hide();
$("#color_cloud_color_ranges_row." + item).show();
$("input[name='radio_choice']").trigger('change');
if (typeof(enterprise_hiddenFields) == 'function') {
@ -1949,6 +2000,13 @@ function cleanFields(item) {
$("select[name='timezone']").val('Europe/Madrid');
$("select[name='clock_animation']").val('analogic_1');
// Color cloud fields
$("input[name='diameter']").val(100);
$("input[name='default_color']").val("#FFFFFF");
// Clean dynamic fields
$("table.color-range-creation input[type=text]").val("");
$("table.color-range-creation input[type=color]").val("#FFFFFF");
$("table.color-range:not(table.color-range-creation)").remove();
$("#preview").empty();
@ -2717,6 +2775,43 @@ function setPercentileBubble(id_data, values) {
});
}
function setColorCloud (visualConsoleId, dataId, $container) {
$container = $container || $("#" + dataId + ".item.color_cloud");
if ($container.length === 0) return;
var $spinner = $container.children("img");
var $svg = $container.children("svg");
if ($svg.length === 0) {
$svg = $("<svg />");
$container.append($svg);
}
if ($spinner.length > 0) $svg.hide();
jQuery
.post(
get_url_ajax(),
{
"page": "include/ajax/visual_console_builder.ajax",
"action": "get_color_cloud",
"id_visual_console": visualConsoleId,
"id_element": dataId
},
null,
"html"
)
.done(function (data) {
var $newSvg = $(data);
// Check if $newSvg contains a svg
if ($newSvg.is("svg")) $svg.replaceWith($newSvg);
})
.always(function () {
if ($spinner.length > 0) $spinner.remove();
$svg.show();
});
}
function get_image_url(img_src) {
var img_url= null;
var parameter = Array();
@ -2765,9 +2860,6 @@ function set_color_line_status(lines, id_data, values) {
}
function createItem(type, values, id_data) {
var sizeStyle = '';
var imageSize = '';
@ -2775,7 +2867,6 @@ function createItem(type, values, id_data) {
metaconsole = $("input[name='metaconsole']").val();
switch (type) {
case 'box_item':
@ -3586,6 +3677,15 @@ function createItem(type, values, id_data) {
var image = values['image'] + ".png";
set_image("image", id_data, image);
break;
case 'color_cloud':
var diameter = values["diameter"] || values["width"] || 100;
item = $('<div id="' + id_data + '" class="item color_cloud" style="text-align: left; position: absolute; width: ' + diameter + 'px; height: ' + diameter + 'px; top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img id="image_' + id_data + '" class="image" src="images/spinner.gif" width="' + diameter + '" height="' + diameter + '" />' +
'</div>'
);
setColorCloud(id_visual_console, id_data, item);
break;
default:
//Maybe create in any Enterprise item.
if (typeof(enterprise_createItem) == 'function') {
@ -3674,9 +3774,10 @@ function insertDB(type, values) {
success: function (data) {
if (data['correct']) {
id = data['id_data'];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){
values['naturalWidth'] = $('#preview > img')[0].naturalWidth;
values['naturalHeight'] = $('#preview > img')[0].naturalHeight;
var image_to_show = $('#preview > img')[0];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph' && typeof(image_to_show) !== 'undefined')){
values['naturalWidth'] = image_to_show.naturalWidth;
values['naturalHeight'] = image_to_show.naturalHeight;
}
createItem(type, values, id);
addItemSelectParents(id, data['text']);
@ -3821,6 +3922,16 @@ function updateDB_visual(type, idElement , values, event, top, left) {
}
}
break;
case 'color_cloud':
var diameter = values["diameter"];
var $container = $("#" + idElement + ".item.color_cloud");
if ($container.children("img").length === 0) {
$container.append(
'<img id="image_' + idElement + '" class="image" src="images/spinner.gif" width="' + diameter + '" height="' + diameter + '" />'
);
}
setColorCloud(id_visual_console, idElement, $container);
break;
case 'background':
if(values['width'] == '0' || values['height'] == '0'){
@ -4276,6 +4387,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('color_cloud')) {
creationItem = null;
selectedItem = 'color_cloud';
idItem = $(divParent).attr('id');
activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('handler_start')) {
idItem = $(divParent).attr('id')
.replace("handler_start_", "");
@ -4463,6 +4583,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('clock')) {
selectedItem = 'clock';
}
if ($(event.target).hasClass('color_cloud')) {
selectedItem = 'color_cloud';
}
if ($(event.target).hasClass('handler_start')) {
selectedItem = 'handler_start';
}
@ -4801,6 +4924,10 @@ function click_button_toolbox(id) {
toolbuttonActive = creationItem = 'line_item';
toggle_item_palette();
break;
case 'color_cloud':
toolbuttonActive = creationItem = 'color_cloud';
toggle_item_palette();
break;
case 'copy_item':
click_copy_item_callback();
break;
@ -4835,6 +4962,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', false);
activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('donut_graph', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false);
@ -4868,6 +4996,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', true);
activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
}
break;
case 'save_visualmap':
@ -4947,6 +5076,9 @@ function showPreviewStaticGraph(staticGraph) {
$spinner.prop("src", "../../images/spinner.gif");
}
// If no image configured do not show anything
if (staticGraph === null) return;
$("#preview")
.empty()
.css('text-align', 'right')
@ -5214,3 +5346,99 @@ function onLinkedMapStatusCalculationTypeChange (event) {
var value = event.target.value || "default";
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value);
}
function validateColorRange (values) {
return (
(values["from_value"].length > 0 || values["to_value"].length > 0) &&
values["color"].length > 0 &&
!Number.isNaN(Number.parseFloat(values["from_value"])) &&
!Number.isNaN(Number.parseFloat(values["to_value"]))
)
}
function getColorRangeTable ($colorRangeCreationTable, values) {
var $colorRangeTable = $colorRangeCreationTable.clone();
$colorRangeTable.attr("id", "").removeClass("color-range-creation");
// ref inputs
var $fromValueInput = $colorRangeTable.find('input[name="from_value_new"]');
var $toValueInput = $colorRangeTable.find('input[name="to_value_new"]');
var $colorInput = $colorRangeTable.find('input[name="color_new"]');
// Override input values
if (values != null) {
if (values["from_value"] != null) {
$fromValueInput.val(values["from_value"]);
}
if (values["to_value"] != null) {
$toValueInput.val(values["to_value"]);
}
if (values["color"] != null) {
$colorInput.val(values["color"]);
}
}
// Change the name of the new inputs (and clear the id attr)
$fromValueInput.attr("name", "color_range_from_values[]").attr("id", "");
$toValueInput.attr("name", "color_range_to_values[]").attr("id", "");
$colorInput.attr("name", "color_range_color_values[]").attr("id", "");
// Change the add button
$colorRangeAddBtn = $colorRangeTable.find("a.color-range-add");
if ($colorRangeAddBtn.length > 0) {
$colorRangeAddBtn
.removeClass("color-range-add")
.addClass("color-range-delete")
.click(function (e) {
e.preventDefault();
e.stopPropagation();
$colorRangeTable.remove();
});
// Change img
$colorRangeAddImg = $colorRangeAddBtn.children("img");
if ($colorRangeAddImg.length > 0) {
var src = $("#hidden-metaconsole").val() == 1
? "../../images/delete.png"
: "images/delete.png";
$colorRangeAddImg.prop("src", src);
}
}
return $colorRangeTable;
}
function handleColorRangeCreation (event) {
event.preventDefault();
event.stopPropagation();
var $creationBtn = $(event.target);
var $colorRangeCreationTable = $creationBtn.parents("table.color-range-creation");
// ref inputs
var $fromValueInput = $colorRangeCreationTable.find('input[name="from_value_new"]');
var $toValueInput = $colorRangeCreationTable.find('input[name="to_value_new"]');
var $colorInput = $colorRangeCreationTable.find('input[name="color_new"]');
// TODO: Show info about validation
var values = {
"from_value": $fromValueInput.val(),
"to_value": $toValueInput.val(),
"color": $colorInput.val()
}
if (!validateColorRange(values)) return;
var $newColorRangeTable = getColorRangeTable($colorRangeCreationTable);
// Clear creation inputs
$fromValueInput.val("");
$toValueInput.val("");
$colorInput.val("#FFFFFF");
// Add the new table
$newColorRangeTable.insertBefore($colorRangeCreationTable);
}
function bindColorRangeEvents () {
$("a.color-range-add").click(handleColorRangeCreation);
}

View File

@ -202,6 +202,11 @@ foreach ($layoutDatas as $layoutData) {
html_print_image('images/line_item.png', true,
array('title' => __('Line')));
break;
case COLOR_CLOUD:
$table->data[$i + 1]['icon'] =
html_print_image('images/color_cloud_item.png', true,
array('title' => __('Color cloud')));
break;
default:
if (enterprise_installed()) {
$table->data[$i + 1]['icon'] =
@ -259,6 +264,11 @@ foreach ($layoutDatas as $layoutData) {
// hasn't the width and height.
$table->data[$i + 1][2] = '';
break;
case COLOR_CLOUD:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
' x ' .
html_print_input_text('height_' . $idLayoutData, $layoutData['width'], '', 2, 5, true);
break;
default:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
' x ' .
@ -284,6 +294,7 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) {
case BOX_ITEM:
case LINE_ITEM:
case COLOR_CLOUD:
$table->data[$i + 1][4] = "";
break;
default:
@ -485,6 +496,7 @@ foreach ($layoutDatas as $layoutData) {
case LINE_ITEM:
case BOX_ITEM:
case AUTO_SLA_GRAPH:
case COLOR_CLOUD:
$table->data[$i + 2][4] = "";
break;
default:

View File

@ -175,7 +175,7 @@ if ($id_profile || $new_profile) {
$vconsole_management = (bool) $profile["vconsole_management"];
$id_audit = db_pandora_audit("User management",
"Edit profile ". io_safe_output($name));
"Edit profile ". $name);
enterprise_include_once('include/functions_audit.php');
$info = 'Name: ' . $name .

View File

@ -74,7 +74,7 @@ if ($delete_profile) {
}
else {
db_pandora_audit("Profile management",
"Delete profile ". io_safe_output($profile['name']));
"Delete profile ". $profile['name']);
ui_print_success_message(__('Successfully deleted'));
}
@ -187,7 +187,7 @@ if ($update_profile) {
"'.get_product_name().' Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Update profile ".io_safe_output($name), false, false, $info);
"Update profile ". $name, false, false, $info);
ui_print_success_message(__('Successfully updated'));
}
@ -234,7 +234,7 @@ if ($create_profile) {
"'.get_product_name().' Management":"'.$pandora_management.'"}';
db_pandora_audit("User management",
"Created profile ". io_safe_output($name), false, false, $info);
"Created profile ". $name, false, false, $info);
}
else {
ui_print_error_message(__('There was a problem creating this profile'));

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

View File

@ -193,25 +193,49 @@ if ($dialogue_event_response) {
$event_id = get_parameter ('event_id');
$response_id = get_parameter ('response_id');
$command = get_parameter ('target');
$massive = get_parameter ('massive');
$end = get_parameter ('end');
$show_execute_again_btn = get_parameter ('show_execute_again_btn');
$out_iterator = get_parameter ('out_iterator');
$event_response = db_get_row('tevent_response','id',$response_id);
$event = db_get_row('tevento','id_evento',$event_id);
$prompt = "<br>> ";
switch($event_response['type']) {
case 'command':
echo "<div style='text-align:left'>";
echo $prompt.sprintf(__('Executing command: %s',$command));
echo "</div><br>";
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
echo "<br><div id='response_out' style='text-align:left'></div>";
echo "<br><div id='re_exec_command' style='display:none;'>";
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
echo "</div>";
if ($massive) {
echo "<div style='text-align:left'>";
echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s',$command));
echo "</div><br>";
echo "<div id='response_loading_command_".$out_iterator."' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
echo "<br><div id='response_out_".$out_iterator."' style='text-align:left'></div>";
if ($end) {
echo "<br><div id='re_exec_command_".$out_iterator."' style='display:none;'>";
html_print_button(__('Execute again'),'btn_str',false,'execute_event_response(false);', "class='sub next'");
echo "<span id='execute_again_loading' style='display:none'>".html_print_image('images/spinner.gif', true)."</span>";
echo "</div>";
}
}
else {
echo "<div style='text-align:left'>";
echo $prompt.sprintf(__('Executing command: %s',$command));
echo "</div><br>";
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
echo "<br><div id='response_out' style='text-align:left'></div>";
echo "<br><div id='re_exec_command' style='display:none;'>";
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
echo "</div>";
}
break;
case 'url':
$command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command);

View File

@ -15,9 +15,7 @@
// Login check
global $config;
check_login ();
check_login();
$get_image_path_status = get_parameter('get_image_path_status', 0);
if ($get_image_path_status){
@ -165,6 +163,12 @@ $timezone = get_parameter('timezone', 'Europe/Madrid');
$show_last_value = get_parameter('show_last_value', null);
$diameter = (int) get_parameter("diameter", $width);
$default_color = get_parameter("default_color", "#FFFFFF");
$color_range_from_values = get_parameter("color_range_from_values", array());
$color_range_to_values = get_parameter("color_range_to_values", array());
$color_range_colors = get_parameter("color_range_colors", array());
switch ($action) {
case 'get_font':
$return = array();
@ -538,7 +542,10 @@ switch ($action) {
echo json_encode($return);
break;
case 'get_color_cloud':
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
echo visual_map_get_color_cloud_element($layoutData);
break;
case 'update':
case 'move':
@ -835,6 +842,36 @@ switch ($action) {
$values['fill_color'] = $fill_color;
}
break;
case "color_cloud":
$values['width'] = $diameter;
$values['height'] = $diameter;
// Fill Color Cloud values
$extra = array(
"default_color" => $default_color,
"color_ranges" => array()
);
$num_ranges = count($color_range_colors);
for ($i = 0; $i < $num_ranges; $i++) {
if (
!isset($color_range_from_values[$i]) ||
!isset($color_range_to_values[$i]) ||
!isset($color_range_colors[$i])
) {
return;
}
$extra["color_ranges"][] = array(
"from_value" => (float) $color_range_from_values[$i],
"to_value" => (float) $color_range_to_values[$i],
"color" => $color_range_colors[$i] // already html encoded
);
}
// Yes, we are using the label to store the extra info.
// Sorry not sorry.
$values["label"] = json_encode($extra);
break;
default:
if (enterprise_installed()) {
if ($image !== null) {
@ -896,6 +933,12 @@ switch ($action) {
unset($values['width']);
unset($values['height']);
break;
case 'color_cloud':
unset($values['width']);
unset($values['height']);
unset($values['diameter']);
unset($values['label']);
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
@ -952,6 +995,7 @@ switch ($action) {
case 'clock':
case 'auto_sla_graph':
case 'donut_graph':
case 'color_cloud':
$elementFields = db_get_row_filter('tlayout_data',
array('id' => $id_element));
@ -1092,6 +1136,16 @@ switch ($action) {
$elementFields['fill_color'] = $elementFields['fill_color'];
break;
case 'color_cloud':
$elementFields["diameter"] = $elementFields["width"];
$elementFields["dynamic_data"] = null;
try {
// Yes, it's using the label field to store the extra data
$elementFields["dynamic_data"] = json_decode($elementFields["label"], true);
} catch (Exception $ex) {}
$elementFields["label"] = "";
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
@ -1347,6 +1401,37 @@ switch ($action) {
$values['width'] = $width;
$values['height'] = $height;
break;
case 'color_cloud':
$values['type'] = COLOR_CLOUD;
$values['width'] = $diameter;
$values['height'] = $diameter;
$extra = array(
"default_color" => $default_color,
"color_ranges" => array()
);
$num_ranges = count($color_range_colors);
for ($i = 0; $i < $num_ranges; $i++) {
if (
!isset($color_range_from_values[$i]) ||
!isset($color_range_to_values[$i]) ||
!isset($color_range_colors[$i])
) {
return;
}
$extra["color_ranges"][] = array(
"from_value" => (int) $color_range_from_values[$i],
"to_value" => (int) $color_range_to_values[$i],
"color" => $color_range_colors[$i] // already html encoded
);
}
// Yes, we are using the label to store the extra info.
// Sorry not sorry.
$values["label"] = json_encode($extra);
break;
default:
if (enterprise_installed()) {
enterprise_ajax_insert_fill_values_insert($type, $values);
@ -1391,7 +1476,6 @@ switch ($action) {
$text = visual_map_create_internal_name_item($label, $type, $image, $agent, $id_module, $idData);
$values['label'] = io_safe_output($values['label']);
$values['left'] = $values['pos_x'];
$values['top'] = $values['pos_y'];
$values['parent'] = $values['parent_item'];
@ -1423,9 +1507,22 @@ switch ($action) {
$return['values']['type_percentile'] = 'percentile';
break;
case COLOR_CLOUD:
$return["values"]["diameter"] = $values["width"];
try {
// Yes, it's using the label field to store the extra data
$return["values"]["dynamic_data"] = json_decode($values["label"], true);
} catch (Exception $ex) {
$return["values"]["dynamic_data"] = array();
}
$values["label"] = "";
break;
}
}
// Don't move this piece of code
$return["values"]["label"] = io_safe_output($values['label']);
echo json_encode($return);
break;

View File

@ -269,32 +269,8 @@ function process_user_login_remote ($login, $pass, $api = false) {
else {
delete_user_pass_ldap ($login);
}
$permissions = array();
if($config['ldap_advanced_config']){
$i = 0;
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$attributes = $ldap_adv_perm['groups_ldap'];
foreach ($attributes as $attr) {
$attr = explode('=', $attr, 2);
foreach ($sr[$attr[0]] as $s_attr) {
if(preg_match('/' . $attr[1] . '/', $s_attr)){
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
$i++;
}
}
}
}
} else {
$permissions[0]["profile"] = $config['default_remote_profile'];
$permissions[0]["groups"][] = $config['default_remote_group'];
$permissions[0]["tags"] = $config['default_assign_tags'];
}
$permissions = fill_permissions_ldap($sr);
if(empty($permissions)) {
$config["auth_error"] = __("User not found in database or incorrect password");
return false;
@ -388,33 +364,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
}
}
$permissions = array();
if($config['ldap_advanced_config']){
$i = 0;
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$attributes = $ldap_adv_perm['groups_ldap'];
foreach ($attributes as $attr) {
$attr = explode('=', $attr, 2);
foreach ($sr[$attr[0]] as $s_attr) {
if(preg_match('/' . $attr[1] . '/', $s_attr)){
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
$i++;
}
}
}
}
} else {
$permissions[0]["profile"] = $config['default_remote_profile'];
$permissions[0]["groups"][] = $config['default_remote_group'];
$permissions[0]["tags"] = $config['default_assign_tags'];
}
$permissions = fill_permissions_ldap($sr);
if(empty($permissions)) {
$config["auth_error"] = __("User not found in database or incorrect password");
return false;
@ -904,10 +854,11 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
$id_profile = $permission["profile"];
$id_groups = $permission["groups"];
$tags = $permission["tags"];
$no_hierarchy = (bool)$permission["no_hierarchy"] ? 1 : 0;
foreach ($id_groups as $id_group) {
$profile = profile_create_user_profile(
$id_user, $id_profile, $id_group, false, $tags);
$id_user, $id_profile, $id_group, false, $tags, $no_hierarchy);
}
if ( defined("METACONSOLE") && $syncronize ) {
@ -934,7 +885,7 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
db_process_sql_insert ("tusuario", $values);
foreach ($id_groups as $id_group) {
$profile = profile_create_user_profile ($id_user,
$id_profile, $id_group, false, $tags);
$id_profile, $id_group, false, $tags, $no_hierarchy);
}
}
@ -1141,6 +1092,46 @@ function check_permission_ldap ($id_user, $password, $user_info,
}
}
/**
* Fill permissions array with setup values
*
* @param string sr return value from LDAP connection
*
* @return array with all permission on LDAP authentication
*/
function fill_permissions_ldap ($sr) {
global $config;
$permissions = array();
if(!$config['ldap_advanced_config']){
$permissions[0]["profile"] = $config['default_remote_profile'];
$permissions[0]["groups"][] = $config['default_remote_group'];
$permissions[0]["tags"] = $config['default_assign_tags'];
$permissions[0]["no_hierarchy"] = $config['default_no_hierarchy'];
return $permissions;
}
// Decode permissions in advanced mode
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
foreach ($ldap_adv_perms as $ldap_adv_perm) {
$attributes = $ldap_adv_perm['groups_ldap'];
foreach ($attributes as $attr) {
$attr = explode('=', $attr, 2);
foreach ($sr[$attr[0]] as $s_attr) {
if(preg_match('/' . $attr[1] . '/', $s_attr)){
$permissions[] = array(
"profile" => $ldap_adv_perm['profile'],
"groups" => $ldap_adv_perm['group'],
"tags" => implode(",",$ldap_adv_perm['tags']),
"no_hierarchy" => (bool)$ldap_adv_perm['no_hierarchy'] ? 1 : 0
);
}
}
}
}
return $permissions;
}
/**
* Update local user pass from ldap user
*

View File

@ -63,7 +63,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/jquery-ui.min.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
@ -86,9 +86,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
</head>
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
$params['only_image'] = false;
<?php
$params['only_image'] = false;
$params['width'] = (int) $_REQUEST['viewport_width'];
$params['menu'] = false;
@ -214,17 +213,19 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
echo '</div>';
$config['font_size'] = $aux_font_size;
?>
?>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
try {
var status = window.callPhantom({ status: "loaded" });
} catch (error) {
console.log("CALLBACK ERROR", error.message)
}
}, 100);
});
</script>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
if (typeof window.callPhantom === 'function') {
window.callPhantom("loaded");
}
}, 10);
});
</script>
</body>
</html>

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC181211';
$pandora_version = 'v7.0NG.729';
$build_version = 'PC190116';
$pandora_version = 'v7.0NG.730';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -204,6 +204,7 @@ define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16);
define('DONUT_GRAPH', 17);
define('BARS_GRAPH', 18);
define('CLOCK', 19);
define('COLOR_CLOUD', 20);
//Some styles
define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120);

View File

@ -3285,11 +3285,19 @@ function series_type_graph_array($data, $show_elements_graph){
function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = false, $module_list = false){
global $config;
if(is_metaconsole()){
$hack_metaconsole = "../..";
}
else{
$hack_metaconsole = "";
}
$file_js = $config["homedir"] . "/include/web2image.js";
$url = $config["homeurl"] . "include/chart_generator.php";
$url = ui_get_full_url(false) . $hack_metaconsole . "/include/chart_generator.php";
$img_file = "img_". uniqid() .".png";
$img_path = $config["homedir"] . "/attachment/" . $img_file;
$img_url = $config["homeurl"] . "attachment/" . $img_file;
$img_url = ui_get_full_url(false) . $hack_metaconsole . "/attachment/" . $img_file;
$width_img = 500;
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280;
@ -3320,7 +3328,10 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
. ' "' . $session_id . '"'
. ' "' . $params['return_img_base_64'] . '"';
exec($cmd, $result);
$result = null;
$retcode = null;
exec($cmd, $result, $retcode);
$img_content = join("\n", $result);
if($params['return_img_base_64']){
@ -3389,5 +3400,39 @@ function validate_csrf_code() {
function generate_hash_to_api(){
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
}
/**
* Disable the profiller and display de result
*
* @param string Key to identify the profiler run.
* @param string Way to display the result
* "link" (default): Click into word "Performance" to display the profilling info.
* "console": Display with a message in pandora_console.log.
*/
function pandora_xhprof_display_result($key = "", $method = "link") {
// Check if function exists
if (!function_exists('tideways_xhprof_disable')) {
error_log("Cannot find tideways_xhprof_disable function");
return;
}
$run_id = uniqid();
$data = tideways_xhprof_disable();
$source = "pandora_$key";
file_put_contents(
sys_get_temp_dir() . "/" . $run_id . ".$source.xhprof",
serialize($data)
);
$new_url = "http://{$_SERVER['HTTP_HOST']}/profiler/index.php?run={$run_id}&source={$source}";
switch($method) {
case "console":
error_log("'{$new_url}'");
case "link":
default:
echo "<a href='{$new_url}' target='_new'>Performance</a>\n";
break;
}
}
?>

View File

@ -827,7 +827,8 @@ function agents_get_group_agents (
$filter = array();
if (!$noACL) {
// check available groups for target user only if asking for 'All' group
if (!$noACL && $id_group == 0) {
$id_group = $id_group == 0
? array_keys(users_get_groups(false, "AR", false))
: groups_safe_acl($config["id_user"], $id_group, "AR");
@ -848,7 +849,8 @@ function agents_get_group_agents (
$id_group = groups_get_id_recursive($id_group, true);
}
if (!$noACL) {
// check available groups for target user only if asking for 'All' group
if (!$noACL && $id_group == 0) {
$id_group = array_keys(
users_get_groups(false, "AR", true, false, (array)$id_group));
}
@ -1231,8 +1233,8 @@ function agents_get_modules ($id_agent = null, $details = false,
ON tagente.id_agente = tasg.id_agent
WHERE tagente_modulo.delete_pending = 0
AND %s
GROUP BY tagente_modulo.id_agente_modulo
ORDER BY tagente_modulo.nombre',
GROUP BY 1
ORDER BY 1',
($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '',
io_safe_output(implode (",", (array) $details)),
$sql_tags_join,

View File

@ -32,6 +32,7 @@ include_once($config['homedir'] . "/include/functions_servers.php");
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
include_once($config['homedir'] . "/include/functions_db.php");
include_once($config['homedir'] . "/include/functions_event_responses.php");
include_once($config['homedir'] . "/include/functions_policies.php");
enterprise_include_once ('include/functions_local_components.php');
enterprise_include_once ('include/functions_events.php');
enterprise_include_once ('include/functions_agents.php');
@ -6448,6 +6449,63 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
array('type' => 'string', 'data' => __('SNMP policy module updated.')));
}
/**
* Remove an agent from a policy.
* @param $id Id of the policy
* @param $id2 Id of the agent policy
* @param $trash1
* @param $trash2
*
* Example:
* api.php?op=set&op2=remove_agent_from_policy&apipass=1234&user=admin&pass=pandora&id=11&id2=2
*/
function api_set_remove_agent_from_policy ($id, $id2, $thrash2, $thrash3) {
global $config;
if (!check_acl($config['id_user'], 0, "AW")){
returnError('forbidden', 'string');
return;
}
if ($id == '' || !$id) {
returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.'));
return;
}
if ($id2 == '' || !$id2) {
returnError('error_parameter', __('Error deleting agent from policy. Agent cannot be left blank.'));
return;
}
$policy = policies_get_policy ($id, false, false);
$agent = db_get_row_filter('tagente', array('id_agente' => $id2));
$policy_agent = db_get_row_filter('tpolicy_agents', array('id_policy' => $id ,'id_agent' => $id2));
if (empty ($policy)){
returnError('error_policy', __('This policy does not exist.'));
return;
}
if (empty ($agent)){
returnError('error_agent', __('This agent does not exist.'));
return;
}
if (empty ($policy_agent)){
returnError('error_policy_agent', __('This agent does not exist in this policy.'));
return;
}
$return = policies_change_delete_pending_agent($policy_agent['id']);
$data = __('Successfully added to delete pending id agent %d to id policy %d.', $id2, $id);
if ($return === false)
returnError('error_delete_policy_agent', 'Could not be deleted id agent %d from id policy %d', $id2, $id);
else
returnData('string', array('type' => 'string', 'data' => $data));
}
/**
* Create a new group. And return the id_group of the new group.
*
@ -9716,6 +9774,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
return;
}
$values['id_grupo'] = $other['data'][1];
if (groups_get_name($values['id_grupo']) === false) {
returnError('error_parameter', 'Group ID does not exist');
return;
}
}
else {
returnError('error_parameter', 'Group ID required.');
@ -10059,7 +10122,7 @@ function api_get_netflow_get_summary ($discard_1, $discard_2, $params) {
}
//http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora
function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
function api_set_validate_event_by_id ($id, $trash1 = null, $trash2 = null, $returnType = 'string') {
global $config;
$data['type'] = 'string';
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
@ -10078,7 +10141,7 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
'ack_utimestamp' => $ack_utimestamp,
'estado' => 1
);
$result = db_process_sql_update('tevento', $values, array('id_evento' => $id));
if ($result === false) {

View File

@ -312,6 +312,8 @@ function config_update_config () {
$error_update[] = __('Autocreate profile group');
if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags'))))
$error_update[] = __('Autocreate profile tags');
if (!config_update_value ('default_no_hierarchy', (int)get_parameter ('default_no_hierarchy')))
$error_update[] = __('Automatically assigned no hierarchy');
if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')))
$error_update[] = __('Autocreate blacklist');
@ -1452,7 +1454,10 @@ function config_process_config () {
if (!isset ($config['default_assign_tags'])) {
config_update_value ( 'default_assign_tags', '');
}
if (!isset ($config['default_no_hierarchy'])) {
config_update_value ('default_no_hierarchy', 0);
}
if (!isset ($config['ldap_server'])) {
config_update_value ( 'ldap_server', 'localhost');
}
@ -2027,6 +2032,14 @@ function config_process_config () {
if (!isset($config["metaconsole_deploy_collection"])) {
config_update_value('metaconsole_deploy_collection', 0);
}
if (!isset($config["metaconsole_deploy_inventory_plugin"])) {
config_update_value('metaconsole_deploy_inventory_plugin', 0);
}
if (!isset($config["metaconsole_deploy_plugin_server"])) {
config_update_value('metaconsole_deploy_plugin_server', 0);
}
}
/* Finally, check if any value was overwritten in a form */

View File

@ -238,7 +238,7 @@ function grafico_modulo_sparse_data(
}
}
if($array_data === false || !isset($array_data['sum1']['data'][0][1])){
if ($array_data === false || (!$params['graph_combined'] && !isset($array_data['sum1']['data'][0][1]))) {
return false;
}
@ -1049,6 +1049,10 @@ function graphic_combined_module (
$params_combined['id_graph'] = 0;
}
if(!isset($params_combined['type_report'])){
$params_combined['type_report'] = '';
}
if(!isset($params['percentil'])){
$params_combined['percentil'] = null;
}
@ -1207,8 +1211,8 @@ function graphic_combined_module (
);
$series = db_get_all_rows_sql(
'SELECT summatory_series,average_series,modules_series
FROM tgraph
'SELECT summatory_series,average_series, modules_series
FROM tgraph
WHERE id_graph = '.
$params_combined['id_graph']
);
@ -1301,7 +1305,6 @@ function graphic_combined_module (
);
}
//XXX arreglar estas
$long_index = '';
switch ($params_combined['stacked']) {
default:
@ -1324,7 +1327,16 @@ function graphic_combined_module (
$i=0;
$array_data = array();
foreach ($module_list as $key => $agent_module_id) {
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
$server = metaconsole_get_connection_by_id ($agent_module_id['server']);
if (metaconsole_connect ($server) != NOERR){
continue;
}
$agent_module_id = $agent_module_id['module'];
}
$module_data = db_get_row_sql (
'SELECT * FROM tagente_modulo
WHERE id_agente_modulo = ' .
@ -1340,12 +1352,12 @@ function graphic_combined_module (
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
$data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
$data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
$data_module_graph['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
$data_module_graph['c_min'] = $module_data['min_critical'];
$data_module_graph['c_max'] = $module_data['max_critical'];
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
$data_module_graph['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
$data_module_graph['c_min'] = $module_data['min_critical'];
$data_module_graph['c_max'] = $module_data['max_critical'];
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
$data_module_graph['module_id'] = $agent_module_id;
//stract data
@ -1357,7 +1369,7 @@ function graphic_combined_module (
$i
);
$series_suffix = $i;
$series_suffix = $i;
//convert to array graph and weight
foreach ($array_data_module as $key => $value) {
@ -1386,6 +1398,10 @@ function graphic_combined_module (
//$array_events_alerts[$series_suffix] = $events;
$i++;
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
metaconsole_restore_db();
}
}
if($params_combined['projection']){
@ -1544,7 +1560,6 @@ function graphic_combined_module (
$water_mark,
$array_events_alerts
);
break;
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
case CUSTOM_GRAPH_BULLET_CHART:

View File

@ -441,7 +441,7 @@ function groups_get_all($groupWithAgents = false) {
* Get all groups recursive from an initial group.
*
* @param int Id of the parent group
* @param bool Whether to return All group or not
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
*
* @return Array with all result groups
*/
@ -451,10 +451,11 @@ function groups_get_id_recursive($id_parent, $all = false) {
$return = array_merge($return, array($id_parent));
//Check propagate
$id = db_get_value_filter('id_grupo', 'tgrupo', array('id_grupo' => $id_parent, 'propagate' => 1));
$propagate = db_get_value_filter('propagate', 'tgrupo', array('id_grupo' => $id_parent));
if (($id !== false) || $all) {
if (($propagate != 1) || $all) {
$children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo'));
if ($children === false) {
$children = array();
}

View File

@ -68,6 +68,7 @@ function groupview_get_modules_counters($groups_ids = false) {
ta.id_grupo AS g
FROM $table ta
WHERE ta.id_grupo IN ($groups_ids)
AND ta.disabled = 0
GROUP BY ta.id_grupo
UNION ALL
SELECT SUM(ta.normal_count) AS module_normal,

View File

@ -97,6 +97,15 @@ function hd ($var, $file = '', $oneline = false) {
html_debug_print ($var, $file, $oneline);
}
function debug () {
$args_num = func_num_args();
$arg_list = func_get_args();
for ($i = 0; $i < $args_num; $i++) {
html_debug_print($arg_list[$i], true);
}
}
function html_f2str($function, $params) {
ob_start();
@ -726,8 +735,11 @@ function html_print_extended_select_for_post_process($name, $selected = '',
$selected_float = (float)$selected;
$found = false;
if (array_key_exists(number_format($selected, 14, '.', ','), $fields))
$found = true;
if($selected){
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
$found = true;
}
}
if (!$found) {
$fields[$selected] = floatval($selected);
@ -1008,7 +1020,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
++$idcounter;
$valid_attrs = array ("accept", "disabled", "maxlength",
"name", "readonly", "size", "value", "accesskey",
"name", "readonly", "placeholder", "size", "value", "accesskey",
"class", "dir", "id", "lang", "style", "tabindex",
"title", "xml:lang", "onfocus", "onblur", "onselect",
"onchange", "onclick", "ondblclick", "onmousedown",
@ -1338,6 +1350,36 @@ function html_print_input_hidden_extended($name, $value, $id, $return = false, $
echo $output;
}
/**
* Render a color input element.
*
* The element will have an id like: "hidden-$name"
*
* @param string $name Input name.
* @param int $value Input value. Decimal representation of the color's hexadecimal value.
* @param string $class Set the class of input.
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
*
* @return string HTML code if return parameter is true.
*/
function html_print_input_color ($name, $value, $class = false, $return = false) {
$attr_type = 'type="color"';
$attr_id = 'id="color-' . htmlspecialchars($name, ENT_QUOTES) . '"';
$attr_name = 'name="' . htmlspecialchars($name, ENT_QUOTES) . '"';
$attr_value = 'value="' . htmlspecialchars($value, ENT_QUOTES) . '"';
$attr_class = 'class="' . ($class !== false ? htmlspecialchars($class, ENT_QUOTES) : "") . '"';
$output = '<input '
. $attr_type . ' '
. $attr_id . ' '
. $attr_name . ' '
. $attr_value . ' '
. $attr_class . ' />';
if ($return) return $output;
echo $output;
}
/**
* Render an submit input button element.
*
@ -2479,7 +2521,7 @@ function html_print_result_div ($text) {
$text = preg_replace ('/\n/i','<br>',$text);
$text = preg_replace ('/\s/i','&nbsp;',$text);
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$enclose .= $text;
$enclose .= "</div>";
return $enclose;

View File

@ -79,14 +79,10 @@ function profile_create_user_profile ($id_user,
$tags = '',
$no_hierarchy = false
) {
global $config;
if (empty ($id_profile) || $id_group < 0)
return false;
// Secondary server is an enterprise function
if (!enterprise_installed() && $no_hierarchy) return false;
return false;
// Checks if the user exists
$result_user = users_get_user_by_id($id_user);

View File

@ -304,7 +304,8 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_availability_graph(
$report,
$content,
$pdf);
$pdf
);
break;
case 'sql':
$report['contents'][] = reporting_sql(
@ -3822,7 +3823,7 @@ function reporting_agent_configuration($report, $content) {
return reporting_check_structure_content($return);
}
function reporting_value($report, $content, $type, $pdf) {
function reporting_value($report, $content, $type, $pdf=false) {
global $config;
$return = array();
@ -6343,13 +6344,18 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
require_once ($config["homedir"] . '/include/functions_graph.php');
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server);
if ($type_report == "custom_graph") {
if (is_metaconsole()) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
if (metaconsole_connect ($server) != NOERR){
return false;
}
}
}
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$return = array();
$return['type'] = 'custom_graph';
@ -6373,30 +6379,25 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$graphs[0]["average_series"] = '';
$graphs[0]["modules_series"] = '';
$graphs[0]["fullscale"] = $content['style']['fullscale'];
$modules = $content['id_agent_module'];
if(is_array($content['id_agent_module'])){
foreach ($content['id_agent_module'] as $key => $value) {
if($content['each_agent']){
$modules[] = $value;
}
else{
$modules[] = $value['module'];
}
}
}
else{
if ($content['id_agent_module']) {
$modules[] = $content['id_agent_module'];
} else {
// restore to metaconsole database
metaconsole_restore_db();
$module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']);
if(!$modules){
$module_source = db_get_all_rows_sql(
"SELECT id_agent_module, id_server
FROM tgraph_source
WHERE id_graph = " .
$content['id_gs']
);
if(isset($module_source) && is_array($module_source)){
$modules = array();
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
$modules[$key]['module'] = $value['id_agent_module'];
$modules[$key]['server'] = $value['id_server'];
}
metaconsole_connect($server);
}
}
$id_graph = 0;
}
else {
@ -6436,7 +6437,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
'summatory' => $graphs[0]["summatory_series"],
'average' => $graphs[0]["average_series"],
'modules_series' => $graphs[0]["modules_series"],
'id_graph' => $id_graph
'id_graph' => $id_graph,
'type_report' => $type_report
);
$return['chart'] = graphic_combined_module(
@ -6445,13 +6447,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$params_combined
);
break;
case 'data':
break;
}
if ($config['metaconsole']) {
metaconsole_restore_db();
if ($type_report == "custom_graph") {
if (is_metaconsole()) {
metaconsole_restore_db();
}
}
return reporting_check_structure_content($return);
@ -10001,7 +10003,7 @@ You can of course remove the warnings, that's why we include the source and do n
$output .= 'parameters["page"] = "include/ajax/events";';
$output .= 'parameters["total_events"] = 1;';
$output .= '$.ajax({type: "GET",url: "ajax.php",data: parameters,';
$output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,';
$output .= 'success: function(data) {';
$output .= '$("#total_events").text(data);';
$output .= '}';

View File

@ -2428,12 +2428,18 @@ function reporting_html_availability(&$table, $item) {
function reporting_html_availability_graph(&$table, $item, $pdf=0) {
global $config;
$metaconsole_on = is_metaconsole();
if($metaconsole_on && $pdf==0){
$src= '../../';
if($metaconsole_on){
$hack_metaconsole = "../../";
}
else{
$src=$config['homeurl'];
$hack_metaconsole = "";
}
$src=ui_get_full_url(false);
$tables_chart = '';
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();
@ -2471,6 +2477,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$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);
}
if($item['type'] == 'availability_graph'){
@ -2480,43 +2487,43 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table2->data = array ();
$table2->size = array ();
$table2->size[0] = '2%';
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
$table2->data[0][0] = '<img src ="'. $src . $hack_metaconsole . 'images/square_green.png">';
$table2->size[1] = '14%';
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
$table2->size[2] = '2%';
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
$table2->data[0][2] = '<img src ="'. $src . $hack_metaconsole .'images/square_red.png">';
$table2->size[3] = '14%';
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
$table2->size[4] = '2%';
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
$table2->data[0][4] = '<img src ="'. $src . $hack_metaconsole .'images/square_gray.png">';
$table2->size[5] = '14%';
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
$table2->size[6] = '2%';
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
$table2->data[0][6] = '<img src ="'. $src . $hack_metaconsole .'images/square_blue.png">';
$table2->size[7] = '14%';
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
$table2->size[8] = '2%';
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
$table2->data[0][8] = '<img src ="'. $src . $hack_metaconsole .'images/square_violet.png">';
$table2->size[9] = '14%';
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
$table2->size[10] = '2%';
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
$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>';
}
$table->colspan['charts']['cell'] = 2;
$table->data['charts']['cell'] = html_print_table($table1, true);
$table->data['charts']['cell'] = $tables_chart;
$table->colspan['legend']['cell'] = 2;
$table->data['legend']['cell'] = html_print_table($table2, true);
if($pdf){
return html_print_table($table1, true) . '<br />' . html_print_table($table2, true);
return $tables_chart . '<br />' . html_print_table($table2, true);
}
}

View File

@ -278,6 +278,11 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
));
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
}
if($salida !== NULL){
$last_data_str = html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
}
$last_data_str .= $salida;
}
else {

View File

@ -3884,7 +3884,7 @@ function ui_print_module_string_value($value, $id_agente_module,
" / " . $module_name;
$salida = "<div " .
"id='hidden_value_module_" . $id_agente_module . "'
style='display: none; width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left' title='" . $title_dialog . "'>" .
style='display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left' title='" . $title_dialog . "'>" .
$value .
"</div>" .
"<span " .

View File

@ -487,7 +487,7 @@ function visual_map_print_item($mode = "read", $layoutData,
else {
$url = ui_meta_get_url_console_child(
$layoutData['id_metaconsole'],
"estado", "operation/agentes/ver_agente&amp;id_agente=" . $layoutData['id_agent'], null, null, null, $isExternalLink);
"view", "operation/agentes/status_monitor&amp;id_module=" . $layoutData['id_agente_modulo'], null, null, null, $isExternalLink);
}
}
else {
@ -1569,6 +1569,9 @@ function visual_map_print_item($mode = "read", $layoutData,
case BOX_ITEM:
$class .= "box_item";
break;
case COLOR_CLOUD:
$class .= "color_cloud";
break;
default:
if (!empty($element_enterprise)) {
$class .= $element_enterprise['class'];
@ -2181,6 +2184,9 @@ function visual_map_print_item($mode = "read", $layoutData,
}
break;
case COLOR_CLOUD:
echo visual_map_get_color_cloud_element($layoutData);
break;
default:
if (!empty($element_enterprise)) {
echo $element_enterprise['item'];
@ -3459,7 +3465,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
$filter = array ();
} else {
if(!empty($filter['name'])){
$where .= "name LIKE '%".io_safe_output($filter['name'])."%'";
$where .= sprintf("name LIKE '%%%s%%'",
db_escape_string_sql(io_safe_output($filter['name'])));
unset($filter['name']);
}
}
@ -3883,6 +3891,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
case 'group_item':
$text = __('Group') . " - ";
break;
case COLOR_CLOUD:
case 'color_cloud':
$text = __('Color cloud') . " - ";
break;
case 'icon':
case ICON:
$text = __('Icon') . " - " .
@ -4020,6 +4032,8 @@ function visual_map_type_in_js($type) {
break;
case LINE_ITEM:
return 'line_item';
case COLOR_CLOUD:
return 'color_cloud';
break;
}
}
@ -4035,5 +4049,76 @@ function visual_map_macro($label,$module){
return $label;
}
function visual_map_get_color_cloud_element ($data) {
$id = (int) $data["id"];
$diameter = (int) $data["width"];
$dynamic_fields = array();
try {
// Yes, the dynamic fields object is stored into the label field. ¯\_(ツ)_/¯
if (!empty($data["label"])) {
$dynamic_fields = json_decode($data["label"], true);
}
} catch (Exception $ex) {}
$default_color = !empty($dynamic_fields["default_color"])
? $dynamic_fields["default_color"]
: "#FFFFFF";
$color = $default_color;
// The svg gradient needs a unique identifier
$gradient_id = "grad_" . $id;
// Color ranges
if (
!empty($dynamic_fields["color_ranges"]) &&
!empty($data["id_agente_modulo"])
) {
$node_id = null;
$node_connected = false;
// Connect to node
if (is_metaconsole() && !empty($data["id_metaconsole"])) {
$node_id = (int) $data["id_metaconsole"];
if (metaconsole_connect(null, $node_id) === NOERR) $node_connected = true;
}
// Fetch module value
$value = (!$node_id || ($node_id && $node_connected))
? modules_get_last_value($data["id_agente_modulo"])
: false;
// Restore connection
if ($node_connected) metaconsole_restore_db();
if ($value !== false) {
/* TODO: It would be ok to give support to string values in the future?
* It can be done by matching the range value with the value if it is a
* string. I think the function to retrieve the value only supports
* numeric values.
*/
$value = (float) $value;
foreach ($dynamic_fields["color_ranges"] as $range) {
if ($range["from_value"] <= $value && $range["to_value"] >= $value) {
$color = $range["color"];
break;
}
}
}
}
ob_start();
?>
<svg height="<?php echo $diameter; ?>" width="<?php echo $diameter; ?>">
<defs>
<radialGradient id="<?php echo $gradient_id; ?>" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
<stop offset="0%" style="stop-color:<?php echo $color; ?>;stop-opacity:0.9" />
<!-- <stop offset="50%" style="stop-color:<?php echo $color; ?>;stop-opacity:0.6" /> -->
<stop offset="100%" style="stop-color:<?php echo $color; ?>;stop-opacity:0" />
</radialGradient>
</defs>
<circle cx="50%" cy="50%" r="50%" fill="url(#<?php echo $gradient_id; ?>)" />
</svg>
<?php
return ob_get_clean();
}
?>

View File

@ -62,7 +62,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'clock' => __('Clock'),
'group_item' => __('Group'),
'box_item' => __('Box'),
'line_item' => __('Line'));
'line_item' => __('Line'),
'color_cloud' => __('Color cloud')
);
if (enterprise_installed()) {
enterprise_visual_map_editor_add_title_palette($titles);
@ -328,7 +330,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['agent_row'] = array();
$form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos', 'auto_sla_graph');
'simple_value', 'datos', 'auto_sla_graph', 'color_cloud');
$form_items['agent_row']['html'] = '<td align="left">' .
__('Agent') . '</td>';
$params = array();
@ -395,7 +397,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['module_row'] = array();
$form_items['module_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph');
'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph',
'color_cloud');
$form_items['module_row']['html'] = '<td align="left">' .
__('Module') . '</td>
<td align="left">' .
@ -510,7 +513,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
__('Max value') . '</td>
<td align="left">' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
$percentile_type = array('percentile' => __('Percentile'), 'bubble' => __('Bubble'), 'circular_progress_bar' => __('Circular progress bar'), 'interior_circular_progress_bar' => __('Circular progress bar (interior)'));
$percentile_type = array(
"percentile" => __("Percentile"),
"bubble" => __("Bubble"),
"circular_progress_bar" => __("Circular porgress bar"),
"interior_circular_progress_bar" => __("Circular progress bar (interior)")
);
$percentile_value = array('percent' => __('Percent'), 'value' => __('Value'));
if (is_metaconsole()){
$form_items['percentile_item_row_3'] = array();
@ -534,14 +542,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['percentile_item_row_3']['html'] = '<td align="left">' .
__('Type') . '</td>
<td align="left">' .
html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true) .
html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false) .
'</td>';
$form_items['percentile_item_row_4'] = array();
$form_items['percentile_item_row_4']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_4']['html'] = '<td align="left">' . __('Value to show') . '</td>
<td align="left">' .
html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true) .
html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false) .
'</td>';
}
@ -580,7 +588,70 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'<td align="left" style="">' . __('Show statistics') . '</td>
<td align="left" style="">' .
html_print_checkbox('show_statistics', 1, '', true) . '</td>';
// Start of Color Cloud rows
// Diameter
$default_diameter = 100;
$form_items["color_cloud_diameter_row"] = array();
$form_items["color_cloud_diameter_row"]["items"] = array("color_cloud");
$form_items["color_cloud_diameter_row"]["html"] =
"<td align=\"left\">" . __("Diameter") . "</td>
<td align=\"left\">" .
html_print_input_text("diameter", $default_diameter, "", 3, 5, true) .
"</td>";
// Default color
$default_color = "#FFFFFF";
$form_items["color_cloud_def_color_row"] = array();
$form_items["color_cloud_def_color_row"]["items"] = array("color_cloud");
$form_items["color_cloud_def_color_row"]["html"] =
"<td align=\"left\">" . __("Default color") . "</td>
<td align=\"left\">" .
html_print_input_color("default_color", $default_color, false, true) .
"</td>";
// Color ranges
$color_range_tip = __("The color of the element will be the one selected in the first range created in which the value of the module is found (with the initial and final values of the range included)") . ".";
$form_items["color_cloud_color_ranges_row"] = array();
$form_items["color_cloud_color_ranges_row"]["items"] = array("color_cloud");
$form_items["color_cloud_color_ranges_row"]["html"] =
"<td align=\"left\">" .
__("Ranges") .
ui_print_help_tip($color_range_tip, true) .
"</td>" .
"<td align=\"left\">" .
"<table id=\"new-color-range\" class=\"databox color-range color-range-creation\">" .
"<tr>" .
"<td>" . __("From value") . "</td>" .
"<td>" .
html_print_input_text("from_value_new", "", "", 5, 255, true) .
"</td>" .
"<td rowspan=\"4\">" .
"<a class=\"color-range-add\" href=\"#\">" .
html_print_image("images/add.png", true) .
"</a>" .
"</td>" .
"</tr>" .
"<td>" . __("To value") . "</td>" .
"<td>" .
html_print_input_text("to_value_new", "", "", 5, 255, true) .
"</td>" .
"<td></td>" .
"<tr>" .
"</tr>" .
"<tr>" .
"<td>" . __("Color") . "</td>" .
"<td>" .
html_print_input_color("color_new", $default_color, false, true) .
"</td>" .
"<td></td>" .
"</tr>" .
"</table>" .
"</td>";
// End of Color Cloud rows
$form_items['show_on_top_row'] = array();
$form_items['show_on_top_row']['items'] = array('group_item');
$form_items['show_on_top_row']['html'] =
@ -616,7 +687,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
__('Type') . '</td>
<td align="left">' . html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true) . '</td>';
//Insert and modify before the buttons to create or update.
if (enterprise_installed()) {
enterprise_visual_map_editor_modify_form_items_palette($form_items);
@ -661,7 +732,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['position_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos', 'box_item',
'auto_sla_graph', 'bars_graph','clock', 'donut_graph');
'auto_sla_graph', 'bars_graph','clock', 'donut_graph', 'color_cloud');
$form_items_advance['position_row']['html'] = '
<td align="left">' . __('Position') . '</td>
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
@ -750,6 +821,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
var $mapLinkedSelect = $("select#map_linked");
var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id");
var visualMaps = <?php echo json_encode($visual_maps); ?>;
if (!(visualMaps instanceof Array)) visualMaps = [];
var nodesById = <?php echo json_encode($meta_servers_by_id); ?>;
visualMaps.forEach(function (vMap) {
@ -870,7 +942,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['element_group_row']['items'] = array(
'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value',
'icon', 'label', 'datos', 'donut_graph');
'icon', 'label', 'datos', 'donut_graph', 'color_cloud');
$form_items_advance['element_group_row']['html'] = '<td align="left">'.
__('Restrict access to group') . '</td>' .
'<td align="left">' .
@ -1021,6 +1093,7 @@ function visual_map_editor_print_toolbox() {
visual_map_print_button_editor('group_item', __('Group'), 'left', false, 'group_item_min', true);
visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item_min', true);
visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item_min', true);
visual_map_print_button_editor('color_cloud', __('Color cloud'), 'left', false, 'color_cloud_min', true);
if(defined("METACONSOLE")){
echo '<a href="javascript:" class="tip"><img src="'.$config['homeurl_static'].'/images/tip.png" data-title="The data displayed in editor mode is not real" data-use_title_for_force_title="1"
class="forced_title" alt="The data displayed in editor mode is not real"></a>';

View File

@ -159,9 +159,10 @@
if (custom_graph) {
dataObject = retrieveDataOject(dataObjects,0);
dataObjects.forEach(function (element) {
elements.push(processDataObject(element));
});
//dataObjects.forEach(function (element) {
//elements.push(processDataObject(element));
//});
elements.push(processDataObject(dataObject));
graphData = elements;
}
else {

View File

@ -362,10 +362,11 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
tickFormatter: xFormatter,
},
yaxis: {
color: tick_color,
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
font: {
size: font_size + 2,
color: 'rgb(84, 84, 84)',
family: font+'Font'
},
ticks: yFormatter,
},
legend: {
@ -417,7 +418,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
div_attributes += "min-height: 2.5em;";
}
div_attributes += '" title="'+title+'" class="'+font+'" '+ ' style="overflow: hidden;"';
div_attributes += '" title="'+title+'" style="overflow: hidden;"';
format.push([i,'<div ' + div_attributes + '>'
+ label

View File

@ -409,12 +409,14 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
$colors = implode($separator, $colors);
}
$return .= "<script type='text/javascript'>";
include_javascript_dependencies_flot_graph();
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
'$series', '$width', $font_size, $water_mark, '$separator',
'$legend_position', '$height', '$colors', " . json_encode($hide_labels) . ")";
$return .= "});";
$return .= "</script>";
return $return;
@ -474,11 +476,11 @@ function flot_custom_pie_chart ($graph_values,
$colors = implode($separator, $temp_colors);
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";
$return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels',
'$width', $font_size, '$fontpath', $water_mark,
'$separator', '$legend_position', '$height', '$colors','$legend','$background_color')";
$return .= "});";
$return .= "</script>";
return $return;
@ -575,10 +577,10 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font =
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";
$return .= "pandoraFlotHBars('$graph_id', '$values', '$labels',
false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color', '$tick_color', $val_min, $val_max)";
$return .= "});";
$return .= "</script>";
return $return;
@ -666,7 +668,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";
if ($from_ux) {
if($from_wux){
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color', '$tick_color')";
@ -678,7 +680,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
else {
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color', '$tick_color')";
}
$return .= "});";
$return .= "</script>";
return $return;
@ -841,7 +843,9 @@ function flot_slicesbar_graph (
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "//<![CDATA[\n";
$return .= "$(document).ready( function () {";
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
$return .= "});";
$return .= "\n//]]>";
$return .= "</script>";

View File

@ -1332,7 +1332,7 @@ function print_phases_donut (recipient, phases) {
var svg = d3.select(recipient)
.append("svg")
.attr("width", 800)
.attr("height", 400)
.attr("height", 500)
.append("g");
svg.append("g")
@ -1361,7 +1361,7 @@ function print_phases_donut (recipient, phases) {
.outerRadius(radius * 0.9);
width = 800;
height = 400;
height = 500;
svg.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var key = function(d){ return d.data.label; };
@ -1440,6 +1440,8 @@ function print_phases_donut (recipient, phases) {
return d.startAngle + (d.endAngle - d.startAngle)/2;
}
var ex = 1;
var sum = 0;
text.transition().duration(0)
.attrTween("transform", function(d) {
this._current = this._current || d;
@ -1447,8 +1449,26 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0);
return function(t) {
var d2 = interpolate(t);
var pos = outerArc.centroid(d2);
pos[0] = radius * (midAngle(d2) < Math.PI ? 1 : -1);
//fix for labels of a very small portion increase the
//height of the label so that they do not overlap
if( ( d2.endAngle - d2.startAngle ) < 0.1){
var pos = outerArc.centroid(d2);
if (ex%2==0){
pos[0] = 150;
}
else{
pos[0] = -150;
sum++;
}
pos[1] = pos[1] - (35*sum);
ex++;
}
else{
var pos = outerArc.centroid(d2);
pos[0] = radius * (midAngle(d2) < Math.PI ? 1 : -1);
}
return "translate("+ pos +")";
};
})
@ -1458,6 +1478,17 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0);
return function(t) {
var d2 = interpolate(t);
//fix for labels of a very small portion increase the
//height of the label so that they do not overlap
if( ( d2.endAngle - d2.startAngle ) < 0.1){
if (ex%2==0){
return "start";
}
else{
return "end";
}
}
return midAngle(d2) < Math.PI ? "start":"end";
};
});
@ -1468,10 +1499,12 @@ function print_phases_donut (recipient, phases) {
/* ------- SLICE TO TEXT POLYLINES -------*/
var polyline = svg.select(".lines").selectAll("polyline")
.data(pie(data), key);
polyline.enter()
.append("polyline");
var ex2 = 1;
var sum2 = 0;
polyline.transition().duration(0)
.attrTween("points", function(d){
this._current = this._current || d;
@ -1479,16 +1512,33 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0);
return function(t) {
var d2 = interpolate(t);
var pos = outerArc.centroid(d2);
pos[0] = radius * 0.95 * (midAngle(d2) < Math.PI ? 1 : -1);
//fix for labels of a very small portion increase the
//height of the label so that they do not overlap
if( ( d2.endAngle - d2.startAngle ) < 0.1){
var pos = outerArc.centroid(d2);
if (ex2%2==0){
pos[0] = 150 * 0.95;
}
else{
pos[0] = -150 * 0.95;
sum2++;
}
pos[1] = pos[1] - (30*sum2);
ex2++;
}
else{
var pos = outerArc.centroid(d2);
pos[0] = radius * 0.95 * (midAngle(d2) < Math.PI ? 1 : -1);
}
return [arc.centroid(d2), outerArc.centroid(d2), pos];
};
};
})
.style("stroke", "black")
.style("opacity", ".3")
.style("stroke-width", "2px")
.style("fill", "none");
polyline.exit()
.remove();
}
@ -2331,4 +2381,4 @@ var digitPattern = [
setTimeout(tick, 1000 - now % 1000);
})();
}
}

View File

@ -31,10 +31,10 @@ Hidden this macros because they cannot edit in the module form
-->
<li>_plugin_parameters_ : Plug-in Parameters of the module.</li>
<li>_name_tag_ : Nombre de los tags asociados al módulo.</li>
<li>_email_tag_ : Emails asociados a los tags de módulos.</li>
<li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li>
<li>_moduletags_ : Teléfonos asociados a los tags de módulos.</li>
<li>_name_tag_ : Names of the tags associated to the module.</li>
<li>_email_tag_ : Emails associated to module tags.</li>
<li>_phone_tag_ : Phone numbers associated to module tags.</li>
<li>_moduletags_ : URLs associated to module tags.</li>
<li>_agentcustomfield_<i>n</i>_: Agent custom field number <i>n</i> (eg. _agentcustomfield_9_).</li>
</ul>
<p>

View File

@ -30,9 +30,9 @@ Hidden this macros because they cannot edit in the module form
-->
<li>_plugin_parameters_ : Parámetros del Plug-in del módulo.</li>
<li>_name_tag_ : Names of the tags associated to the module.</li>
<li>_email_tag_ : Emails associated to the module tags.</li>
<li>_phone_tag_ : Phone numbers associated to the module tags.</li>
<li>_moduletags_ : URLs associated to the module tags.</li>
<li>_name_tag_ : Nombre de los tags asociados al módulo.</li>
<li>_email_tag_ : Emails asociados a los tags de módulos.</li>
<li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li>
<li>_moduletags_ : URLs asociadas a los tags de módulos.</li>
<li>_agentcustomfield_<i>n</i>_: Campo personalizado número <i>n</i> del agente (eg. _agentcustomfield_9_). </li>
</ul>

View File

@ -26,7 +26,8 @@
$.fn.showMessage = function (msg) {
return $(this).hide ().empty ()
.text (msg)
// here, previously .text (msg)
.html (msg)
.slideDown ();
};
}) (jQuery);

View File

@ -594,12 +594,51 @@ function post_process_select_init_unit(name,selected) {
function post_process_select_events_unit(name,selected) {
$('.' + name + '_toggler').click(function() {
$('#' + name + '_select option[value=none]').attr("selected",true);
$('#text-' + name + '_text').val("");
var value = $('#text-' + name + '_text').val();
var count = $('#' + name + '_select option')
.filter(function(i, item) {
if ($(item).val() == value)
return true;
else return false;
})
.length;
if (count != 1) {
$('#' + name + '_select')
.append($("<option>").val(value).text(value));
}
$('#' + name + '_select option')
.filter(function(i, item) {
if ($(item).val() == value)
return true;
else return false;
})
.prop("selected", true);
toggleBoth(name);
$('#text-' + name + '_text').focus();
});
// When select a default period, is setted in seconds
$('#' + name + '_select').change(function() {
var value = $('#' + name + '_select').val();
$('.' + name).val(value);
$('#text-' + name + '_text').val(value);
});
$('#text-' + name + '_text').keyup (function () {
var value = $('#text-' + name + '_text').val();
$('.' + name).val(value);
});
}
function post_process_select_events(name) {
$('.' + name + '_toggler').click(function() {
var value = $('#text-' + name + '_text').val();

View File

@ -158,10 +158,11 @@ function show_response_dialog(event_id, response_id, response) {
var params = [];
params.push("page=include/ajax/events");
params.push("dialogue_event_response=1");
params.push("massive=0");
params.push("event_id="+event_id);
params.push("target="+response['target']);
params.push("response_id="+response_id);
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
@ -187,6 +188,57 @@ function show_response_dialog(event_id, response_id, response) {
});
}
//Show the modal window of event responses when multiple events are selected
function show_massive_response_dialog(event_id, response_id, response, out_iterator, end) {
var ajax_file = $('#hidden-ajax_file').val();
var params = [];
params.push("page=include/ajax/events");
params.push("dialogue_event_response=1");
params.push("massive=1");
params.push("end="+end);
params.push("out_iterator="+out_iterator);
params.push("event_id="+event_id);
params.push("target="+response['target']);
params.push("response_id="+response_id);
jQuery.ajax ({
data: params.join ("&"),
response_tg: response['target'],
response_id: response_id,
out_iterator: out_iterator,
type: 'POST',
url: action=ajax_file,
dataType: 'html',
success: function (data) {
if (out_iterator === 0)
$("#event_response_window").empty();
$("#event_response_window").hide ()
.append (data)
.dialog ({
title: $('#select_custom_response option:selected').html(),
resizable: true,
draggable: true,
modal: false,
open: function(event, ui) {
$('#response_loading_dialog').hide();
$('#button-submit_event_response').show();
},
close: function(event, ui) {
$( ".chk_val" ).prop( "checked", false );
},
width: response['modal_width'],
height: response['modal_height']
})
.show ();
perform_response_massive(this.response_tg, this.response_id, this.out_iterator);
}
});
}
// Get an event response from db
function get_response(response_id) {
var ajax_file = $('#hidden-ajax_file').val();
@ -371,6 +423,42 @@ function perform_response(target, response_id) {
return false;
}
// Perform a response and put the output into a div
function perform_response_massive(target, response_id, out_iterator) {
var ajax_file = $('#hidden-ajax_file').val();
$('#re_exec_command').hide();
$('#response_loading_command_'+out_iterator).show();
$('#response_out_'+out_iterator).html('');
var finished = 0;
var time = Math.round(+new Date()/1000);
var timeout = time + 10;
var params = [];
params.push("page=include/ajax/events");
params.push("perform_event_response=1");
params.push("target="+target);
params.push("response_id="+response_id)
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action=ajax_file,
async: true,
timeout: 10000,
dataType: 'html',
success: function (data) {
var out = data.replace(/[\n|\r]/g, "<br>");
$('#response_out_'+out_iterator).html(out);
$('#response_loading_command_'+out_iterator).hide();
$('#re_exec_command_'+out_iterator).show();
}
});
return false;
}
// Change the status of an event to new, in process or validated
function event_change_status(event_ids) {
var ajax_file = $('#hidden-ajax_file').val();

View File

@ -320,8 +320,23 @@ function configure_modules_form () {
$("#text-ff_event_normal").attr ("value", (data["min_ff_event_normal"] == 0) ? 0 : data["min_ff_event_normal"]);
$("#text-ff_event_warning").attr ("value", (data["min_ff_event_warning"] == 0) ? 0 : data["min_ff_event_warning"]);
$("#text-ff_event_critical").attr ("value", (data["min_ff_event_critical"] == 0) ? 0 : data["min_ff_event_critical"]);
$("#text-post_process").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
$("#text-unit").attr("value", (data["unit"] == '') ? '' : data["unit"]);
// Shows manual input if post_process field is setted
if (data["post_process"] != 0) {
$('#post_process_manual').show();
$('#post_process_default').hide();
}
$("#text-post_process_text").attr("value", (data["post_process"] == 0) ? 0 : data["post_process"]);
// Shows manual input if unit field is setted
if (data["unit"] != '') {
$('#unit_manual').show();
$('#unit_default').hide();
}
$("#text-unit_text").attr("value", (data["unit"] == '') ? '' : data["unit"]);
$("#checkbox-critical_inverse").prop ("checked", data["critical_inverse"]);
$("#checkbox-warning_inverse").prop ("checked", data["warning_inverse"]);
$("#component_loading").hide ();

View File

@ -886,6 +886,12 @@ input.group_item_min {
input.group_item_min[disabled] {
background: #fefefe url(../../images/group_green.disabled.png) no-repeat center !important;
}
input.color_cloud_min {
background: #fefefe url(../../images/color_cloud_item.png) no-repeat center !important;
}
input.color_cloud_min[disabled] {
background: #fefefe url(../../images/color_cloud_item.disabled.png) no-repeat center !important;
}
div#cont {
position: fixed;

View File

@ -37,11 +37,8 @@ else{
"&session_id=" + session_id;
}
var page = require('webpage').create();
page.viewportSize = {
width: viewport_width,
height: viewport_height
@ -49,20 +46,26 @@ page.viewportSize = {
page.zoomFactor = 1;
page.onConsoleMessage = function(msg){
console.log(msg);
};
page.onCallback = function (st){
if(!base_64){
page.render(output_filename, {format: 'png'});
} else{
page.onError = function(msg){
console.log(msg);
page.close();
}
page.onCallback = function (st) {
if (!base_64) {
page.render(output_filename, { format: 'png' });
} else {
var base64 = page.renderBase64('png');
// do not remove this console.output
console.log(base64);
}
phantom.exit();
};
page.open(url, 'POST', post_data, function (status) {
});

View File

@ -14,6 +14,17 @@
// 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);
if (__PAN_XHPROF__ === 1) {
if (function_exists('tideways_xhprof_enable')) {
tideways_xhprof_enable();
} else {
error_log("Cannot find tideways_xhprof_enable function");
}
}
//Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
if (function_exists ('mb_internal_encoding')) {
mb_internal_encoding ("UTF-8");
@ -1277,3 +1288,8 @@ require('include/php_to_js_values.php');
*/
}
</script>
<?php
if (__PAN_XHPROF__ === 1) {
pandora_xhprof_display_result("node_index");
}
?>

View File

@ -115,8 +115,8 @@
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.729';
$build = '181211';
$version = '7.0NG.730';
$build = '190116';
$banner = "v$version Build $build";
error_reporting(0);
@ -663,14 +663,7 @@ function install_step3() {
value='".dirname (__FILE__)."'>
<tr>";
if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
echo "<td valign=top>
Drop Database if exists<br>
<input class='login' type='checkbox' name='drop' value=1>
";
} else {
echo "<td>";
}
echo "<td>";
echo "<td>URL path to Pandora FMS Console<br>
<span style='font-size: 9px'>For example '/pandora_console'</span>
</br>

View File

@ -18,6 +18,7 @@ global $config;
require_once ("include/functions_agents.php");
require_once ("include/functions_custom_graphs.php");
ui_require_javascript_file ('calendar');
if (! check_acl ($config['id_user'], $id_grupo, "AR") && ! check_acl ($config['id_user'], 0, "AW")) {
db_pandora_audit("ACL Violation",
@ -242,7 +243,7 @@ echo '</div>';
//Dialog to save the custom graph
echo "<div id='dialog_save_custom_graph' style='display: none;'>";
$table = null;
$table = new stdClass();
$table->width = '100%';
$table->style[0] = 'font-weight: bolder; text-align: right;';
$table->data[0][0] = __('Name custom graph');

View File

@ -552,7 +552,7 @@ if (is_metaconsole()) {
$filters .= html_print_table($table, true);
$filters .= "</form>";
ui_toggle($filters, __('Show Options'));
ui_toggle($filters, __('Show Options'), '', false);
}
else {
$table->colspan[3][0] = 7;
@ -778,84 +778,89 @@ $sql = 'SELECT
ORDER BY ' . $order['field'] . " " . $order['order'] . '
LIMIT '.$offset.",".$limit_sql;
if (! defined ('METACONSOLE')) {
$result = db_get_all_rows_sql ($sql);
if ($result === false) {
$result = array ();
// When you enter for the first time you have less than 4 query params in the url
$first_interaction = count($_GET) > 4;
// We do not show the modules until the user searches with the filter
if ($first_interaction) {
if (! defined ('METACONSOLE')) {
$result = db_get_all_rows_sql($sql);
if ($result === false) {
$result = array();
} else {
ui_pagination($count, false, $offset);
}
}
else
ui_pagination ($count, false, $offset);
}
else {
// For each server defined and not disabled:
$servers = db_get_all_rows_sql ('SELECT *
else {
// For each server defined and not disabled:
$servers = db_get_all_rows_sql('SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0');
if ($servers === false)
$servers = array();
$result = array();
$count_modules = 0;
foreach ($servers as $server) {
if ($servers === false)
$servers = array();
$result = array();
$count_modules = 0;
foreach ($servers as $server) {
// If connection was good then retrieve all data server
if (metaconsole_connect($server) == NOERR)
$connection = true;
else
$connection = false;
$result_server = db_get_all_rows_sql ($sql);
if (!empty($result_server)) {
if (metaconsole_connect($server) == NOERR)
$connection = true;
else
$connection = false;
$result_server = db_get_all_rows_sql($sql);
if (!empty($result_server)) {
// Create HASH login info
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd,true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&' .
'loginhash=auto&' .
'loginhash_data=' . $hashdata . '&' .
'loginhash_user=' . $user_rot13;
foreach ($result_server as $result_element_key => $result_element_value) {
$result_server[$result_element_key]['server_id'] = $server['id'];
$result_server[$result_element_key]['server_name'] = $server['server_name'];
$result_server[$result_element_key]['server_url'] = $server['server_url'].'/';
$result_server[$result_element_key]['hashdata'] = $hashdata;
$result_server[$result_element_key]['user'] = $config['id_user'];
$result_server[$result_element_key]['groups_in_server'] =
agents_get_all_groups_agent(
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd, true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user . $pwd;
$hashdata = md5($hashdata);
$url_hash = '&' .
'loginhash=auto&' .
'loginhash_data=' . $hashdata . '&' .
'loginhash_user=' . $user_rot13;
foreach ($result_server as $result_element_key => $result_element_value) {
$result_server[$result_element_key]['server_id'] = $server['id'];
$result_server[$result_element_key]['server_name'] = $server['server_name'];
$result_server[$result_element_key]['server_url'] = $server['server_url'] . '/';
$result_server[$result_element_key]['hashdata'] = $hashdata;
$result_server[$result_element_key]['user'] = $config['id_user'];
$result_server[$result_element_key]['groups_in_server'] =
agents_get_all_groups_agent(
$result_element_value['id_agent'],
$result_element_value['id_group']
);
$count_modules++;
);
$count_modules++;
}
$result = array_merge($result, $result_server);
}
$result = array_merge($result, $result_server);
metaconsole_restore_db();
}
metaconsole_restore_db();
if ($count_modules > $config['block_size']) {
ui_pagination($count_modules, false, $offset);
}
// Get number of elements of the pagination
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
}
if ($count_modules > $config['block_size']) {
ui_pagination ($count_modules, false, $offset);
}
// Get number of elements of the pagination
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
}
if (($config['dbtype'] == 'oracle') && ($result !== false)) {
@ -1391,9 +1396,14 @@ if (!empty($result)) {
}
html_print_table ($table);
} else {
if ($first_interaction) {
ui_print_info_message(array('no_close' => true, 'message' => __('This group doesn\'t have any monitor')));
} else {
ui_print_info_message(array('no_close' => true, 'message' => __('Sorry no search parameters')));
}
}
else
ui_print_info_message ( array ( 'no_close' => true, 'message' => __('This group doesn\'t have any monitor') ) );
// End Build List Result
/////////////////////////////////////

View File

@ -110,7 +110,7 @@ if (is_ajax ()) {
}
// Perform search
$agents = agents_get_group_agents($id_group,$filter,"lower",false,false,false,'|',$cluster_mode);
$agents = agents_get_group_agents($id_group,$filter,"lower",false,$recursion,false,'|',$cluster_mode);
if (empty($agents)) $agents = array();
// Add keys prefix

View File

@ -20,6 +20,8 @@ require_once ($config["homedir"] . "/include/functions_ui.php");
$sort_field = get_parameter("sort_field", "timestamp");
$sort = get_parameter("sort", "down");
$response_id = get_parameter ("response_id", "");
$table = new stdClass();
if(!isset($table->width)) {
$table->width = '100%';
@ -887,9 +889,8 @@ else {
echo '<div style="width:' . $table->width . ';" class="action-buttons">';
if (!$readonly && $show_validate_button) {
html_print_button(__('In progress selected'), 'validate_button', false, 'validate_selected(2);', 'class="sub ok"');
echo " ";
html_print_button(__('Validate selected'), 'validate_button', false, 'validate_selected(1);', 'class="sub ok"');
$array_events_actions['in_progress_selected'] = 'In progress selected';
$array_events_actions['validate_selected'] = 'Validate selected';
// Fix: validated_selected JS function has to be included with the proper user ACLs
?>
<script type="text/javascript">
@ -899,12 +900,14 @@ else {
validate_event_advanced($(this).val(), new_status);
}
});
location.reload();
}
</script>
<?php
}
if (!$readonly && ($show_delete_button)) {
html_print_button(__('Delete selected'), 'delete_button', false, 'delete_selected();', 'class="sub delete"');
$array_events_actions['delete_selected'] = 'Delete selected';
?>
<script type="text/javascript">
function delete_selected() {
@ -916,13 +919,126 @@ else {
</script>
<?php
}
echo '</div>';
echo '</form>';
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
$event_responses = db_get_all_rows_sql ($sql_event_resp);
foreach ($event_responses as $val)
$array_events_actions[$val['id']] = $val['name'];
if ($config['event_replication'] != 1) {
echo '<div style="width:100%;text-align:right;">';
echo '<form method="post" id="form_event_response">';
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
echo '&nbsp&nbsp';
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true)."</span>";
echo '</form>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#FC4444; line-height: 200%;">'.__("A maximum of 10 event custom responses can be selected").'</span>';
echo '</div>';
}
}
?>
<script type="text/javascript">
function execute_event_response(event_list_btn) {
$('#max_custom_event_resp_msg').hide();
var response_id = $('select[name=response_id]').val();
if (!isNaN(response_id)) { // It is a custom response
var response = get_response(response_id);
var counter=0;
var end=0;
// If cannot get response abort it
if (response == null) {
return;
}
var total_checked = $(".chk_val:checked").length;
// Limit number of events to apply custom responses to for performance reasons
if (total_checked > 10) {
$('#max_custom_event_resp_msg').show();
return;
}
if (event_list_btn) {
$('#button-submit_event_response').hide(function() {
$('#response_loading_dialog').show(function() {
$(".chk_val").each(function() {
if ($(this).is(":checked")) {
//var server_id = $('#hidden-server_id_'+).
event_id = $(this).val();
server_id = $('#hidden-server_id_'+event_id).val();
response['target'] = get_response_target(event_id, response_id, server_id);
if (total_checked-1 === counter) end=1;
show_massive_response_dialog(event_id, response_id, response, counter, end);
counter++;
}
});
});
});
}
else {
$('#button-btn_str').hide(function() {
$('#execute_again_loading').show(function() {
$(".chk_val").each(function() {
if ($(this).is(":checked")) {
//var server_id = $('#hidden-server_id_'+).
event_id = $(this).val();
server_id = $('#hidden-server_id_'+event_id).val();
response['target'] = get_response_target(event_id, response_id, server_id);
if (total_checked-1 === counter) end=1;
show_massive_response_dialog(event_id, response_id, response, counter, end);
counter++;
}
});
});
});
}
}
else { // It is not a custom response
switch (response_id) {
case 'in_progress_selected':
validate_selected(2);
break;
case 'validate_selected':
validate_selected(1);
break;
case 'delete_selected':
delete_selected();
break;
}
}
}
</script>
<?php
}
else {
echo '<div class="nf">' . __('No events') . '</div>';
}
echo '</div>';
}
?>
?>

View File

@ -559,6 +559,18 @@ if ($validate) {
if ($delete) {
$ids = (array) get_parameter ("validate_ids", -1);
// Discard deleting in progress events
$in_process_status = db_get_all_rows_sql("
SELECT id_evento
FROM tevento
WHERE estado=2");
foreach ($in_process_status as $val) {
if (($key = array_search($val['id_evento'], $ids)) !== false) {
unset($ids[$key]);
}
}
if ($ids[0] != -1) {
$return = events_delete_event ($ids, ($group_rep == 1), $meta);
ui_print_result_message ($return,

View File

@ -321,7 +321,7 @@ switch ($opt) {
// Last contact
$row = array();
$row[] = __('Last contact');
if ($agent["ultimo_contacto"] == "01-01-1970 00:00:00") {
if ($agent["ultimo_contacto"] == "1970-01-01 00:00:00") {
$row[] = __('Never');
}
else {
@ -332,7 +332,7 @@ switch ($opt) {
// Last remote contact
$row = array();
$row[] = __('Remote');
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
if ($agent["ultimo_contacto_remoto"] == "1970-01-01 00:00:00") {
$row[] = __('Never');
}
else {

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