Merge branch 'develop' into 2521_Crear_grupos_de_modulo_desde_la_API

Former-commit-id: c8ce459cee080644b5184d74bdea56f34ab82eaf
This commit is contained in:
samucarc 2019-01-21 11:31:36 +01:00
commit 1dbbc820ad
144 changed files with 5742 additions and 4149 deletions

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # 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, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (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 # 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 # 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 # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.729, AIX version # Version 7.0NG.730, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.729-181205 Version: 7.0NG.730-190121
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.729-181205" pandora_version="7.0NG.730-190121"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # 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, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.729'; use constant AGENT_VERSION => '7.0NG.730';
use constant AGENT_BUILD => '181205'; use constant AGENT_BUILD => '190121';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -516,11 +516,18 @@ sub parse_conf_modules($) {
log_message ('setup', "Invalid regular expression in intensive condition: $line"); 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; my $cron_text = $1;
chomp ($cron_text); 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)) { if (cron_check_syntax($cron_text)) {
$module->{'cron'} = $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*$/) { } elsif ($line =~ /^\s*module_end\s*$/) {
@ -2397,6 +2404,7 @@ sub check_module_cron {
$interval $interval
); );
my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0;
$module->{'cron_utimestamp'} = $now + $time_to_next_execution; $module->{'cron_utimestamp'} = $now + $time_to_next_execution;
$module->{'cron_interval'} = $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 # 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 # Check if current timestamp is a valid cron date
my $next_execution = cron_next_execution_date( my $next_execution = cron_next_execution_date(

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (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 # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.729} {Pandora FMS Windows Agent v7.0NG.730}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{181205} {190121}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.729(Build 181205)") #define PANDORA_VERSION ("7.0NG.730(Build 190121)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.729(Build 181205))" VALUE "ProductVersion", "(7.0NG.730(Build 190121))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.729-181205 Version: 7.0NG.730-190121
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -14,6 +14,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// 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"))) { if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"))) {
exit; exit;
} }
@ -88,4 +97,8 @@ if (file_exists ($page)) {
else { else {
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>'; 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); $info = groupview_plain_groups($info);
$counter = count($info); $counter = count($info);
$offset = get_parameter('offset', 0); $offset = get_parameter('offset', 0);
$groups_view = $is_not_paginated $agent_group_search = get_parameter('agent_group_search', '');
? $info $module_group_search = get_parameter('module_group_search', '');
: 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); $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_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_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[$value['id_mg']] = $value['name'];
} }
$array_module_group[0] = 'Nothing'; $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) { foreach ($agents_counters as $key => $value) {
$array_for_defect[$key]['gm'] = $array_module_group; $array_for_defect[$key]['gm'] = $array_module_group;
$array_for_defect[$key]['data']['name'] = $value['name']; $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, ''); 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 = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;'; $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';

View File

@ -30,7 +30,7 @@
}, },
yaxis: { yaxis: {
tickFormatter: function (value, axis) { tickFormatter: function (value, axis) {
return shortNumber(value); return shortNumber(roundToTwo(value)) ;
} }
}, },
series: { series: {
@ -178,6 +178,9 @@
return number + " " + shorts[pos]; return number + " " + shorts[pos];
} }
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}
$('#graph').change(function() { $('#graph').change(function() {
$('form#realgraph').submit(); $('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 `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; 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_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0', `dynamic_max` int(4) default '0',
`dynamic_min` 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_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0, `prediction_samples` int(4) default 0,
`prediction_threshold` 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 ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) 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` -- Table `tpolicy_modules`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
`dynamic_interval` int(4) unsigned default '0', `dynamic_interval` int(4) unsigned default '0',
`dynamic_max` int(4) default '0', `dynamic_max` int(4) default '0',
`dynamic_min` 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_sample_window` int(10) default 0,
`prediction_samples` int(4) default 0, `prediction_samples` int(4) default 0,
`prediction_threshold` 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`) UNIQUE (`id_policy`, `name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) 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` -- Table `tpolicies`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
UNIQUE (`id_policy`, `id_agent`) UNIQUE (`id_policy`, `id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) 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` -- Table `tpolicy_groups`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicy_modules_inventory` -- Table `tpolicy_modules_inventory`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tagente_datos_inventory` -- Table `tagente_datos_inventory`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`id` int(10) NOT NULL auto_increment primary key, `id` int(10) NOT NULL auto_increment primary key,
`server_name` text, `server_name` text default '',
`server_url` text, `server_url` text default '',
`dbuser` text, `dbuser` text default '',
`dbpass` text, `dbpass` text default '',
`dbhost` text, `dbhost` text default '',
`dbport` text, `dbport` text default '',
`dbname` text, `dbname` text default '',
`meta_dbuser` text,
`meta_dbpass` text,
`meta_dbhost` text,
`meta_dbport` text,
`meta_dbname` text,
`auth_token` text default '', `auth_token` text default '',
`id_group` int(10) unsigned NOT NULL default 0, `id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL, `api_password` text NOT NULL,
@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
COMMENT = 'Table to store metaconsole sources' COMMENT = 'Table to store metaconsole sources'
DEFAULT CHARSET=utf8; 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` -- 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_warning` int(10) unsigned NOT NULL default 0,
`id_template_alert_critical` 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_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`) PRIMARY KEY (`id`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor' 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`) KEY `idx_id_event_alert` (`id_event_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tevent_alert` -- Table `tevent_alert`
-- ----------------------------------------------------- -- -----------------------------------------------------
@ -744,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_names` TEXT, `module_names` TEXT,
`module_free_text` TEXT, `module_free_text` TEXT,
`each_agent` tinyint(1) default 1, `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`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) 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) -- 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: 5 - Minor
-- Criticity: 6 - Major -- 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` -- Table `tmetaconsole_event_history`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -905,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
-- Criticity: 5 - Minor -- Criticity: 5 - Minor
-- Criticity: 6 - Major -- 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` -- Table `textension_translate_string`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -957,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`agent_version` varchar(100) default '', `agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00', `ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0', `disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default '0',
`id_parent` int(10) unsigned default '0', `id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '', `custom_id` varchar(255) default '',
`server_name` varchar(100) default '', `server_name` varchar(100) default '',
`cascade_protection` tinyint(2) NOT NULL default '0', `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' , `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' , `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' , `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', `fired_count` bigint(20) NOT NULL default '0',
`update_module_count` tinyint(1) NOT NULL default '0', `update_module_count` tinyint(1) NOT NULL default '0',
`update_alert_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`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)), KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`), 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 FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) 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` -- 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 `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 `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 `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` -- 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 ''; 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` -- Table `tpolicy_module`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default ''; 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; ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmetaconsole_agent` -- 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 `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 `safe_mode_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int 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` -- 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; 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; 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` ( CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL, `name` varchar(600) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL, `id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL, `background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0, `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", `clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time", `time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid", `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`), PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) 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` -- 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 `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_version` varchar(5) NOT NULL default '1';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default ''; 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_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '', `id_status` varchar(600) default '',
`module_search` 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`) PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) 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

@ -228,11 +228,11 @@ foreach ($result as $row) {
$rowPair = !$rowPair; $rowPair = !$rowPair;
$data = array(); $data = array();
$data[0] = $row["id_usuario"]; $data[0] = io_safe_output($row["id_usuario"]);
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"]; $data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true) $data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true); . ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"]; $data[3] = io_safe_output($row["ip_origen"]);
$data[4] = io_safe_output($row["descripcion"]); $data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {

View File

@ -484,7 +484,7 @@ $table->data[4][1] = __('Disabled') . ' ' .
$table->data[4][1] .= __('Enabled') . ' ' . $table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) { 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', $table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true); $url_description, '', 45, 255, true);
}else{ }else{

View File

@ -924,9 +924,8 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente)); enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated')); ui_print_success_message (__('Successfully updated'));
$unsafe_alias = io_safe_output($alias);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Updated agent $unsafe_alias", false, false, $info); "Updated agent $alias", false, false, $info);
} }
} }
@ -1427,7 +1426,7 @@ if ($update_module) {
$edit_module = true; $edit_module = true;
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"])); "Fail to try update module '$name' for agent " . $agent["alias"]);
} }
else { else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1445,7 +1444,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values)); "Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
} }
} }
@ -1586,7 +1585,7 @@ if ($create_module) {
$edit_module = true; $edit_module = true;
$moduletype = $id_module; $moduletype = $id_module;
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"])); "Fail to try added module '$name' for agent ".$agent["alias"]);
} }
else { else {
if ($prediction_module == 3) { if ($prediction_module == 3) {
@ -1604,7 +1603,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values)); "Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
} }
} }
@ -1727,7 +1726,7 @@ if ($delete_module) { // DELETE agent module !
$agent = db_get_row ('tagente', 'id_agente', $id_agente); $agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"])); "Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
} }
@ -1760,11 +1759,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) { if ($result) {
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result); "Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
} }
else { else {
db_pandora_audit("Agent management", db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"])); "Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
} }
} }

View File

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

View File

@ -249,29 +249,33 @@ else {
$idModuleType = ''; $idModuleType = '';
} }
$sql = sprintf ('SELECT id_tipo, descripcion //Removed web analysis and log4x from select
$sql = sprintf (
'SELECT id_tipo, descripcion, nombre
FROM ttipo_modulo FROM ttipo_modulo
WHERE categoria IN (%s) WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
ORDER BY descripcion', ORDER BY descripcion',
implode (',', $categories)); 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));
$type_names = db_get_all_rows_sql($sql); $type_names = db_get_all_rows_sql($sql);
$type_names_hash = array(); $type_names_hash = array();
foreach ($type_names as $tn) { $type_description_hash = array();
$type_names_hash[$tn['id_tipo']] = $tn['nombre']; 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); $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][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
$table_advanced->data[2][4] = $table_advanced->data[2][4] =
html_print_extended_select_for_post_process('post_process', html_print_extended_select_for_post_process('post_process',
$post_process, '', '', '0', false, true, false, true, $post_process, '', '', '0', false, true, false, false,
$disabledBecauseInPolicy); $disabledBecauseInPolicy);
$table_advanced->colspan[2][4] = 3; $table_advanced->colspan[2][4] = 3;

View File

@ -65,6 +65,8 @@ if (! $id_agente) {
$params['selectbox_id'] = 'id_agent_module'; $params['selectbox_id'] = 'id_agent_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['metaconsole_enabled'] = false; $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); $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); $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">'; echo '<form class="add_alert_form" method="post">';
html_print_table ($table); html_print_table ($table);
} }
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
if (!isset($step) || $step!=5) { if (!isset($step)) {
if($id_cluster){ 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')."'>"; 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_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
html_print_input_hidden ('create_alert', 1); html_print_input_hidden ('create_alert', 1);
echo '</div></form>'; echo '</div></form>';
@ -223,7 +223,7 @@ $(document).ready (function () {
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>"); $("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
} }
else { else {
$("#value", $value).append (parseInt(data)); $("#value", $value).append (data);
} }
$loading.hide (); $loading.hide ();
$value.show (); $value.show ();

View File

@ -16,6 +16,8 @@
global $config; global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login (); check_login ();
if (! check_acl($config['id_user'], 0, "PM")) { if (! check_acl($config['id_user'], 0, "PM")) {

View File

@ -48,7 +48,7 @@ if ($create_profiles) {
// If the profile doesnt exist, we create it // If the profile doesnt exist, we create it
if ($profile_data === false) { if ($profile_data === false) {
db_pandora_audit("User management", db_pandora_audit("User management",
"Added profile for user ".io_safe_output($user)); "Added profile for user ".io_safe_input($user));
$return = profile_create_user_profile ($user, $profile, $group); $return = profile_create_user_profile ($user, $profile, $group);
if ($return !== false) { if ($return !== false) {
$n_added ++; $n_added ++;

View File

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

View File

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

View File

@ -32,6 +32,7 @@ enterprise_include ('godmode/massive/massive_operations.php');
$tab = (string) get_parameter ('tab', 'massive_agents'); $tab = (string) get_parameter ('tab', 'massive_agents');
$option = (string) get_parameter ('option', ''); $option = (string) get_parameter ('option', '');
$options_alerts = array( $options_alerts = array(
'add_alerts' => __('Bulk alert add'), 'add_alerts' => __('Bulk alert add'),
'delete_alerts' => __('Bulk alert delete'), 'delete_alerts' => __('Bulk alert delete'),
@ -224,6 +225,11 @@ if ((get_cfg_var("max_execution_time") != 0)
echo '</div>'; 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 // Catch all submit operations in this view to display Wait banner
$submit_action = get_parameter('go'); $submit_action = get_parameter('go');
$submit_update = get_parameter('updbutton'); $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_users"]["text"] = __('Users operations');
} }
$sub2["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts 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('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu'); enterprise_hook('massivesatellite_submenu');

View File

@ -60,8 +60,6 @@ if ($edit_graph) {
$stacked = $graphInTgraph['stacked']; $stacked = $graphInTgraph['stacked'];
$period = $graphInTgraph['period']; $period = $graphInTgraph['period'];
$id_group = $graphInTgraph['id_group']; $id_group = $graphInTgraph['id_group'];
$width = $graphInTgraph['width'];
$height = $graphInTgraph['height'];
$check = false; $check = false;
$percentil = $graphInTgraph['percentil']; $percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series']; $summatory_series = $graphInTgraph['summatory_series'];
@ -78,8 +76,6 @@ else {
$id_agent = 0; $id_agent = 0;
$id_module = 0; $id_module = 0;
$id_group = 0; $id_group = 0;
$width = 550;
$height = 210;
$period = SECONDS_1DAY; $period = SECONDS_1DAY;
$factor = 1; $factor = 1;
$stacked = 4; $stacked = 4;
@ -136,15 +132,6 @@ if ($stacked == CUSTOM_GRAPH_GAUGE)
$hidden = ' style="display:none;" '; $hidden = ' style="display:none;" ';
else else
$hidden = ''; $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 "<tr>";
echo "<td class='datos'>"; echo "<td class='datos'>";

View File

@ -81,8 +81,6 @@ if ($add_graph) {
$description = get_parameter_post ("description"); $description = get_parameter_post ("description");
$module_number = get_parameter_post ("module_number"); $module_number = get_parameter_post ("module_number");
$idGroup = get_parameter_post ('graph_id_group'); $idGroup = get_parameter_post ('graph_id_group');
$width = get_parameter_post ("width");
$height = get_parameter_post ("height");
$stacked = get_parameter ("stacked", 0); $stacked = get_parameter ("stacked", 0);
$period = get_parameter_post ("period"); $period = get_parameter_post ("period");
$threshold = get_parameter('threshold'); $threshold = get_parameter('threshold');
@ -102,8 +100,6 @@ if ($add_graph) {
'name' => $name, 'name' => $name,
'description' => $description, 'description' => $description,
'period' => $period, 'period' => $period,
'width' => $width,
'height' => $height,
'private' => 0, 'private' => 0,
'id_group' => $idGroup, 'id_group' => $idGroup,
'stacked' => $stacked, 'stacked' => $stacked,
@ -134,8 +130,6 @@ if ($update_graph) {
$name = get_parameter('name'); $name = get_parameter('name');
$id_group = get_parameter('graph_id_group'); $id_group = get_parameter('graph_id_group');
$description = get_parameter('description'); $description = get_parameter('description');
$width = get_parameter('width');
$height = get_parameter('height');
$period = get_parameter('period'); $period = get_parameter('period');
$stacked = get_parameter('stacked'); $stacked = get_parameter('stacked');
$percentil = get_parameter('percentil'); $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'; WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
} }
$all_agent_log = db_get_all_rows_sql($sql_log_report); $all_agent_log = db_get_all_rows_sql($sql_log_report);
foreach ($all_agent_log as $key => $value) { if(isset($all_agent_log) && is_array($all_agent_log)){
$agents2[$value['id_agente']] = $value['alias']; foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias'];
}
} }
if ((empty($agents2)) || $agents2 == -1) $agents = array(); if ((empty($agents2)) || $agents2 == -1) $agents = array();
$agents_select = array(); $agents_select = array();
if (is_array($id_agents) || is_object($id_agents)){ if (is_array($id_agents) || is_object($id_agents)){
foreach ($id_agents as $id) { foreach ($id_agents as $id) {

View File

@ -119,7 +119,9 @@ if ($schedule_report != '') {
$time = date(TIME_FORMAT); $time = date(TIME_FORMAT);
$parameters[0] = get_parameter('id_schedule_report'); $parameters[0] = get_parameter('id_schedule_report');
//$parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_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); $parameters['first_execution'] = strtotime ($date.' '.$time);
$values = array( $values = array(

View File

@ -145,7 +145,9 @@ function visual_map_main() {
} }
}); });
bindColorRangeEvents();
draw_lines(lines, 'background', true); draw_lines(lines, 'background', true);
draw_user_lines("", 0, 0, 0 , 0, 0, true); draw_user_lines("", 0, 0, 0 , 0, 0, true);
@ -742,8 +744,10 @@ function readFields() {
var text = tinymce.get('text-label').getContent(); var text = tinymce.get('text-label').getContent();
values['label'] = text; values['label'] = text;
if ($("input[name=percentile_label]").val().length > 0) if ($("input[name=percentile_label]").val().length > 0) {
values['label'] = $("input[name=percentile_label]").val(); values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
values['label'] = "<span style='color:"+values['percentile_label_color']+";'>" + $("input[name=percentile_label]").val() + "</span>";
}
values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height'); values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
values['type_graph'] = $("select[name=type_graph]").val(); values['type_graph'] = $("select[name=type_graph]").val();
@ -784,7 +788,6 @@ function readFields() {
values['event_max_time_row'] = $("select[name=event_max_time_row]").val(); values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
values['type_percentile'] = $("select[name=type_percentile]").val(); values['type_percentile'] = $("select[name=type_percentile]").val();
values['percentile_color'] = $("input[name=percentile_color]").val(); values['percentile_color'] = $("input[name=percentile_color]").val();
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
values['percentile_label'] = $("input[name=percentile_label]").val(); values['percentile_label'] = $("input[name=percentile_label]").val();
values['value_show'] = $("select[name=value_show]").val(); values['value_show'] = $("select[name=value_show]").val();
@ -812,6 +815,25 @@ function readFields() {
values['clock_animation'] = $("select[name=clock_animation]").val(); values['clock_animation'] = $("select[name=clock_animation]").val();
values['show_last_value'] = $("select[name=last_value]").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()) { if (is_metaconsole()) {
values['metaconsole'] = 1; values['metaconsole'] = 1;
values['id_agent'] = $("#hidden-agent").val(); values['id_agent'] = $("#hidden-agent").val();
@ -1178,6 +1200,7 @@ function toggle_item_palette() {
activeToolboxButton('line_item', true); activeToolboxButton('line_item', true);
activeToolboxButton('auto_sla_graph', true); activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true); activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
if (typeof(enterprise_activeToolboxButton) == 'function') { if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true); enterprise_activeToolboxButton(true);
@ -1208,6 +1231,7 @@ function toggle_item_palette() {
activeToolboxButton('group_item', false); activeToolboxButton('group_item', false);
activeToolboxButton('box_item', false); activeToolboxButton('box_item', false);
activeToolboxButton('line_item', false); activeToolboxButton('line_item', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false); activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false); activeToolboxButton('edit_item', false);
@ -1614,6 +1638,26 @@ function loadFieldsFromDB(item) {
.css('background-color', val); .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); $('#count_items').html(1);
@ -1895,6 +1939,14 @@ function hiddenFields(item) {
$("#line_case").css('display', 'none'); $("#line_case").css('display', 'none');
$("#line_case." + item).css('display', ''); $("#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'); $("input[name='radio_choice']").trigger('change');
if (typeof(enterprise_hiddenFields) == 'function') { if (typeof(enterprise_hiddenFields) == 'function') {
@ -1948,6 +2000,13 @@ function cleanFields(item) {
$("select[name='timezone']").val('Europe/Madrid'); $("select[name='timezone']").val('Europe/Madrid');
$("select[name='clock_animation']").val('analogic_1'); $("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(); $("#preview").empty();
@ -2716,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) { function get_image_url(img_src) {
var img_url= null; var img_url= null;
var parameter = Array(); var parameter = Array();
@ -2764,9 +2860,6 @@ function set_color_line_status(lines, id_data, values) {
} }
function createItem(type, values, id_data) { function createItem(type, values, id_data) {
var sizeStyle = ''; var sizeStyle = '';
var imageSize = ''; var imageSize = '';
@ -2774,7 +2867,6 @@ function createItem(type, values, id_data) {
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
switch (type) { switch (type) {
case 'box_item': case 'box_item':
@ -3585,6 +3677,15 @@ function createItem(type, values, id_data) {
var image = values['image'] + ".png"; var image = values['image'] + ".png";
set_image("image", id_data, image); set_image("image", id_data, image);
break; 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: default:
//Maybe create in any Enterprise item. //Maybe create in any Enterprise item.
if (typeof(enterprise_createItem) == 'function') { if (typeof(enterprise_createItem) == 'function') {
@ -3673,9 +3774,10 @@ function insertDB(type, values) {
success: function (data) { success: function (data) {
if (data['correct']) { if (data['correct']) {
id = data['id_data']; id = data['id_data'];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ var image_to_show = $('#preview > img')[0];
values['naturalWidth'] = $('#preview > img')[0].naturalWidth; if((type === 'group_item') || (type === 'icon') || (type === 'static_graph' && typeof(image_to_show) !== 'undefined')){
values['naturalHeight'] = $('#preview > img')[0].naturalHeight; values['naturalWidth'] = image_to_show.naturalWidth;
values['naturalHeight'] = image_to_show.naturalHeight;
} }
createItem(type, values, id); createItem(type, values, id);
addItemSelectParents(id, data['text']); addItemSelectParents(id, data['text']);
@ -3820,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; break;
case 'background': case 'background':
if(values['width'] == '0' || values['height'] == '0'){ if(values['width'] == '0' || values['height'] == '0'){
@ -4275,6 +4387,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); 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')) { if ($(divParent).hasClass('handler_start')) {
idItem = $(divParent).attr('id') idItem = $(divParent).attr('id')
.replace("handler_start_", ""); .replace("handler_start_", "");
@ -4462,6 +4583,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('clock')) { if ($(event.target).hasClass('clock')) {
selectedItem = 'clock'; selectedItem = 'clock';
} }
if ($(event.target).hasClass('color_cloud')) {
selectedItem = 'color_cloud';
}
if ($(event.target).hasClass('handler_start')) { if ($(event.target).hasClass('handler_start')) {
selectedItem = 'handler_start'; selectedItem = 'handler_start';
} }
@ -4800,6 +4924,10 @@ function click_button_toolbox(id) {
toolbuttonActive = creationItem = 'line_item'; toolbuttonActive = creationItem = 'line_item';
toggle_item_palette(); toggle_item_palette();
break; break;
case 'color_cloud':
toolbuttonActive = creationItem = 'color_cloud';
toggle_item_palette();
break;
case 'copy_item': case 'copy_item':
click_copy_item_callback(); click_copy_item_callback();
break; break;
@ -4834,6 +4962,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', false); activeToolboxButton('group_item', false);
activeToolboxButton('auto_sla_graph', false); activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('donut_graph', false); activeToolboxButton('donut_graph', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false); activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false); activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false); activeToolboxButton('delete_item', false);
@ -4867,6 +4996,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', true); activeToolboxButton('group_item', true);
activeToolboxButton('auto_sla_graph', true); activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true); activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
} }
break; break;
case 'save_visualmap': case 'save_visualmap':
@ -4946,6 +5076,9 @@ function showPreviewStaticGraph(staticGraph) {
$spinner.prop("src", "../../images/spinner.gif"); $spinner.prop("src", "../../images/spinner.gif");
} }
// If no image configured do not show anything
if (staticGraph === null) return;
$("#preview") $("#preview")
.empty() .empty()
.css('text-align', 'right') .css('text-align', 'right')
@ -5213,3 +5346,99 @@ function onLinkedMapStatusCalculationTypeChange (event) {
var value = event.target.value || "default"; var value = event.target.value || "default";
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value); 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, html_print_image('images/line_item.png', true,
array('title' => __('Line'))); array('title' => __('Line')));
break; break;
case COLOR_CLOUD:
$table->data[$i + 1]['icon'] =
html_print_image('images/color_cloud_item.png', true,
array('title' => __('Color cloud')));
break;
default: default:
if (enterprise_installed()) { if (enterprise_installed()) {
$table->data[$i + 1]['icon'] = $table->data[$i + 1]['icon'] =
@ -259,6 +264,11 @@ foreach ($layoutDatas as $layoutData) {
// hasn't the width and height. // hasn't the width and height.
$table->data[$i + 1][2] = ''; $table->data[$i + 1][2] = '';
break; 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: default:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) . $table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
' x ' . ' x ' .
@ -284,6 +294,7 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) { switch ($layoutData['type']) {
case BOX_ITEM: case BOX_ITEM:
case LINE_ITEM: case LINE_ITEM:
case COLOR_CLOUD:
$table->data[$i + 1][4] = ""; $table->data[$i + 1][4] = "";
break; break;
default: default:
@ -485,6 +496,7 @@ foreach ($layoutDatas as $layoutData) {
case LINE_ITEM: case LINE_ITEM:
case BOX_ITEM: case BOX_ITEM:
case AUTO_SLA_GRAPH: case AUTO_SLA_GRAPH:
case COLOR_CLOUD:
$table->data[$i + 2][4] = ""; $table->data[$i + 2][4] = "";
break; break;
default: default:

View File

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

View File

@ -242,7 +242,7 @@ if ($create_user) {
} }
db_pandora_audit("User management", db_pandora_audit("User management",
"Created user ".io_safe_output($id), false, false, $info); "Created user ".io_safe_input($id), false, false, $info);
ui_print_result_message ($result, ui_print_result_message ($result,
__('Successfully created'), __('Successfully created'),
@ -392,7 +392,7 @@ if ($update_user) {
} }
db_pandora_audit("User management", "Updated user ".io_safe_output($id), db_pandora_audit("User management", "Updated user ".io_safe_input($id),
false, false, $info); false, false, $info);
ui_print_result_message ($res1, ui_print_result_message ($res1,
@ -450,7 +450,7 @@ if ($add_profile) {
$tags = implode(',', $tags); $tags = implode(',', $tags);
db_pandora_audit("User management", db_pandora_audit("User management",
"Added profile for user ".io_safe_output($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags); "Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy); $return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
ui_print_result_message ($return, ui_print_result_message ($return,
__('Profile added successfully'), __('Profile added successfully'),
@ -466,7 +466,7 @@ if ($delete_profile) {
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil); $perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
db_pandora_audit("User management", db_pandora_audit("User management",
"Deleted profile for user ".io_safe_output($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']); "Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
$return = profile_delete_user_profile ($id2, $id_up); $return = profile_delete_user_profile ($id2, $id_up);
ui_print_result_message ($return, ui_print_result_message ($return,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -73,6 +73,7 @@ if($build_table_custom_fields){
id_server int(10), id_server int(10),
id_agent int(10), id_agent int(10),
name_custom_fields varchar(2048), name_custom_fields varchar(2048),
`status` int(2),
KEY `data_index_temp_1` (`id_server`, `id_agent`) KEY `data_index_temp_1` (`id_server`, `id_agent`)
)"; )";
db_process_sql($table_temporary); db_process_sql($table_temporary);
@ -80,7 +81,7 @@ if($build_table_custom_fields){
//insert values array in table temporary //insert values array in table temporary
$values_insert = array(); $values_insert = array();
foreach ($indexed_descriptions as $key => $value) { foreach ($indexed_descriptions as $key => $value) {
$values_insert[] = "(".$value['id_server'].", ".$value['id_agente'].", '".$value['description']."')"; $values_insert[] = "(".$value['id_server'].", ".$value['id_agente'].", '".$value['description']."', ".$value['status'].")";
} }
$values_insert_implode = implode(",", $values_insert); $values_insert_implode = implode(",", $values_insert);
$query_insert ="INSERT INTO temp_custom_fields VALUES ". $values_insert_implode; $query_insert ="INSERT INTO temp_custom_fields VALUES ". $values_insert_implode;
@ -104,25 +105,7 @@ if($build_table_custom_fields){
tma.direccion, tma.direccion,
tma.server_name, tma.server_name,
temp.name_custom_fields, temp.name_custom_fields,
(CASE temp.status
WHEN tma.critical_count > 0
THEN 1
WHEN tma.critical_count = 0
AND tma.warning_count > 0
THEN 2
WHEN tma.critical_count = 0
AND tma.warning_count = 0
AND tma.unknown_count > 0
THEN 3
WHEN tma.critical_count = 0
AND tma.warning_count = 0
AND tma.unknown_count = 0
AND tma.notinit_count <> tma.total_count
THEN 0
WHEN tma.total_count = tma.notinit_count
THEN 5
ELSE 0
END) AS `status`
FROM tmetaconsole_agent tma FROM tmetaconsole_agent tma
INNER JOIN temp_custom_fields temp INNER JOIN temp_custom_fields temp
ON temp.id_agent = tma.id_tagente ON temp.id_agent = tma.id_tagente
@ -413,7 +396,10 @@ if($build_table_child_custom_fields){
} }
} }
$status_agent = agents_get_status($id_agent, true); //status agents from tagente
$sql_info_agents = "SELECT * fROM tagente WHERE id_agente =" . $id_agent;
$info_agents = db_get_row_sql($sql_info_agents);
$status_agent = agents_get_status_from_counts($info_agents);
if (is_metaconsole()) { if (is_metaconsole()) {
metaconsole_restore_db(); metaconsole_restore_db();
@ -484,21 +470,23 @@ if($append_tab_filter){
$table->id = 'save_filter_form'; $table->id = 'save_filter_form';
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox'; $table->class = 'databox';
$table->rowspan = array();
if($filters['id'] == 'extended_create_filter'){ if($filters['id'] == 'extended_create_filter'){
echo "<div id='msg_error_create'></div>"; echo "<div id='msg_error_create'></div>";
$table->data[0][0] = __('Filter name'); $table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true); $table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true);
$table->data[0][2] = __('Group'); $table->data[1][0] = __('Group');
$table->data[0][3] = html_print_select_groups( $table->data[1][1] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_cr', $config['id_user'], 'AR', true, 'group_search_cr',
0, '', '', '0', true, false, 0, '', '', '0', true, false,
false, '', false, '', false, false, false, '', false, 'width:180px;', false, false,
'id_grupo', false 'id_grupo', false
); );
$table->data[0][4] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true); $table->rowspan[0][2] = 2;
$table->data[0][2] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
} }
else{ else{
echo "<div id='msg_error_update'></div>"; echo "<div id='msg_error_update'></div>";
@ -516,7 +504,7 @@ if($append_tab_filter){
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_up', $config['id_user'], 'AR', true, 'group_search_up',
$group, '', '', '0', true, false, $group, '', '', '0', true, false,
false, '', false, '', false, false, false, '', false, 'width:180px;', false, false,
'id_grupo', false 'id_grupo', false
); );

View File

@ -193,25 +193,49 @@ if ($dialogue_event_response) {
$event_id = get_parameter ('event_id'); $event_id = get_parameter ('event_id');
$response_id = get_parameter ('response_id'); $response_id = get_parameter ('response_id');
$command = get_parameter ('target'); $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_response = db_get_row('tevent_response','id',$response_id);
$event = db_get_row('tevento','id_evento',$event_id); $event = db_get_row('tevento','id_evento',$event_id);
$prompt = "<br>> "; $prompt = "<br>> ";
switch($event_response['type']) { switch($event_response['type']) {
case 'command': 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>"; if ($massive) {
echo "<br><div id='response_out' style='text-align:left'></div>"; echo "<div style='text-align:left'>";
echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s',$command));
echo "<br><div id='re_exec_command' style='display:none;'>"; echo "</div><br>";
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
echo "</div>"; 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; break;
case 'url': case 'url':
$command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command); $command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command);

View File

@ -15,9 +15,7 @@
// Login check // Login check
global $config; global $config;
check_login (); check_login();
$get_image_path_status = get_parameter('get_image_path_status', 0); $get_image_path_status = get_parameter('get_image_path_status', 0);
if ($get_image_path_status){ if ($get_image_path_status){
@ -165,6 +163,12 @@ $timezone = get_parameter('timezone', 'Europe/Madrid');
$show_last_value = get_parameter('show_last_value', null); $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) { switch ($action) {
case 'get_font': case 'get_font':
$return = array(); $return = array();
@ -538,7 +542,10 @@ switch ($action) {
echo json_encode($return); echo json_encode($return);
break; 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 'update':
case 'move': case 'move':
@ -835,6 +842,36 @@ switch ($action) {
$values['fill_color'] = $fill_color; $values['fill_color'] = $fill_color;
} }
break; 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: default:
if (enterprise_installed()) { if (enterprise_installed()) {
if ($image !== null) { if ($image !== null) {
@ -896,6 +933,12 @@ switch ($action) {
unset($values['width']); unset($values['width']);
unset($values['height']); unset($values['height']);
break; break;
case 'color_cloud':
unset($values['width']);
unset($values['height']);
unset($values['diameter']);
unset($values['label']);
break;
// -- line_item -- // -- line_item --
case 'handler_start': case 'handler_start':
case 'handler_end': case 'handler_end':
@ -952,6 +995,7 @@ switch ($action) {
case 'clock': case 'clock':
case 'auto_sla_graph': case 'auto_sla_graph':
case 'donut_graph': case 'donut_graph':
case 'color_cloud':
$elementFields = db_get_row_filter('tlayout_data', $elementFields = db_get_row_filter('tlayout_data',
array('id' => $id_element)); array('id' => $id_element));
@ -1092,6 +1136,16 @@ switch ($action) {
$elementFields['fill_color'] = $elementFields['fill_color']; $elementFields['fill_color'] = $elementFields['fill_color'];
break; 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 -- // -- line_item --
case 'handler_start': case 'handler_start':
case 'handler_end': case 'handler_end':
@ -1347,6 +1401,37 @@ switch ($action) {
$values['width'] = $width; $values['width'] = $width;
$values['height'] = $height; $values['height'] = $height;
break; 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: default:
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_ajax_insert_fill_values_insert($type, $values); 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); $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['left'] = $values['pos_x'];
$values['top'] = $values['pos_y']; $values['top'] = $values['pos_y'];
$values['parent'] = $values['parent_item']; $values['parent'] = $values['parent_item'];
@ -1423,9 +1507,22 @@ switch ($action) {
$return['values']['type_percentile'] = 'percentile'; $return['values']['type_percentile'] = 'percentile';
break; 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); echo json_encode($return);
break; break;

View File

@ -269,32 +269,8 @@ function process_user_login_remote ($login, $pass, $api = false) {
else { else {
delete_user_pass_ldap ($login); delete_user_pass_ldap ($login);
} }
$permissions = array(); $permissions = fill_permissions_ldap($sr);
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'];
}
if(empty($permissions)) { if(empty($permissions)) {
$config["auth_error"] = __("User not found in database or incorrect password"); $config["auth_error"] = __("User not found in database or incorrect password");
return false; return false;
@ -388,33 +364,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
} }
} }
$permissions = array(); $permissions = fill_permissions_ldap($sr);
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'];
}
if(empty($permissions)) { if(empty($permissions)) {
$config["auth_error"] = __("User not found in database or incorrect password"); $config["auth_error"] = __("User not found in database or incorrect password");
return false; return false;
@ -904,10 +854,11 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
$id_profile = $permission["profile"]; $id_profile = $permission["profile"];
$id_groups = $permission["groups"]; $id_groups = $permission["groups"];
$tags = $permission["tags"]; $tags = $permission["tags"];
$no_hierarchy = (bool)$permission["no_hierarchy"] ? 1 : 0;
foreach ($id_groups as $id_group) { foreach ($id_groups as $id_group) {
$profile = profile_create_user_profile( $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 ) { 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); db_process_sql_insert ("tusuario", $values);
foreach ($id_groups as $id_group) { foreach ($id_groups as $id_group) {
$profile = profile_create_user_profile ($id_user, $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 * Update local user pass from ldap user
* *

View File

@ -63,7 +63,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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> <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/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/jquery-ui.min.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> <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> <script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
</head> </head>
<body bgcolor="#ffffff" style='background:#ffffff;'> <body bgcolor="#ffffff" style='background:#ffffff;'>
<?php <?php
$params['only_image'] = false;
$params['only_image'] = false;
$params['width'] = (int) $_REQUEST['viewport_width']; $params['width'] = (int) $_REQUEST['viewport_width'];
$params['menu'] = false; $params['menu'] = false;
@ -214,17 +213,19 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
echo '</div>'; echo '</div>';
$config['font_size'] = $aux_font_size; $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> </body>
</html> </html>

View File

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

View File

@ -204,6 +204,7 @@ define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16);
define('DONUT_GRAPH', 17); define('DONUT_GRAPH', 17);
define('BARS_GRAPH', 18); define('BARS_GRAPH', 18);
define('CLOCK', 19); define('CLOCK', 19);
define('COLOR_CLOUD', 20);
//Some styles //Some styles
define('MIN_WIDTH', 300); define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120); 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){ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = false, $module_list = false){
global $config; global $config;
if(is_metaconsole()){
$hack_metaconsole = "../..";
}
else{
$hack_metaconsole = "";
}
$file_js = $config["homedir"] . "/include/web2image.js"; $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_file = "img_". uniqid() .".png";
$img_path = $config["homedir"] . "/attachment/" . $img_file; $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; $width_img = 500;
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280; $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 . '"' . ' "' . $session_id . '"'
. ' "' . $params['return_img_base_64'] . '"'; . ' "' . $params['return_img_base_64'] . '"';
exec($cmd, $result); $result = null;
$retcode = null;
exec($cmd, $result, $retcode);
$img_content = join("\n", $result); $img_content = join("\n", $result);
if($params['return_img_base_64']){ if($params['return_img_base_64']){
@ -3389,5 +3400,39 @@ function validate_csrf_code() {
function generate_hash_to_api(){ function generate_hash_to_api(){
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key')); 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(); $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 $id_group = $id_group == 0
? array_keys(users_get_groups(false, "AR", false)) ? array_keys(users_get_groups(false, "AR", false))
: groups_safe_acl($config["id_user"], $id_group, "AR"); : 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); $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( $id_group = array_keys(
users_get_groups(false, "AR", true, false, (array)$id_group)); 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 ON tagente.id_agente = tasg.id_agent
WHERE tagente_modulo.delete_pending = 0 WHERE tagente_modulo.delete_pending = 0
AND %s AND %s
GROUP BY tagente_modulo.id_agente_modulo GROUP BY 1
ORDER BY tagente_modulo.nombre', ORDER BY 1',
($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '', ($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '',
io_safe_output(implode (",", (array) $details)), io_safe_output(implode (",", (array) $details)),
$sql_tags_join, $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_planned_downtimes.php");
include_once($config['homedir'] . "/include/functions_db.php"); include_once($config['homedir'] . "/include/functions_db.php");
include_once($config['homedir'] . "/include/functions_event_responses.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_local_components.php');
enterprise_include_once ('include/functions_events.php'); enterprise_include_once ('include/functions_events.php');
enterprise_include_once ('include/functions_agents.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.'))); 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. * Create a new group. And return the id_group of the new group.
* *
@ -9804,6 +9862,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
return; return;
} }
$values['id_grupo'] = $other['data'][1]; $values['id_grupo'] = $other['data'][1];
if (groups_get_name($values['id_grupo']) === false) {
returnError('error_parameter', 'Group ID does not exist');
return;
}
} }
else { else {
returnError('error_parameter', 'Group ID required.'); returnError('error_parameter', 'Group ID required.');
@ -10147,7 +10210,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 //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; global $config;
$data['type'] = 'string'; $data['type'] = 'string';
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id); $check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
@ -10166,7 +10229,7 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
'ack_utimestamp' => $ack_utimestamp, 'ack_utimestamp' => $ack_utimestamp,
'estado' => 1 'estado' => 1
); );
$result = db_process_sql_update('tevento', $values, array('id_evento' => $id)); $result = db_process_sql_update('tevento', $values, array('id_evento' => $id));
if ($result === false) { if ($result === false) {
@ -11940,6 +12003,445 @@ function api_get_cluster_items ($cluster_id){
} }
} }
/**
* Create an event filter.
*
* @param string $id Name of event filter to add.
* @param $thrash1 Don't use.
* @param array $other it's array, $other as param is<id_group_filter>;<id_group>;<event_type>;
* <severity>;<event_status>;<free_search>;<agent_search_id>;<pagination_size>;<max_hours_old>;<id_user_ack>;<duplicate>;
* <date_from>;<date_to>;<events_with_tags>;<events_without_tags>;<alert_events>;<module_search_id>;<source>;
* <id_extra>;<user_comment> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
*
* example: api.php?op=set&op2=create_event_filter&id=test&other=||error|4|||1||12|||2018-12-09|2018-12-13|[%226%22]|[%2210%22,%226%22,%223%22]|1|10|||&other_mode=url_encode_separator_|
*
*
* @param $thrash3 Don't use
*/
function api_set_create_event_filter($name, $thrash1, $other, $thrash3) {
if ($name == "") {
returnError('error_create_event_filter',
__('Error creating event filter. Event filter name cannot be left blank.'));
return;
}
$event_w = check_acl ($config['id_user'], 0, "EW");
$event_m = check_acl ($config['id_user'], 0, "EM");
$access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
$event_filter_name = $name;
$user_groups = users_get_groups ($config['id_user'], "AR", true);
$id_group_filter = (array_key_exists($other['data'][0], $user_groups)) ? $other['data'][0] : 0;
$id_group = (array_key_exists($other['data'][1], $user_groups)) ? $other['data'][1] : 0;
$event_type = (array_key_exists($other['data'][2], get_event_types ()) || $other['data'][2]=='') ? $other['data'][2] : '';
$severity = (array_key_exists($other['data'][3], get_priorities()) || $other['data'][3]==-1) ? $other['data'][3] : -1;
$status = (array_key_exists($other['data'][4], events_get_all_status()) || $other['data'][4]==-1) ? $other['data'][4] : -1;
if (!is_numeric($other['data'][6]) || empty($other['data'][6])) {
$text_agent = '';
$id_agent = 0;
}
else {
$filter = array ();
if ($id_group == 0)
$filter['id_grupo'] = array_keys ($user_groups);
else
$filter['id_grupo'] = $id_group;
$filter[] = '(id_agente = '.$other["data"][6].')';
$agent = agents_get_agents($filter, array ('id_agente'));
if ($agent === false)
$text_agent = '';
else {
$sql = sprintf('SELECT alias
FROM tagente
WHERE id_agente = %d', $agent[0]['id_agente']);
$id_agent = $other["data"][6];
$text_agent = db_get_value_sql($sql);
}
}
$pagination = (in_array($other['data'][7], [20,25,50,100,200,500])) ? $other['data'][7] : 20;
$users = users_get_user_users($config['id_user'], $access, users_can_manage_group_all());
$id_user_ack = (in_array($other['data'][9], $users)) ? $other['data'][9] : 0;
$group_rep = ($other['data'][10] == 0 || $other['data'][10] == 1) ? $other['data'][10] : 0;
$date_from = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][11])) ? $other['data'][11] : '0000-00-00';
$date_to = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][12])) ? $other['data'][12] : '0000-00-00';
$tag_with = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][13]))) ? $other['data'][13] : '[]';
$tag_without = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][14]))) ? $other['data'][14] : '[]';
$filter_only_alert = (in_array($other['data'][15], [-1,0,1])) ? $other['data'][15] : -1;
if (!is_numeric($other['data'][16]) || empty($other['data'][16]))
$id_agent_module = 0;
else {
$groups = array();
$groups = users_get_groups($config['id_user'], "AW", false);
$groups = array_keys($groups);
if (empty($groups)) {
$id_groups = 0;
}
else {
$id_groups = implode(',', $groups);
}
$agents = db_get_all_rows_sql('SELECT id_agente
FROM tagente
WHERE id_grupo IN (' . $id_groups . ')');
if ($agents === false) $agents = array();
$id_agents = array();
foreach ($agents as $agent) {
$id_agents[] = $agent['id_agente'];
}
$filter = '(' . $other['data'][16] . ')';
$modules = agents_get_modules($id_agents, false,
(array('tagente_modulo.id_agente_modulo in' => $filter)));
$id_agent_module = (array_key_exists($other['data'][16], $modules)) ? $other['data'][16] : 0;
}
$values = array(
'id_group_filter' => $id_group_filter,
'id_group' => $id_group,
'event_type' => $event_type,
'severity' => $severity,
'status' => $status,
'search' => $other['data'][5],
'text_agent' => $text_agent,
'id_agent' => $id_agent,
'pagination' => $pagination,
'event_view_hr' => $other['data'][8],
'id_user_ack' => $id_user_ack,
'group_rep' => $group_rep,
'date_from' => $date_from,
'date_to' => $date_to,
'tag_with' => $tag_with,
'tag_without' => $tag_without,
'filter_only_alert' => $filter_only_alert,
'id_agent_module' => $id_agent_module,
'source' => $other['data'][17],
'id_extra' => $other['data'][18],
'user_comment' => $other['data'][19]
);
$values['id_name'] = $event_filter_name;
$id_filter = db_process_sql_insert('tevent_filter', $values);
if ($id_filter === false) {
returnError('error_create_event_filter', __('Error creating event filter.'));
}
else {
returnData('string', array('type' => 'string',
'data' => __('Event filter successfully created.')));
}
}
/**
* Update an event filter. And return a message with the result of the operation.
*
* @param string $id_event_filter Id of the event filter to update.
* @param $thrash1 Don't use.
* @param array $other it's array, $other as param is <filter_name>;<id_group>;<event_type>;
* <severity>;<event_status>;<free_search>;<agent_search_id>;<pagination_size>;<max_hours_old>;<id_user_ack>;<duplicate>;
* <date_from>;<date_to>;<events_with_tags>;<events_without_tags>;<alert_events>;<module_search_id>;<source>;
* <id_extra>;<user_comment> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
*
* example:
*
* api.php?op=set&op2=update_event_filter&id=198&other=new_name|||alert_recovered|||||||||||||||||&other_mode=url_encode_separator_%7C
*
* @param $thrash3 Don't use
*/
function api_set_update_event_filter($id_event_filter, $thrash1, $other, $thrash3) {
global $config;
if (!check_acl($config['id_user'], 0, "LM")) {
returnError('forbidden', 'string');
return;
}
if ($id_event_filter == "") {
returnError('error_update_event_filter',
__('Error updating event filter. Event filter ID cannot be left blank.'));
return;
}
$sql = "SELECT * FROM tevent_filter WHERE id_filter=$id_event_filter";
$result_event_filter = db_get_row_sql($sql);
if (!$result_event_filter) {
returnError('error_update_event_filter',
__('Error updating event filter. Event filter ID doesn\'t exist.'));
return;
}
$values = array();
for ($i=0; $i<21; $i++) {
if ($other['data'][$i] != "") {
switch ($i) {
case 0:
$values['id_name'] = $other['data'][0];
break;
case 1:
$user_groups = users_get_groups ($config['id_user'], "AR", true);
$values['id_group_filter'] = (array_key_exists($other['data'][1], $user_groups)) ? $other['data'][1] : 0;
break;
case 2:
$user_groups = users_get_groups ($config['id_user'], "AR", true);
$values['id_group'] = (array_key_exists($other['data'][2], $user_groups)) ? $other['data'][2] : 0;
break;
case 3:
$values['event_type'] = (array_key_exists($other['data'][3], get_event_types ()) || $other['data'][3]=='') ? $other['data'][3] : '';
break;
case 4:
$values['severity'] = (array_key_exists($other['data'][4], get_priorities()) || $other['data'][4]==-1) ? $other['data'][4] : -1;
break;
case 5:
$values['status'] = (array_key_exists($other['data'][5], events_get_all_status()) || $other['data'][5]==-1) ? $other['data'][5] : -1;
break;
case 6:
$values['search'] = $other['data'][6];
break;
case 7:
$user_groups = users_get_groups ($config['id_user'], "AR", true);
if (!is_numeric($other['data'][7]) || empty($other['data'][7])) {
$values['text_agent'] = '';
$values['id_agent'] = 0;
}
else {
$filter = array ();
if ($id_group == 0)
$filter['id_grupo'] = array_keys ($user_groups);
else
$filter['id_grupo'] = $id_group;
$filter[] = '(id_agente = '.$other["data"][7].')';
$agent = agents_get_agents($filter, array ('id_agente'));
if ($agent === false)
$values['text_agent'] = '';
else {
$sql = sprintf('SELECT alias
FROM tagente
WHERE id_agente = %d', $agent[0]['id_agente']);
$values['id_agent'] = $other["data"][7];
$values['text_agent'] = db_get_value_sql($sql);
}
}
break;
case 8:
$values['pagination'] = (in_array($other['data'][8], [20,25,50,100,200,500])) ? $other['data'][8] : 20;
break;
case 9:
$values['event_view_hr'] = $other['data'][9];
break;
case 10:
$event_w = check_acl ($config['id_user'], 0, "EW");
$event_m = check_acl ($config['id_user'], 0, "EM");
$access = ($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'EW');
$users = users_get_user_users($config['id_user'], $access, users_can_manage_group_all());
$values['id_user_ack'] = (in_array($other['data'][10], $users)) ? $other['data'][10] : 0;
break;
case 11:
$values['group_rep'] = ($other['data'][11] == 0 || $other['data'][11] == 1) ? $other['data'][11] : 0;
break;
case 12:
$values['date_from'] = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][12])) ? $other['data'][12] : '0000-00-00';
break;
case 13:
$values['date_to'] = (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$other['data'][13])) ? $other['data'][13] : '0000-00-00';
break;
case 14:
print_r("14444444");
$values['tag_with'] = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][14]))) ? $other['data'][14] : '[]';
break;
case 15:
print_r("1555555555");
$values['tag_without'] = (preg_match('/^\[(("\d+"((,|\])("\d+"))+)|"\d+")\]$/', io_safe_output($other['data'][15]))) ? $other['data'][15] : '[]';
break;
case 16:
$values['filter_only_alert'] = (in_array($other['data'][16], [-1,0,1])) ? $other['data'][16] : -1;
break;
case 17:
if (!is_numeric($other['data'][17]) || empty($other['data'][17]))
$values['id_agent_module'] = 0;
else {
$groups = array();
$groups = users_get_groups($config['id_user'], "AW", false);
$groups = array_keys($groups);
if (empty($groups)) {
$id_groups = 0;
}
else {
$id_groups = implode(',', $groups);
}
$agents = db_get_all_rows_sql('SELECT id_agente
FROM tagente
WHERE id_grupo IN (' . $id_groups . ')');
if ($agents === false) $agents = array();
$id_agents = array();
foreach ($agents as $agent) {
$id_agents[] = $agent['id_agente'];
}
$filter = '(' . $other['data'][17] . ')';
$modules = agents_get_modules($id_agents, false,
(array('tagente_modulo.id_agente_modulo in' => $filter)));
$values['id_agent_module'] = (array_key_exists($other['data'][17], $modules)) ? $other['data'][17] : 0;
}
break;
case 18:
$values['source'] = $other['data'][18];
break;
case 19:
$values['id_extra'] = $other['data'][19];
break;
case 20:
print_r("adadadasds");
$values['user_comment'] = $other['data'][20];
break;
}
}
}
$result = db_process_sql_update ('tevent_filter',
$values,
array ('id_filter' => $id_event_filter));
if ($result === false) {
returnError('error_update_event_filter', __('Error updating event filter.'));
}
else {
returnData('string', array('type' => 'string',
'data' => __('Event filter successfully updated.')));
}
}
/**
* Delete an event filter. And return a message with the result of the operation.
*
* @param string $id_template Id of the event filter to delete.
* @param $thrash1 Don't use.
* @param array $other Don't use
*
* example:
*
* api.php?op=set&op2=delete_event_filter&id=38
*
* @param $thrash3 Don't use
*/
function api_set_delete_event_filter($id_event_filter, $thrash1, $other, $thrash3) {
if ($id_event_filter == "") {
returnError('error_delete_event_filter',
__('Error deleting event_filter. Event filter ID cannot be left blank.'));
return;
}
$result = db_process_sql_delete ('tevent_filter',array('id_filter' => $id_event_filter));
if ($result == 0) {
returnError('error_delete_event_filter',
__('Error deleting event filter.'));
}
else {
returnData('string', array('type' => 'string',
'data' => __('Event filter successfully deleted.')));
}
}
/**
* Get all event filters, and print all the result like a csv.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, but only <csv_separator> is available.
* example:
*
* api.php?op=get&op2=all_event_filters&return_type=csv&other=;
*
* @param $thrash3 Don't use.
*/
function api_get_all_event_filters($thrash1, $thrash2, $other, $thrash3) {
global $config;
if (!isset($other['data'][0]))
$separator = ';'; // by default
else
$separator = $other['data'][0];
if (!check_acl($config["id_user"], 0, "LM")) {
returnError("forbidden", "csv");
return;
}
$filter = false;
$sql = "SELECT * FROM tevent_filter";
$event_filters = db_get_all_rows_sql($sql);
if ($event_filters !== false) {
$data['type'] = 'array';
$data['data'] = $event_filters;
}
if (!$event_filters) {
returnError('error_get_all_event_filters',
__('Error getting all event filters.'));
}
else {
returnData('csv', $data, $separator);
}
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// AUX FUNCTIONS // AUX FUNCTIONS
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
@ -11959,6 +12461,231 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
return false; return false;
} }
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
$separator = ';';
$other = json_decode(base64_decode($other['data']),true);
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
$user_info = db_get_all_rows_sql($sql);
if (count($user_info) > 0 and $user_info !== false) {
$data = array('type' => 'array', 'data' => $user_info);
returnData($returnType, $data, $separator);
}
else {
return 0;
}
}
/*
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
Parameter 0
The User ID that attempts the action is used to check the status of the application for access.
Parameter 1
Login, logout, exclude, browse.
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
Browse action: It has the same answers as login, but does not register anything in the audit.
Logout action: It records the deslogeo but does not send a response.
All other actions do not return a response,
Parameter 2
IP address of the application is also used to check the status of the application for access.
Parameter 3
Name of the application, it is also used to check the status of the application for access.
Parameter 4
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
*/
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence = db_get_all_rows_sql($sql);
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
//The user trying to log in is an administrator
if(users_is_admin($other['data'][0])){
//The admin user is trying to login
if($other['data'][1] == 'login'){
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => 'taken'));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'logout') {
// The administrator user wants to log out
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'exclude') {
// The administrator user has ejected another administrator user who was logged in
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
}
//The admin user is trying to browse
elseif ($other['data'][1] == 'browse') {
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'cancelled'){
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
}
}
else{
if($other['data'][4] == 1){
//The user trying to log in is not an administrator and is not allowed no admin access
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'denied'));
}
else{
//The user trying to log in is not an administrator and is allowed no admin access
if($other['data'][1] == 'login'){
//The user trying to login is not admin, can enter without concurrent use filter
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
elseif ($other['data'][1] == 'logout') {
//The user trying to logoff is not admin
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'browse'){
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
}
}
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
if($other['data'][4]){
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
}
if($other['data'][2]){
$sql .= ' limit '.$other['data'][2];
}
if($other['data'][3]){
$sql .= ' offset '.$other['data'][3];
}
if($other['data'][5]){
$sql .= ' and status = 0';
}
if(sizeof($other['data']) == 0){
$sql = 'SELECT * from ttrap';
}
$traps = db_get_all_rows_sql($sql);
if($other['data'][6]){
foreach ($traps as $key => $value) {
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
unset($traps[$key]);
}
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
unset($traps[$key]);
}
}
}
$traps_json = json_encode($traps);
if (count($traps) > 0 and $traps !== false) {
returnData('string', array('type' => 'string', 'data' => $traps_json));
}
else {
return 0;
}
}
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) { function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
@ -11984,117 +12711,116 @@ function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
} }
} }
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) { function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) { if (defined ('METACONSOLE')) {
return; return;
} }
if($id == 'all'){ if($id == 'all'){
$result = db_process_sql ('delete from ttrap'); $result = db_process_sql ('delete from ttrap');
} }
else{ else{
$result = db_process_sql_delete('ttrap',array('id_trap' => $id)); $result = db_process_sql_delete('ttrap',array('id_trap' => $id));
} }
if (is_error($result)) { if (is_error($result)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info
returnError('error_delete_trap', __('Error in trap delete.')); returnError('error_delete_trap', __('Error in trap delete.'));
} }
else { else {
returnData('string', returnData('string',
array('type' => 'string', array('type' => 'string',
'data' => __('Deleted traps.'))); 'data' => __('Deleted traps.')));
}
}
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT id_grupo
FROM tgrupo WHERE nombre = "'.$other['data'].'"');
$group_id = db_get_all_rows_sql($sql);
if (count($group_id) > 0 and $group_id !== false) {
$data = array('type' => 'array', 'data' => $group_id);
returnData('csv', $data, ';');
}
else {
returnError('error_group_name', 'No groups retrieved.');
}
}
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "timezone"');
$timezone = db_get_all_rows_sql($sql);
if (count($timezone) > 0 and $timezone !== false) {
$data = array('type' => 'string', 'data' => $timezone);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_timezone', 'No timezone retrieved.');
}
} }
}
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "language"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_language', 'No language retrieved.');
}
}
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "session_timeout"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_session_timeout', 'No session timeout retrieved.');
}
}
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT id_grupo
FROM tgrupo WHERE nombre = "'.$other['data'].'"');
$group_id = db_get_all_rows_sql($sql);
if (count($group_id) > 0 and $group_id !== false) {
$data = array('type' => 'array', 'data' => $group_id);
returnData('csv', $data, ';');
}
else {
returnError('error_group_name', 'No groups retrieved.');
}
}
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "timezone"');
$timezone = db_get_all_rows_sql($sql);
if (count($timezone) > 0 and $timezone !== false) {
$data = array('type' => 'string', 'data' => $timezone);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_timezone', 'No timezone retrieved.');
}
}
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "language"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_language', 'No language retrieved.');
}
}
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT value
FROM tconfig WHERE token = "session_timeout"');
$language = db_get_all_rows_sql($sql);
if (count($language) > 0 and $language !== false) {
$data = array('type' => 'string', 'data' => $language);
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
}
else {
returnError('error_session_timeout', 'No session timeout retrieved.');
}
}
?> ?>

View File

@ -312,6 +312,8 @@ function config_update_config () {
$error_update[] = __('Autocreate profile group'); $error_update[] = __('Autocreate profile group');
if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags')))) if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags'))))
$error_update[] = __('Autocreate profile 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'))) if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')))
$error_update[] = __('Autocreate blacklist'); $error_update[] = __('Autocreate blacklist');
@ -1452,7 +1454,10 @@ function config_process_config () {
if (!isset ($config['default_assign_tags'])) { if (!isset ($config['default_assign_tags'])) {
config_update_value ( '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'])) { if (!isset ($config['ldap_server'])) {
config_update_value ( 'ldap_server', 'localhost'); config_update_value ( 'ldap_server', 'localhost');
} }
@ -2027,6 +2032,14 @@ function config_process_config () {
if (!isset($config["metaconsole_deploy_collection"])) { if (!isset($config["metaconsole_deploy_collection"])) {
config_update_value('metaconsole_deploy_collection', 0); 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 */ /* Finally, check if any value was overwritten in a form */

View File

@ -193,6 +193,13 @@ function get_custom_fields_data ($custom_field_name) {
function agent_counters_custom_fields($filters){ function agent_counters_custom_fields($filters){
//filter by status agent //filter by status agent
$and_status = ""; $and_status = "";
$agent_state_normal = 0;
$agent_state_critical = 0;
$agent_state_warning = 0;
$agent_state_unknown = 0;
$agent_state_notinit = 0;
$agent_state_total = 0;
if(is_array($filters['id_status'])){ if(is_array($filters['id_status'])){
if(!in_array(-1, $filters['id_status'])){ if(!in_array(-1, $filters['id_status'])){
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['id_status'])){ if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['id_status'])){
@ -200,34 +207,34 @@ function agent_counters_custom_fields($filters){
$and_status = " AND ( "; $and_status = " AND ( ";
foreach ($filters['id_status'] as $key => $value) { foreach ($filters['id_status'] as $key => $value) {
$and_status .= ($key != 0) $and_status .= ($key != 0)
? " OR (" ? " OR "
: " ("; : " ";
switch ($value) { switch ($value) {
default: default:
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
$and_status .= " ta.critical_count = 0 $agent_state_normal = agents_get_status_clause(AGENT_STATUS_NORMAL);
AND ta.warning_count = 0 $and_status .= agents_get_status_clause(AGENT_STATUS_NORMAL);
AND ta.unknown_count = 0
AND ta.total_count <> ta.notinit_count ) ";
break; break;
case AGENT_STATUS_CRITICAL: case AGENT_STATUS_CRITICAL:
$and_status .= " ta.critical_count > 0 ) "; $and_status .= agents_get_status_clause(AGENT_STATUS_CRITICAL);
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
break; break;
case AGENT_STATUS_WARNING: case AGENT_STATUS_WARNING:
$and_status .= " ta.critical_count = 0 $and_status .= agents_get_status_clause(AGENT_STATUS_WARNING);
AND ta.warning_count > 0 ) "; $agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
break; break;
case AGENT_STATUS_UNKNOWN: case AGENT_STATUS_UNKNOWN:
$and_status .= " ta.critical_count = 0 $and_status .= agents_get_status_clause(AGENT_STATUS_UNKNOWN);
AND ta.warning_count = 0 $agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
AND ta.unknown_count > 0 ) ";
break; break;
case AGENT_STATUS_NOT_INIT: case AGENT_STATUS_NOT_INIT:
$and_status .= " ta.total_count = ta.notinit_count ) "; $and_status .= agents_get_status_clause(AGENT_STATUS_NOT_INIT);
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
break; break;
} }
} }
$and_status .= " ) "; $and_status .= " ) ";
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
} }
} }
else{ else{
@ -237,14 +244,45 @@ function agent_counters_custom_fields($filters){
OR ( ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0 ) OR ( ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0 )
OR ( ta.total_count = ta.notinit_count ) OR ( ta.total_count = ta.notinit_count )
) "; ) ";
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
$agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
$agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
} }
} }
else{
$agent_state_normal = agents_get_status_clause(AGENT_STATUS_NORMAL);
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
$agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
$agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
}
} }
//filter by status module //filter by status module
$empty_agents_count = "UNION ALL
SELECT ta.id_agente,
0 AS c_m_total,
0 AS mm_normal,
0 AS mm_critical,
0 AS mm_warning,
0 AS mm_unknown,
0 AS mm_not_init,
0 AS mm_total
FROM tagente ta
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE ta.disabled = 0
AND ta.total_count = 0
$groups_and";
$and_module_status = ""; $and_module_status = "";
if(is_array($filters['module_status'])){ if(is_array($filters['module_status'])){
if(!in_array(-1, $filters['module_status'])){ if(!in_array(-1, $filters['module_status'])){
$empty_agents_count = "";
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['module_status'])){ if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['module_status'])){
if(count($filters['module_status']) > 0){ if(count($filters['module_status']) > 0){
$and_module_status = " AND ( "; $and_module_status = " AND ( ";
@ -277,25 +315,15 @@ function agent_counters_custom_fields($filters){
else{ else{
//not normal //not normal
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 "; $and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
$empty_agents_count = "";
} }
} }
} }
//filters module //filters module
if($filters['module_search']){ if($filters['module_search']){
$and_module_search = 'AND nombre LIKE "%' . $filters['module_search'] . '%"'; $and_module_search = 'AND tam.nombre LIKE "%' . $filters['module_search'] . '%"';
} $empty_agents_count = "";
$module_filter = "";
if($and_module_search != '' || $and_module_status != ''){
$module_filter = ' AND (
SELECT count(*) AS n
FROM tagente_modulo tam
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo
WHERE tam.id_agente=ta.id_agente
'. $and_module_search . ' ' . $and_module_status .'
) > 0 ';
} }
//filter group and check ACL groups //filter group and check ACL groups
@ -359,42 +387,63 @@ function agent_counters_custom_fields($filters){
// Establishes connection // Establishes connection
if (metaconsole_load_external_db ($server_data) !== NOERR) continue; if (metaconsole_load_external_db ($server_data) !== NOERR) continue;
$query = sprintf("SELECT $query = sprintf(
tcd.description as name_data, "SELECT tcd.description AS name_data,
SUM(ta.normal_count) AS m_normal, SUM(IF($agent_state_total, 1, 0)) AS a_agents,
SUM(ta.critical_count) AS m_critical, SUM(IF($agent_state_critical, 1, 0)) AS a_critical,
SUM(ta.warning_count) AS m_warning, SUM(IF($agent_state_warning, 1, 0)) AS a_warning,
SUM(ta.unknown_count) AS m_unknown, SUM(IF($agent_state_unknown, 1, 0)) AS a_unknown,
SUM(ta.notinit_count) AS m_not_init, SUM(IF($agent_state_normal, 1, 0)) AS a_normal,
SUM(ta.fired_count) AS m_alerts, SUM(IF($agent_state_notinit, 1, 0)) AS a_not_init,
SUM(ta.total_count) AS m_total, SUM(tagent_counters.mm_normal) AS m_normal,
SUM(IF(ta.critical_count > 0, 1, 0)) AS a_critical, SUM(tagent_counters.mm_critical) AS m_critical,
SUM(IF(ta.critical_count = 0 AND ta.warning_count > 0, 1, 0)) AS a_warning, SUM(tagent_counters.mm_warning) AS m_warning,
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS a_unknown, SUM(tagent_counters.mm_unknown) AS m_unknown,
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count = 0 AND ta.notinit_count <> ta.total_count, 1, 0)) AS a_normal, SUM(tagent_counters.mm_not_init) AS m_not_init,
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS a_not_init, SUM(tagent_counters.mm_total) AS m_total
COUNT(ta.id_agente) AS a_agents, FROM tagent_custom_data tcd
GROUP_CONCAT(DISTINCT(ta.id_agente) SEPARATOR ',') as ids
FROM tagente ta
INNER JOIN tagent_custom_data tcd
ON tcd.id_agent = ta.id_agente
INNER JOIN tagent_custom_fields tcf INNER JOIN tagent_custom_fields tcf
ON tcd.id_field = tcf.id_field ON tcd.id_field = tcf.id_field
LEFT JOIN tagent_secondary_group tasg INNER JOIN (
ON ta.id_agente = tasg.id_agent SELECT ta.id_agente,
WHERE ta.disabled = 0 ta.total_count AS c_m_total,
AND tcf.name = '%s' SUM( IF(tae.estado = 0, 1, 0) ) AS mm_normal,
SUM( IF(tae.estado = 1, 1, 0) ) AS mm_critical,
SUM( IF(tae.estado = 2, 1, 0) ) AS mm_warning,
SUM( IF(tae.estado = 3, 1, 0) ) AS mm_unknown,
SUM( IF(tae.estado = 4 OR tae.estado = 5, 1, 0) ) AS mm_not_init,
COUNT(tam.id_agente_modulo) AS mm_total
FROM tagente ta
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae
ON tam.id_agente = tae.id_agente
AND tam.id_agente_modulo = tae.id_agente_modulo
WHERE ta.disabled = 0
AND tam.disabled = 0
%s
%s
%s
%s
GROUP by ta.id_agente
%s
) AS tagent_counters
ON tcd.id_agent = tagent_counters.id_agente
INNER JOIN tagente ta
ON ta.id_agente = tagent_counters.id_agente
WHERE tcf.name = '%s'
AND tcd.description <> '' AND tcd.description <> ''
%s %s
%s
%s
%s
GROUP BY tcd.description", GROUP BY tcd.description",
$custom_field_name,
$custom_data_and,
$groups_and, $groups_and,
$and_status, $and_status,
$module_filter $and_module_search,
$and_module_status,
$empty_agents_count,
$custom_field_name,
$custom_data_and
); );
$result_meta[$server_data['id']] = db_get_all_rows_sql($query); $result_meta[$server_data['id']] = db_get_all_rows_sql($query);
@ -402,10 +451,34 @@ function agent_counters_custom_fields($filters){
$query_data = sprintf("SELECT $query_data = sprintf("SELECT
tcd.description, tcd.description,
ta.id_agente, ta.id_agente,
%d AS id_server %d AS id_server,
(CASE
WHEN ta.critical_count > 0
THEN 1
WHEN ta.critical_count = 0
AND ta.warning_count > 0
THEN 2
WHEN ta.critical_count = 0
AND ta.warning_count = 0
AND ta.unknown_count > 0
THEN 3
WHEN ta.critical_count = 0
AND ta.warning_count = 0
AND ta.unknown_count = 0
AND ta.notinit_count <> ta.total_count
THEN 0
WHEN ta.total_count = ta.notinit_count
THEN 5
ELSE 0
END) AS `status`
FROM tagente ta FROM tagente ta
LEFT JOIN tagent_secondary_group tasg LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent ON ta.id_agente = tasg.id_agent
INNER JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae
ON tam.id_agente = tae.id_agente
AND tam.id_agente_modulo = tae.id_agente_modulo
INNER JOIN tagent_custom_data tcd INNER JOIN tagent_custom_data tcd
ON tcd.id_agent = ta.id_agente ON tcd.id_agent = ta.id_agente
INNER JOIN tagent_custom_fields tcf INNER JOIN tagent_custom_fields tcf
@ -413,22 +486,28 @@ function agent_counters_custom_fields($filters){
WHERE ta.disabled = 0 WHERE ta.disabled = 0
AND tcf.name = '%s' AND tcf.name = '%s'
AND tcd.description <> '' AND tcd.description <> ''
AND tam.disabled = 0
%s %s
%s %s
%s %s
%s %s
%s
GROUP BY ta.id_agente
", ",
$server_data['id'], $server_data['id'],
$custom_field_name, $custom_field_name,
$custom_data_and, $custom_data_and,
$groups_and, $groups_and,
$and_status, $and_status,
$module_filter $and_module_search,
$and_module_status
); );
$node_result = db_get_all_rows_sql($query_data); $node_result = db_get_all_rows_sql($query_data);
if (empty($node_result)) $node_result = array(); if (empty($node_result)) $node_result = array();
$data = array_merge($data, $node_result); $data = array_merge($data, $node_result);
// Restore connection to root node // Restore connection to root node
metaconsole_restore_db(); metaconsole_restore_db();
@ -455,7 +534,6 @@ function agent_counters_custom_fields($filters){
't_a_not_init' => 0, 't_a_not_init' => 0,
't_a_agents' => 0 't_a_agents' => 0
); );
foreach ($result_meta as $k => $nodo) { foreach ($result_meta as $k => $nodo) {
if(isset($nodo) && is_array($nodo)){ if(isset($nodo) && is_array($nodo)){
foreach ($nodo as $key => $value) { foreach ($nodo as $key => $value) {

View File

@ -853,10 +853,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$filter = '1 = 1'; $filter = '1 = 1';
} }
$secondary_join = ''; $secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
if (!users_can_manage_group_all("ER")) {
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
}
$sql = sprintf ("SELECT DISTINCT tevento.* $sql = sprintf ("SELECT DISTINCT tevento.*
FROM tevento %s FROM tevento %s

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; return false;
} }
@ -1049,6 +1049,10 @@ function graphic_combined_module (
$params_combined['id_graph'] = 0; $params_combined['id_graph'] = 0;
} }
if(!isset($params_combined['type_report'])){
$params_combined['type_report'] = '';
}
if(!isset($params['percentil'])){ if(!isset($params['percentil'])){
$params_combined['percentil'] = null; $params_combined['percentil'] = null;
} }
@ -1207,8 +1211,8 @@ function graphic_combined_module (
); );
$series = db_get_all_rows_sql( $series = db_get_all_rows_sql(
'SELECT summatory_series,average_series,modules_series 'SELECT summatory_series,average_series, modules_series
FROM tgraph FROM tgraph
WHERE id_graph = '. WHERE id_graph = '.
$params_combined['id_graph'] $params_combined['id_graph']
); );
@ -1301,7 +1305,6 @@ function graphic_combined_module (
); );
} }
//XXX arreglar estas
$long_index = ''; $long_index = '';
switch ($params_combined['stacked']) { switch ($params_combined['stacked']) {
default: default:
@ -1324,7 +1327,16 @@ function graphic_combined_module (
$i=0; $i=0;
$array_data = array(); $array_data = array();
foreach ($module_list as $key => $agent_module_id) { 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 ( $module_data = db_get_row_sql (
'SELECT * FROM tagente_modulo 'SELECT * FROM tagente_modulo
WHERE id_agente_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['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['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['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
$data_module_graph['w_min'] = $module_data['min_warning']; $data_module_graph['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning']; $data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse']; $data_module_graph['w_inv'] = $module_data['warning_inverse'];
$data_module_graph['c_min'] = $module_data['min_critical']; $data_module_graph['c_min'] = $module_data['min_critical'];
$data_module_graph['c_max'] = $module_data['max_critical']; $data_module_graph['c_max'] = $module_data['max_critical'];
$data_module_graph['c_inv'] = $module_data['critical_inverse']; $data_module_graph['c_inv'] = $module_data['critical_inverse'];
$data_module_graph['module_id'] = $agent_module_id; $data_module_graph['module_id'] = $agent_module_id;
//stract data //stract data
@ -1357,7 +1369,7 @@ function graphic_combined_module (
$i $i
); );
$series_suffix = $i; $series_suffix = $i;
//convert to array graph and weight //convert to array graph and weight
foreach ($array_data_module as $key => $value) { foreach ($array_data_module as $key => $value) {
@ -1386,6 +1398,10 @@ function graphic_combined_module (
//$array_events_alerts[$series_suffix] = $events; //$array_events_alerts[$series_suffix] = $events;
$i++; $i++;
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
metaconsole_restore_db();
}
} }
if($params_combined['projection']){ if($params_combined['projection']){
@ -1544,7 +1560,6 @@ function graphic_combined_module (
$water_mark, $water_mark,
$array_events_alerts $array_events_alerts
); );
break; break;
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
case CUSTOM_GRAPH_BULLET_CHART: 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. * Get all groups recursive from an initial group.
* *
* @param int Id of the parent 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 * @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)); $return = array_merge($return, array($id_parent));
//Check propagate //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')); $children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo'));
if ($children === false) { if ($children === false) {
$children = array(); $children = array();
} }

View File

@ -68,6 +68,7 @@ function groupview_get_modules_counters($groups_ids = false) {
ta.id_grupo AS g ta.id_grupo AS g
FROM $table ta FROM $table ta
WHERE ta.id_grupo IN ($groups_ids) WHERE ta.id_grupo IN ($groups_ids)
AND ta.disabled = 0
GROUP BY ta.id_grupo GROUP BY ta.id_grupo
UNION ALL UNION ALL
SELECT SUM(ta.normal_count) AS module_normal, 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); 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) { function html_f2str($function, $params) {
ob_start(); ob_start();
@ -726,8 +735,11 @@ function html_print_extended_select_for_post_process($name, $selected = '',
$selected_float = (float)$selected; $selected_float = (float)$selected;
$found = false; $found = false;
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) if($selected){
$found = true; if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
$found = true;
}
}
if (!$found) { if (!$found) {
$fields[$selected] = floatval($selected); $fields[$selected] = floatval($selected);
@ -1008,7 +1020,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
++$idcounter; ++$idcounter;
$valid_attrs = array ("accept", "disabled", "maxlength", $valid_attrs = array ("accept", "disabled", "maxlength",
"name", "readonly", "size", "value", "accesskey", "name", "readonly", "placeholder", "size", "value", "accesskey",
"class", "dir", "id", "lang", "style", "tabindex", "class", "dir", "id", "lang", "style", "tabindex",
"title", "xml:lang", "onfocus", "onblur", "onselect", "title", "xml:lang", "onfocus", "onblur", "onselect",
"onchange", "onclick", "ondblclick", "onmousedown", "onchange", "onclick", "ondblclick", "onmousedown",
@ -1338,6 +1350,36 @@ function html_print_input_hidden_extended($name, $value, $id, $return = false, $
echo $output; 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. * 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 ('/\n/i','<br>',$text);
$text = preg_replace ('/\s/i','&nbsp;',$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 .= $text;
$enclose .= "</div>"; $enclose .= "</div>";
return $enclose; return $enclose;

View File

@ -375,8 +375,8 @@ function __ ($string /*, variable arguments */) {
global $config; global $config;
static $extensions_cache = array(); static $extensions_cache = array();
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) { if( isset($config["id_user"]) ) {
if (array_key_exists($config["id_user"], $extensions_cache)) { if ( count($extensions_cache) > 0 && array_key_exists($config["id_user"], $extensions_cache)) {
$extensions = $extensions_cache[$config["id_user"]]; $extensions = $extensions_cache[$config["id_user"]];
} }
else { else {
@ -385,8 +385,9 @@ function __ ($string /*, variable arguments */) {
} }
} }
else{ else{
$extension =null; $extensions=null;
} }
if (empty($extensions)) if (empty($extensions))
$extensions = array(); $extensions = array();

View File

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

View File

@ -159,7 +159,8 @@ function reporting_make_reporting_data($report = null, $id_report,
true); true);
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente $sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo"; INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent";
$sql = sprintf('SELECT count(*) FROM tagente_modulo t1 $sql = sprintf('SELECT count(*) FROM tagente_modulo t1
%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .' %s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .'
@ -303,7 +304,8 @@ function reporting_make_reporting_data($report = null, $id_report,
$report['contents'][] = reporting_availability_graph( $report['contents'][] = reporting_availability_graph(
$report, $report,
$content, $content,
$pdf); $pdf
);
break; break;
case 'sql': case 'sql':
$report['contents'][] = reporting_sql( $report['contents'][] = reporting_sql(
@ -3821,7 +3823,7 @@ function reporting_agent_configuration($report, $content) {
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }
function reporting_value($report, $content, $type, $pdf) { function reporting_value($report, $content, $type, $pdf=false) {
global $config; global $config;
$return = array(); $return = array();
@ -6342,13 +6344,18 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
require_once ($config["homedir"] . '/include/functions_graph.php'); require_once ($config["homedir"] . '/include/functions_graph.php');
if ($config['metaconsole']) { if ($type_report == "custom_graph") {
$id_meta = metaconsole_get_id_server($content["server_name"]); if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($id_meta); $id_meta = metaconsole_get_id_server($content["server_name"]);
metaconsole_connect($server); $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']); $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$return = array(); $return = array();
$return['type'] = 'custom_graph'; $return['type'] = 'custom_graph';
@ -6372,30 +6379,25 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$graphs[0]["average_series"] = ''; $graphs[0]["average_series"] = '';
$graphs[0]["modules_series"] = ''; $graphs[0]["modules_series"] = '';
$graphs[0]["fullscale"] = $content['style']['fullscale']; $graphs[0]["fullscale"] = $content['style']['fullscale'];
$modules = $content['id_agent_module'];
if(is_array($content['id_agent_module'])){ if(!$modules){
foreach ($content['id_agent_module'] as $key => $value) { $module_source = db_get_all_rows_sql(
if($content['each_agent']){ "SELECT id_agent_module, id_server
$modules[] = $value; FROM tgraph_source
} WHERE id_graph = " .
else{ $content['id_gs']
$modules[] = $value['module']; );
}
} if(isset($module_source) && is_array($module_source)){
} $modules = array();
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']);
foreach ($module_source as $key => $value) { 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; $id_graph = 0;
} }
else { else {
@ -6435,7 +6437,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
'summatory' => $graphs[0]["summatory_series"], 'summatory' => $graphs[0]["summatory_series"],
'average' => $graphs[0]["average_series"], 'average' => $graphs[0]["average_series"],
'modules_series' => $graphs[0]["modules_series"], 'modules_series' => $graphs[0]["modules_series"],
'id_graph' => $id_graph 'id_graph' => $id_graph,
'type_report' => $type_report
); );
$return['chart'] = graphic_combined_module( $return['chart'] = graphic_combined_module(
@ -6444,13 +6447,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$params_combined $params_combined
); );
break;
case 'data':
break; break;
} }
if ($config['metaconsole']) { if ($type_report == "custom_graph") {
metaconsole_restore_db(); if (is_metaconsole()) {
metaconsole_restore_db();
}
} }
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
@ -10000,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["page"] = "include/ajax/events";';
$output .= 'parameters["total_events"] = 1;'; $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 .= 'success: function(data) {';
$output .= '$("#total_events").text(data);'; $output .= '$("#total_events").text(data);';
$output .= '}'; $output .= '}';
@ -10361,7 +10364,7 @@ function reporting_label_macro ($item, $label) {
case 'MTTR': case 'MTTR':
case 'automatic_graph': case 'automatic_graph':
if (preg_match("/_agent_/", $label)) { if (preg_match("/_agent_/", $label)) {
if (count($item['agents']) > 1) { if (isset($item['agents']) && count($item['agents']) > 1) {
$agent_name = count($item['agents']) . __(' agents'); $agent_name = count($item['agents']) . __(' agents');
} }
else { else {

View File

@ -2428,12 +2428,18 @@ function reporting_html_availability(&$table, $item) {
function reporting_html_availability_graph(&$table, $item, $pdf=0) { function reporting_html_availability_graph(&$table, $item, $pdf=0) {
global $config; global $config;
$metaconsole_on = is_metaconsole(); $metaconsole_on = is_metaconsole();
if($metaconsole_on && $pdf==0){
$src= '../../'; if($metaconsole_on){
$hack_metaconsole = "../../";
} }
else{ else{
$src=$config['homeurl']; $hack_metaconsole = "";
} }
$src=ui_get_full_url(false);
$tables_chart = '';
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
$table1->data = array (); $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][1] = $chart['chart'];
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" . $sla_value . '</span>'; $table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" . $sla_value . '</span>';
$table1->data[0][3] = $checks_resume; $table1->data[0][3] = $checks_resume;
$tables_chart .= html_print_table($table1, true);
} }
if($item['type'] == 'availability_graph'){ if($item['type'] == 'availability_graph'){
@ -2480,43 +2487,43 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
$table2->data = array (); $table2->data = array ();
$table2->size = array (); $table2->size = array ();
$table2->size[0] = '2%'; $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->size[1] = '14%';
$table2->data[0][1] = '<span>'.__('OK') . '</span>'; $table2->data[0][1] = '<span>'.__('OK') . '</span>';
$table2->size[2] = '2%'; $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->size[3] = '14%';
$table2->data[0][3] = '<span>'.__('Critical'). '</span>'; $table2->data[0][3] = '<span>'.__('Critical'). '</span>';
$table2->size[4] = '2%'; $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->size[5] = '14%';
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>'; $table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
$table2->size[6] = '2%'; $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->size[7] = '14%';
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>'; $table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
$table2->size[8] = '2%'; $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->size[9] = '14%';
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>'; $table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
$table2->size[10] = '2%'; $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->size[11] = '15%';
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>'; $table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
} }
$table->colspan['charts']['cell'] = 2; $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->colspan['legend']['cell'] = 2;
$table->data['legend']['cell'] = html_print_table($table2, true); $table->data['legend']['cell'] = html_print_table($table2, true);
if($pdf){ 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

@ -770,7 +770,7 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group_and_tag = false, $force_equal = false) { function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group_and_tag = false, $force_equal = false) {
global $config; global $config;
$condition = ''; $condition = array();
// Get all tags of the system // Get all tags of the system
$all_tags = tags_get_all_tags(false); $all_tags = tags_get_all_tags(false);
@ -808,8 +808,11 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
$tags_condition = $group_condition . " AND (" . implode(" OR ", $tags_condition_array) . ")"; $tags_condition = $group_condition . " AND (" . implode(" OR ", $tags_condition_array) . ")";
$condition[] = "($tags_condition)\n"; $condition[] = "($tags_condition)\n";
} }
if (!empty($condition)) { if (!empty($condition)) {
$condition = implode(' OR ', $condition); $condition = implode(' OR ', $condition);
} else {
$condition = '';
} }
if (!empty($without_tags)) { if (!empty($without_tags)) {

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;'; $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; $last_data_str .= $salida;
} }
else { else {

View File

@ -3884,7 +3884,7 @@ function ui_print_module_string_value($value, $id_agente_module,
" / " . $module_name; " / " . $module_name;
$salida = "<div " . $salida = "<div " .
"id='hidden_value_module_" . $id_agente_module . "' "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 . $value .
"</div>" . "</div>" .
"<span " . "<span " .

View File

@ -487,7 +487,7 @@ function visual_map_print_item($mode = "read", $layoutData,
else { else {
$url = ui_meta_get_url_console_child( $url = ui_meta_get_url_console_child(
$layoutData['id_metaconsole'], $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 { else {
@ -1569,6 +1569,9 @@ function visual_map_print_item($mode = "read", $layoutData,
case BOX_ITEM: case BOX_ITEM:
$class .= "box_item"; $class .= "box_item";
break; break;
case COLOR_CLOUD:
$class .= "color_cloud";
break;
default: default:
if (!empty($element_enterprise)) { if (!empty($element_enterprise)) {
$class .= $element_enterprise['class']; $class .= $element_enterprise['class'];
@ -1867,7 +1870,9 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
if (get_parameter('tab')=='editor')
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
break; break;
case PERCENTILE_BUBBLE: case PERCENTILE_BUBBLE:
@ -1911,7 +1916,9 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
if (get_parameter('tab')=='editor')
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
break; break;
case CIRCULAR_PROGRESS_BAR: case CIRCULAR_PROGRESS_BAR:
@ -1955,7 +1962,9 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
if (get_parameter('tab')=='editor')
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
break; break;
case CIRCULAR_INTERIOR_PROGRESS_BAR: case CIRCULAR_INTERIOR_PROGRESS_BAR:
@ -2000,7 +2009,9 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
echo $img; echo $img;
echo io_safe_output($text);
if (get_parameter('tab')=='editor')
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
break; break;
case MODULE_GRAPH: case MODULE_GRAPH:
@ -2173,6 +2184,9 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
break; break;
case COLOR_CLOUD:
echo visual_map_get_color_cloud_element($layoutData);
break;
default: default:
if (!empty($element_enterprise)) { if (!empty($element_enterprise)) {
echo $element_enterprise['item']; echo $element_enterprise['item'];
@ -3451,7 +3465,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
$filter = array (); $filter = array ();
} else { } else {
if(!empty($filter['name'])){ 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']); unset($filter['name']);
} }
} }
@ -3875,6 +3891,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
case 'group_item': case 'group_item':
$text = __('Group') . " - "; $text = __('Group') . " - ";
break; break;
case COLOR_CLOUD:
case 'color_cloud':
$text = __('Color cloud') . " - ";
break;
case 'icon': case 'icon':
case ICON: case ICON:
$text = __('Icon') . " - " . $text = __('Icon') . " - " .
@ -4012,6 +4032,8 @@ function visual_map_type_in_js($type) {
break; break;
case LINE_ITEM: case LINE_ITEM:
return 'line_item'; return 'line_item';
case COLOR_CLOUD:
return 'color_cloud';
break; break;
} }
} }
@ -4027,5 +4049,76 @@ function visual_map_macro($label,$module){
return $label; 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'), 'clock' => __('Clock'),
'group_item' => __('Group'), 'group_item' => __('Group'),
'box_item' => __('Box'), 'box_item' => __('Box'),
'line_item' => __('Line')); 'line_item' => __('Line'),
'color_cloud' => __('Color cloud')
);
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_visual_map_editor_add_title_palette($titles); 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'] = array();
$form_items['agent_row']['items'] = array('static_graph', $form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_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">' . $form_items['agent_row']['html'] = '<td align="left">' .
__('Agent') . '</td>'; __('Agent') . '</td>';
$params = array(); $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'] = array();
$form_items['module_row']['items'] = array('static_graph', $form_items['module_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_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">' . $form_items['module_row']['html'] = '<td align="left">' .
__('Module') . '</td> __('Module') . '</td>
<td align="left">' . <td align="left">' .
@ -510,7 +513,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
__('Max value') . '</td> __('Max value') . '</td>
<td align="left">' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</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 porgress 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')); $percentile_value = array('percent' => __('Percent'), 'value' => __('Value'));
if (is_metaconsole()){ if (is_metaconsole()){
$form_items['percentile_item_row_3'] = array(); $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">' . $form_items['percentile_item_row_3']['html'] = '<td align="left">' .
__('Type') . '</td> __('Type') . '</td>
<td align="left">' . <td align="left">' .
html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true) . html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false) .
'</td>'; '</td>';
$form_items['percentile_item_row_4'] = array(); $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']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_4']['html'] = '<td align="left">' . __('Value to show') . '</td> $form_items['percentile_item_row_4']['html'] = '<td align="left">' . __('Value to show') . '</td>
<td align="left">' . <td align="left">' .
html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true) . html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false) .
'</td>'; '</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="">' . __('Show statistics') . '</td>
<td align="left" style="">' . <td align="left" style="">' .
html_print_checkbox('show_statistics', 1, '', true) . '</td>'; 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'] = array();
$form_items['show_on_top_row']['items'] = array('group_item'); $form_items['show_on_top_row']['items'] = array('group_item');
$form_items['show_on_top_row']['html'] = $form_items['show_on_top_row']['html'] =
@ -616,7 +687,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
__('Type') . '</td> __('Type') . '</td>
<td align="left">' . html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true) . '</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. //Insert and modify before the buttons to create or update.
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_visual_map_editor_modify_form_items_palette($form_items); 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', $form_items_advance['position_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph', 'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos', 'box_item', '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'] = ' $form_items_advance['position_row']['html'] = '
<td align="left">' . __('Position') . '</td> <td align="left">' . __('Position') . '</td>
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) . <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 $mapLinkedSelect = $("select#map_linked");
var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id"); var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id");
var visualMaps = <?php echo json_encode($visual_maps); ?>; var visualMaps = <?php echo json_encode($visual_maps); ?>;
if (!(visualMaps instanceof Array)) visualMaps = [];
var nodesById = <?php echo json_encode($meta_servers_by_id); ?>; var nodesById = <?php echo json_encode($meta_servers_by_id); ?>;
visualMaps.forEach(function (vMap) { 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( $form_items_advance['element_group_row']['items'] = array(
'group_item', 'static_graph', 'percentile_bar', 'group_item', 'static_graph', 'percentile_bar',
'percentile_item', 'module_graph', 'simple_value', '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">'. $form_items_advance['element_group_row']['html'] = '<td align="left">'.
__('Restrict access to group') . '</td>' . __('Restrict access to group') . '</td>' .
'<td align="left">' . '<td align="left">' .
@ -903,11 +975,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
</tbody> </tbody>
</table> </table>
<?php <?php
//------------------------------------------------------------------------------
echo '</div>'; echo '</div>';
@ -1026,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('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('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('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")){ 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" 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>'; class="forced_title" alt="The data displayed in editor mode is not real"></a>';

View File

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

View File

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

View File

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

View File

@ -1332,7 +1332,7 @@ function print_phases_donut (recipient, phases) {
var svg = d3.select(recipient) var svg = d3.select(recipient)
.append("svg") .append("svg")
.attr("width", 800) .attr("width", 800)
.attr("height", 400) .attr("height", 500)
.append("g"); .append("g");
svg.append("g") svg.append("g")
@ -1361,7 +1361,7 @@ function print_phases_donut (recipient, phases) {
.outerRadius(radius * 0.9); .outerRadius(radius * 0.9);
width = 800; width = 800;
height = 400; height = 500;
svg.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"); svg.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var key = function(d){ return d.data.label; }; 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; return d.startAngle + (d.endAngle - d.startAngle)/2;
} }
var ex = 1;
var sum = 0;
text.transition().duration(0) text.transition().duration(0)
.attrTween("transform", function(d) { .attrTween("transform", function(d) {
this._current = this._current || d; this._current = this._current || d;
@ -1447,8 +1449,26 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0); this._current = interpolate(0);
return function(t) { return function(t) {
var d2 = interpolate(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 +")"; return "translate("+ pos +")";
}; };
}) })
@ -1458,6 +1478,17 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0); this._current = interpolate(0);
return function(t) { return function(t) {
var d2 = interpolate(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"; return midAngle(d2) < Math.PI ? "start":"end";
}; };
}); });
@ -1468,10 +1499,12 @@ function print_phases_donut (recipient, phases) {
/* ------- SLICE TO TEXT POLYLINES -------*/ /* ------- SLICE TO TEXT POLYLINES -------*/
var polyline = svg.select(".lines").selectAll("polyline") var polyline = svg.select(".lines").selectAll("polyline")
.data(pie(data), key); .data(pie(data), key);
polyline.enter() polyline.enter()
.append("polyline"); .append("polyline");
var ex2 = 1;
var sum2 = 0;
polyline.transition().duration(0) polyline.transition().duration(0)
.attrTween("points", function(d){ .attrTween("points", function(d){
this._current = this._current || d; this._current = this._current || d;
@ -1479,16 +1512,33 @@ function print_phases_donut (recipient, phases) {
this._current = interpolate(0); this._current = interpolate(0);
return function(t) { return function(t) {
var d2 = interpolate(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]; return [arc.centroid(d2), outerArc.centroid(d2), pos];
}; };
}) })
.style("stroke", "black") .style("stroke", "black")
.style("opacity", ".3") .style("opacity", ".3")
.style("stroke-width", "2px") .style("stroke-width", "2px")
.style("fill", "none"); .style("fill", "none");
polyline.exit() polyline.exit()
.remove(); .remove();
} }
@ -2331,4 +2381,4 @@ var digitPattern = [
setTimeout(tick, 1000 - now % 1000); 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>_plugin_parameters_ : Plug-in Parameters of the module.</li>
<li>_name_tag_ : Nombre de los tags asociados al módulo.</li> <li>_name_tag_ : Names of the tags associated to the module.</li>
<li>_email_tag_ : Emails asociados a los tags de módulos.</li> <li>_email_tag_ : Emails associated to module tags.</li>
<li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li> <li>_phone_tag_ : Phone numbers associated to module tags.</li>
<li>_moduletags_ : Teléfonos asociados a los tags de módulos.</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> <li>_agentcustomfield_<i>n</i>_: Agent custom field number <i>n</i> (eg. _agentcustomfield_9_).</li>
</ul> </ul>
<p> <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>_plugin_parameters_ : Parámetros del Plug-in del módulo.</li>
<li>_name_tag_ : Names of the tags associated to the module.</li> <li>_name_tag_ : Nombre de los tags asociados al módulo.</li>
<li>_email_tag_ : Emails associated to the module tags.</li> <li>_email_tag_ : Emails asociados a los tags de módulos.</li>
<li>_phone_tag_ : Phone numbers associated to the module tags.</li> <li>_phone_tag_ : Teléfonos asociados a los tags de módulos.</li>
<li>_moduletags_ : URLs associated to the module tags.</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> <li>_agentcustomfield_<i>n</i>_: Campo personalizado número <i>n</i> del agente (eg. _agentcustomfield_9_). </li>
</ul> </ul>

View File

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

View File

@ -594,12 +594,51 @@ function post_process_select_init_unit(name,selected) {
function post_process_select_events_unit(name,selected) { function post_process_select_events_unit(name,selected) {
$('.' + name + '_toggler').click(function() { $('.' + name + '_toggler').click(function() {
$('#' + name + '_select option[value=none]').attr("selected",true); var value = $('#text-' + name + '_text').val();
$('#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); 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) { function post_process_select_events(name) {
$('.' + name + '_toggler').click(function() { $('.' + name + '_toggler').click(function() {
var value = $('#text-' + name + '_text').val(); var value = $('#text-' + name + '_text').val();

View File

@ -158,10 +158,11 @@ function show_response_dialog(event_id, response_id, response) {
var params = []; var params = [];
params.push("page=include/ajax/events"); params.push("page=include/ajax/events");
params.push("dialogue_event_response=1"); params.push("dialogue_event_response=1");
params.push("massive=0");
params.push("event_id="+event_id); params.push("event_id="+event_id);
params.push("target="+response['target']); params.push("target="+response['target']);
params.push("response_id="+response_id); params.push("response_id="+response_id);
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),
type: 'POST', 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 // Get an event response from db
function get_response(response_id) { function get_response(response_id) {
var ajax_file = $('#hidden-ajax_file').val(); var ajax_file = $('#hidden-ajax_file').val();
@ -371,6 +423,42 @@ function perform_response(target, response_id) {
return false; 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 // Change the status of an event to new, in process or validated
function event_change_status(event_ids) { function event_change_status(event_ids) {
var ajax_file = $('#hidden-ajax_file').val(); var ajax_file = $('#hidden-ajax_file').val();

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