diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 0b22878285..90c4bf6519 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -16,7 +16,7 @@ else fi VERSION=$2 if [ $# == 2 ]; then - BUILD=`date +%g%m%d` + BUILD=`date +%y%m%d` else BUILD=$3 fi diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index ad9f9f3c3d..969c6c3edc 100644 --- a/pandora_agents/pc/AIX/pandora_agent.conf +++ b/pandora_agents/pc/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, AIX version +# Version 7.0NG.730, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 8de6468c19..968b8b2273 100644 --- a/pandora_agents/pc/FreeBSD/pandora_agent.conf +++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, FreeBSD Version +# Version 7.0NG.730, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index 0c7582879b..1bb7afe932 100644 --- a/pandora_agents/pc/HP-UX/pandora_agent.conf +++ b/pandora_agents/pc/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, HP-UX Version +# Version 7.0NG.730, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 17b4e3ec67..1032e972c3 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, GNU/Linux +# Version 7.0NG.730, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 15f274095a..27d6bc2499 100644 --- a/pandora_agents/pc/NT4/pandora_agent.conf +++ b/pandora_agents/pc/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, GNU/Linux +# Version 7.0NG.730, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf index b4e901951d..86860f55e6 100644 --- a/pandora_agents/pc/SunOS/pandora_agent.conf +++ b/pandora_agents/pc/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, Solaris Version +# Version 7.0NG.730, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index bbf52b6bc1..5e5d0580e6 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2010 Artica Soluciones Tecnologicas -# Version 7.0NG.729 +# Version 7.0NG.730 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 72375ecebe..1b3ba629b7 100644 --- a/pandora_agents/shellscript/aix/pandora_agent.conf +++ b/pandora_agents/shellscript/aix/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.729, AIX version +# Version 7.0NG.730, AIX version # General Parameters # ================== diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index 6d08062786..4ed22c0a3e 100644 --- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf +++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.729 +# Version 7.0NG.730 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index 9b452127ca..22faee00e8 100644 --- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf +++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.729, HPUX Version +# Version 7.0NG.730, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index c8ebc2b25f..a784ce4fc0 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729 +# Version 7.0NG.730 # Licensed under GPL license v2, # (c) 2003-2010 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index d0044b7398..456802c06a 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729 +# Version 7.0NG.730 # Licensed under GPL license v2, # (c) 2003-2009 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index 53b696ba06..44e244c74e 100644 --- a/pandora_agents/shellscript/openWRT/pandora_agent.conf +++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729 +# Version 7.0NG.730 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index c592279323..fdb61b9888 100644 --- a/pandora_agents/shellscript/solaris/pandora_agent.conf +++ b/pandora_agents/shellscript/solaris/pandora_agent.conf @@ -1,6 +1,6 @@ # Fichero de configuracion base de agentes de Pandora # Base config file for Pandora agents -# Version 7.0NG.729, Solaris version +# Version 7.0NG.730, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 64671fae84..54451441dd 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, AIX version +# Version 7.0NG.730, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 91d97ac889..758ee6811a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.729-181211 +Version: 7.0NG.730-190116 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index aee81acb54..4e5706c7cf 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.729-181211" +pandora_version="7.0NG.730-190116" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 160a20b253..2c4ea59daa 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, GNU/Linux +# Version 7.0NG.730, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index e97a1675fb..3feebad741 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, FreeBSD Version +# Version 7.0NG.730, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 366928ea65..b0f9dd590e 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, HP-UX Version +# Version 7.0NG.730, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index e6a3200726..2679f78617 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, GNU/Linux +# Version 7.0NG.730, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index c3f4b791f1..8d3736b35f 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, GNU/Linux +# Version 7.0NG.730, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index 8efe821f74..e0eea4b59e 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, NetBSD Version +# Version 7.0NG.730, NetBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index b32f162d4b..30ac06a0ca 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.729, Solaris Version +# Version 7.0NG.730, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index e6070a42d7..9646cee020 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,8 +41,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.729'; -use constant AGENT_BUILD => '181211'; +use constant AGENT_VERSION => '7.0NG.730'; +use constant AGENT_BUILD => '190116'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -516,11 +516,18 @@ sub parse_conf_modules($) { log_message ('setup', "Invalid regular expression in intensive condition: $line"); } } - } elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) { + } elsif ($line =~ /^\s*module_crontab\s+(.*)$/) { my $cron_text = $1; chomp ($cron_text); + $cron_text =~ s/\s+$//; + # Get module name if is already read. + my $module_name_message = ""; + $module_name_message = " (module $module->{'name'})" if defined($module->{'name'}); if (cron_check_syntax($cron_text)) { $module->{'cron'} = $cron_text; + log_message('debug', "Cron '$module->{'cron'}' configured $module_name_message."); + } else { + log_message('setup', "Incorrect cron syntax '$cron_text'. This module$module_name_message will be executed always."); } } elsif ($line =~ /^\s*module_end\s*$/) { @@ -2397,6 +2404,7 @@ sub check_module_cron { $interval ); + my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0; $module->{'cron_utimestamp'} = $now + $time_to_next_execution; $module->{'cron_interval'} = $time_to_next_execution; @@ -2405,7 +2413,7 @@ sub check_module_cron { } # On first execution checking if cron is valid is required - return 1 unless ($module->{'cron_utimestamp'} == 0); + return 1 unless ($is_first); # Check if current timestamp is a valid cron date my $next_execution = cron_next_execution_date( diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d4a375c7e7..bd1b569af4 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 745cf21973..1156c6297a 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 1632cf5448..b4c3b66bab 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -9,8 +9,8 @@ # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.729" -PI_BUILD="181211" +PI_VERSION="7.0NG.730" +PI_BUILD="190116" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 9ba6eff68d..795842f5f5 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.729 +# Version 7.0NG.730 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 652c522463..3c639031de 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -3,7 +3,7 @@ AllowLanguageSelection {Yes} AppName -{Pandora FMS Windows Agent v7.0NG.729} +{Pandora FMS Windows Agent v7.0NG.730} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{181211} +{190116} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 5cbaba25c9..87cec0dbac 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.729(Build 181211)") +#define PANDORA_VERSION ("7.0NG.730(Build 190116)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b4d4b3b4f4..91df373d23 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.729(Build 181211))" + VALUE "ProductVersion", "(7.0NG.730(Build 190116))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9900f8db7e..d7e1669bf6 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.729-181211 +Version: 7.0NG.730-190116 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 8ffb10a322..af3a24ea27 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.729-181211" +pandora_version="7.0NG.730-190116" package_pear=0 package_pandora=1 diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index 97ffe031a9..c7d21fff1a 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -14,6 +14,15 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +// Enable profiler for testing +if (!defined("__PAN_XHPROF__")) define ("__PAN_XHPROF__", 0); + +if (__PAN_XHPROF__ === 1) { + if (function_exists('tideways_xhprof_enable')) { + tideways_xhprof_enable(); + } +} + if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"))) { exit; } @@ -88,4 +97,8 @@ if (file_exists ($page)) { else { echo '
Sorry! I can\'t find the page '.$page.'!'; } + +if (__PAN_XHPROF__ === 1) { + pandora_xhprof_display_result("ajax", "console"); +} ?> diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index b7eca3b3e9..18ba051b60 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -61,17 +61,27 @@ function mainModuleGroups() { $info = groupview_plain_groups($info); $counter = count($info); $offset = get_parameter('offset', 0); - $groups_view = $is_not_paginated - ? $info - : array_slice($info, $offset, $config['block_size']); - $agents_counters = array_reduce($groups_view, function($carry, $item){ - $carry[$item['id']] = $item; - return $carry; - }, array()); + $agent_group_search = get_parameter('agent_group_search', ''); + $module_group_search = get_parameter('module_group_search', ''); - $ids_array = array_keys($agents_counters); + $info = array_filter($info, function($v, $k) use ($agent_group_search) { + return preg_match("/$agent_group_search/i", $v['name']); + }, ARRAY_FILTER_USE_BOTH); - $ids_group = implode(',', $ids_array); + if (!empty($info)) { + $groups_view = $is_not_paginated + ? $info + : array_slice($info, $offset, $config['block_size']); + $agents_counters = array_reduce($groups_view, function($carry, $item){ + $carry[$item['id']] = $item; + return $carry; + }, array()); + + $ids_array = array_keys($agents_counters); + + $ids_group = implode(',', $ids_array); + } else + $ids_group = -1; $condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT); $condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT); @@ -90,6 +100,12 @@ function mainModuleGroups() { $array_module_group[$value['id_mg']] = $value['name']; } $array_module_group[0] = 'Nothing'; + + + $array_module_group = array_filter($array_module_group, function($v, $k) use ($module_group_search) { + return preg_match("/$module_group_search/i", $v); + }, ARRAY_FILTER_USE_BOTH); + foreach ($agents_counters as $key => $value) { $array_for_defect[$key]['gm'] = $array_module_group; $array_for_defect[$key]['data']['name'] = $value['name']; @@ -167,7 +183,26 @@ $sql = ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, ''); - if(count($array_for_defect) > 0){ + echo " + "; + echo ""; + + echo "
"; + echo __('Search by agent group') . ' '; + html_print_input_text ("agent_group_search", $agent_group_search); + + echo ""; + echo __('Search by module group') . ' '; + html_print_input_text ("module_group_search", $module_group_search); + + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + + if(true){ $table = new StdClass(); $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;'; $table->width = '100%'; diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js index 34da7b1704..924331cafe 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js @@ -30,7 +30,7 @@ }, yaxis: { tickFormatter: function (value, axis) { - return shortNumber(value); + return shortNumber(roundToTwo(value)) ; } }, series: { @@ -178,6 +178,9 @@ return number + " " + shorts[pos]; } + function roundToTwo(num) { + return +(Math.round(num + "e+2") + "e-2"); + } $('#graph').change(function() { $('form#realgraph').submit(); diff --git a/pandora_console/extras/mr/23.sql b/pandora_console/extras/mr/23.sql index a602023e3b..98ef4f5747 100644 --- a/pandora_console/extras/mr/23.sql +++ b/pandora_console/extras/mr/23.sql @@ -6,4 +6,6 @@ ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600 ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0'; +ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0; + COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/mr/24.sql b/pandora_console/extras/mr/24.sql new file mode 100644 index 0000000000..f93d9c6e6e --- /dev/null +++ b/pandora_console/extras/mr/24.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical'; + +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 5b98fdbec0..5dc7cd70c4 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -48,8 +48,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( `dynamic_interval` int(4) unsigned default '0', `dynamic_max` int(4) default '0', `dynamic_min` int(4) default '0', - `dynamic_next` bigint(20) NOT NULL default '0', - `dynamic_two_tailed` tinyint(1) unsigned default '0', `prediction_sample_window` int(10) default 0, `prediction_samples` int(4) default 0, `prediction_threshold` int(4) default 0, @@ -58,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; + -- ----------------------------------------------------- -- Table `tpolicy_modules` -- ----------------------------------------------------- @@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( `dynamic_interval` int(4) unsigned default '0', `dynamic_max` int(4) default '0', `dynamic_min` int(4) default '0', - `dynamic_next` bigint(20) NOT NULL default '0', - `dynamic_two_tailed` tinyint(1) unsigned default '0', `prediction_sample_window` int(10) default 0, `prediction_samples` int(4) default 0, `prediction_threshold` int(4) default 0, @@ -135,6 +134,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( UNIQUE (`id_policy`, `name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; + -- --------------------------------------------------------------------- -- Table `tpolicies` -- --------------------------------------------------------------------- @@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` ( UNIQUE (`id_policy`, `id_agent`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0'; +ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`); + -- ----------------------------------------------------- -- Table `tpolicy_groups` -- ----------------------------------------------------- @@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL; + -- --------------------------------------------------------------------- -- Table `tpolicy_modules_inventory` -- --------------------------------------------------------------------- @@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL; + -- ----------------------------------------------------- -- Table `tagente_datos_inventory` -- ----------------------------------------------------- @@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( `id` int(10) NOT NULL auto_increment primary key, - `server_name` text, - `server_url` text, - `dbuser` text, - `dbpass` text, - `dbhost` text, - `dbport` text, - `dbname` text, - `meta_dbuser` text, - `meta_dbpass` text, - `meta_dbhost` text, - `meta_dbport` text, - `meta_dbname` text, + `server_name` text default '', + `server_url` text default '', + `dbuser` text default '', + `dbpass` text default '', + `dbhost` text default '', + `dbport` text default '', + `dbname` text default '', `auth_token` text default '', `id_group` int(10) unsigned NOT NULL default 0, `api_password` text NOT NULL, @@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( COMMENT = 'Table to store metaconsole sources' DEFAULT CHARSET=utf8; +ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text; +ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text; +ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text; +ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text; +ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text; + -- --------------------------------------------------------------------- -- Table `tprofile_view` -- --------------------------------------------------------------------- @@ -400,7 +410,7 @@ CREATE TABLE IF NOT EXISTS `tservice` ( `id_template_alert_warning` int(10) unsigned NOT NULL default 0, `id_template_alert_critical` int(10) unsigned NOT NULL default 0, `id_template_alert_unknown` int(10) unsigned NOT NULL default 0, - `id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0 + `id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB COMMENT = 'Table to define services to monitor' @@ -548,6 +558,8 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` ( KEY `idx_id_event_alert` (`id_event_alert`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0; + -- ----------------------------------------------------- -- Table `tevent_alert` -- ----------------------------------------------------- @@ -744,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `module_names` TEXT, `module_free_text` TEXT, `each_agent` tinyint(1) default 1, - `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, - `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', - `lapse` int(11) UNSIGNED NOT NULL default '300', - `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', - `hide_no_data` tinyint(1) default 0, PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300'; +ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0'; + -- ----------------------------------------------------- -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) -- ----------------------------------------------------- @@ -860,6 +873,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` ( -- Criticity: 5 - Minor -- Criticity: 6 - Major +ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL; +ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0'; + -- --------------------------------------------------------------------- -- Table `tmetaconsole_event_history` -- --------------------------------------------------------------------- @@ -905,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` ( -- Criticity: 5 - Minor -- Criticity: 6 - Major +ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL; +ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `textension_translate_string` -- --------------------------------------------------------------------- @@ -957,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( `agent_version` varchar(100) default '', `ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00', `disabled` tinyint(2) NOT NULL default '0', - `remote` tinyint(1) NOT NULL default '0', `id_parent` int(10) unsigned default '0', `custom_id` varchar(255) default '', `server_name` varchar(100) default '', `cascade_protection` tinyint(2) NOT NULL default '0', - `cascade_protection_module` int(10) unsigned default '0', `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' , `icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' , `update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' , @@ -977,8 +993,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( `fired_count` bigint(20) NOT NULL default '0', `update_module_count` tinyint(1) NOT NULL default '0', `update_alert_count` tinyint(1) NOT NULL default '0', - `transactional_agent` tinyint(1) NOT NULL default '0', - `alias` varchar(600) BINARY NOT NULL default '', PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`(255)), KEY `direccion` (`direccion`), @@ -987,6 +1001,11 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0'; +ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0'; +ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0'; +ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT ''; + -- --------------------------------------------------------------------- -- Table `ttransaction` -- --------------------------------------------------------------------- @@ -1305,6 +1324,10 @@ ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL defau ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time"; ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid"; ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0'; +ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default'; +ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0; +ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0; +ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1358,26 +1381,15 @@ ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL; -- --------------------------------------------------------------------- ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; --- Table `tlocal_component` --- --------------------------------------------------------------------- -ALTER TABLE tlocal_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; -ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; - -- --------------------------------------------------------------------- -- Table `tpolicy_module` -- --------------------------------------------------------------------- ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default ''; -ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; -ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0; -- --------------------------------------------------------------------- -- Table `tmetaconsole_agent` -- --------------------------------------------------------------------- -ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT ''; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0; @@ -1542,6 +1554,8 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul -- --------------------------------------------------------------------- -- Table `tsnmp_filter` -- --------------------------------------------------------------------- +ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0; + SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter; UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0; @@ -1732,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` ( -- --------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS `tlayout_template` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL, + `name` varchar(600) NOT NULL, `id_group` INTEGER UNSIGNED NOT NULL, `background` varchar(200) NOT NULL, `height` INTEGER UNSIGNED NOT NULL default 0, @@ -1778,11 +1792,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` ( `clock_animation` varchar(60) NOT NULL default "analogic_1", `time_format` varchar(60) NOT NULL default "time", `timezone` varchar(60) NOT NULL default "Europe/Madrid", + `show_last_value` tinyint(1) UNSIGNED NULL default '0', + `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default', + `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0, + `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0, + `linked_layout_node_id` INT(10) NOT NULL default 0, PRIMARY KEY(`id`), FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; -ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0'; -- --------------------------------------------------------------------- -- Table `tlog_graph_models` -- --------------------------------------------------------------------- @@ -1804,6 +1822,7 @@ INSERT INTO tlog_graph_models VALUES (1, 'Apache log model', -- ----------------------------------------------------- ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0; +ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical'; ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1'; ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default ''; @@ -1824,11 +1843,28 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` ( `id_custom_fields_data` varchar(600) default '', `id_status` varchar(600) default '', `module_search` varchar(600) default '', + `module_status` varchar(600) default '', + `recursion` int(1) unsigned default '0', + `group_search` int(10) unsigned default '0', PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; -ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default ''; +-- --------------------------------------------------------------------- +-- Table `tevento` +-- --------------------------------------------------------------------- +ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL; -ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0'; +ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0'; -ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0'; +-- ----------------------------------------------------- +-- Table `tgis_map_layer_groups` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` ( + `layer_id` INT NOT NULL, + `group_id` MEDIUMINT(4) UNSIGNED NOT NULL, + `agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group', + PRIMARY KEY (`layer_id`, `group_id`), + FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE, + FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE, + FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 4e6be0e725..f94cb7737b 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -484,7 +484,7 @@ $table->data[4][1] = __('Disabled') . ' ' . $table->data[4][1] .= __('Enabled') . ' ' . html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); if (enterprise_installed()) { - $table->data[4][2] = __('Url address'); + $table->data[4][2] = __('Url address') . ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true); $table->data[4][3] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); }else{ diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index f9347c8b9b..079ff74573 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -573,18 +573,27 @@ ui_require_javascript_file ('pandora_modules'); ?> @@ -86,9 +86,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) { -'; $config['font_size'] = $aux_font_size; -?> + ?> + + - - diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a99d7b880d..280aba46a5 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,8 +22,8 @@ /** * Pandora build version and version */ -$build_version = 'PC181211'; -$pandora_version = 'v7.0NG.729'; +$build_version = 'PC190116'; +$pandora_version = 'v7.0NG.730'; // Do not overwrite default timezone set if defined. $script_tz = @date_default_timezone_get(); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index c223738b2a..22f46257dc 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -204,6 +204,7 @@ define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16); define('DONUT_GRAPH', 17); define('BARS_GRAPH', 18); define('CLOCK', 19); +define('COLOR_CLOUD', 20); //Some styles define('MIN_WIDTH', 300); define('MIN_HEIGHT', 120); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index d36c68ada2..f2056f058e 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3285,11 +3285,19 @@ function series_type_graph_array($data, $show_elements_graph){ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = false, $module_list = false){ global $config; + if(is_metaconsole()){ + $hack_metaconsole = "../.."; + } + else{ + $hack_metaconsole = ""; + } + $file_js = $config["homedir"] . "/include/web2image.js"; - $url = $config["homeurl"] . "include/chart_generator.php"; + $url = ui_get_full_url(false) . $hack_metaconsole . "/include/chart_generator.php"; + $img_file = "img_". uniqid() .".png"; $img_path = $config["homedir"] . "/attachment/" . $img_file; - $img_url = $config["homeurl"] . "attachment/" . $img_file; + $img_url = ui_get_full_url(false) . $hack_metaconsole . "/attachment/" . $img_file; $width_img = 500; $height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280; @@ -3320,7 +3328,10 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal . ' "' . $session_id . '"' . ' "' . $params['return_img_base_64'] . '"'; - exec($cmd, $result); + $result = null; + $retcode = null; + exec($cmd, $result, $retcode); + $img_content = join("\n", $result); if($params['return_img_base_64']){ @@ -3389,5 +3400,39 @@ function validate_csrf_code() { function generate_hash_to_api(){ hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key')); +} + +/** + * Disable the profiller and display de result + * + * @param string Key to identify the profiler run. + * @param string Way to display the result + * "link" (default): Click into word "Performance" to display the profilling info. + * "console": Display with a message in pandora_console.log. + */ +function pandora_xhprof_display_result($key = "", $method = "link") { + // Check if function exists + if (!function_exists('tideways_xhprof_disable')) { + error_log("Cannot find tideways_xhprof_disable function"); + return; } + + $run_id = uniqid(); + $data = tideways_xhprof_disable(); + $source = "pandora_$key"; + file_put_contents( + sys_get_temp_dir() . "/" . $run_id . ".$source.xhprof", + serialize($data) + ); + $new_url = "http://{$_SERVER['HTTP_HOST']}/profiler/index.php?run={$run_id}&source={$source}"; + switch($method) { + case "console": + error_log("'{$new_url}'"); + case "link": + default: + echo "Performance\n"; + break; + + } +} ?> diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index d69a27d8fe..b1d258e223 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -827,7 +827,8 @@ function agents_get_group_agents ( $filter = array(); - if (!$noACL) { + // check available groups for target user only if asking for 'All' group + if (!$noACL && $id_group == 0) { $id_group = $id_group == 0 ? array_keys(users_get_groups(false, "AR", false)) : groups_safe_acl($config["id_user"], $id_group, "AR"); @@ -848,7 +849,8 @@ function agents_get_group_agents ( $id_group = groups_get_id_recursive($id_group, true); } - if (!$noACL) { + // check available groups for target user only if asking for 'All' group + if (!$noACL && $id_group == 0) { $id_group = array_keys( users_get_groups(false, "AR", true, false, (array)$id_group)); } @@ -1231,8 +1233,8 @@ function agents_get_modules ($id_agent = null, $details = false, ON tagente.id_agente = tasg.id_agent WHERE tagente_modulo.delete_pending = 0 AND %s - GROUP BY tagente_modulo.id_agente_modulo - ORDER BY tagente_modulo.nombre', + GROUP BY 1 + ORDER BY 1', ($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '', io_safe_output(implode (",", (array) $details)), $sql_tags_join, diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 53479ae7ed..8695ad9b1d 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -32,6 +32,7 @@ include_once($config['homedir'] . "/include/functions_servers.php"); include_once($config['homedir'] . "/include/functions_planned_downtimes.php"); include_once($config['homedir'] . "/include/functions_db.php"); include_once($config['homedir'] . "/include/functions_event_responses.php"); +include_once($config['homedir'] . "/include/functions_policies.php"); enterprise_include_once ('include/functions_local_components.php'); enterprise_include_once ('include/functions_events.php'); enterprise_include_once ('include/functions_agents.php'); @@ -6448,6 +6449,63 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) { array('type' => 'string', 'data' => __('SNMP policy module updated.'))); } +/** + * Remove an agent from a policy. + * @param $id Id of the policy + * @param $id2 Id of the agent policy + * @param $trash1 + * @param $trash2 + * + * Example: + * api.php?op=set&op2=remove_agent_from_policy&apipass=1234&user=admin&pass=pandora&id=11&id2=2 + */ +function api_set_remove_agent_from_policy ($id, $id2, $thrash2, $thrash3) { + global $config; + + if (!check_acl($config['id_user'], 0, "AW")){ + returnError('forbidden', 'string'); + return; + } + + if ($id == '' || !$id) { + returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.')); + return; + } + + if ($id2 == '' || !$id2) { + returnError('error_parameter', __('Error deleting agent from policy. Agent cannot be left blank.')); + return; + } + + $policy = policies_get_policy ($id, false, false); + $agent = db_get_row_filter('tagente', array('id_agente' => $id2)); + $policy_agent = db_get_row_filter('tpolicy_agents', array('id_policy' => $id ,'id_agent' => $id2)); + + if (empty ($policy)){ + returnError('error_policy', __('This policy does not exist.')); + return; + } + if (empty ($agent)){ + returnError('error_agent', __('This agent does not exist.')); + return; + } + if (empty ($policy_agent)){ + returnError('error_policy_agent', __('This agent does not exist in this policy.')); + return; + } + + $return = policies_change_delete_pending_agent($policy_agent['id']); + $data = __('Successfully added to delete pending id agent %d to id policy %d.', $id2, $id); + + if ($return === false) + returnError('error_delete_policy_agent', 'Could not be deleted id agent %d from id policy %d', $id2, $id); + else + returnData('string', array('type' => 'string', 'data' => $data)); + + +} + + /** * Create a new group. And return the id_group of the new group. * @@ -9716,6 +9774,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) { return; } $values['id_grupo'] = $other['data'][1]; + + if (groups_get_name($values['id_grupo']) === false) { + returnError('error_parameter', 'Group ID does not exist'); + return; + } } else { returnError('error_parameter', 'Group ID required.'); @@ -10059,7 +10122,7 @@ function api_get_netflow_get_summary ($discard_1, $discard_2, $params) { } //http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora -function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) { +function api_set_validate_event_by_id ($id, $trash1 = null, $trash2 = null, $returnType = 'string') { global $config; $data['type'] = 'string'; $check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id); @@ -10078,7 +10141,7 @@ function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) { 'ack_utimestamp' => $ack_utimestamp, 'estado' => 1 ); - + $result = db_process_sql_update('tevento', $values, array('id_evento' => $id)); if ($result === false) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e773224c16..17f6d9b345 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -312,6 +312,8 @@ function config_update_config () { $error_update[] = __('Autocreate profile group'); if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags')))) $error_update[] = __('Autocreate profile tags'); + if (!config_update_value ('default_no_hierarchy', (int)get_parameter ('default_no_hierarchy'))) + $error_update[] = __('Automatically assigned no hierarchy'); if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist'))) $error_update[] = __('Autocreate blacklist'); @@ -1452,7 +1454,10 @@ function config_process_config () { if (!isset ($config['default_assign_tags'])) { config_update_value ( 'default_assign_tags', ''); } - + if (!isset ($config['default_no_hierarchy'])) { + config_update_value ('default_no_hierarchy', 0); + } + if (!isset ($config['ldap_server'])) { config_update_value ( 'ldap_server', 'localhost'); } @@ -2027,6 +2032,14 @@ function config_process_config () { if (!isset($config["metaconsole_deploy_collection"])) { config_update_value('metaconsole_deploy_collection', 0); } + + if (!isset($config["metaconsole_deploy_inventory_plugin"])) { + config_update_value('metaconsole_deploy_inventory_plugin', 0); + } + + if (!isset($config["metaconsole_deploy_plugin_server"])) { + config_update_value('metaconsole_deploy_plugin_server', 0); + } } /* Finally, check if any value was overwritten in a form */ diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index b53f0041ca..42128d5c74 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -238,7 +238,7 @@ function grafico_modulo_sparse_data( } } - if($array_data === false || !isset($array_data['sum1']['data'][0][1])){ + if ($array_data === false || (!$params['graph_combined'] && !isset($array_data['sum1']['data'][0][1]))) { return false; } @@ -1049,6 +1049,10 @@ function graphic_combined_module ( $params_combined['id_graph'] = 0; } + if(!isset($params_combined['type_report'])){ + $params_combined['type_report'] = ''; + } + if(!isset($params['percentil'])){ $params_combined['percentil'] = null; } @@ -1207,8 +1211,8 @@ function graphic_combined_module ( ); $series = db_get_all_rows_sql( - 'SELECT summatory_series,average_series,modules_series - FROM tgraph + 'SELECT summatory_series,average_series, modules_series + FROM tgraph WHERE id_graph = '. $params_combined['id_graph'] ); @@ -1301,7 +1305,6 @@ function graphic_combined_module ( ); } - //XXX arreglar estas $long_index = ''; switch ($params_combined['stacked']) { default: @@ -1324,7 +1327,16 @@ function graphic_combined_module ( $i=0; $array_data = array(); + foreach ($module_list as $key => $agent_module_id) { + if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){ + $server = metaconsole_get_connection_by_id ($agent_module_id['server']); + if (metaconsole_connect ($server) != NOERR){ + continue; + } + $agent_module_id = $agent_module_id['module']; + } + $module_data = db_get_row_sql ( 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . @@ -1340,12 +1352,12 @@ function graphic_combined_module ( $data_module_graph['id_module_type'] = $module_data['id_tipo_modulo']; $data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']); $data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']); - $data_module_graph['w_min'] = $module_data['min_warning']; - $data_module_graph['w_max'] = $module_data['max_warning']; - $data_module_graph['w_inv'] = $module_data['warning_inverse']; - $data_module_graph['c_min'] = $module_data['min_critical']; - $data_module_graph['c_max'] = $module_data['max_critical']; - $data_module_graph['c_inv'] = $module_data['critical_inverse']; + $data_module_graph['w_min'] = $module_data['min_warning']; + $data_module_graph['w_max'] = $module_data['max_warning']; + $data_module_graph['w_inv'] = $module_data['warning_inverse']; + $data_module_graph['c_min'] = $module_data['min_critical']; + $data_module_graph['c_max'] = $module_data['max_critical']; + $data_module_graph['c_inv'] = $module_data['critical_inverse']; $data_module_graph['module_id'] = $agent_module_id; //stract data @@ -1357,7 +1369,7 @@ function graphic_combined_module ( $i ); - $series_suffix = $i; + $series_suffix = $i; //convert to array graph and weight foreach ($array_data_module as $key => $value) { @@ -1386,6 +1398,10 @@ function graphic_combined_module ( //$array_events_alerts[$series_suffix] = $events; $i++; + + if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){ + metaconsole_restore_db(); + } } if($params_combined['projection']){ @@ -1544,7 +1560,6 @@ function graphic_combined_module ( $water_mark, $array_events_alerts ); - break; case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: case CUSTOM_GRAPH_BULLET_CHART: diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index bfc5d3af55..be2c23518d 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -441,7 +441,7 @@ function groups_get_all($groupWithAgents = false) { * Get all groups recursive from an initial group. * * @param int Id of the parent group - * @param bool Whether to return All group or not + * @param bool Whether to force recursive search ignoring propagation (true) or not (false) * * @return Array with all result groups */ @@ -451,10 +451,11 @@ function groups_get_id_recursive($id_parent, $all = false) { $return = array_merge($return, array($id_parent)); //Check propagate - $id = db_get_value_filter('id_grupo', 'tgrupo', array('id_grupo' => $id_parent, 'propagate' => 1)); + $propagate = db_get_value_filter('propagate', 'tgrupo', array('id_grupo' => $id_parent)); - if (($id !== false) || $all) { + if (($propagate != 1) || $all) { $children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo')); + if ($children === false) { $children = array(); } diff --git a/pandora_console/include/functions_groupview.php b/pandora_console/include/functions_groupview.php index e9b7ca7c1d..55256313b2 100644 --- a/pandora_console/include/functions_groupview.php +++ b/pandora_console/include/functions_groupview.php @@ -68,6 +68,7 @@ function groupview_get_modules_counters($groups_ids = false) { ta.id_grupo AS g FROM $table ta WHERE ta.id_grupo IN ($groups_ids) + AND ta.disabled = 0 GROUP BY ta.id_grupo UNION ALL SELECT SUM(ta.normal_count) AS module_normal, diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 932e8a3457..06257a5457 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -97,6 +97,15 @@ function hd ($var, $file = '', $oneline = false) { html_debug_print ($var, $file, $oneline); } +function debug () { + $args_num = func_num_args(); + $arg_list = func_get_args(); + + for ($i = 0; $i < $args_num; $i++) { + html_debug_print($arg_list[$i], true); + } +} + function html_f2str($function, $params) { ob_start(); @@ -726,8 +735,11 @@ function html_print_extended_select_for_post_process($name, $selected = '', $selected_float = (float)$selected; $found = false; - if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) - $found = true; + if($selected){ + if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) { + $found = true; + } + } if (!$found) { $fields[$selected] = floatval($selected); @@ -1008,7 +1020,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle ++$idcounter; $valid_attrs = array ("accept", "disabled", "maxlength", - "name", "readonly", "size", "value", "accesskey", + "name", "readonly", "placeholder", "size", "value", "accesskey", "class", "dir", "id", "lang", "style", "tabindex", "title", "xml:lang", "onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown", @@ -1338,6 +1350,36 @@ function html_print_input_hidden_extended($name, $value, $id, $return = false, $ echo $output; } +/** + * Render a color input element. + * + * The element will have an id like: "hidden-$name" + * + * @param string $name Input name. + * @param int $value Input value. Decimal representation of the color's hexadecimal value. + * @param string $class Set the class of input. + * @param bool $return Whether to return an output string or echo now (optional, echo by default). + * + * @return string HTML code if return parameter is true. + */ +function html_print_input_color ($name, $value, $class = false, $return = false) { + $attr_type = 'type="color"'; + $attr_id = 'id="color-' . htmlspecialchars($name, ENT_QUOTES) . '"'; + $attr_name = 'name="' . htmlspecialchars($name, ENT_QUOTES) . '"'; + $attr_value = 'value="' . htmlspecialchars($value, ENT_QUOTES) . '"'; + $attr_class = 'class="' . ($class !== false ? htmlspecialchars($class, ENT_QUOTES) : "") . '"'; + + $output = ''; + + if ($return) return $output; + echo $output; +} + /** * Render an submit input button element. * @@ -2479,7 +2521,7 @@ function html_print_result_div ($text) { $text = preg_replace ('/\n/i','
',$text); $text = preg_replace ('/\s/i',' ',$text); - $enclose = "
"; + $enclose = "
"; $enclose .= $text; $enclose .= "
"; return $enclose; diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index 01d876697d..292d2892a7 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -79,14 +79,10 @@ function profile_create_user_profile ($id_user, $tags = '', $no_hierarchy = false ) { - global $config; if (empty ($id_profile) || $id_group < 0) - return false; - - // Secondary server is an enterprise function - if (!enterprise_installed() && $no_hierarchy) return false; + return false; // Checks if the user exists $result_user = users_get_user_by_id($id_user); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index d45abda41b..3209a61492 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -304,7 +304,8 @@ function reporting_make_reporting_data($report = null, $id_report, $report['contents'][] = reporting_availability_graph( $report, $content, - $pdf); + $pdf + ); break; case 'sql': $report['contents'][] = reporting_sql( @@ -3822,7 +3823,7 @@ function reporting_agent_configuration($report, $content) { return reporting_check_structure_content($return); } -function reporting_value($report, $content, $type, $pdf) { +function reporting_value($report, $content, $type, $pdf=false) { global $config; $return = array(); @@ -6343,13 +6344,18 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', require_once ($config["homedir"] . '/include/functions_graph.php'); - if ($config['metaconsole']) { - $id_meta = metaconsole_get_id_server($content["server_name"]); - $server = metaconsole_get_connection_by_id ($id_meta); - metaconsole_connect($server); + if ($type_report == "custom_graph") { + if (is_metaconsole()) { + $id_meta = metaconsole_get_id_server($content["server_name"]); + $server = metaconsole_get_connection_by_id ($id_meta); + if (metaconsole_connect ($server) != NOERR){ + return false; + } + } } $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); + $return = array(); $return['type'] = 'custom_graph'; @@ -6373,30 +6379,25 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', $graphs[0]["average_series"] = ''; $graphs[0]["modules_series"] = ''; $graphs[0]["fullscale"] = $content['style']['fullscale']; + $modules = $content['id_agent_module']; - if(is_array($content['id_agent_module'])){ - foreach ($content['id_agent_module'] as $key => $value) { - if($content['each_agent']){ - $modules[] = $value; - } - else{ - $modules[] = $value['module']; - } - } - } - else{ - if ($content['id_agent_module']) { - $modules[] = $content['id_agent_module']; - } else { - // restore to metaconsole database - metaconsole_restore_db(); - $module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']); + if(!$modules){ + $module_source = db_get_all_rows_sql( + "SELECT id_agent_module, id_server + FROM tgraph_source + WHERE id_graph = " . + $content['id_gs'] + ); + + if(isset($module_source) && is_array($module_source)){ + $modules = array(); foreach ($module_source as $key => $value) { - $modules[$key] = $value['id_agent_module']; + $modules[$key]['module'] = $value['id_agent_module']; + $modules[$key]['server'] = $value['id_server']; } - metaconsole_connect($server); } } + $id_graph = 0; } else { @@ -6436,7 +6437,8 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', 'summatory' => $graphs[0]["summatory_series"], 'average' => $graphs[0]["average_series"], 'modules_series' => $graphs[0]["modules_series"], - 'id_graph' => $id_graph + 'id_graph' => $id_graph, + 'type_report' => $type_report ); $return['chart'] = graphic_combined_module( @@ -6445,13 +6447,13 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', $params_combined ); - break; - case 'data': break; } - if ($config['metaconsole']) { - metaconsole_restore_db(); + if ($type_report == "custom_graph") { + if (is_metaconsole()) { + metaconsole_restore_db(); + } } return reporting_check_structure_content($return); @@ -10001,7 +10003,7 @@ You can of course remove the warnings, that's why we include the source and do n $output .= 'parameters["page"] = "include/ajax/events";'; $output .= 'parameters["total_events"] = 1;'; - $output .= '$.ajax({type: "GET",url: "ajax.php",data: parameters,'; + $output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,'; $output .= 'success: function(data) {'; $output .= '$("#total_events").text(data);'; $output .= '}'; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 3df0b56cfe..182977207d 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2428,12 +2428,18 @@ function reporting_html_availability(&$table, $item) { function reporting_html_availability_graph(&$table, $item, $pdf=0) { global $config; $metaconsole_on = is_metaconsole(); - if($metaconsole_on && $pdf==0){ - $src= '../../'; + + if($metaconsole_on){ + $hack_metaconsole = "../../"; } else{ - $src=$config['homeurl']; + $hack_metaconsole = ""; } + + $src=ui_get_full_url(false); + + $tables_chart = ''; + $table1 = new stdClass(); $table1->width = '99%'; $table1->data = array (); @@ -2471,6 +2477,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) { $table1->data[0][1] = $chart['chart']; $table1->data[0][2] = "" . $sla_value . ''; $table1->data[0][3] = $checks_resume; + $tables_chart .= html_print_table($table1, true); } if($item['type'] == 'availability_graph'){ @@ -2480,43 +2487,43 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) { $table2->data = array (); $table2->size = array (); $table2->size[0] = '2%'; - $table2->data[0][0] = ''; + $table2->data[0][0] = ''; $table2->size[1] = '14%'; $table2->data[0][1] = ''.__('OK') . ''; $table2->size[2] = '2%'; - $table2->data[0][2] = ''; + $table2->data[0][2] = ''; $table2->size[3] = '14%'; $table2->data[0][3] = ''.__('Critical'). ''; $table2->size[4] = '2%'; - $table2->data[0][4] = ''; + $table2->data[0][4] = ''; $table2->size[5] = '14%'; $table2->data[0][5] = ''.__('Unknow'). ''; $table2->size[6] = '2%'; - $table2->data[0][6] = ''; + $table2->data[0][6] = ''; $table2->size[7] = '14%'; $table2->data[0][7] = ''.__('Not Init'). ''; $table2->size[8] = '2%'; - $table2->data[0][8] = ''; + $table2->data[0][8] = ''; $table2->size[9] = '14%'; $table2->data[0][9] = ''.__('Downtimes'). ''; $table2->size[10] = '2%'; - $table2->data[0][10] = ''; + $table2->data[0][10] = ''; $table2->size[11] = '15%'; $table2->data[0][11] = ''.__('Ignore time'). ''; } $table->colspan['charts']['cell'] = 2; - $table->data['charts']['cell'] = html_print_table($table1, true); + $table->data['charts']['cell'] = $tables_chart; $table->colspan['legend']['cell'] = 2; $table->data['legend']['cell'] = html_print_table($table2, true); if($pdf){ - return html_print_table($table1, true) . '
' . html_print_table($table2, true); + return $tables_chart . '
' . html_print_table($table2, true); } } diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 72a222becd..a4be0d445e 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -278,6 +278,11 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = )); $salida = ui_get_snapshot_image($link, $is_snapshot) . '  '; } + + if($salida !== NULL){ + $last_data_str = html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px')); + } + $last_data_str .= $salida; } else { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 999ff4337b..8f6f5a35d8 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3884,7 +3884,7 @@ function ui_print_module_string_value($value, $id_agente_module, " / " . $module_name; $salida = "
" . + 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) { + $color = $range["color"]; + break; + } + } + } + } + + ob_start(); +?> + + + + + + + + + + + \ No newline at end of file diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 9799c65b62..4b835d65fc 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -62,7 +62,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'clock' => __('Clock'), 'group_item' => __('Group'), 'box_item' => __('Box'), - 'line_item' => __('Line')); + 'line_item' => __('Line'), + 'color_cloud' => __('Color cloud') + ); if (enterprise_installed()) { enterprise_visual_map_editor_add_title_palette($titles); @@ -328,7 +330,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'color_cloud'); $form_items['agent_row']['html'] = '' . __('Agent') . ''; $params = array(); @@ -395,7 +397,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph'); + 'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph', + 'color_cloud'); $form_items['module_row']['html'] = '' . __('Module') . ' ' . @@ -510,7 +513,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { __('Max value') . ' ' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . ''; - $percentile_type = array('percentile' => __('Percentile'), 'bubble' => __('Bubble'), 'circular_progress_bar' => __('Circular progress bar'), 'interior_circular_progress_bar' => __('Circular progress bar (interior)')); + $percentile_type = array( + "percentile" => __("Percentile"), + "bubble" => __("Bubble"), + "circular_progress_bar" => __("Circular porgress bar"), + "interior_circular_progress_bar" => __("Circular progress bar (interior)") + ); $percentile_value = array('percent' => __('Percent'), 'value' => __('Value')); if (is_metaconsole()){ $form_items['percentile_item_row_3'] = array(); @@ -534,14 +542,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['percentile_item_row_3']['html'] = '' . __('Type') . ' ' . - html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true) . + html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false) . ''; $form_items['percentile_item_row_4'] = array(); $form_items['percentile_item_row_4']['items'] = array('percentile_bar', 'percentile_item', 'datos'); $form_items['percentile_item_row_4']['html'] = '' . __('Value to show') . ' ' . - html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true) . + html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false) . ''; } @@ -580,7 +588,70 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { '' . __('Show statistics') . ' ' . html_print_checkbox('show_statistics', 1, '', true) . ''; + + // 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"] = + "" . __("Diameter") . " + " . + html_print_input_text("diameter", $default_diameter, "", 3, 5, true) . + ""; + + // 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"] = + "" . __("Default color") . " + " . + html_print_input_color("default_color", $default_color, false, true) . + ""; + + // 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"] = + "" . + __("Ranges") . + ui_print_help_tip($color_range_tip, true) . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "" . + "
" . __("From value") . "" . + html_print_input_text("from_value_new", "", "", 5, 255, true) . + "" . + "" . + html_print_image("images/add.png", true) . + "" . + "
" . __("To value") . "" . + html_print_input_text("to_value_new", "", "", 5, 255, true) . + "
" . __("Color") . "" . + html_print_input_color("color_new", $default_color, false, true) . + "
" . + ""; + // End of Color Cloud rows + $form_items['show_on_top_row'] = array(); $form_items['show_on_top_row']['items'] = array('group_item'); $form_items['show_on_top_row']['html'] = @@ -616,7 +687,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { __('Type') . ' ' . html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true) . ''; - + //Insert and modify before the buttons to create or update. if (enterprise_installed()) { enterprise_visual_map_editor_modify_form_items_palette($form_items); @@ -661,7 +732,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['position_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', 'label', 'icon', 'datos', 'box_item', - 'auto_sla_graph', 'bars_graph','clock', 'donut_graph'); + 'auto_sla_graph', 'bars_graph','clock', 'donut_graph', 'color_cloud'); $form_items_advance['position_row']['html'] = ' ' . __('Position') . ' (' . html_print_input_text('left', '0', '', 3, 5, true) . @@ -750,6 +821,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { var $mapLinkedSelect = $("select#map_linked"); var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id"); var visualMaps = ; + if (!(visualMaps instanceof Array)) visualMaps = []; var nodesById = ; visualMaps.forEach(function (vMap) { @@ -870,7 +942,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['element_group_row']['items'] = array( 'group_item', 'static_graph', 'percentile_bar', 'percentile_item', 'module_graph', 'simple_value', - 'icon', 'label', 'datos', 'donut_graph'); + 'icon', 'label', 'datos', 'donut_graph', 'color_cloud'); $form_items_advance['element_group_row']['html'] = ''. __('Restrict access to group') . '' . '' . @@ -1021,6 +1093,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('group_item', __('Group'), 'left', false, 'group_item_min', true); visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item_min', true); visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item_min', true); + visual_map_print_button_editor('color_cloud', __('Color cloud'), 'left', false, 'color_cloud_min', true); if(defined("METACONSOLE")){ echo 'The data displayed in editor mode is not real'; diff --git a/pandora_console/include/graphs/flot/jquery.flot.exportdata.pandora.js b/pandora_console/include/graphs/flot/jquery.flot.exportdata.pandora.js index 781c1d1cc0..5bc3ef32b1 100644 --- a/pandora_console/include/graphs/flot/jquery.flot.exportdata.pandora.js +++ b/pandora_console/include/graphs/flot/jquery.flot.exportdata.pandora.js @@ -159,9 +159,10 @@ if (custom_graph) { dataObject = retrieveDataOject(dataObjects,0); - dataObjects.forEach(function (element) { - elements.push(processDataObject(element)); - }); + //dataObjects.forEach(function (element) { + //elements.push(processDataObject(element)); + //}); + elements.push(processDataObject(dataObject)); graphData = elements; } else { diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 7067e1d560..e69fb155e0 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -362,10 +362,11 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, tickFormatter: xFormatter, }, yaxis: { - color: tick_color, - axisLabelUseCanvas: true, - axisLabelFontSizePixels: font_size, - axisLabelFontFamily: font+'Font', + font: { + size: font_size + 2, + color: 'rgb(84, 84, 84)', + family: font+'Font' + }, ticks: yFormatter, }, legend: { @@ -417,7 +418,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, div_attributes += "min-height: 2.5em;"; } - div_attributes += '" title="'+title+'" class="'+font+'" '+ ' style="overflow: hidden;"'; + div_attributes += '" title="'+title+'" style="overflow: hidden;"'; format.push([i,'
' + label diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 7524fc119e..46191aed93 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -409,12 +409,14 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark, $colors = implode($separator, $colors); } - $return .= ""; return $return; @@ -474,11 +476,11 @@ function flot_custom_pie_chart ($graph_values, $colors = implode($separator, $temp_colors); $return .= ""; return $return; @@ -575,10 +577,10 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = // Javascript code $return .= ""; return $return; @@ -666,7 +668,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon // Javascript code $return .= ""; return $return; @@ -841,7 +843,9 @@ function flot_slicesbar_graph ( // Javascript code $return .= ""; diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 29728984e1..f33a3b5e68 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1332,7 +1332,7 @@ function print_phases_donut (recipient, phases) { var svg = d3.select(recipient) .append("svg") .attr("width", 800) - .attr("height", 400) + .attr("height", 500) .append("g"); svg.append("g") @@ -1361,7 +1361,7 @@ function print_phases_donut (recipient, phases) { .outerRadius(radius * 0.9); width = 800; - height = 400; + height = 500; svg.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"); var key = function(d){ return d.data.label; }; @@ -1440,6 +1440,8 @@ function print_phases_donut (recipient, phases) { return d.startAngle + (d.endAngle - d.startAngle)/2; } + var ex = 1; + var sum = 0; text.transition().duration(0) .attrTween("transform", function(d) { this._current = this._current || d; @@ -1447,8 +1449,26 @@ function print_phases_donut (recipient, phases) { this._current = interpolate(0); return function(t) { var d2 = interpolate(t); - var pos = outerArc.centroid(d2); - pos[0] = radius * (midAngle(d2) < Math.PI ? 1 : -1); + + //fix for labels of a very small portion increase the + //height of the label so that they do not overlap + if( ( d2.endAngle - d2.startAngle ) < 0.1){ + var pos = outerArc.centroid(d2); + if (ex%2==0){ + pos[0] = 150; + } + else{ + pos[0] = -150; + sum++; + } + pos[1] = pos[1] - (35*sum); + ex++; + } + else{ + var pos = outerArc.centroid(d2); + pos[0] = radius * (midAngle(d2) < Math.PI ? 1 : -1); + } + return "translate("+ pos +")"; }; }) @@ -1458,6 +1478,17 @@ function print_phases_donut (recipient, phases) { this._current = interpolate(0); return function(t) { var d2 = interpolate(t); + + //fix for labels of a very small portion increase the + //height of the label so that they do not overlap + if( ( d2.endAngle - d2.startAngle ) < 0.1){ + if (ex%2==0){ + return "start"; + } + else{ + return "end"; + } + } return midAngle(d2) < Math.PI ? "start":"end"; }; }); @@ -1468,10 +1499,12 @@ function print_phases_donut (recipient, phases) { /* ------- SLICE TO TEXT POLYLINES -------*/ var polyline = svg.select(".lines").selectAll("polyline") .data(pie(data), key); - + polyline.enter() .append("polyline"); + var ex2 = 1; + var sum2 = 0; polyline.transition().duration(0) .attrTween("points", function(d){ this._current = this._current || d; @@ -1479,16 +1512,33 @@ function print_phases_donut (recipient, phases) { this._current = interpolate(0); return function(t) { var d2 = interpolate(t); - var pos = outerArc.centroid(d2); - pos[0] = radius * 0.95 * (midAngle(d2) < Math.PI ? 1 : -1); + + //fix for labels of a very small portion increase the + //height of the label so that they do not overlap + if( ( d2.endAngle - d2.startAngle ) < 0.1){ + var pos = outerArc.centroid(d2); + if (ex2%2==0){ + pos[0] = 150 * 0.95; + } + else{ + pos[0] = -150 * 0.95; + sum2++; + } + pos[1] = pos[1] - (30*sum2); + ex2++; + } + else{ + var pos = outerArc.centroid(d2); + pos[0] = radius * 0.95 * (midAngle(d2) < Math.PI ? 1 : -1); + } return [arc.centroid(d2), outerArc.centroid(d2), pos]; - }; + }; }) .style("stroke", "black") .style("opacity", ".3") .style("stroke-width", "2px") .style("fill", "none"); - + polyline.exit() .remove(); } @@ -2331,4 +2381,4 @@ var digitPattern = [ setTimeout(tick, 1000 - now % 1000); })(); -} \ No newline at end of file +} diff --git a/pandora_console/include/help/en/help_plugin_macros.php b/pandora_console/include/help/en/help_plugin_macros.php index 1660c45e13..6d1e508b21 100644 --- a/pandora_console/include/help/en/help_plugin_macros.php +++ b/pandora_console/include/help/en/help_plugin_macros.php @@ -31,10 +31,10 @@ Hidden this macros because they cannot edit in the module form -->
  • _plugin_parameters_ : Plug-in Parameters of the module.
  • -
  • _name_tag_ : Nombre de los tags asociados al módulo.
  • -
  • _email_tag_ : Emails asociados a los tags de módulos.
  • -
  • _phone_tag_ : Teléfonos asociados a los tags de módulos.
  • -
  • _moduletags_ : Teléfonos asociados a los tags de módulos.
  • +
  • _name_tag_ : Names of the tags associated to the module.
  • +
  • _email_tag_ : Emails associated to module tags.
  • +
  • _phone_tag_ : Phone numbers associated to module tags.
  • +
  • _moduletags_ : URLs associated to module tags.
  • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
  • diff --git a/pandora_console/include/help/es/help_plugin_macros.php b/pandora_console/include/help/es/help_plugin_macros.php index 701d15f35e..77c97aa4d7 100644 --- a/pandora_console/include/help/es/help_plugin_macros.php +++ b/pandora_console/include/help/es/help_plugin_macros.php @@ -30,9 +30,9 @@ Hidden this macros because they cannot edit in the module form -->

  • _plugin_parameters_ : Parámetros del Plug-in del módulo.
  • -
  • _name_tag_ : Names of the tags associated to the module.
  • -
  • _email_tag_ : Emails associated to the module tags.
  • -
  • _phone_tag_ : Phone numbers associated to the module tags.
  • -
  • _moduletags_ : URLs associated to the module tags.
  • +
  • _name_tag_ : Nombre de los tags asociados al módulo.
  • +
  • _email_tag_ : Emails asociados a los tags de módulos.
  • +
  • _phone_tag_ : Teléfonos asociados a los tags de módulos.
  • +
  • _moduletags_ : URLs asociadas a los tags de módulos.
  • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
  • diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index 7cc18ec790..bd0da308c4 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -26,7 +26,8 @@ $.fn.showMessage = function (msg) { return $(this).hide ().empty () - .text (msg) + // here, previously .text (msg) + .html (msg) .slideDown (); }; }) (jQuery); diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 2b323a55f1..1ca0759801 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -594,12 +594,51 @@ function post_process_select_init_unit(name,selected) { function post_process_select_events_unit(name,selected) { $('.' + name + '_toggler').click(function() { - $('#' + name + '_select option[value=none]').attr("selected",true); - $('#text-' + name + '_text').val(""); + var value = $('#text-' + name + '_text').val(); + + var count = $('#' + name + '_select option') + .filter(function(i, item) { + + if ($(item).val() == value) + return true; + else return false; + }) + .length; + + if (count != 1) { + $('#' + name + '_select') + .append($("
    "; - if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') { - echo " - Drop Database if exists
    - - "; - } else { - echo ""; - } + echo ""; echo "URL path to Pandora FMS Console
    For example '/pandora_console'
    diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index 4c9a546798..49c2f27cb4 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -18,6 +18,7 @@ global $config; require_once ("include/functions_agents.php"); require_once ("include/functions_custom_graphs.php"); +ui_require_javascript_file ('calendar'); if (! check_acl ($config['id_user'], $id_grupo, "AR") && ! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", @@ -242,7 +243,7 @@ echo '
    '; //Dialog to save the custom graph echo "'; } -?> +?> \ No newline at end of file diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index ad692695ae..5f76201864 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -559,6 +559,18 @@ if ($validate) { if ($delete) { $ids = (array) get_parameter ("validate_ids", -1); + // Discard deleting in progress events + $in_process_status = db_get_all_rows_sql(" + SELECT id_evento + FROM tevento + WHERE estado=2"); + + foreach ($in_process_status as $val) { + if (($key = array_search($val['id_evento'], $ids)) !== false) { + unset($ids[$key]); + } + } + if ($ids[0] != -1) { $return = events_delete_event ($ids, ($group_rep == 1), $meta); ui_print_result_message ($return, diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index d1a66c0a3e..3f8775dced 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -321,7 +321,7 @@ switch ($opt) { // Last contact $row = array(); $row[] = __('Last contact'); - if ($agent["ultimo_contacto"] == "01-01-1970 00:00:00") { + if ($agent["ultimo_contacto"] == "1970-01-01 00:00:00") { $row[] = __('Never'); } else { @@ -332,7 +332,7 @@ switch ($opt) { // Last remote contact $row = array(); $row[] = __('Remote'); - if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") { + if ($agent["ultimo_contacto_remoto"] == "1970-01-01 00:00:00") { $row[] = __('Never'); } else { diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 2c33acdea6..1c2eb0ef2e 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -74,9 +74,9 @@ if (isset ($_GET["modified"]) && !$view_mode) { $upd_info["lastname"] = get_parameter_post ("lastname", $user_info["lastname"]); $password_new = get_parameter_post ("password_new", ""); $password_confirm = get_parameter_post ("password_conf", ""); - $upd_info["email"] = get_parameter_post ("email", $user_info["email"]); - $upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]); - $upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]); + $upd_info["email"] = get_parameter_post ("email", ""); + $upd_info["phone"] = get_parameter_post ("phone", ""); + $upd_info["comments"] = get_parameter_post ("comments", ""); $upd_info["language"] = get_parameter_post ("language", $user_info["language"]); $upd_info["timezone"] = get_parameter_post ("timezone", ""); $upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]); @@ -164,25 +164,36 @@ if (isset ($_GET["modified"]) && !$view_mode) { $success_msg = __('Password successfully updated'); } - $return_update_user = update_user ($id, $upd_info); + // if info is valid then proceed with update + if ((filter_var($upd_info["email"], FILTER_VALIDATE_EMAIL) || $upd_info["email"]=="") && (preg_match('/^[0-9- ]+$/D', $upd_info["phone"]) || $upd_info["phone"]=="")) { + $return_update_user = update_user ($id, $upd_info); - if ($return_update_user === false) { - $error_msg = __('Error updating user info'); - } - elseif($return_update_user == true){ - $success_msg = __('User info successfully updated'); - } - else{ - if(!empty($password_new) && !empty($password_confirm)){ - $success_msg = __('Password successfully updated'); - } + if ($return_update_user === false) { + $error_msg = __('Error updating user info'); + } + elseif($return_update_user == true){ + $success_msg = __('User info successfully updated'); + } else{ - $return=false; - $error_msg = __('No changes have been made'); - } + if(!empty($password_new) && !empty($password_confirm)){ + $success_msg = __('Password successfully updated'); + } + else{ + $return=false; + $error_msg = __('No changes have been made'); + } + } + + ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error); + } + else if (!filter_var($upd_info["email"], FILTER_VALIDATE_EMAIL)) + ui_print_error_message (__('Please enter a valid email')); + else if (!preg_match('/^[0-9- ]+$/D', $upd_info["phone"])) + ui_print_error_message (__('Please enter a valid phone number')); $user_info = $upd_info; + } else{ if(!$error_msg){ @@ -190,9 +201,10 @@ if (isset ($_GET["modified"]) && !$view_mode) { } $user_auth_error= $config['auth_error']; + + ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error); } - ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error); } // Prints action status for current message @@ -221,7 +233,7 @@ $data = array(); $data[0] = '' . __('User ID') . ''; $data[0] .= $jump . '' . $id . ''; $data[1] = '' . __('Full (display) name') . ''; -$data[1] .= $jump . '' . html_print_input_text_extended ("fullname", $user_info["fullname"], '', '', 20, 100, $view_mode, '', 'class="input"', true).''; +$data[1] .= $jump . '' . html_print_input_text_extended ("fullname", $user_info["fullname"], 'fullname', '', 20, 100, $view_mode, '', 'class="input"', true).''; // Show "Picture" (in future versions, why not, allow users to upload it's own avatar here. if (is_user_admin ($id)) { @@ -243,9 +255,9 @@ $table->data[] = $data; $data = array(); $data[0] = ''.__('E-mail').''; -$data[0] .= $jump .''. html_print_input_text_extended ("email", $user_info["email"], '', '', '25', '100', $view_mode, '', 'class="input"', true).''; +$data[0] .= $jump .''. html_print_input_text_extended ("email", $user_info["email"], 'email', '', '25', '100', $view_mode, '', 'class="input"', true).''; $data[1] = ''.__('Phone number').''; -$data[1] .= $jump . '
    '.html_print_input_text_extended ("phone", $user_info["phone"], '', '', '20', '30', $view_mode, '', 'class="input"', true).'
    '; +$data[1] .= $jump . '
    '.html_print_input_text_extended ("phone", $user_info["phone"], 'phone', '', '20', '30', $view_mode, '', 'class="input"', true).'
    '; $table->rowclass[] = ''; $table->rowstyle[] = 'font-weight: bold;'; $table->data[] = $data; @@ -254,9 +266,9 @@ if ($view_mode === false) { if ($config["user_can_update_password"]) { $data = array(); $data[0] = ''.__('New Password').''; - $data[0] .= $jump .''.html_print_input_text_extended ("password_new", "", '', '', '25', '45', $view_mode, '', 'class="input"', true, true).''; + $data[0] .= $jump .''.html_print_input_text_extended ("password_new", "", 'password_new', '', '25', '45', $view_mode, '', 'class="input"', true, true).''; $data[1] = ''.__('Password confirmation').''; - $data[1] .= $jump . ''.html_print_input_text_extended ("password_conf", "", '', '', '20', '45', $view_mode, '', 'class="input"', true, true).''; + $data[1] .= $jump . ''.html_print_input_text_extended ("password_conf", "", 'password_conf', '', '20', '45', $view_mode, '', 'class="input"', true, true).''; $table->rowclass[] = ''; $table->rowstyle[] = 'font-weight: bold;'; $table->data[] = $data; diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index 20dd1d1346..f3cd5523e4 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index 9ae238917f..b05edc5e78 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 @@ -28,7 +28,7 @@ BuildRoot: %{_tmppath}/%{name} BuildArch: noarch AutoReq: 0 Requires: apache2 -Requires: (apache2-mod_php5 or apache2-mod_php7) +Requires: apache2-mod_php7 Requires: php >= 4.3.0 Requires: php-gd, php-snmp, php-json, php-gettext Requires: php-mysqlnd, php-ldap, php-mbstring, php diff --git a/pandora_console/pandora_console_install b/pandora_console/pandora_console_install index bc6c9e9752..c834f83769 100644 --- a/pandora_console/pandora_console_install +++ b/pandora_console/pandora_console_install @@ -9,7 +9,7 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.729" +PI_VERSION="7.0NG.730" FORCE=0 DESTDIR="" LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 054204d85a..7f8197540b 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1251,6 +1251,7 @@ CREATE TABLE IF NOT EXISTS `treport` ( `metaconsole` tinyint(1) DEFAULT 0, `non_interactive` tinyint(1) UNSIGNED NOT NULL default 0, `hidden` tinyint(1) DEFAULT 0, + `orientation` varchar(25) NOT NULL default 'vertical', PRIMARY KEY(`id_report`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -2621,6 +2622,7 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` ( `user_comment` text NOT NULL, `id_tag` integer(10) unsigned NOT NULL default '0', `name` text default '', + `group_recursion` INT(1) unsigned default 0, PRIMARY KEY (`id_event_rule`), KEY `idx_id_event_alert` (`id_event_alert`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index 9584941943..674c0d718a 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.729-181211 +Version: 7.0NG.730-190116 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index e4a79fc302..a5f005088e 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.729-181211" +pandora_version="7.0NG.730-190116" package_cpan=0 package_pandora=1 diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 681ca471d8..cf651cfeb3 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -1,7 +1,7 @@ ############################################################################# # Pandora FMS Server Parameters # Pandora FMS, the Flexible Monitoring System. -# Version 7.0NG.729 +# Version 7.0NG.730 # Licensed under GPL license v2, # (c) 2003-2017 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 1b7cbd72ca..6c90dba2dc 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -44,8 +44,8 @@ our @EXPORT = qw( ); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.729"; -my $pandora_build = "181211"; +my $pandora_version = "7.0NG.730"; +my $pandora_build = "190116"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm index c73a9b53b1..5f91cc4b0d 100644 --- a/pandora_server/lib/PandoraFMS/PluginTools.pm +++ b/pandora_server/lib/PandoraFMS/PluginTools.pm @@ -31,8 +31,8 @@ use base 'Exporter'; our @ISA = qw(Exporter); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.729"; -my $pandora_build = "181211"; +my $pandora_version = "7.0NG.730"; +my $pandora_build = "190116"; our $VERSION = $pandora_version." ".$pandora_build; our %EXPORT_TAGS = ( 'all' => [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 509867278b..87903a3efb 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c40d4371c0..1f46908e02 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.729 -%define release 181211 +%define version 7.0NG.730 +%define release 190116 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 4dca27ac5d..636984f6b0 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -8,8 +8,8 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.729" -PI_BUILD="181211" +PI_VERSION="7.0NG.730" +PI_BUILD="190116" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index b994f34cfc..da655fa933 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.729 PS181211"; +my $version = "7.0NG.730 PS190116"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ef9f528623..85e8ce85f6 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.729 PS181211"; +my $version = "7.0NG.730 PS190116"; # save program name for logging my $progname = basename($0); @@ -195,6 +195,7 @@ sub help_screen{ help_screen_line('--apply_policy', '', 'Force apply a policy'); help_screen_line('--apply_all_policies', '', 'Force apply to all the policies'); help_screen_line('--add_agent_to_policy', ' ', 'Add an agent to a policy'); + help_screen_line('--remove_agent_from_policy', ' ', 'Delete an agent to a policy'); help_screen_line('--delete_not_policy_modules', '', 'Delete all modules without policy from configuration file'); help_screen_line('--disable_policy_alerts', '', 'Disable all the alerts of a policy'); help_screen_line('--create_policy', ' '); @@ -4101,6 +4102,19 @@ sub cli_policy_add_agent() { } } +############################################################################## +# delete an agent to a policy +# Related option: --remove_agent_from_policy +############################################################################## + +sub cli_policy_delete_agent() { + my ($policy_id, $agent_id) = @ARGV[2..3]; + + my $result = api_call(\%conf,'set', 'remove_agent_from_policy', $policy_id, $agent_id); + print "$result \n\n "; + +} + sub cli_create_planned_downtime() { my $name = @ARGV[2]; my @todo = @ARGV[3..21]; @@ -5836,6 +5850,10 @@ sub pandora_manage_main ($$$) { param_check($ltotal, 2); cli_policy_add_agent(); } + elsif ($param eq '--remove_agent_from_policy') { + param_check($ltotal, 2); + cli_policy_delete_agent(); + } elsif ($param eq '--enable_user') { param_check($ltotal, 1); cli_user_enable(); diff --git a/pandora_server/util/pwrd/README.txt b/pandora_server/util/pwrd/README.txt deleted file mode 100644 index 8cdd5d2c6c..0000000000 --- a/pandora_server/util/pwrd/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -instalar java -instalar selenium (descargar) -instalar xorg-x11-server-Xvfb -#wget ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm -#yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm -#Xvfb :99 -ac & ----> Pulsar Enter para continuar -#export DISPLAY=:99 -#java -jar seleniumXXX.jar - -Ya tenemos funcionando Selenium sin necesidad de X. - - - diff --git a/pandora_server/util/pwrd/config.json b/pandora_server/util/pwrd/config.json deleted file mode 100644 index a93b44f7b7..0000000000 --- a/pandora_server/util/pwrd/config.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "capabilities": [ - { - "browserName": "*firefox", - "maxInstances": 1, - "seleniumProtocol": "Selenium" - }, - { - "browserName": "firefox", - "maxInstances": 1, - "seleniumProtocol": "WebDriver" - } - ], - "configuration": { - "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", - "maxSession": 1, - "port": 5555, - "register": true, - "registerCycle": 5000 - } -} \ No newline at end of file diff --git a/pandora_server/util/pwrd/extras/crontab_entries_sample b/pandora_server/util/pwrd/extras/crontab_entries_sample deleted file mode 100644 index 8dc9018ef5..0000000000 --- a/pandora_server/util/pwrd/extras/crontab_entries_sample +++ /dev/null @@ -1,20 +0,0 @@ -# Sample PWRD crontab control tweaks - -# Do not allow firefox running for more than 1h -0 * * * * root /opt/pwrd_maintenance.sh -k - -# Force node-start -*/5 * * * * root /opt/pwrd_maintenance.sh -s - -# Reset firefox version if does not match required 47.0.1 -* * * * * root /opt/pwrd_maintenance.sh -f - -# Restart node if java process is not found -* * * * * root /opt/pwrd_maintenance.sh -r - -# Restart node if no activity since last check -*/5 * * * * root /opt/pwrd_maintenance.sh -c1 - -# Restart node if connection have been lost to hub -*/5 * * * * root /opt/pwrd_maintenance.sh -c2 - diff --git a/pandora_server/util/pwrd/extras/pwrd_maintenance.sh b/pandora_server/util/pwrd/extras/pwrd_maintenance.sh deleted file mode 100755 index cc71eefb9f..0000000000 --- a/pandora_server/util/pwrd/extras/pwrd_maintenance.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# Sample PWRD maintenance script -# ********************************************************************** - -# ********************************************************************** -# Settings -hub_ip="192.168.1.10" -hub_port="4444" - -# Customize PWR global installation directory -PWR_FIREFOX_INSTALLDIR="/opt" - -# ********************************************************************** - -if [ "$1" == "-k" ]; then - killall --older-than 1h firefox >/dev/null 2>&1 - -elif [ "$1" == "-s" ]; then - /etc/init.d/pwrd start-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1 - -elif [ "$1" == "-f" ]; then - if [ "`firefox --version`" != "Mozilla Firefox 47.0.1" ]; then - $PWR_FIREFOX_INSTALLDIR/restore_firefox.sh >/dev/null 2>&1 - echo `date +"%c"` Firefox restored > /tmp/restore_firefox.log - [`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1 - [`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1 - fi - -elif [ "$1" == "-r" ]; then - if [ ` ps aux | grep "java -jar" | grep -v grep | wc -l` -lt 1 ]; then - [`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1 - [`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1 - echo `date +"%c"` PWRD restarted, java process not found > /tmp/pwrd_restart_detected.log - fi - -elif [ "$1" == "-c1" ]; then - if [ $(/etc/pandora/plugins/grep_log /var/log/pwr/pwr_std.log check_pwrd ".*" | wc -l) -eq 0 ]; then - [`/etc/init.d/pwrd status | grep "Node is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1 - [`/etc/init.d/pwrd status | grep "PWRD is running" | wc -l` -eq 1 ] && /etc/init.d/pwrd restart > /dev/null 2>&1 - echo $(date +"%c") PWRD restarted, no output detected in log > /tmp/pwrd_restart_detected.log - fi - -elif [ "$1" == "-c2" ]; then - if [ $(/etc/pandora/plugins/grep_log /var/log/pwr/pwr_std.log check_pwrd_err_conn "refused" | grep "$hub_ip:$hub_port [/$hub_ip] failed:" | wc -l) -gt 0 ]; then - /etc/init.d/pwrd restart-node http://$hub_ip:$hub_port/grid/register > /dev/null 2>&1 - echo $(date +"%c") PWRD restarted, lost connection with hub > /tmp/pwrd_restart_detected.log - fi -fi - - - diff --git a/pandora_server/util/pwrd/extras/restore_firefox.sh b/pandora_server/util/pwrd/extras/restore_firefox.sh deleted file mode 100755 index 245a7dde19..0000000000 --- a/pandora_server/util/pwrd/extras/restore_firefox.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Script to restore firefox to tar -# -# ********************************************************************** - -# Customize PWR global installation directory -PWR_FIREFOX_INSTALLDIR="/opt" - -cd $PWR_FIREFOX_INSTALLDIR - -if [ -f firefox-47.0.1.tar ]; then - rm -rf firefox-47 >/dev/null 2>&1 - mv firefox firefox_ >/dev/null 2>&1 - tar xvf firefox-47.0.1.tar >/dev/null 2>&1 - mv firefox firefox-47 >/dev/null 2>&1 - mv firefox_ firefox >/dev/null 2>&1 -else - echo "firefox-47.0.1.tar not found, please leave a copy at $PWR_FIREFOX_INSTALLDIR" -fi diff --git a/pandora_server/util/pwrd/firefox-47.0.1.tar.REMOVED.git-id b/pandora_server/util/pwrd/firefox-47.0.1.tar.REMOVED.git-id deleted file mode 100644 index 03f39ef914..0000000000 --- a/pandora_server/util/pwrd/firefox-47.0.1.tar.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4881ba55982d75040775bafdffcdf57b2cd7ea13 \ No newline at end of file diff --git a/pandora_server/util/pwrd/firefox_profile.tar.gz b/pandora_server/util/pwrd/firefox_profile.tar.gz deleted file mode 100644 index 15e1e4f2fc..0000000000 Binary files a/pandora_server/util/pwrd/firefox_profile.tar.gz and /dev/null differ diff --git a/pandora_server/util/pwrd/install_pwrd.sh b/pandora_server/util/pwrd/install_pwrd.sh deleted file mode 100755 index e36d87b640..0000000000 --- a/pandora_server/util/pwrd/install_pwrd.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash - -HELP=`cat<<_HELP -********************** - PWR Server installer -********************** - -To install the Pandora web robot daemon (pwrd) -Please launch this script as root: - -$0 --install [[user] [directory]] - - -_HELP -` - -if [ "$1" == "" ] || [ "$1" != "--install" ]; then - echo "$HELP" - exit 0 -fi - -if [ "`which rpm`" ]; then - if [ "`rpm -qa | grep xorg-x11-server-Xvfb | wc -l`" == "0" ]; then - echo "Package xorg-x11-server-Xvfb is required" - exit 0 - fi -else - echo "Xvfb is required, please confirm is installed in your system" -fi - -# default user is running user -GLOBAL_INST_USER=`whoami` - -if [ "$2" != "" ]; then - if [ `cat /etc/passwd | cut -f1 -d':' | grep -w "$2" | wc -l` -gt 0 ]; then - GLOBAL_INST_USER=$2 - elif [ -d "$2" ]; then - GLOBAL_INST_DIR=$2 - else - echo "Cannot use \"$2\" as user nor directory" - echo "$HELP" - exit 0 - fi -fi - -if [ "$3" != "" ]; then - if [ -d "$3" ]; then - GLOBAL_INST_DIR=$3 - elif [ `cat /etc/passwd | cut -f1 -d':' | grep -w "$3" | wc -l` -gt 0 ]; then - GLOBAL_INST_USER=$3 - else - echo "Cannot use \"$3\" as directory nor user" - echo "$HELP" - exit 0 - fi -fi - -chmod +x pwrd - -PWR_SERVER_DEST=$GLOBAL_INST_DIR/usr/lib/pwr -PWR_SERVER_RSC=$GLOBAL_INST_DIR/etc/pwr/tmp -PWR_SERVER_LOG=$GLOBAL_INST_DIR/var/log/pwr -PWR_FIREFOX_INSTALLDIR=$GLOBAL_INST_DIR/opt - -PWR_FIREFOX_INSTALLDIR_ESCAPED=`echo $PWR_FIREFOX_INSTALLDIR | sed 's/\\//\\\\\//g'` -GLOBAL_INST_DIR_ESCAPED=`echo $GLOBAL_INST_DIR | sed 's/\\//\\\\\//g'` - -[ -d $PWR_SERVER_DEST ] || mkdir -p $PWR_SERVER_DEST -[ -d $PWR_SERVER_LOG ] || mkdir -p $PWR_SERVER_LOG -[ -d $PWR_SERVER_RSC ] || mkdir -p $PWR_SERVER_RSC -[ -d $PWR_FIREFOX_INSTALLDIR ] || mkdir -p $PWR_FIREFOX_INSTALLDIR -[ -d $GLOBAL_INST_DIR/etc/init.d ] || mkdir -p $GLOBAL_INST_DIR/etc/init.d - -tar xvf firefox-47.0.1.tar >/dev/null -mv firefox $PWR_FIREFOX_INSTALLDIR/firefox-47 -ln -s $PWR_FIREFOX_INSTALLDIR/firefox-47/firefox $PWR_FIREFOX_INSTALLDIR/firefox - -tar xvzf firefox_profile.tar.gz >/dev/null -if [ $? -ne 0 ]; then - echo "Failed to deploy firefox profile, please retry installation" - exit 1 -fi -chown -R "$GLOBAL_INST_USER". firefox_profile -[ ! -d "$PWR_FIREFOX_INSTALLDIR/firefox_profile" ] && mv firefox_profile $PWR_FIREFOX_INSTALLDIR - -[ -d "$PWR_FIREFOX_INSTALLDIR/selenium" ] || mkdir -p $PWR_FIREFOX_INSTALLDIR/selenium - -cp config.json $PWR_FIREFOX_INSTALLDIR/selenium/ - -ln -s $PWR_FIREFOX_INSTALLDIR/firefox /usr/bin/firefox - -# Generate logrotate configuration -echo < /etc/logrotate.d/pwrd -/var/log/pwr/pwr_std.log -/var/log/pwr/xvfb.log -/var/log/pwr/pwr_error.log { - weekly - missingok - size 300000 - rotate 3 - maxage 90 - compress - notifempty - copytruncate -} - -EO_LROTATE - -cp ./extras/restore_firefox.sh $PWR_FIREFOX_INSTALLDIR/ -cp ./extras/pwrd_maintenance.sh $PWR_FIREFOX_INSTALLDIR/ -cp ./selenium-server-standalone-2.53.1.jar $PWR_SERVER_DEST/ -cp ./pwrd /etc/init.d/pwrd -cp ./pwrd $GLOBAL_INST_DIR/etc/init.d/pwrd -chmod +x /etc/init.d/pwrd - -# Update pwrd daemon -if [ "$GLOBAL_INST_DIR" != "" ]; then - echo "Adjusting pwrd global directory to: $GLOBAL_INST_DIR" - sed -i "s/PWR_GLOBAL_DIR=\"\"/PWR_GLOBAL_DIR=\"$GLOBAL_INST_DIR_ESCAPED\"/g" /etc/init.d/pwrd - sed -i "s/PWR_GLOBAL_DIR=\"\"/PWR_GLOBAL_DIR=\"$GLOBAL_INST_DIR_ESCAPED\"/g" $GLOBAL_INST_DIR/etc/init.d/pwrd - echo "Adjusting pwrd_maintenance global directory to: $PWR_FIREFOX_INSTALLDIR" - sed -i "s/PWR_FIREFOX_INSTALLDIR=\"\/opt\"/PWR_FIREFOX_INSTALLDIR=\"$PWR_FIREFOX_INSTALLDIR_ESCAPED\"/g" $PWR_FIREFOX_INSTALLDIR/pwrd_maintenance.sh - echo "Adjusting restore_firefox global directory to: $PWR_FIREFOX_INSTALLDIR" - sed -i "s/PWR_FIREFOX_INSTALLDIR=\"\/opt\"/PWR_FIREFOX_INSTALLDIR=\"$PWR_FIREFOX_INSTALLDIR_ESCAPED\"/g" $PWR_FIREFOX_INSTALLDIR/restore_firefox.sh -fi - -if [ "$GLOBAL_INST_USER" != "" ]; then - echo "Adjusting pwrd global user to: $GLOBAL_INST_USER" - sed -i "s/USER=\"root\"/USER=\"$GLOBAL_INST_USER\"/g" /etc/init.d/pwrd - sed -i "s/USER=\"root\"/USER=\"$GLOBAL_INST_USER\"/g" $GLOBAL_INST_DIR/etc/init.d/pwrd -fi - - -[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_DEST -[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_LOG -[ "$GLOBAL_INST_USER" != "" ] && chown -R "$GLOBAL_INST_USER". $PWR_SERVER_RSC - -cat </dev/null 2>&1` - if [ $? -ne 0 ]; then - echo "Xvfb not found, please install it" - if [ -e /etc/rc.d/init.d/functions ]; then - failure - echo 1 - fi - else - Xvfb :99 -screen 0 1400x768x24 -ac +extension RANDR > $LOG_DIR/xvfb.log 2>&1 & echo $! > $XVFB_PID_FILE - export DISPLAY=:99 - echo 0 - fi -} - -# Stop Xvfb -function stop_xvfb() { - echo - if test -f $XVFB_PID_FILE ; then - # Check if there's more instances of pwrd running i.e. standalone + node - if [ ! -e "$BASE_DIR/pwrd_node.pid" ] && [ ! -e "$BASE_DIR/pwrd.pid" ]; then - if [ ! -e /etc/rc.d/init.d/functions ]; then - echo -n "Stopping Xvfb..." - fi - PID=$(cat $XVFB_PID_FILE) - if [ "$PID" != "" ] && [ `kill -9 $PID 2>&1 | grep "No such process" | wc -l` == "1" ]; then - # PID file exists but no process - [ -f $XVFB_PID_FILE ] && rm -f $XVFB_PID_FILE - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - return 0 - fi - else - [ -e $BASE_DIR/pwrd_node.pid ] && echo -n `cat $BASE_DIR/pwrd_node.pid` - [ -e $BASE_DIR/pwrd.pid ] && echo -n `cat $BASE_DIR/pwrd.pid` - echo -e "\nThere're pwrd processes left. Skipping Xvfb" - fi - fi -} - - -######################################################################## -# START -######################################################################## - -# Start Selenium Standalone server -function start() { - if test -f $pid_file; then - PID=`cat $pid_file` - if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then - echo "PWRD is already running: $PID" - exit 2 - else - echo "Removing stale pid file: $pid_file" - fi - fi - - if [ "`start_xvfb`" != "0" ]; then - if [ -e /etc/rc.d/init.d/functions ]; then - failure - fi - echo "Failed... Check Xvfb" - return 1 - fi - - if [ ! -e /etc/rc.d/init.d/functions ]; then - echo -n "Starting PWRD..." - fi - - export DISPLAY=:99 - PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_PORT $PWR_OPTS > $STD_LOG 2>&1 & echo \$!") - if [ $? == "0" ]; then - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - echo "Success" - else - if [ -e /etc/rc.d/init.d/functions ]; then - failure - fi - echo "Failed" - fi - - # Store PID - echo -n $PID > $pid_file - -} - -# Start Selenium GRID server: HUB component -function start-hub() { - if test -f $pid_file; then - PID=`cat $pid_file` - if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then - echo "PWRD is already running: $PID" - exit 2 - else - echo "Removing stale pid file: $pid_file" - fi - fi - - if [ ! -e /etc/rc.d/init.d/functions ]; then - echo -n "Starting PWRD..." - fi - - # No Xvfb needed in hub mode - - PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_HUB_PORT -role hub $PWR_HUB_OPTS > $STD_LOG 2>&1 & echo \$!") - if [ $? == "0" ]; then - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - echo "Success" - else - if [ -e /etc/rc.d/init.d/functions ]; then - failure - fi - echo "Failed" - fi - - # Store PID - echo -n $PID > $pid_file - - echo - echo -e "Add nodes to HUB executing:\n $0 start-node http://$host:$PWR_HUB_PORT/grid/register" -} - -# Start Selenium GRID server: Node Connect to hub -function start-node() { - if test -f $pid_file ; then - PID=`cat $pid_file` - if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then - echo "PWRD is already running: $PID" - exit 2 - else - echo "Removing stale pid file: $pid_file" - fi - fi - - if [ "`start_xvfb`" != "0" ]; then - if [ -e /etc/rc.d/init.d/functions ]; then - failure - fi - echo "Failed... Check Xvfb" - return 1 - fi - - if [ ! -e /etc/rc.d/init.d/functions ]; then - echo -n "Starting PWRD..." - fi - - export DISPLAY=:99 - PID=$(su $USER -c "$JAVA -jar $PWR -host $host -port $PWR_NODE_PORT -role node -hub $1 $PWR_OPTS > $STD_LOG 2>&1 & echo \$!") - if [ $? == "0" ]; then - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - echo "Success" - else - if [ -e /etc/rc.d/init.d/functions ]; then - failure - fi - echo "Failed" - fi - - # Store PID - echo -n $PID > $pid_file -} - - -######################################################################## -# STOP -######################################################################## - -# Stop Selenium Standalone server -function stop() { - if test -f $pid_file ; then - echo -n "Stopping PWRD..." - PID=$(cat $pid_file) - [ "$PID" == "" ] && PID=`ps aux | grep "$JAVA -jar $PWR" | grep -v grep | awk '{print $2}'` - [ "$PID" != "" ] && ps --pid $PID >/dev/null && su $USER -c "kill -3 $PID" - [ "$PID" != "" ] && ps --pid $PID >/dev/null && kill -9 $PID >/dev/null 2>&1 - if [ $? -eq 0 ]; then - sleep 2 - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - test -f $pid_file && rm -f $pid_file - - stop_xvfb - else - if [ -e /etc/rc.d/init.d/functions ]; then - failure - else - echo "Failed" - fi - fi - # Clean pid file - test -f $pid_file && rm -f $pid_file - else - echo "PWRD is not running." - stop_xvfb - if [ -e /etc/rc.d/init.d/functions ]; then - success - fi - fi - echo -} - - -######################################################################## -# STATUS -######################################################################## - -# Status of Selenium Standalone server -function status() { - mode=$1 - if test -f $pid_file ; then - echo "checking: $pid_file" - PID=`cat $pid_file` - if [ "$PID" != "" ] && ps --pid $PID >/dev/null; then - echo "PWRD$mode is running: $PID" - if test -f $XVFB_PID_FILE ; then - PID=`cat $XVFB_PID_FILE` - if test -f $XVFB_PID_FILE ; then - echo "Xvfb is running: $PID" - fi - fi - else - echo "PWRD$mode isn't running..." - fi - else - echo "PWRD$mode isn't running..." - fi -} - - - -######################################################################## -# MAIN -######################################################################## - -if [ ! -x "$JAVA" ]; then - echo "Please verify $JAVA is a valid java" 2>&1 - exit 1 -fi - -case "$1" in - start) # Standalone - pid_file=$BASE_DIR/pwrd.pid - start - ;; - start-hub) # hub - pid_file=$BASE_DIR/pwrd_hub.pid - start-hub - ;; - start-node) # node - pid_file=$BASE_DIR/pwrd_node.pid - start-node $2 - ;; - stop) # standalone - pid_file=$BASE_DIR/pwrd.pid - stop - ;; - stop-hub) # hub - pid_file=$BASE_DIR/pwrd_hub.pid - stop - ;; - stop-node) # node - pid_file=$BASE_DIR/pwrd_node.pid - stop - ;; - restart) # standalone - pid_file=$BASE_DIR/pwrd.pid - stop - start - ;; - restart-hub) # hub - pid_file=$BASE_DIR/pwrd_hub.pid - stop - start-hub - ;; - restart-node) # node - pid_file=$BASE_DIR/pwrd_node.pid - stop - start-node $2 - ;; - status) - pid_file=$BASE_DIR/pwrd.pid - status "" - pid_file=$BASE_DIR/pwrd_hub.pid - status " HUB" - pid_file=$BASE_DIR/pwrd_node.pid - status " Node" - ;; - *) - echo "Usage: $SELF start*|stop*|restart*|status" - echo " start* (standalone, hub or node)" - echo " start" - echo " start-hub" - echo " start-node http://hub:4444/grid/register" - echo " stop* (standalone, hub or node)" - echo " stop" - echo " stop-hub" - echo " stop-node" - echo " restart* (standalone, hub or node)" - echo " restart" - echo " restart-hub" - echo " restart-node http://hub:4444/grid/register" - exit 9 - ;; -esac diff --git a/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar b/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar deleted file mode 100644 index 5c3c4fd210..0000000000 Binary files a/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar and /dev/null differ diff --git a/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi b/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi deleted file mode 100644 index c93d15d840..0000000000 Binary files a/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi and /dev/null differ