diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index cb98c5789b..486dcbb79b 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -54,6 +54,18 @@ AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc" AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi" AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc" SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl" +PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \ +$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \ +$PANDHOME_ENT/pandora_plugins/MarkLogic/pandora_marklogic.pl \ +$PANDHOME_ENT/pandora_plugins/Apache/pandora_apache.pl \ +$PANDHOME_ENT/pandora_plugins/Oracle/Database/pandora_oracle.pl \ +$PANDHOME_ENT/pandora_plugins/OpenNebula/pandora_opennebula.pl \ +$PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \ +$PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \ +$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \ +$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \ +$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl" +PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm" # Update version in spec files function update_spec_version { @@ -87,6 +99,14 @@ function update_installer_version { sed -i -e "/^PI_VERSION/s/=.*/=\"$VERSION\"/" -e "/^PI_BUILD/s/=.*/=\"$BUILD\"/" "$FILE" } +# Update version in Perl files +function update_perl_version { + FILE=$1 + + sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$FILE" + sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$FILE" +} + # Spec files for file in $SPEC_FILES; do echo "Updating spec file $file..." @@ -105,6 +125,12 @@ for file in $INSTALLER_FILES; do update_installer_version $file done +# Perl plugins files +for file in $PERL_PLUGIN_FILES; do + echo "Updating plugin file $file..." + update_perl_version $file +done + # Pandora Server echo "Updating Pandora Server version..." sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$SERVER_FILE" @@ -116,6 +142,9 @@ sed -i -e "s/my\s\s*\$version\s*=.*/my \$version = \"$VERSION PS$BUILD\";/" "$SE sed -i -e "s/\s*\#\s*\Version.*/\# Version $VERSION/" "$SERVER_CONF_FILE" sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_OPEN_FILE" sed -i -e "s/\s*\!define PRODUCT_VERSION.*/\!define PRODUCT_VERSION \"$VERSION\"/" "$SERVER_WIN_MPI_ENT_FILE" +echo "Updateing Pandora PluginTools version..." +sed -i -e "s/my\s\s*\$pandora_version\s*=.*/my \$pandora_version = \"$VERSION\";/" "$PLUGIN_LIB_FILE" +sed -i -e "s/my\s\s*\$pandora_build\s*=.*/my \$pandora_build = \"$BUILD\";/" "$PLUGIN_LIB_FILE" # Pandora Satellite Server echo "Updating Pandora Satellite Server version..." diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index c4a017d5df..173b2e8aac 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.715, AIX version +# Version 7.0NG.716, 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 66ed797d78..5964b8c23b 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.715, FreeBSD Version +# Version 7.0NG.716, 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 876222a5eb..c32ca457de 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.715, HP-UX Version +# Version 7.0NG.716, 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 1ab6555ce5..fdea3a3700 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.715, GNU/Linux +# Version 7.0NG.716, 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 d308a01e8e..fc457d1358 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.715, GNU/Linux +# Version 7.0NG.716, 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 514782e164..ca431a8917 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.715, Solaris Version +# Version 7.0NG.716, 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 8479b4515f..c17122f997 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.715 +# Version 7.0NG.716 # 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 53c491e3c4..e9929e30ee 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.715, AIX version +# Version 7.0NG.716, 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 e5c7738542..3688e15492 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.715 +# Version 7.0NG.716 # 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 8f8c2febdf..1a2d1075d7 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.715, HPUX Version +# Version 7.0NG.716, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 25712c4d7c..cf9c6d54b7 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.715 +# Version 7.0NG.716 # 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 7a8f736c41..107aeacbc5 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.715 +# Version 7.0NG.716 # 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 8a33853ae5..9189faa142 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.715 +# Version 7.0NG.716 # 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 ba1d866ed2..1cf52d41cf 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.715, Solaris version +# Version 7.0NG.716, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index bb75e5f95b..625fca365d 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.715, AIX version +# Version 7.0NG.716, 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 ebaaee3a6d..82af482a0d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.715-171120 +Version: 7.0NG.716-171218 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 9ca68fb2f9..03f7693ce3 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.715-171120" +pandora_version="7.0NG.716-171218" 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 aaf29acb8f..d7647191a4 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.715, GNU/Linux +# Version 7.0NG.716, 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 817432efa6..2625ca7542 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.715, FreeBSD Version +# Version 7.0NG.716, 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 d0f28e9943..2387412e15 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.715, HP-UX Version +# Version 7.0NG.716, 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 d9876734df..da5c2b2c18 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.715, GNU/Linux +# Version 7.0NG.716, 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 c4665aaa94..a0717d889e 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.715, GNU/Linux +# Version 7.0NG.716, 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 8100e76026..0cc5dc41cc 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.715, NetBSD Version +# Version 7.0NG.716, 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 9a5432057a..ac8ece9b0c 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.715, Solaris Version +# Version 7.0NG.716, 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 90ade33a33..a616f955f1 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -40,8 +40,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.715'; -use constant AGENT_BUILD => '171120'; +use constant AGENT_VERSION => '7.0NG.716'; +use constant AGENT_BUILD => '171218'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1244,7 +1244,11 @@ sub check_collections () { # Delete old collections if there are no broker agents if ($BrokerEnabled == 0) { - opendir (DIR, "$ConfDir/collections") || return; + if(!opendir (DIR, "$ConfDir/collections")){ + log_message ('Collection', "Could not open dir $ConfDir/collections"); + return; + } + while (defined (my $file_name = readdir(DIR))) { next if ($file_name eq '.' || $file_name eq '..'); @@ -1252,8 +1256,14 @@ sub check_collections () { $file_name =~ s/\.md5$//; if (! defined ($Collections{$file_name})) { - rmrf ("$ConfDir/collections/$file_name"); - unlink ("$ConfDir/collections/$file_name.md5"); + if(opendir (DIR_check, "$ConfDir/collections/$file_name")){ + closedir (DIR_check); + rmrf ("$ConfDir/collections/$file_name"); + unlink ("$ConfDir/collections/$file_name.md5"); + } + else { + log_message ('Collection', "Could not open dir $ConfDir/collections/$file_name"); + } } } closedir (DIR); @@ -1272,7 +1282,11 @@ sub check_collections () { # Get remote md5 error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file")); - next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_md5_file on " . $Conf{'server_path_md5'}); + next; + } + open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!."); my $remote_collection_md5 = ; close (MD5_FILE); @@ -1284,13 +1298,20 @@ sub check_collections () { $local_collection_md5 = ; close MD5_FILE; } + else{ + log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); + next; + } # Check for changes $local_collection_md5 = $remote_collection_md5 unless defined ($local_collection_md5); next if ($local_collection_md5 eq $remote_collection_md5); # Download and unzip - next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'}); + next; + } rmrf ("$ConfDir/collections/$collection"); `unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`; unlink ("$Conf{'temporal'}/$collection_file"); diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 9bb6cb147e..b2bbcb2b56 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.715 -%define release 171120 +%define version 7.0NG.716 +%define release 171218 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 a705e9733e..d80cef2388 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.715 -%define release 171120 +%define version 7.0NG.716 +%define release 171218 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 93de5ca678..6523e68bfa 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.715" -PI_BUILD="171120" +PI_VERSION="7.0NG.716" +PI_BUILD="171218" 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 90626fedbc..5cbf2b0876 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-2014 Artica Soluciones Tecnologicas -# Version 7.0NG.715 +# (c) 2006-2017 Artica Soluciones Tecnologicas +# Version 7.0NG.716 # 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 @@ -21,6 +21,13 @@ server_ip $ServerIP$ server_path /var/spool/pandora/data_in temporal "%ProgramFiles%\pandora_agent\temp" +# Group assigned for this agent (descriptive, p.e: Servers) +group $GroupName$ + +# If set to 1 allows the agent to be configured via the web console +# (only works on enterprise version). Set to 0 to disable it +remote_config 0 + #include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf" #broker_agent name_agent @@ -43,15 +50,10 @@ agent_name_cmd __rand__ # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example - address auto - # or setting a fixed IP address, like for example: #address 192.168.36.73 -# Group assigned for this agent (descriptive, p.e: Servers) -group Servers - # This limits operation if temporal dir has not enough free disk. #temporal_min_size 1024 @@ -80,10 +82,6 @@ server_port 41121 # Debug mode renames XML in the temp folder and continues running # debug 1 -# If set to 1 allows the agent to be configured via the web console -# (only works on enterprise version). Set to 0 to disable it -remote_config 0 - # XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here. #encoding ISO-8859-1 @@ -102,6 +100,10 @@ xml_buffer 1 # Agent mode: Learn (default), No-learn, Autodisable # agent_mode autodisable +# EHorus configuration file default full path. +#It try to find the EKID and set it like a custom field. +ehorus_conf "C:\Program Files\ehorus_agent\ehorus_agent.conf" + # Secondary server configuration # ============================== @@ -127,74 +129,166 @@ xml_buffer 1 #process_firefox_stop killall firefox #service_messenger 1 +############################################### # Module Definition # Check online documentation and module library at http://pandorafms.org # ================= -# Get Network information using Agent plugin -module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs" - -# Get disk occupation (percent) -module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent.vbs" - -# External inventory plugin -module_begin -module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs" -module_interval 288 -# 288 x 5min = 24 hr, one execution per day, using module_interval -module_end - -# CPU Load - +# CPU Load using WMI module_begin module_name CPU Load module_type generic_data -#module_wmiquery SELECT LoadPercentage FROM Win32_Processor -#module_wmicolumn LoadPercentage -module_cpuusage all -module_description CPU Load (%) -module_unit % -module_min_warning 80 +module_wmiquery SELECT LoadPercentage FROM Win32_Processor +module_wmicolumn LoadPercentage +module_max 100 +module_min 0 +module_description User CPU Usage (%) +module_min_warning 70 module_max_warning 90 module_min_critical 91 module_max_critical 100 +module_unit % +module_group System module_end -# Number processes +# Basic info about TCP Connection module_begin -module_name Number processes -module_type generic_data -module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l -module_description Number of processes running -module_min_warning 175 -module_max_warning 249 -module_min_critical 250 -module_max_critical 300 +module_name TCP_Connections +module_type generic_data +module_exec netstat -an | find /c /v "estab" +module_description Total number of TCP connections active +module_group Networking module_end +# Example plugin to retrieve drive usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs" + +# Example plugin to retrieve memory usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\mem_percent_used.vbs" + +# Example plugin to retrieve network usage +module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\network.vbs" + +## Windows inventory module (This information will be displayed only in enterprise version) +## Please check the WMI is healthy before activate this functionality + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +#module_begin +#module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" +#module_crontab * 12-15 * * 1 +#module_end + +######################################### +# EXAMPLES # +######################################### + +# Example: get Network information using Agent plugin +#module_plugin cscript //B "%ProgramFiles%\Pandora_Agent\util\nettraffic.vbs" + +# External inventory plugin +#module_begin +#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\software_installed.vbs" +#module_interval 288 +## 288 x 5min = 24 hr, one execution per day, using module_interval +#module_end + # Free Memory -module_begin -module_name FreeMemory -module_type generic_data -module_freepercentmemory -module_unit % -module_description Free memory (%). -module_min_warning 21 -module_max_warning 30 -module_min_critical 0 -module_max_critical 20 -module_end +#module_begin +#module_name FreeMemory +#module_type generic_data +#module_freepercentmemory +#module_description Free memory (%). +#module_min_warning 21 +#module_max_warning 30 +#module_min_critical 0 +#module_max_critical 20 +#module_end # Log events +#module_begin +#module_name System Events (TermService) +#module_type async_string +#module_logevent +#module_description Log Events coming from Terminal Service +#module_source System +#module_application TermService +#module_end -module_begin -module_name Security Events (Invalid Login) -module_type async_string -module_description Security log events for invalid login attempt -module_logevent -module_source Security -module_eventcode 529 -module_end +#module_begin +#module_name Security Events (Invalid Login) +#module_type async_string +#module_description Security log events for invalid login attempt +#module_logevent +#module_source Security +#module_eventcode 529 +#module_end + +# Check if Dhcp service is enabled +#module_begin +#module_name DHCP Enabled +#module_type generic_proc +#module_service Dhcp +#module_description Check DCHP service enabled +#module_end #Antivirus monitoring #This modules checks the antivirus is running on your system, if there is and antivirus @@ -207,72 +301,51 @@ module_end #module_description Last update for Antivirus Signature file #module_end -## Windows inventory module (This information will be displayed only in enterprise version) -## Please check the WMI is healthy before activate this functionality +# Number processes +#module_begin +#module_name Number processes +#module_type generic_data +#module_exec tasklist | gawk "NR > 3 {print$0}" | wc -l +#module_description Number of processes running +#module_min_warning 175 +#module_max_warning 249 +#module_min_critical 250 +#module_max_critical 300 +#module_end -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# Example plugin to retrieve drive usage +#module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs" -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# Free space on disk C: (%) +#module_begin +#module_name FreeDiskC +#module_type generic_data +#module_freepercentdisk C: +#module_description Free space on drive C: (%) +#module_min_warning 31 +#module_max_warning 40 +#module_min_critical 0 +#module_max_critical 30 +#module_end -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs" -# module_crontab * 12-15 * * 1 -# module_end +# CPU usage percentage +#module_begin +#module_name CPUUse +#module_type generic_data +#module_cpuusage all +#module_description CPU# usage +#module_min_warning 70 +#module_max_warning 90 +#module_min_critical 91 +#module_max_critical 100 +#module_end +# Free space on disk D: (%) # module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs" -# module_crontab * 12-15 * * 1 -# module_end - -# module_begin -# module_plugin cscript.exe //B //t:20 "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs" -# module_crontab * 12-15 * * 1 +# module_name FreeDiskD +# module_type generic_data +# module_freepercentdisk D: +# module_description Free space on drive D: (%) # module_end ## Plugin example for custom fields (version, architecture, IP, IPv6, MAC) @@ -281,10 +354,9 @@ module_end # module_crontab * 12-15 * * 1 # module_end -# ---------------------------------------------------------------------------------------------------- -# This samples below need to be reconfigured and uncommented. Please read documentation -# on how to setup pandora fms windows agent at http://wiki.pandorafms.com -# ---------------------------------------------------------------------------------------------------- +# Example plugin to retrieve last 5 min events in log4x format +# module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\logevent_log4x.vbs" Aplicacion System 300 + # Sample on how to get a value from registry # This returns the last time user launch microsoft Windows update #module_begin @@ -391,11 +463,11 @@ module_end #module_description Postcondition test module #module_end -#Example of when module_native_encoding is necessary -#Dont uncomment module_native_encoding tag to see the difference +# Example of native encoding. #module_begin -#module_name Accent_example +#module_name Written Accent #module_type generic_data_string #module_exec echo Bordón #module_native_encoding OEM #module_end + diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index d9e8ef326d..0ef626ad59 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.715} +{Pandora FMS Windows Agent v7.0NG.716} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171120} +{171218} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8c439c4c58..7c3f775f61 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.715(Build 171120)") +#define PANDORA_VERSION ("7.0NG.716(Build 171218)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 16a1462882..ac4e020c76 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.715(Build 171120))" + VALUE "ProductVersion", "(7.0NG.716(Build 171218))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index b429559c2d..07c908533e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.715-171120 +Version: 7.0NG.716-171218 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 b3915af62d..b9b44c99f4 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.715-171120" +pandora_version="7.0NG.716-171218" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 2b0e281993..d184850a34 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -259,80 +259,60 @@ function extension_db_check_tables_differences($connection_test, $field_system = $fields_system[$name_field]; $diff = array_diff($field_test, $field_system); + if (!empty($diff)) { - foreach ($diff as $config_field => $value) { - switch ($config_field) { - case 'type': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the type with %s.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-										"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $value . ";" .
-									'
' - ); - break; - case 'null': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be null: (%s).', - $name_field, $table, $value)); + $info_message = ""; + $error_message = ""; + if($diff['type']){ + $error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."
"; + } + + if($diff['null']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").
"; + } + + if($diff['default']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.
"; + } + + if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ + $null_defect = " NULL"; + } + else{ + $null_defect = " NOT NULL"; + } + + if(!isset($field_test['default']) || $field_test['default'] == ""){ + $default_value = ""; + } + else{ + $default_value = " DEFAULT ".$field_test['default']; + } + + if($diff['type'] || $diff['null'] || $diff['default']){ + $info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";"; + } + + if($diff['key']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.
"; + $info_message .= "

Please check the SQL file for to know the kind of key needed."; + } + + if($diff['extra']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.
"; + $info_message .= "

Please check the SQL file for to know the kind of extra config needed."; + } + + ui_print_error_message( + __($error_message)); - if ($value == "YES") { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . " NULL;" .
-										'
' - ); - } - else { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
-										'
' - ); - } + ui_print_info_message( + __($info_message)); - break; - case 'key': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the key as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of key needed.')); - break; - case 'default': - if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ - $null_defect = " NULL"; - } - else{ - $null_defect = " NOT NULL"; - } - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set %s as default value.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
-										'
' - ); - break; - case 'extra': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of extra config needed.')); - break; } } } } - } - } if ($correct_fields) { ui_print_success_message( @@ -366,4 +346,4 @@ function extension_db_status_execute_sql_file($url, $connection) { extensions_add_godmode_function('extension_db_status'); extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman'); -?> \ No newline at end of file +?> diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index f20bcab720..4241018a16 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -69,9 +69,9 @@ function pandoralogs_extension_main () { ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" ); - echo "

" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "

"; + echo "

" . __('Use this tool to view your Pandora FMS logfiles directly on the console') . "

"; - echo "

" . __('You can control the size information to show in general setup (Log size limit in view extension), actually ') . $config['max_log_size'] * 1000 . "B" . "

"; + echo "

" . __('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), ' . $config['max_log_size'] * 1000 . 'B at the moment') . "

"; $logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora"; diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js index 8a8b686bb9..538a68f144 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js @@ -140,14 +140,19 @@ function snmpBrowserWindow () { opacity: 0.5, background: "black" }, - width: 780, - height: 430 + width: 920, + height: 500 }); } // Set the form OID to the value selected in the SNMP browser function setOID () { - $('#text-snmp_oid').val($('#snmp_selected_oid').text()); + + if($('#snmp_browser_version').val() == '3'){ + $('#text-snmp_oid').val($('#table1-0-1').text()); + } else { + $('#text-snmp_oid').val($('#snmp_selected_oid').text()); + } // Close the SNMP browser $('.ui-dialog-titlebar-close').trigger('click'); diff --git a/pandora_console/extras/mr/10.sql b/pandora_console/extras/mr/10.sql new file mode 100644 index 0000000000..53c7c7bcc6 --- /dev/null +++ b/pandora_console/extras/mr/10.sql @@ -0,0 +1,12 @@ +START TRANSACTION; + +ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0; +ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0; +ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0; +UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1; + +ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0'; + +COMMIT; \ No newline at end of file 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 111ac54ee0..78ff5bf563 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 @@ -728,6 +728,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `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; @@ -1262,6 +1263,7 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %'; ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` @@ -1433,6 +1435,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default '' -- --------------------------------------------------------------------- ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0; +ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `tserver_export_data` diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index e228c1eca4..2ac1e34df4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -388,6 +388,12 @@ config_check(); $do_refresh = false; } } + + $new_dashboard = get_parameter('new_dashboard',0); + + if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) { + $do_refresh = false; + } if ($do_refresh) { ?> diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index fbd1e842ed..a895373628 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -542,7 +542,7 @@ if (!empty($interfaces_list)) { $table->data[0][1] = ''; $table->data[0][2] = ''.__('Modules').''; - $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;'); + $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;'); $table->data[1][1] = html_print_image('images/darrowright.png', true); $table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 39f3cbba5b..4ba6b9db02 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -232,7 +232,7 @@ if ($create_agent) { if ($id_agente !== false) { // Create custom fields for this agent foreach ($field_values as $key => $value) { - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key, 'id_agent' => $id_agente, 'description' => $value)); } @@ -735,13 +735,17 @@ if ($update_agent) { // if modified some agent paramenter if ($old_value === false) { // Create custom field if not exist - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value)); } else { - db_process_sql_update ('tagent_custom_data', + $update_custom = db_process_sql_update ('tagent_custom_data', array('description' => $value), array('id_field' => $key,'id_agent' => $id_agente)); + + if($update_custom == 1){ + $update_custom_result = 1; + } } } @@ -799,14 +803,16 @@ if ($update_agent) { // if modified some agent paramenter WHERE id_group = ".$group_old); $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); - if ($result == false) { + + + if ($result == false && $update_custom_result == false) { ui_print_error_message( __('There was a problem updating the agent')); } else { // Update the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); - enterprise_hook ('agent_update_from_cache', array($id_agente, $values)); + enterprise_hook ('agent_update_from_cache', array($id_agente, $values,$server_name)); if ($old_interval != $intervalo) { enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo)); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index cc5349182e..cba68980dc 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -24,6 +24,7 @@ $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $recursion = (bool) get_parameter('recursion',false); $disabled = get_parameter('disabled', 0); +$os = get_parameter('os', 0); if ($ag_group == -1 ) $ag_group = (int) get_parameter ("ag_group", -1); @@ -66,6 +67,14 @@ $agent_to_delete = (int)get_parameter('borrar_agente'); $enable_agent = (int)get_parameter('enable_agent'); $disable_agent = (int)get_parameter('disable_agent'); +if($disable_agent != 0){ + $server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$disable_agent); +} +elseif ($enable_agent != 0) { + $server_name = db_get_row_sql('select server_name from tagente where id_agente = '.$enable_agent); +} + + $result = null; if ($agent_to_delete) { @@ -105,7 +114,7 @@ if ($enable_agent) { // Update the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); $values = array('disabled' => 0); - enterprise_hook ('agent_update_from_cache', array($enable_agent, $values)); + enterprise_hook ('agent_update_from_cache', array($enable_agent, $values,$server_name)); db_pandora_audit("Agent management", 'Enable ' . $alias); } @@ -125,7 +134,7 @@ if ($disable_agent) { // Update the agent from the metaconsole cache enterprise_include_once('include/functions_agents.php'); $values = array('disabled' => 1); - enterprise_hook ('agent_update_from_cache', array($disable_agent, $values)); + enterprise_hook ('agent_update_from_cache', array($disable_agent, $values,$server_name)); db_pandora_audit("Agent management", 'Disable ' . $alias); } @@ -163,6 +172,20 @@ html_print_select($fields,"disabled",$disabled,'this.form.submit()'); echo ""; +echo ""; +echo __('Operative System') . ' '; + +$pre_fields = db_get_all_rows_sql('select distinct(tagente.id_os),tconfig_os.description from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'); +$fields = array(); + +foreach ($pre_fields as $key => $value) { + $fields[$value['id_os']] = $value['description']; +} + +html_print_select($fields,"os",$os,'this.form.submit()','All',0); + +echo ""; + echo ""; echo __('Recursion') . ' '; html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()'); @@ -171,6 +194,8 @@ echo ""; echo __('Search') . ' '; html_print_input_text ("search", $search, '', 12); +echo ui_print_help_tip(__('Search filter by alias, name, description, IP address or custom fields content'), true); + echo ""; echo ""; echo ""; @@ -296,20 +321,26 @@ if ($search != "") { }else{ $search_sql = " AND ( nombre " . $order_collation . " LIKE LOWER('%$search%') OR alias " . $order_collation . " - LIKE LOWER('%$search%')) "; + LIKE LOWER('%$search%') OR comentarios " . $order_collation . " LIKE LOWER('%$search%') + OR EXISTS (SELECT * FROM tagent_custom_data + WHERE id_agent = id_agente AND description LIKE '%$search%'))"; } } if ($disabled == 1) { - $search_sql = " AND disabled = ". $disabled . $search_sql; + $search_sql .= " AND disabled = ". $disabled . $search_sql; } else { if ($disabled == 0) { - $search_sql = " AND disabled = 0" . $search_sql; + $search_sql .= " AND disabled = 0" . $search_sql; } } +if($os != 0){ + $search_sql .= " AND id_os = " . $os; +} + // Show only selected groups if ($ag_group > 0) { @@ -471,27 +502,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) { } // Prepare pagination -ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset); +ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); if ($agents !== false) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; @@ -666,7 +697,7 @@ if ($agents !== false) { echo ""; } echo "
".__('Agent name') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; echo "".__('R'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . ''; echo "".__('OS'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; echo "".__('Type'). "".__('Group'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; echo "" . __('Description') . "" . __('Actions') . "
"; - ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled", $offset); + ui_pagination ($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); echo ""; $form_filter .= ""; $form_filter .= ""; echo ""; echo ""; +echo ""; +echo " +"; +echo ""; +echo ""; + +echo ""; echo "
"; } else { diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 9b9b96ffaf..a764eff924 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) { $table_simple->data[4][1] .= '
'.__('Inverse interval').''; $table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy); if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[4][2] = ''; + $table_simple->data[4][2] = ' '; $table_simple->colspan[4][2] = 2; $table_simple->rowspan[4][2] = 3; } @@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6; if (isset($id_agente) && $moduletype == MODULE_DATA) { $has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"])); if ($has_remote_conf) { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->colspan[11][1] = 6; @@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) { $table_advanced->colspan[12][1] = 6; } else { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true); $table_advanced->colspan[11][1] = 6; @@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) { } } else { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->colspan[11][1] = 6; @@ -1202,294 +1199,34 @@ function paint_graph_values(){ //inicialiced error var error_w = 0; var error_c = 0; - //if haven't error - if(max_w == 0 || max_w > min_w){ - if(max_c == 0 || max_c > min_c){ - paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c); - } else { - error_c = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c); - } - } else { - error_w = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c); - } -} - -//function use d3.js for paint graph -function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) { - - //Check if they are numbers - if(isNaN(min_w)){ min_w = 0; }; - if(isNaN(max_w)){ max_w = 0; }; - if(isNaN(min_c)){ min_c = 0; }; - if(isNaN(max_c)){ max_c = 0; }; - //messages legend var legend_normal = ''; var legend_warning = ''; var legend_critical = ''; - - //remove elements - d3.select("#svg_dinamic rect").remove(); - $("#text-max_warning").removeClass("input_error"); - $("#text-max_critical").removeClass("input_error"); - - //if haven't errors - if (error_w == 0 && error_c == 0){ - //parse element - min_w = parseFloat(min_w); - min_c = parseFloat(min_c); - max_w = parseFloat(max_w); - max_c = parseFloat(max_c); - - //inicialize var - var range_min = 0; - var range_max = 0; - var range_max_min = 0; - var range_max_min = 0; - - //Find the lowest possible value - if(min_w < 0 || min_c < 0){ - if(min_w < min_c){ - range_min = min_w - 100; - } else { - range_min = min_c - 100; - } - } else if (min_w > 0 || min_c > 0) { - if(min_w > min_c){ - range_max_min = min_w; - } else { - range_max_min = min_c; - } + //messages error + var message_error_warning = ''; + var message_error_critical = ''; + + //if haven't error + if(max_w == 0 || max_w > min_w){ + if(max_c == 0 || max_c > min_c){ + paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } else { - if(min_w < min_c){ - range_min = min_w - 100; - } else { - range_min = min_c - 100; - } + error_c = 1; + paint_graph_status(0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } - - //Find the maximum possible value - if(max_w > max_c){ - range_max = max_w + 100 + range_max_min; - } else { - range_max = max_c + 100 + range_max_min; - } - - //Controls whether the maximum = 0 is infinite - if((max_w == 0 || max_w == 0.00) && min_w != 0){ - max_w = range_max; - } - if((max_c == 0 || max_c == 0.00) && min_c != 0){ - max_c = range_max; - } - - //Scale according to the position - position = 200 / (range_max-range_min); - - //axes - var yScale = d3.scale.linear() - .domain([range_min, range_max]) - .range([100, -100]); - - var yAxis = d3.svg.axis() - .orient("left") - .scale(yScale); - - //create svg - var svg = d3.select("#svg_dinamic"); - //delete elements - svg.selectAll("g").remove(); - svg.selectAll("rect").remove(); - svg.selectAll("text").remove(); - svg.append("g") - .attr("transform", "translate(0, 100)") - .call(yAxis); - - //legend Normal text - svg.append("text") - .attr("x", 0) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_normal) - .style("text-anchor", "first"); - - //legend Normal rect - svg.append("rect") - .attr("id", "legend_normal") - .attr("x", 72) - .attr("y", -30) - .attr("width", '10px') - .attr("height", '10px') - .style("fill", "#82B92E"); - - //legend Warning text - svg.append("text") - .attr("x", 91) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_warning) - .style("text-anchor", "first"); - - //legend Warning rect - svg.append("rect") - .attr("id", "legend_warning") - .attr("x", 168) - .attr("y", -30) - .attr("width", '10px') - .attr("height", '10px') - .style("fill", "#ffd731"); - - //legend Critical text - svg.append("text") - .attr("x", 187) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_critical) - .style("text-anchor", "first"); - - //legend critical rect - svg.append("rect") - .attr("id", "legend_critical") - .attr("x", 258) - .attr("y", -30) - .attr("width", '10px') - .attr("height", '10px') - .style("fill", "#fc4444"); - - //styles for number and axes - svg.selectAll("g .domain") - .style("stroke-width", 2) - .style("fill", "none") - .style("stroke", "black"); - - svg.selectAll("g .tick text") - .style("font-size", "9pt") - .style("font-weight", "initial"); - - //estatus normal - svg.append("rect") - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", '300px') - .attr("height", '200px') - .style("fill", "#82B92E"); - - //controls the inverse warning - if(inverse_w == 0){ - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position)) - .attr("width", 300) - .attr("height", ((max_w - min_w) * position)) - .style("fill", "#ffd731"); - } - else { - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", 200 - ((min_w -range_min) * position)) - .attr("width", 300) - .attr("height", (min_w -range_min) * position) - .style("fill", "#ffd731"); - - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_inverse_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", 300) - .attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position)) - .style("fill", "#ffd731"); - - } - //controls the inverse critical - if(inverse_c == 0){ - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_rect") - .attr("x", 3) - .attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position)) - .attr("width", 300) - .attr("height", ((max_c - min_c) * position)) - .style("fill", "#fc4444"); - } - else { - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_rect") - .attr("x", 3) - .attr("y", 200 - ((min_c -range_min) * position)) - .attr("width", 300) - .attr("height", (min_c -range_min) * position) - .style("fill", "#fc4444"); - - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_inverse_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", 300) - .attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position)) - .style("fill", "#fc4444"); - } - } - else { - var message_error_warning = ''; - var message_error_critical = ''; - - d3.select("#svg_dinamic rect").remove(); - //create svg - var svg = d3.select("#svg_dinamic"); - svg.selectAll("g").remove(); - svg.selectAll("rect").remove(); - svg.selectAll("text").remove(); - //message error warning - if (error_w == 1) { - $("#text-max_warning").addClass("input_error"); - svg.append("text") - .attr("x", -90) - .attr("y", 10) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 14) - .style("fill", "red") - .html(message_error_warning) - .style("text-anchor", "first"); - } - //message error critical - if (error_c == 1) { - $("#text-max_critical").addClass("input_error"); - svg.append("text") - .attr("x", -90) - .attr("y", 105) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 14) - .style("fill", "red") - .html(message_error_critical) - .style("text-anchor", "first"); - } - + } else { + error_w = 1; + paint_graph_status(0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } } - /* End of relationship javascript */ /* ]]> */ diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index b640243cfe..915d1b542a 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -414,14 +414,19 @@ function snmpBrowserWindow () { opacity: 0.5, background: "black" }, - width: 780, - height: 430 + width: 920, + height: 500 }); } // Set the form OID to the value selected in the SNMP browser function setOID () { - $('#text-snmp_oid').val($('#snmp_selected_oid').text()); + + if($('#snmp_browser_version').val() == '3'){ + $('#text-snmp_oid').val($('#table1-0-1').text()); + } else { + $('#text-snmp_oid').val($('#snmp_selected_oid').text()); + } // Close the SNMP browser $('.ui-dialog-titlebar-close').trigger('click'); diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 4b57931a2c..8a2a7c6702 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -132,8 +132,8 @@ $form_filter .= "
".__('Enabled / Disabled').""; $ed_list = array (); -$ed_list[0] = __('Enable'); -$ed_list[1] = __('Disable'); +$ed_list[0] = __('Enabled'); +$ed_list[1] = __('Disabled'); $form_filter .= html_print_select ($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true); $form_filter .= "".__('Standby').""; $sb_list = array (); diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 94e834bbf5..f60ba4e5a6 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -30,15 +30,15 @@ $default = (int) get_parameter('default', 0); if ($default != 0) { - $event_fields = io_safe_input('evento,id_agente,estado,timestamp'); - $fields_selected = explode (',', $event_fields); + //$event_fields = io_safe_input('evento,id_agente,estado,timestamp'); + $fields_selected = explode (',', $config['event_fields']); } else if ($update != '') { $fields_selected = (array)get_parameter('fields_selected'); if ($fields_selected[0] == '') { - $event_fields = io_safe_input('evento,id_agente,estado,timestamp'); - $fields_selected = explode (',', $event_fields); + //$event_fields = io_safe_input('evento,id_agente,estado,timestamp'); + $fields_selected = explode (',', $config['event_fields']); } else { $event_fields = implode (',', $fields_selected); @@ -130,7 +130,7 @@ $event = array(); echo '

'.__('Show event fields'); echo ' '; -html_print_image ('images/clean.png', false, array ('title' => __('Load default event fields'), 'onclick' => "if (! confirm ('" . __('Default event fields will be loaded. Do you want to continue?') ."')) return false")); +html_print_image ('images/clean.png', false, array ('title' => __('Load the fields from previous events'), 'onclick' => "if (! confirm ('" . __('Event fields will be loaded. Do you want to continue?') ."')) return false")); echo '

'; $table = new stdClass(); diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index b9cc96a468..fd6744c283 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -128,7 +128,7 @@ $table->data[4][1] .= html_print_input_text ('str_warning', $str_warning, $table->data[4][1] .= '
'.__('Inverse interval').''; $table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true); -$table->data[4][2] = ' '; +$table->data[4][2] = ' '; $table->colspan[4][2] = 2; $table->rowspan[4][2] = 3; @@ -349,294 +349,37 @@ $next_row++; if(!inverse_w){ inverse_w = 0; } var inverse_c = $('input:checkbox[name=critical_inverse]:checked').val(); if(!inverse_c){ inverse_c = 0; } + //inicialiced error var error_w = 0; var error_c = 0; - //if haven't error - if(max_w == 0 || max_w > min_w){ - if(max_c == 0 || max_c > min_c){ - paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c); - } else { - error_c = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c); - } - } else { - error_w = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c); - } - } - - //function use d3.js for paint graph - function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c) { - - //Check if they are numbers - if(isNaN(min_w)){ min_w = 0; }; - if(isNaN(max_w)){ max_w = 0; }; - if(isNaN(min_c)){ min_c = 0; }; - if(isNaN(max_c)){ max_c = 0; }; - //messages legend var legend_normal = ''; var legend_warning = ''; var legend_critical = ''; - - //remove elements - d3.select("#svg_dinamic rect").remove(); - $("#text-max_warning").removeClass("input_error"); - $("#text-max_critical").removeClass("input_error"); - - //if haven't errors - if (error_w == 0 && error_c == 0){ - //parse element - min_w = parseFloat(min_w); - min_c = parseFloat(min_c); - max_w = parseFloat(max_w); - max_c = parseFloat(max_c); - - //inicialize var - var range_min = 0; - var range_max = 0; - var range_max_min = 0; - var range_max_min = 0; - - //Find the lowest possible value - if(min_w < 0 || min_c < 0){ - if(min_w < min_c){ - range_min = min_w - 100; - } else { - range_min = min_c - 100; - } - } else if (min_w > 0 || min_c > 0) { - if(min_w > min_c){ - range_max_min = min_w; - } else { - range_max_min = min_c; - } + //messages error + var message_error_warning = ''; + var message_error_critical = ''; + + //if haven't error + if(max_w == 0 || max_w > min_w){ + if(max_c == 0 || max_c > min_c){ + paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } else { - if(min_w < min_c){ - range_min = min_w - 100; - } else { - range_min = min_c - 100; - } + error_c = 1; + paint_graph_status(0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } - - //Find the maximum possible value - if(max_w > max_c){ - range_max = max_w + 100 + range_max_min; - } else { - range_max = max_c + 100 + range_max_min; - } - - //Controls whether the maximum = 0 is infinite - if((max_w == 0 || max_w == 0.00) && min_w != 0){ - max_w = range_max; - } - if((max_c == 0 || max_c == 0.00) && min_c != 0){ - max_c = range_max; - } - - //Scale according to the position - position = 200 / (range_max-range_min); - - //axes - var yScale = d3.scale.linear() - .domain([range_min, range_max]) - .range([100, -100]); - - var yAxis = d3.svg.axis() - .orient("left") - .scale(yScale); - - //create svg - var svg = d3.select("#svg_dinamic"); - //delete elements - svg.selectAll("g").remove(); - svg.selectAll("rect").remove(); - svg.selectAll("text").remove(); - svg.append("g") - .attr("transform", "translate(0, 100)") - .call(yAxis); - - //legend Normal text - svg.append("text") - .attr("x", 0) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_normal) - .style("text-anchor", "first"); - - //legend Normal rect - svg.append("rect") - .attr("id", "legend_normal") - .attr("x", 72) - .attr("y", -30) - .attr("width", '10px') - .attr("height", '10px') - .style("fill", "#82B92E"); - - //legend Warning text - svg.append("text") - .attr("x", 91) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_warning) - .style("text-anchor", "first"); - - //legend Warning rect - svg.append("rect") - .attr("id", "legend_warning") - .attr("x", 168) - .attr("y", -30) - .attr("width", 10) - .attr("height", 10) - .style("fill", "#ffd731"); - - //legend Critical text - svg.append("text") - .attr("x", 187) - .attr("y", -20) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 10) - .html(legend_critical) - .style("text-anchor", "first"); - - //legend critical rect - svg.append("rect") - .attr("id", "legend_critical") - .attr("x", 258) - .attr("y", -30) - .attr("width", 10) - .attr("height", 10) - .style("fill", "#fc4444"); - - //styles for number and axes - svg.selectAll("g .domain") - .style("stroke-width", 2) - .style("fill", "none") - .style("stroke", "black"); - - svg.selectAll("g .tick text") - .style("font-size", "9pt") - .style("font-weight", "initial"); - - //estatus normal - svg.append("rect") - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", 300) - .attr("height", 200) - .style("fill", "#82B92E"); - - //controls the inverse warning - if(inverse_w == 0){ - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", ((range_max - min_w) * position) - ((max_w - min_w) * position)) - .attr("width", 300) - .attr("height", ((max_w - min_w) * position)) - .style("fill", "#ffd731"); - } - else { - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_rect") - .attr("x", 3) - .attr("y", 200 - ((min_w -range_min) * position)) - .attr("width", 300) - .attr("height", (min_w -range_min) * position) - .style("fill", "#ffd731"); - - svg.append("rect").transition() - .duration(600) - .attr("id", "warning_inverse_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", 300) - .attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position)) - .style("fill", "#ffd731"); - - } - //controls the inverse critical - if(inverse_c == 0){ - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_rect") - .attr("x", 3) - .attr("y", ((range_max - min_c) * position) - ((max_c - min_c) * position)) - .attr("width", 300) - .attr("height", ((max_c - min_c) * position)) - .style("fill", "#fc4444"); - } - else { - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_rect") - .attr("x", 3) - .attr("y", 200 - ((min_c -range_min) * position)) - .attr("width", 300) - .attr("height", (min_c -range_min) * position) - .style("fill", "#fc4444"); - - svg.append("rect").transition() - .duration(600) - .attr("id", "critical_inverse_rect") - .attr("x", 3) - .attr("y", 0) - .attr("width", 300) - .attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position)) - .style("fill", "#fc4444"); - } - } - else { - var message_error_warning = ''; - var message_error_critical = ''; - - d3.select("#svg_dinamic rect").remove(); - //create svg - var svg = d3.select("#svg_dinamic"); - svg.selectAll("g").remove(); - svg.selectAll("rect").remove(); - svg.selectAll("text").remove(); - //message error warning - if (error_w == 1) { - $("#text-max_warning").addClass("input_error"); - svg.append("text") - .attr("x", -90) - .attr("y", 10) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 14) - .style("fill", "red") - .html(message_error_warning) - .style("text-anchor", "first"); - } - //message error critical - if (error_c == 1) { - $("#text-max_critical").addClass("input_error"); - svg.append("text") - .attr("x", -90) - .attr("y", 105) - .attr("fill", 'black') - .style("font-family", "arial") - .style("font-weight", "bold") - .style("font-size", 14) - .style("fill", "red") - .html(message_error_critical) - .style("text-anchor", "first"); - } - + } else { + error_w = 1; + paint_graph_status(0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical); } } + diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index a89a9422ba..da612b6e33 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -32,6 +32,7 @@ require_once($config['homedir'] . "/include/functions_modules.php"); require_once($config['homedir'] . "/include/functions_groups.php"); $editGraph = (bool) get_parameter('edit_graph', 0); +$action = get_parameter('action', ''); if (isset ($_GET["get_agent"])) { $id_agent = $_POST["id_agent"]; @@ -39,6 +40,122 @@ if (isset ($_GET["get_agent"])) { $chunkdata = $_POST["chunk"]; } +switch ($action) { + case 'sort_items': + $resultOperationDB = null; + $position_to_sort = (int)get_parameter('position_to_sort', 1); + $ids_serialize = (string)get_parameter('ids_items_to_sort', ''); + $move_to = (string)get_parameter('move_to', 'after'); + + $countItems = db_get_sql(' + SELECT COUNT(id_gs) + FROM tgraph_source + WHERE id_graph = ' . $id_graph); + + if (($countItems < $position_to_sort) || ($position_to_sort < 1)) { + $resultOperationDB = false; + } + else if (!empty($ids_serialize)) { + $ids = explode('|', $ids_serialize); + + switch ($config["dbtype"]) { + case "mysql": + $items = db_get_all_rows_sql(' + SELECT id_gs, `field_order` + FROM tgraph_source + WHERE id_graph = ' . $id_graph . ' + ORDER BY `field_order`'); + break; + } + + if ($items === false) $items = array(); + + + // Clean the repeated order values + $order_temp = 1; + foreach ($items as $item) { + switch ($config["dbtype"]) { + case "mysql": + db_process_sql_update('tgraph_source', + array('`field_order`' => $order_temp), + array('id_gs' => $item['id_rc'])); + break; + } + + $order_temp++; + } + + + switch ($config["dbtype"]) { + case "mysql": + $items = db_get_all_rows_sql(' + SELECT id_gs, `field_order` + FROM tgraph_source + WHERE id_graph = ' . $id_graph . ' + ORDER BY `field_order`'); + break; + } + + if ($items === false) $items = array(); + + + + $temp = array(); + + $temp = array(); + foreach ($items as $item) { + //Remove the contents from the block to sort + if (array_search($item['id_gs'], $ids) === false) { + $temp[$item['field_order']] = $item['id_gs']; + } + } + $items = $temp; + + + + $sorted_items = array(); + foreach ($items as $pos => $id_unsort) { + if ($pos == $position_to_sort) { + if ($move_to == 'after') { + $sorted_items[] = $id_unsort; + } + + foreach ($ids as $id) { + $sorted_items[] = $id; + } + + if ($move_to != 'after') { + $sorted_items[] = $id_unsort; + } + } + else { + $sorted_items[] = $id_unsort; + } + } + + $items = $sorted_items; + + + + foreach ($items as $order => $id) { + switch ($config["dbtype"]) { + case "mysql": + + db_process_sql_update('tgraph_source', + array('`field_order`' => ($order + 1)), + array('id_gs' => $id)); + break; + } + } + + $resultOperationDB = true; + } + else { + $resultOperationDB = false; + } + break; + } + if ($editGraph) { $graphRows = db_get_all_rows_sql("SELECT t1.*, (SELECT t3.alias @@ -49,7 +166,8 @@ if ($editGraph) { WHERE t2.id_agente_modulo = t1.id_agent_module)) AS agent_name FROM tgraph_source t1 - WHERE t1.id_graph = " . $id_graph); + WHERE t1.id_graph = " . $id_graph . " order by `field_order`"); + $position_array = array(); $module_array = array(); $weight_array = array(); $agent_array = array(); @@ -65,6 +183,7 @@ if ($editGraph) { $weight_array[] = $graphRow['weight']; $label_array[] = $graphRow['label']; $agent_array[] = $graphRow['agent_name']; + $position_array[] = $graphRow['field_order']; } $graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph); @@ -81,11 +200,13 @@ if ($editGraph) { if (count($module_array) > 0) { echo ""; echo " + - "; + + "; $color = 0; for ($a = 0; $a < count($module_array); $a++) { // Calculate table line color @@ -98,7 +219,8 @@ if (count($module_array) > 0) { $color = 1; } - echo ""; + echo ""; + echo ""; echo ""; @@ -126,11 +248,55 @@ if (count($module_array) > 0) { echo ""; + echo ""; + + echo ""; + + + echo ""; } echo "
".__('P.')." ".__('Agent')." ".__('Module')." ".__('Label')." ".__('Weight')."".__('Delete')."".__('Delete')."".__('Sort')."
" . $agent_array[$a] . "
$position_array[$a]" . $agent_array[$a] . ""; echo modules_get_agentmodule_name ($module_array[$a]).""; echo "".html_print_image('images/cross.png', true, array ('title' => __('Delete'))).""; - echo "
"; + + echo html_print_checkbox_extended('sorted_items[]', $idgs_array[$a], false, false, '', 'class="selected_check"', true); + + echo "
"; } + +$table = new stdClass(); +$table->width = '100%'; +$table->colspan[0][0] = 3; +$table->size = array(); +$table->size[0] = '25%'; +$table->size[1] = '25%'; +$table->size[2] = '25%'; +$table->size[3] = '25%'; +if (defined("METACONSOLE")) { + $table->class = "databox data"; + $table->head[0] = __("Sort items"); + $table->head_colspan[0] = 4; + $table->headstyle[0] = 'text-align: center'; +} +else { + $table->data[0][0] = "". __("Sort items") . ""; +} +$table->data[1][0] = __('Sort selected items'); +$table->data[1][1] = html_print_select_style( + array('before' => __('before to'), 'after' => __('after to')), 'move_to', + '', '', '', '', 0, true); +$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1, + 'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true); +$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true); +$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true); +$table->data[1][4] = html_print_input_hidden('action', 'sort_items', true); + +echo "
"; +html_print_table($table); +echo "
"; + +echo "
"; + + //Configuration form echo ''; echo "
"; @@ -217,4 +383,28 @@ function filterByGroup(idGroup) { "json" ); } + +function added_ids_sorted_items_to_hidden_input() { + var ids = ''; + var first = true; + + $("input.selected_check:checked").each(function(i, val) { + if (!first) + ids = ids + '|'; + first = false; + + ids = ids + $(val).val(); + }); + + $("input[name='ids_items_to_sort']").val(ids); + + if (ids == '') { + alert(""); + + return false; + } + else { + return true; + } +} diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index 9c95f2263b..cb2c5f265c 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -66,6 +66,9 @@ if ($edit_graph) { $height = $graphInTgraph['height']; $check = false; $percentil = $graphInTgraph['percentil']; + $summatory_series = $graphInTgraph['summatory_series']; + $average_series = $graphInTgraph['average_series']; + $modules_series = $graphInTgraph['modules_series']; if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = CUSTOM_GRAPH_BULLET_CHART; @@ -84,6 +87,9 @@ else { $stacked = 4; $check = false; $percentil = 0; + $summatory_series = 0; + $average_series = 0; + $modules_series = 0; } @@ -177,6 +183,16 @@ echo "
".__('Percentil')."" . html_print_checkbox ("percentil", 1, $percentil, true) . "
".__('Add summatory series') . + ui_print_help_tip (__("Adds synthetic series to the graph, using all module + values to calculate the summation and/or average in each time interval. + This feature could be used instead of synthetic modules if you only want to see a graph."), true) . "" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "".__('Add average series')."" . html_print_checkbox ("average_series", 1, $average_series, true) . "
".__('Modules and series')."" . html_print_checkbox ("modules_series", 1, $modules_series, true) . "
"; if ($edit_graph) { @@ -195,6 +211,12 @@ echo ''; ?> diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 317f562e6f..79cb82302a 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -87,6 +87,9 @@ if ($add_graph) { $period = get_parameter_post ("period"); $threshold = get_parameter('threshold'); $percentil = get_parameter ("percentil", 0); + $summatory_series = get_parameter ("summatory_series", 0); + $average_series = get_parameter ("average_series", 0); + $modules_series = get_parameter ("modules_series", 0); if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ $stacked = $threshold; @@ -103,7 +106,10 @@ if ($add_graph) { 'private' => 0, 'id_group' => $idGroup, 'stacked' => $stacked, - 'percentil' => $percentil + 'percentil' => $percentil, + 'summatory_series' => $summatory_series, + 'average_series' => $average_series, + 'modules_series' => $modules_series ); if (trim($name) != "") { @@ -131,6 +137,9 @@ if ($update_graph) { $period = get_parameter('period'); $stacked = get_parameter('stacked'); $percentil = get_parameter('percentil'); + $summatory_series = get_parameter ("summatory_series"); + $average_series = get_parameter ("average_series"); + $modules_series = get_parameter ("modules_series"); $alerts = get_parameter('alerts'); $threshold = get_parameter('threshold'); @@ -141,7 +150,10 @@ if ($update_graph) { if (trim($name) != "") { $success = db_process_sql_update('tgraph', - array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ), + array('name' => $name, 'id_group' => $id_group, 'description' => $description, + 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, + 'percentil' => $percentil, 'summatory_series' => $summatory_series, + 'average_series' => $average_series, 'modules_series' => $modules_series), array('id_graph' => $id_graph)); if ($success !== false) db_pandora_audit("Report management", "Update graph #$id_graph"); @@ -179,10 +191,14 @@ if ($add_module) { implode("','", $id_modules). "')"); - if (count($id_agent_modules) > 0 && $id_agent_modules != '') { - foreach($id_agent_modules as $id_agent_module) - $result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight)); - } + if (count($id_agent_modules) > 0 && $id_agent_modules != '') { + $order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC"); + $order = $order['field_order']; + foreach($id_agent_modules as $id_agent_module){ + $order++; + $result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order)); + } + } else $result = false; } diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 03a12883e7..fd7886f275 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -1976,7 +1976,7 @@ function set_static_graph_status(idElement, image, status) { data: parameter, success: function (data) { set_static_graph_status(idElement, image, data); - if(values['show_statistics'] == 1){ + if(data['show_statistics'] == 1){ if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); } diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 88ea386ee6..c84cb95f9c 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64'); tinyMCE.init({ mode : "exact", elements: "text-label", + convert_urls: false, theme : "advanced", data['ldap_login_attr'] = $row; + + // Admin LDAP login + $row = array(); + $row['name'] = __('Admin LDAP login'); + $row['control'] = html_print_input_text ('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true); + $table->data['ldap_admin_login'] = $row; + + // Admin LDAP password + $row = array(); + $row['name'] = __('Admin LDAP password'); + $row['control'] = html_print_input_password ('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true); + $table->data['ldap_admin_pass'] = $row; break; case 'pandora': diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 24955f0d17..61233d6901 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -188,7 +188,7 @@ $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Direc $table->data[32][1] = html_print_input_text ('server_log_dir', $config["server_log_dir"], '', 50, 255, true); -$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Maximun size to show in system log extension."), true); +$table->data[33][0] = __('Log size limit in system logs viewer extension') . ui_print_help_tip (__("Max size (in bytes) for the logs to be shown."), true); $table->data[33][1] = html_print_input_text ('max_log_size', $config["max_log_size"], '', 10, 255, true) . html_print_label(" x1000", "max_log_size", true); @@ -209,8 +209,8 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') . $table->data[34][1] = __('Yes').'   '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'  '; $table->data[34][1] .= __('No').'   '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true); -$table->data[35][0] = __('Limit parameters bulk') . - ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true); +$table->data[35][0] = __('Limit for bulk operations') . + ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true); $table->data[35][1] = html_print_input_text('limit_parameters_massive', $config['limit_parameters_massive'], '', 10, 10, true); diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index 085b23957d..2ee023dd7c 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -28,6 +28,7 @@ $update_filter = (int) get_parameter ('update_filter', -2); $delete_filter = (int) get_parameter ('delete_filter', -1); $description = (string) get_parameter ('description', ''); $filter = (string) get_parameter ('filter', ''); +$index_post = (int) get_parameter('index_post', 0); // Create/update header if ($edit_filter > -2) { @@ -44,9 +45,35 @@ else {// Overview header // Create/update filter if ($update_filter > -2) { + // UPDATE if ($update_filter > -1) { - $values = array('description' => $description, 'filter' => $filter); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter)); + $new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter)); + $elements = get_parameter('elements', array()); + + $elements = explode(",", $elements); + foreach ($elements as $e) { + $filter = get_parameter('filter_' . $e); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e)); + } + if (count($elements) == 1) { + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + $filter = get_parameter('filter_' . $elements[0]); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0])); + } + for ($i = 1; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + if ($filter != "") { + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } + if ($result === false) { ui_print_error_message (__('There was a problem updating the filter')); } @@ -54,11 +81,29 @@ if ($update_filter > -2) { ui_print_success_message (__('Successfully updated')); } } + // CREATE else { - $values = array( - 'description' => $description, - 'filter' => $filter); - $result = db_process_sql_insert('tsnmp_filter', $values); + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + if ($index_post == 1) { + $filter = get_parameter('filter_0'); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => 0); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + else { + for ($i = 0; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } + if ($result === false) { ui_print_error_message (__('There was a problem creating the filter')); } @@ -68,7 +113,15 @@ if ($update_filter > -2) { } } else if ($delete_filter > -1) { // Delete - $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); + $unified_id_to_delete = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter)); + + if ($unified_id_to_delete == 0) { + $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); + } + else { + $result = db_process_sql_delete('tsnmp_filter', array('unified_filters_id' => $unified_id_to_delete)); + } + if ($result === false) { ui_print_error_message (__('There was a problem deleting the filter')); } @@ -88,19 +141,50 @@ if ($edit_filter > -1) { // Create/update form if ($edit_filter > -2) { + $index = $index_post; $table->data = array (); + $table->id = 'filter_table'; $table->width = '100%'; $table->class = 'databox filters'; $table->data[0][0] = __('Description'); $table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true); $table->data[1][0] = __('Filter'); - $table->data[1][1] = html_print_input_text ('filter', $filter, '', 60, 100, true); - $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); - + if ($edit_filter > -1) { + $filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")"); + $j = 1; + foreach ($filters as $f) { + if ($j != 1) { + $table->data[$j][0] = ""; + } + $table->data[$j][1] = html_print_input_text ('filter_' . $f['id_snmp_filter'], $f['filter'], '', 60, 100, true); + if ($j == 1) { + $table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + else { + $table->data[$j][1] .= html_print_image('images/cross.png', true, array('id' => 'delete_filter_' . $f['id_snmp_filter'], 'alt' => __('Click to remove the filter'))); + } + $j++; + $index++; + } + } + else { + $table->data[1][1] = html_print_input_text ('filter_' . $index, $filter, '', 60, 100, true); + $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + $index++; echo ''; html_print_input_hidden ('update_filter', $edit_filter); + html_print_input_hidden ('index_post', $index); + if ($edit_filter > -1) { + $filters_to_post = array(); + foreach ($filters as $fil) { + $filters_to_post[] = $fil['id_snmp_filter']; + } + html_print_input_hidden ('elements', implode(",", $filters_to_post)); + } html_print_table ($table); echo '
'; + html_print_image('images/add.png', false, array('id' => 'add_filter', 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'), 'style' => 'float:left;')); if ($edit_filter > -1) { html_print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"'); } @@ -112,13 +196,13 @@ if ($edit_filter > -2) { // Overview } else { - $result = db_get_all_rows_in_table ("tsnmp_filter"); - if ($result === false) { - $result = array (); - require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php"); - return; + $result_unified = db_get_all_rows_sql("SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC"); + + $aglomerate_result = array(); + foreach ($result_unified as $res) { + $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC"); } - + $table->data = array (); $table->head = array (); $table->size = array (); @@ -133,16 +217,43 @@ else { $table->head[2] = __('Action'); $table->size[2] = "50px"; $table->align[2] = 'center'; - - foreach ($result as $row) { - $data = array (); - $data[0] = '' . $row['description'] . ''; - $data[1] = $row['filter']; - $data[2] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . - '  ' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; - array_push ($table->data, $data); + + foreach ($aglomerate_result as $ind => $row) { + if ($ind == 0) { + foreach ($row as $r) { + $data = array (); + $data[0] = '' . $r['description'] . ''; + $data[1] = $r['filter']; + $data[2] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + array_push ($table->data, $data); + } + } + else { + $ind2 = 0; + $compose_filter = array(); + $compose_id = ""; + $compose_action = ""; + foreach ($row as $i => $r) { + if ($ind2 == 0) { + $compose_id = '' . $r['description'] . ''; + $compose_action = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + $ind2++; + } + $compose_filter[] = $r['filter']; + } + $data = array (); + $data[0] = $compose_id; + $data[1] = implode(" AND ", $compose_filter); + $data[2] = $compose_action; + array_push ($table->data, $data); + } + } if (!empty ($table->data)) { @@ -157,3 +268,45 @@ else { echo '
'; } ?> + + diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index ef2e4f0f9c..afd33b961e 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -180,7 +180,7 @@ if ($create_user) { $values["data_section"] = $dashboard; } else if (io_safe_output($values['section']) == 'Visual console') { $values["data_section"] = $visual_console; - } else if ($values['section'] == 'Other'){ + } else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){ $values["data_section"] = get_parameter ('data_section'); } @@ -304,7 +304,7 @@ if ($update_user) { $values["data_section"] = $dashboard; } else if (io_safe_output($values['section']) == 'Visual console') { $values["data_section"] = $visual_console; - } else if ($values['section'] == 'Other'){ + } else if ($values['section'] == 'Other' || io_safe_output($values['section']) == 'External link'){ $values["data_section"] = get_parameter ('data_section'); } @@ -334,6 +334,8 @@ if ($update_user) { else { $res2 = update_user_password ($id, $password_new); if ($res2) { + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); $res3 = save_pass_history($id, $password_new); } ui_print_result_message ($res1 || $res2, @@ -345,6 +347,8 @@ if ($update_user) { $res2 = update_user_password ($id, $password_new); if ($res2) { $res3 = save_pass_history($id, $password_new); + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password updated','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); } ui_print_result_message ($res1 || $res2, __('User info successfully updated'), @@ -352,6 +356,8 @@ if ($update_user) { } } else { + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Password change', + 'descripcion' => 'Access password update failed','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); ui_print_error_message (__('Passwords does not match')); } } @@ -564,6 +570,7 @@ $values = array ( 'Group view'=>__('Group view'), 'Tactical view'=>__('Tactical view'), 'Alert detail' => __('Alert detail'), + 'External link' => __('External link'), 'Other'=>__('Other')); if (enterprise_installed() && !is_metaconsole()) { $values['Dashboard'] = __('Dashboard'); @@ -864,6 +871,11 @@ function show_data_section () { $("#dashboard").css("display", "none"); $("#visual_console").css("display", "none"); break; + case : + $("#text-data_section").css("display", ""); + $("#dashboard").css("display", "none"); + $("#visual_console").css("display", "none"); + break; case : $("#text-data_section").css("display", ""); $("#dashboard").css("display", "none"); diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 71acc33881..2a10e8c7b8 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -76,11 +76,11 @@ switch ($sortField) { switch ($sort) { case 'up': $selectLastConnectUp = $selected; - $order = array('field' => 'fullname', 'order' => 'ASC'); + $order = array('field' => 'last_connect', 'order' => 'ASC'); break; case 'down': $selectLastConnectDown = $selected; - $order = array('field' => 'fullname', 'order' => 'DESC'); + $order = array('field' => 'last_connect', 'order' => 'DESC'); break; } break; @@ -494,10 +494,4 @@ echo ''; enterprise_hook('close_meta_frame'); ?> - diff --git a/pandora_console/images/help/chart_normal_detail.png b/pandora_console/images/help/chart_normal_detail.png new file mode 100644 index 0000000000..7ded4aff9c Binary files /dev/null and b/pandora_console/images/help/chart_normal_detail.png differ diff --git a/pandora_console/images/help/chart_normal_sample.png b/pandora_console/images/help/chart_normal_sample.png new file mode 100644 index 0000000000..cdc19c14dd Binary files /dev/null and b/pandora_console/images/help/chart_normal_sample.png differ diff --git a/pandora_console/images/help/chart_tip_detail.png b/pandora_console/images/help/chart_tip_detail.png new file mode 100644 index 0000000000..1358037bf4 Binary files /dev/null and b/pandora_console/images/help/chart_tip_detail.png differ diff --git a/pandora_console/images/help/chart_tip_sample.png b/pandora_console/images/help/chart_tip_sample.png new file mode 100644 index 0000000000..c017adfdc4 Binary files /dev/null and b/pandora_console/images/help/chart_tip_sample.png differ diff --git a/pandora_console/images/help/creacion mapa normal.png b/pandora_console/images/help/creacion mapa normal.png new file mode 100644 index 0000000000..4ecc520812 Binary files /dev/null and b/pandora_console/images/help/creacion mapa normal.png differ diff --git a/pandora_console/images/help/creacion mapa vacio.png b/pandora_console/images/help/creacion mapa vacio.png new file mode 100644 index 0000000000..4b5619246d Binary files /dev/null and b/pandora_console/images/help/creacion mapa vacio.png differ diff --git a/pandora_console/images/help/crear enlace agente agente hijo.png b/pandora_console/images/help/crear enlace agente agente hijo.png new file mode 100644 index 0000000000..15017d9850 Binary files /dev/null and b/pandora_console/images/help/crear enlace agente agente hijo.png differ diff --git a/pandora_console/images/help/crear enlace agente agente padre.png b/pandora_console/images/help/crear enlace agente agente padre.png new file mode 100644 index 0000000000..70d7bbe727 Binary files /dev/null and b/pandora_console/images/help/crear enlace agente agente padre.png differ diff --git a/pandora_console/images/help/crear enlace de interfaz hijo.png b/pandora_console/images/help/crear enlace de interfaz hijo.png new file mode 100644 index 0000000000..ca0953329e Binary files /dev/null and b/pandora_console/images/help/crear enlace de interfaz hijo.png differ diff --git a/pandora_console/images/help/crear enlace de interfaz padre.png b/pandora_console/images/help/crear enlace de interfaz padre.png new file mode 100644 index 0000000000..97dcf524f5 Binary files /dev/null and b/pandora_console/images/help/crear enlace de interfaz padre.png differ diff --git a/pandora_console/images/help/crear enlace de interfaz tabla.png b/pandora_console/images/help/crear enlace de interfaz tabla.png new file mode 100644 index 0000000000..4023e66a8b Binary files /dev/null and b/pandora_console/images/help/crear enlace de interfaz tabla.png differ diff --git a/pandora_console/images/help/informacion de nodo.png b/pandora_console/images/help/informacion de nodo.png new file mode 100644 index 0000000000..8cc2d85805 Binary files /dev/null and b/pandora_console/images/help/informacion de nodo.png differ diff --git a/pandora_console/images/help/mapa vista general.png b/pandora_console/images/help/mapa vista general.png new file mode 100644 index 0000000000..c36ea56a34 Binary files /dev/null and b/pandora_console/images/help/mapa vista general.png differ diff --git a/pandora_console/images/help/mapa vista menu mapa.png b/pandora_console/images/help/mapa vista menu mapa.png new file mode 100644 index 0000000000..90c4a58547 Binary files /dev/null and b/pandora_console/images/help/mapa vista menu mapa.png differ diff --git a/pandora_console/images/help/mapa vista menu nodo.png b/pandora_console/images/help/mapa vista menu nodo.png new file mode 100644 index 0000000000..5430ea30f8 Binary files /dev/null and b/pandora_console/images/help/mapa vista menu nodo.png differ diff --git a/pandora_console/images/help/vista de la lista de mapas.png b/pandora_console/images/help/vista de la lista de mapas.png new file mode 100644 index 0000000000..81d61483d2 Binary files /dev/null and b/pandora_console/images/help/vista de la lista de mapas.png differ diff --git a/pandora_console/images/reset.png b/pandora_console/images/reset.png new file mode 100644 index 0000000000..a3304f8263 Binary files /dev/null and b/pandora_console/images/reset.png differ diff --git a/pandora_console/images/syslog.png b/pandora_console/images/syslog.png new file mode 100644 index 0000000000..aea0839c10 Binary files /dev/null and b/pandora_console/images/syslog.png differ diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index cad5efae1a..d431a83dd7 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -478,10 +478,13 @@ if ($get_extended_event) { if ($get_events_details) { $event_ids = explode(',',get_parameter ('event_ids')); - $events = db_get_all_rows_filter ('tevento', - array ('id_evento' => $event_ids, - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario')); + $events = db_get_all_rows_filter ( + 'tevento', + array ('id_evento' => $event_ids,'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'estado', 'criticity', 'id_usuario'), + 'AND', + true + ); $out = ''; $out .= ''; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 32de285b11..18a28e06c9 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -123,12 +123,17 @@ if ($get_module_detail) { $time_from = (string) get_parameter ('time_from', date ('h:iA')); $date_to = (string) get_parameter ('date_to', date ('Y-m-j')); $time_to = (string) get_parameter ('time_to', date ('h:iA')); + $freesearch = (string) get_parameter ('freesearch', ''); + $free_checkbox = (bool) get_parameter ('free_checkbox', false); $formtable->width = '98%'; $formtable->class = "databox"; $formtable->data = array (); $formtable->size = array (); + $moduletype_name = modules_get_moduletype_name( + modules_get_agentmodule_type($module_id)); + $periods = array(SECONDS_5MINUTES =>__('5 minutes'), SECONDS_30MINUTES =>__('30 minutes'), SECONDS_1HOUR =>__('1 hour'), @@ -175,10 +180,19 @@ if ($get_module_detail) { $formtable->data[1][2] .= html_print_input_text('time_to', $time_to, '', 9, 7, true); - html_print_table($formtable); + $freesearch_object = ''; + if (preg_match("/_string/", $moduletype_name)) { + $formtable->data[2][0] = __('Free search') . ' '; + $formtable->data[2][1] = html_print_input_text ('freesearch', $freesearch, '', 20, null, true); + $formtable->data[2][2] = html_print_checkbox('free_checkbox', 1, $free_checkbox, true); + $formtable->data[2][2] .= ' ' . __('Exact phrase'); + $freesearch_object = json_encode( array( + 'value' => io_safe_output($freesearch), + 'exact' => (bool)$free_checkbox + )); + } - $moduletype_name = modules_get_moduletype_name( - modules_get_agentmodule_type($module_id)); + html_print_table($formtable); $offset = (int) get_parameter("offset"); $block_size = (int) $config["block_size"]; @@ -222,10 +236,10 @@ if ($get_module_detail) { } $count = modules_get_agentmodule_data ($module_id, $period, - $date, true, $conexion); + $date, true, $conexion, 'ASC', $freesearch_object); $module_data = modules_get_agentmodule_data ($module_id, $period, - $date, false, $conexion, 'DESC'); + $date, false, $conexion, 'DESC', $freesearch_object); if (empty($module_data)) { $result = array(); @@ -758,7 +772,7 @@ if ($list_modules) { $table->head[5] = __('Status') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . ''; - $table->head[6] = __('Warn'); + $table->head[6] = __('Thresholds'); $table->head[7] = __('Data'); $table->head[8] = __('Graph'); $table->head[9] = __('Last contact') . ' ' . diff --git a/pandora_console/include/ajax/snmp.ajax.php b/pandora_console/include/ajax/snmp.ajax.php index 7b3e45c704..29fefa026e 100644 --- a/pandora_console/include/ajax/snmp.ajax.php +++ b/pandora_console/include/ajax/snmp.ajax.php @@ -20,6 +20,7 @@ require_once("include/functions_snmp.php"); $save_snmp_translation = (bool)get_parameter('save_snmp_translation', 0); $delete_snmp_translation = (bool)get_parameter('delete_snmp_translation', 0); $update_snmp_translation = (bool)get_parameter('update_snmp_translation', 0); +$delete_snmp_filter = (bool)get_parameter('delete_snmp_filter', 0); /* skins image checks */ if ($save_snmp_translation) { @@ -56,4 +57,11 @@ if ($update_snmp_translation) { return; } + +if ($delete_snmp_filter) { + $filter_id = get_parameter('filter_id'); + db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id)); + + return; +} ?> diff --git a/pandora_console/include/ajax/snmp_browser.ajax.php b/pandora_console/include/ajax/snmp_browser.ajax.php index 63053e1919..f7414c2fe1 100644 --- a/pandora_console/include/ajax/snmp_browser.ajax.php +++ b/pandora_console/include/ajax/snmp_browser.ajax.php @@ -33,8 +33,6 @@ if(is_ajax()){ $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_browser_privacy_pass')); $targets_oids = get_parameter ("oids", ""); - $targets_oids = explode(",", $targets_oids); - $custom_action = get_parameter ("custom_action", ""); if ($custom_action != "") { diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 89f2cf3bf7..6e7a612171 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -17,8 +17,25 @@ if (is_ajax ()) { global $config; - // Login check - check_login (); + enterprise_include_once("include/functions_dashboard.php"); + + $public_hash = get_parameter('hash', 0); + + // Try to authenticate by hash on public dashboards + if ($public_hash == 0) { + // Login check + check_login(); + } else { + $validate_hash = enterprise_hook( + 'dasboard_validate_public_hash', + array($public_hash, 'tree_view') + ); + if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) { + db_pandora_audit("Invalid public hash", "Trying to access report builder"); + require ("general/noaccess.php"); + exit; + } + } require_once($config['homedir'] . "/include/class/Tree.class.php"); enterprise_include_once("include/class/Tree.class.php"); @@ -36,6 +53,10 @@ if (is_ajax ()) { $rootID = get_parameter('rootID', -1); $serverID = get_parameter('serverID', false); $childrenMethod = get_parameter('childrenMethod', 'on_demand'); + $hash = get_parameter('hash', false); + if ($hash !== false) { + enterprise_hook('dasboard_validate_public_hash', array($hash, 'tree_view')); + } $default_filters = array( 'searchAgent' => '', diff --git a/pandora_console/include/ajax/visual_console.ajax.php b/pandora_console/include/ajax/visual_console.ajax.php index 789398139c..91af22ec7e 100644 --- a/pandora_console/include/ajax/visual_console.ajax.php +++ b/pandora_console/include/ajax/visual_console.ajax.php @@ -12,10 +12,30 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// Login check global $config; -check_login (); +enterprise_include_once ('include/functions_dashboard.php'); +require_once('include/functions_visual_map.php'); +enterprise_include_once('include/functions_visual_map.php'); + +$public_hash = get_parameter('hash', false); +$id_visual_console = get_parameter('id_visual_console', null); + +// Try to authenticate by hash on public dashboards +if ($public_hash === false) { + // Login check + check_login(); +} else { + $validate_hash = enterprise_hook( + 'dasboard_validate_public_hash', + array($public_hash, $id_visual_console, 'visual_console') + ); + if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) { + db_pandora_audit("Invalid public hash", "Trying to access report builder"); + require ("general/noaccess.php"); + exit; + } +} // Fix: IW was the old ACL to check for report editing, now is RW if (! check_acl ($config['id_user'], 0, "VR")) { @@ -29,12 +49,6 @@ if (! check_acl ($config['id_user'], 0, "VR")) { //Fix ajax to avoid include the file, 'functions_graph.php'. $ajax = true; - -require_once('include/functions_visual_map.php'); -enterprise_include_once('include/functions_visual_map.php'); - -$id_visual_console = get_parameter('id_visual_console', null); - $render_map = (bool)get_parameter('render_map', false); $graph_javascript = (bool)get_parameter('graph_javascript', false); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 3a07812d10..05e6f7fc4c 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -750,6 +750,7 @@ switch ($action) { // Don't change the label because only change the positions unset($values['label']); unset($values['label_position']); + // Don't change this values when move unset($values['id_agent']); unset($values['id_agente_modulo']); unset($values['enable_link']); diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 4b85e3a8e0..77ce04e257 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -689,42 +689,72 @@ function ldap_process_user_login ($login, $password) { } } + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } + $dc = io_safe_output($config["ldap_base_dn"]); #Search group of this user it belong. $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")"; $justthese = array("objectclass=group"); - $sr = ldap_search($ds, $dc, $filter, $justthese); + $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login)); + + if (!$sr == false){ + $user_dn=$sr["dn"]; + + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; - $memberof = ldap_get_entries($ds, $sr); - - if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) { + $correct = false; + if(!empty($ldap_base_dn)) { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) { + $correct = true; + } + } else { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { + $correct = true; + } + } @ldap_close ($ds); - return false; - } - else { - $memberof = $memberof[0]; - } - - unset($memberof["count"]); + + } else { + $sr = ldap_search($ds, $dc, $filter, $justthese); - $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; - - $correct = false; - if(!empty($ldap_base_dn)) { - if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) { - $correct = true; - } - } - else { - if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { - $correct = true; - } - } - - @ldap_close ($ds); + $memberof = ldap_get_entries($ds, $sr); + if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) { + @ldap_close ($ds); + return false; + } else { + $memberof = $memberof[0]; + } + unset($memberof["count"]); + + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; + $correct = false; + if(!empty($ldap_base_dn)) { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) { + $correct = true; + } + } else { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { + $correct = true; + } + } + @ldap_close ($ds); + } + if ($correct) { return true; } @@ -768,28 +798,46 @@ function get_ldap_login_attr ($login) { $id_user = $login; switch ($config['ldap_login_user_attr']) { - case 'email': + case 'mail': $dc = io_safe_output($config["ldap_base_dn"]); + + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; $justthese = array("mail"); - $sr = ldap_search($ds, $dc, $filter, $justthese); - - $info = ldap_get_entries($ds, $sr); + $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'],io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login)); - if ($info["count"] == 0 && !isset($info[0]["mail"])) { + if (!$sr == false){ + $id_user=$sr["mail"]; + @ldap_close ($ds); + } else { + $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0 ,2); + + $info = ldap_get_entries($ds, $sr); + if ($info["count"] == 0 && !isset($info[0]["mail"])) { + @ldap_close ($ds); + return $id_user; + } else { + $info = $info[0]; + } + + $id_user = $info['mail'][0]; @ldap_close ($ds); - return $id_user; } - else { - $info = $info[0]; - } - - $id_user = $info['mail'][0]; - - @ldap_close ($ds); - + break; } @@ -859,42 +907,75 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password, $dc = io_safe_output($config["ldap_base_dn"]); + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } + #Search group of this user it belong. $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; $justthese = array("objectclass=group"); - - $sr = ldap_search($ds, $dc, $filter, $justthese); - - $memberof = ldap_get_entries($ds, $sr); - - if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) { - @ldap_close ($ds); - return false; - } - else { - $memberof = $memberof[0]; - } - - unset($memberof["count"]); - $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; - - $correct = false; - if(!empty($ldap_base_dn)) { - if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) { - $correct = true; - } - } - else { - if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { - $correct = true; - } - } - - if (!$correct) { - @ldap_close ($ds); + $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user)); - return false; + if (!$sr == false) { + $user_dn=$sr["dn"]; + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; + + $correct = false; + if(!empty($ldap_base_dn)) { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) { + $correct = true; + } + } else { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { + $correct = true; + } + } + if (!$correct) { + @ldap_close ($ds); + return false; + } + } else { + $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2); + + $memberof = ldap_get_entries($ds, $sr); + + if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) { + @ldap_close ($ds); + return false; + } else { + $memberof = $memberof[0]; + } + + unset($memberof["count"]); + + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; + + $correct = false; + if(!empty($ldap_base_dn)) { + if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) { + $correct = true; + } + } else { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { + $correct = true; + } + } + + if (!$correct) { + @ldap_close ($ds); + return false; + } } $permissions = array(); @@ -968,25 +1049,31 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password, if (!is_user ($id_user)) { if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) { switch ($config['ldap_login_user_attr']) { - case 'email': + case 'mail': $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; $justthese = array("mail"); - $sr = ldap_search($ds, $dc, $filter, $justthese); + $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user)); + + if (!$sr == false){ + $id_user=$sr["mail"]; + $user_info['fullname']=$sr["mail"]; + } else { + $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2); + + $info = ldap_get_entries($ds, $sr); + if ($info["count"] == 0 && !isset($info[0]["mail"])) { + @ldap_close ($ds); + return false; + } else { + $info = $info[0]; + } + + $id_user = $info['mail'][0]; + $user_info['fullname'] = $id_user; + + } - $info = ldap_get_entries($ds, $sr); - - if ($info["count"] == 0 && !isset($info[0]["mail"])) { - @ldap_close ($ds); - return false; - } - else { - $info = $info[0]; - } - - $id_user = $info['mail'][0]; - $user_info['fullname'] = $id_user; - break; } } @@ -1299,6 +1386,35 @@ function delete_user_pass_ldap ($id_user) { return; } +function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $access_attr, $ldap_admin_user, $ldap_admin_pass, $user) { + $filter="(" . $access_attr . "=" . $user . ")"; + $shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x -h ' . $ldap_host . ' -p ' . $ldap_port . ' -P ' . $ldap_version . ' -E pr=10000/noprompt -D "' . $ldap_admin_user . '" -w ' . $ldap_admin_pass . ' -b "' . $dn . '" -s sub "' . $filter . '" | grep -v "^#\|^$" | sed "s/:\+ /=>/g"')); + foreach($shell_ldap_search as $line) { + $values = explode("=>", $line); + if(!empty($values[0]) && !empty($values[1])) { + $user_attr[$values[0]] = $values[1]; + } + } + + if (empty($user_attr)) { + return false; + } + + $user_dn = safe_output_accute(base64_decode($user_attr["dn"])); + if(strlen($user_dn) > 0) { + $user_attr["dn"]=$user_dn; + } + + return $user_attr; +} + +function safe_output_accute($string) { + $no_allowed= array ("á","é","í","ó","ú","Ã","É","Ã","Ó","Ú","ñ","Ñ"); + $allowed= array ("a","e","i","o","u","A","E","I","O","U","n","N"); + $result = str_replace($no_allowed, $allowed ,$string); + return $result; +} + //Reference the global use authorization error to last auth error. $config["auth_error"] = &$mysql_cache["auth_error"]; ?> \ No newline at end of file diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 6dc52ea68d..a64bb5fc90 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -23,6 +23,7 @@ class Tree { protected $filter = array(); protected $childrenMethod = "on_demand"; + protected $userGroupsACL; protected $userGroups; protected $strictACL = false; @@ -36,45 +37,29 @@ class Tree { $this->id = $id; $this->rootID = !empty($rootID) ? $rootID : $id; $this->serverID = $serverID; - $this->childrenMethod = $childrenMethod; - $this->access = $access; - - $userGroups = users_get_groups(false, $this->access); + $this->childrenMethod = $childrenMethod; + $this->access = $access; - if (empty($userGroups)) - $this->userGroups = false; - else - $this->userGroups = $userGroups; + $userGroupsACL = users_get_groups(false, $this->access); + $this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL; + $this->userGroups = $this->userGroupsACL; global $config; include_once($config['homedir']."/include/functions_servers.php"); include_once($config['homedir']."/include/functions_modules.php"); require_once($config['homedir']."/include/functions_tags.php"); - if (is_metaconsole()) - enterprise_include_once("meta/include/functions_ui_meta.php"); + if (is_metaconsole()) enterprise_include_once("meta/include/functions_ui_meta.php"); $this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']); $this->acltags = tags_get_user_module_and_tags($config['id_user'], $this->access); } - public function setType($type) { - $this->type = $type; - } - public function setFilter($filter) { $this->filter = $filter; } - public function isStrict () { - return $this->strictACL; - } - - public function setStrict ($value) { - $this->strictACL = (bool) $value; - } - protected function getAgentStatusFilter ($status = -1) { if ($status == -1) $status = $this->filter['statusAgent']; @@ -323,7 +308,7 @@ class Tree { case 'group': // ACL Group $user_groups_str = "-1"; - $group_acl = ""; + $group_filter = ""; if (!$this->strictACL) { if (empty($this->userGroups)) { return; @@ -338,7 +323,7 @@ class Tree { // Asking for all groups. else { $user_groups_str = implode(",", array_keys($this->userGroups)); - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } } else { @@ -356,7 +341,7 @@ class Tree { } } } - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } switch ($type) { @@ -390,7 +375,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -411,7 +396,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -439,7 +424,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter GROUP BY $group_by_fields @@ -456,7 +441,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter ORDER BY $order_fields"; @@ -498,7 +483,7 @@ class Tree { ON ta.disabled = 0 AND tam.id_agente = ta.id_agente AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter WHERE tam.disabled = 0 @@ -1123,7 +1108,8 @@ class Tree { if (empty($data)) return array(); - if ($this->type == 'agent') { + // [26/10/2017] It seems the module hierarchy should be only available into the tree by group + if ($this->rootType == 'group' && $this->type == 'agent') { $data = $this->getProcessedModules($data); } @@ -1866,6 +1852,25 @@ class Tree { } } + private static function extractGroupsWithIDs ($groups, $ids_hash) { + $result_groups = array(); + foreach ($groups as $group) { + if (isset($ids_hash[$group['id']])) { + $result_groups[] = $group; + } + else if (!empty($group['children'])) { + $result = self::extractGroupsWithIDs($group['children'], $ids_hash); + + // Item found on children + if (!empty($result)) { + $result_groups = array_merge($result_groups, $result); + } + } + } + + return $result_groups; + } + private static function extractItemWithID ($items, $item_id, $item_type = "group", $strictACL = false) { foreach ($items as $item) { if ($item["type"] != $item_type) @@ -2155,14 +2160,33 @@ class Tree { $processed_items = $this->getProcessedGroups($items, true); - // groupID filter. To access the view from tactical views f.e. - if (!empty($processed_items) && !empty($this->filter['groupID'])) { - $result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL); + if (!empty($processed_items)) { + // Filter by group name. This should be done after rerieving the items cause we need the possible items descendants + if (!empty($this->filter['searchGroup'])) { + // Save the groups which intersect with the user groups + $groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $this->filter['searchGroup'] . '%')); + if ($groups == false) $groups = array(); + $userGroupsACL = $this->userGroupsACL; + $ids_hash = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) { + $group_id = $group['id_grupo']; + if (isset($userGroupsACL[$group_id])) { + $userGroups[$group_id] = $userGroupsACL[$group_id]; + } + + return $userGroups; + }, array()); + + $result = self::extractGroupsWithIDs($processed_items, $ids_hash); + + $processed_items = ($result === false) ? array() : $result; + } + + // groupID filter. To access the view from tactical views f.e. + if (!empty($this->filter['groupID'])) { + $result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL); - if ($result === false) - $processed_items = array(); - else - $processed_items = array($result); + $processed_items = ($result === false) ? array() : array($result); + } } } // Agents diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 85d15a3877..2baa1f1377 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 = 'PC171120'; -$pandora_version = 'v7.0NG.715'; +$build_version = 'PC171218'; +$pandora_version = 'v7.0NG.716'; // 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 901cff9eeb..cc89ce8a0a 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -357,6 +357,7 @@ define('SERVER_TYPE_ENTERPRISE_TRANSACTIONAL', 14); define('SERVER_TYPE_MAINFRAME', 15); define('SERVER_TYPE_SYNC', 16); define('SERVER_TYPE_WUX', 17); +define('SERVER_TYPE_SYSLOG', 18); /* REPORTS */ define('REPORT_TOP_N_MAX', 1); diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 7da9316c65..7101f960de 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -738,7 +738,7 @@ function mysql_db_get_row_sql ($sql, $search_history_db = false) { * * @return mixed Array of the row or false in case of error. */ -function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND') { +function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { if (empty ($fields)) { $fields = '*'; } @@ -758,7 +758,7 @@ function mysql_db_get_row_filter ($table, $filter, $fields = false, $where_join $sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter); - return db_get_row_sql ($sql); + return db_get_row_sql ($sql, $historydb); } /** diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 4edfe2c512..104b201a29 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2580,7 +2580,7 @@ function get_percentile($percentile, $array) { $index = ($percentile / 100) * count($array); if (floor($index) == $index) { - $result = ($array[$index-1] + $array[$index]) / 2; + $result = ($array[$index-1] + $array[$index]) / 2; } else { $result = $array[floor($index)]; diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 838fb58d55..9c38157300 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -55,6 +55,17 @@ function agents_get_agent_id_by_module_id ($id_agente_modulo) { 'id_agente_modulo', $id_agente_modulo); } +/** + * Get agent id from an agent alias. + * + * @param string $alias Agent alias. + * + * @return int Id from the agent. + */ +function agents_get_agent_id_by_alias ($alias) { + return db_get_all_rows_sql ("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')"); +} + /** * Creates an agent * @@ -314,6 +325,13 @@ function agents_get_agents ($filter = false, $fields = false, $search = ''; } + if (isset($filter['search_custom'])) { + $search_custom = $filter['search_custom']; + unset($filter['search_custom']); + } else { + $search_custom = ''; + } + if (isset($filter['offset'])) { $offset = $filter['offset']; unset($filter['offset']); @@ -450,8 +468,8 @@ function agents_get_agents ($filter = false, $fields = false, $sql_extra, $where, $where_nogroup, $status_sql, $search, $disabled); } else { - $where = sprintf('%s AND %s AND (%s) %s AND %s', - $where, $where_nogroup, $status_sql, $search, $disabled); + $where = sprintf('%s AND %s AND (%s) %s AND %s %s', + $where, $where_nogroup, $status_sql, $search, $disabled, $search_custom); } $sql = sprintf('SELECT %s FROM tagente diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 8e87eee5b3..577dfe82f1 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1039,14 +1039,16 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal $filter = array (); if ($id_alert_agent_module) $filter['id'] = $id_alert_agent_module; - - // Get the modules of the fired alerts that will be deleted to update counts - $filter_get = $filter; - - $filter_get['group'] = 'id_agent_module'; - $filter_get['times_fired'] = '>0'; - - $fired_alert_modules = db_get_all_rows_filter('talert_template_modules', $filter_get, array('id_agent_module', 'COUNT(*) alerts')); + + // Get the id agent to update the fired alert counts + $agent_id = false; + if (isset ($filter['id_agent_module'])){ + $agent_id = modules_get_agentmodule_agent ($filter["id_agent_module"]); + } + else if (isset ($filter['id'])){ + $alert = alerts_get_alert_agent_module($id_alert_agent_module); + $agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]); + } /* The deletion of actions from talert_template_module_actions, @@ -1054,6 +1056,11 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal a foreing key and delete on cascade. */ if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) { + // Update fired alert count on the agent + // It will only occur if is specified the alert id or the id_agent_module + if ($agent_id !== false) { + db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id)); + } return true; } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 5ecac3a944..c1c7c9ca50 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -8531,7 +8531,7 @@ function api_set_enable_module ($agent_name, $module_name, $thrast3, $thrash4) { * @param string $template_name Name of the alert template (for example, "Warning event") * @param $thrash4 Don't use. -// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=garfio&id2=Status&other=Warning%20condition +// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=c2cea5860613e363e25f4ba185b54fe28f869ff8a5e8bb46343288337c903531&id2=Status&other=Warning%20condition */ function api_set_disable_alert ($agent_name, $module_name, $template_name, $thrash4) { @@ -8543,11 +8543,53 @@ function api_set_disable_alert ($agent_name, $module_name, $template_name, $thra $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name)); $id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"])); - db_process_sql("UPDATE talert_template_modules + $result = db_process_sql("UPDATE talert_template_modules SET disabled = 1 WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template"); - returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + if ($result) { + returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + } else { + returnData('string', array('type' => 'string', 'data' => __('Error alert disable'))); + } +} + + +/** + * Disable an alert with alias + * + * @param string $agent_alias Alias of agent (for example "myagent") + * @param string $module_name Name of the module (for example "Host alive") + * @param string $template_name Name of the alert template (for example, "Warning event") + * @param $thrash4 Don't use. + +// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert_alias&id=garfio&id2=Status&other=Warning%20condition + */ + +function api_set_disable_alert_alias ($agent_alias, $module_name, $template_name, $thrash4) { + if (defined ('METACONSOLE')) { + return; + } + + $agent_id = agents_get_agent_id_by_alias($agent_alias); + $result = false; + foreach ($agent_id as $key => $id_agent) { + $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent['id_agente'], 'nombre' => $module_name)); + $id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"])); + + $result = db_process_sql("UPDATE talert_template_modules + SET disabled = 1 + WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template"); + + if ($result) { + returnData('string', array('type' => 'string', 'data' => "Correct alert disable")); + return; + } + } + + if(!$result){ + returnData('string', array('type' => 'string', 'data' => __('Error alert disable'))); + } } /** diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 26e87a9cd8..30078c5685 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -343,6 +343,10 @@ function config_update_config () { $error_update[] = __('Base DN'); if (!config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr'))) $error_update[] = __('Login attribute'); + if (!config_update_value ('ldap_admin_login', get_parameter ('ldap_admin_login'))) + $error_update[] = __('Admin LDAP login'); + if (!config_update_value ('ldap_admin_pass', get_parameter ('ldap_admin_pass'))) + $error_update[] = __('Admin LDAP password'); if (!config_update_value ('fallback_local_auth', get_parameter ('fallback_local_auth'))) $error_update[] = __('Fallback to local authentication'); if (!config_update_value ('ldap_login_user_attr', get_parameter ('ldap_login_user_attr'))) @@ -1358,6 +1362,14 @@ function config_process_config () { if (!isset ($config['ldap_login_attr'])) { config_update_value ( 'ldap_login_attr', 'uid'); } + + if (!isset ($config['ldap_admin_login'])) { + config_update_value ( 'ldap_admin_login', ''); + } + + if (!isset ($config['ldap_admin_pass'])) { + config_update_value ( 'ldap_admin_pass', ''); + } if (!isset ($config['fallback_local_auth'])) { config_update_value ( 'fallback_local_auth', '0'); diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index cf131eac8e..efa5f2f342 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -30,24 +30,30 @@ function cron_update_module_interval ($module_id, $cron) { $module_interval = db_get_value_filter('module_interval','tagente_modulo',array("id_agente_modulo" => $module_id)); return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . $module_interval . ' WHERE id_agente_modulo = ' . (int) $module_id); } else { - return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . cron_next_execution ($cron) . ' WHERE id_agente_modulo = ' . (int) $module_id); + return db_process_sql ( + 'UPDATE tagente_estado SET current_interval = ' . + cron_next_execution ($cron, $module_interval, $module_id) . + ' WHERE id_agente_modulo = ' . + (int) $module_id) + ; } } // Get the number of seconds left to the next execution of the given cron entry. -function cron_next_execution ($cron) { +function cron_next_execution ($cron, $module_interval, $module_id) { // Get day of the week and month from cron config list ($minute, $hour, $mday, $month, $wday) = explode (" ", $cron); - // Get current time - $cur_time = time(); + // Get last execution time + $last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id); + $cur_time = ($last_execution !== false) ? $last_execution : time(); // Any day of the way if ($wday == '*') { - $nex_time = cron_next_execution_date ($cron, $cur_time); + $nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval); return $nex_time - $cur_time; } @@ -55,7 +61,7 @@ function cron_next_execution ($cron) { $count = 0; $nex_time = $cur_time; do { - $nex_time = cron_next_execution_date ($cron, $nex_time); + $nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval); $nex_time_wd = $nex_time; list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd)); @@ -80,90 +86,202 @@ function cron_next_execution ($cron) { } // Get the next execution date for the given cron entry in seconds since epoch. -function cron_next_execution_date ($cron, $cur_time = false) { +function cron_next_execution_date ($cron, $cur_time = false, $module_interval = 300) { // Get cron configuration - list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron); - + $cron_array = explode (" ", $cron); // Months start from 0 - if ($mon != '*') { - $mon -= 1; + if ($cron_array[3] != '*') { + $mon_s = cron_get_interval ($cron_array[3]); + if ($mon_s['up'] !== false) { + $cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1; + } else { + $cron_array[3] = $mon_s['down'] - 1; + } } // Get current time - if ($cur_time === false) { - $cur_time = time(); - } - list ($cur_min, $cur_hour, $cur_mday, $cur_mon, $cur_year) = explode (" ", date ("i H d m Y", $cur_time)); + if ($cur_time === false) $cur_time = time(); + + $nex_time = $cur_time + $module_interval; + $nex_time_array = explode (" ", date ("i H d m Y", $nex_time)); + if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time; - // Get first next date candidate from cron configuration - $nex_min = $min; - $nex_hour = $hour; - $nex_mday = $mday; - $nex_mon = $mon; - $nex_year = $cur_year; + // Get first next date candidate from next cron configuration + // Initialize some vars + $prev_ovfl = false; + + // Update minutes + $min_s = cron_get_interval ($cron_array[0]); + $nex_time_array[0] = ($min_s['down'] == '*') ? 0 : $min_s['down']; - // Replace wildcards - if ($min == '*') { - if ($hour != '*' || $mday != '*' || $wday != '*' || $mon != '*') { - $nex_min = 0; - } - else { - $nex_min = $cur_min; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time >= $cur_time) { + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; } } - if ($hour == '*') { - if ($mday != '*' || $wday != '*' ||$mon != '*') { - $nex_hour = 0; - } - else { - $nex_hour = $cur_hour; - } - } - if ($mday == '*') { - if ($mon != '*') { - $nex_mday = 1; - } - else { - $nex_mday = $cur_mday; - } - } - if ($mon == '*') { - $nex_mon = $cur_mon; - } - - // Find the next execution date - $count = 0; - do { - $next_time = mktime($nex_hour, $nex_min, 0, $nex_mon, $nex_mday, $nex_year); - if ($next_time > $cur_time) { - return $next_time; - } - if ($min == '*' && $hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1MINUTE)); - } - else if ($hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1HOUR)); - } - else if ($mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1DAY)); - } - else if ($mon == '*') { - $nex_mon = $nex_mon + 1; - if ($nex_mon > 11) { - $nex_mon = 0; - $nex_year++; + + // Check if next hour is in cron + $nex_time_array[1]++; + $nex_time = cron_valid_date($nex_time_array); + + if ($nex_time === false) { + // Update the month day if overflow + $prev_ovfl = true; + $nex_time_array[1] = 0; + $nex_time_array[2]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the month if overflow + $nex_time_array[2] = 1; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + #Update the year if overflow + $nex_time_array[3] = 0; + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); } } - else { - $nex_year++; - } - $count++; } - while ($count < SECONDS_1DAY); + // Check the hour + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the hour if fails + $hour_s = cron_get_interval ($cron_array[1]); + $nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down']; + + // When an overflow is passed check the hour update again + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + $prev_ovfl = false; + + // Check if next day is in cron + $nex_time_array[2]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the month if overflow + $prev_ovfl = true; + $nex_time_array[2] = 1; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the year if overflow + $nex_time_array[3] = 0; + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); + } + } + // Check the day + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the day if fails + $mday_s = cron_get_interval ($cron_array[2]); + $nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down']; + + // When an overflow is passed check the hour update in the next execution + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + $prev_ovfl = false; + + // Check if next month is in cron + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + #Update the year if overflow + $prev_ovfl = true; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + } + + // Check the month + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the month if fails + $mon_s = cron_get_interval ($cron_array[3]); + $nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down']; + + // When an overflow is passed check the hour update in the next execution + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + + // Update the year + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); + + return ($nex_time !== false) ? $nex_time : $module_interval; +} + +// Get an array with the cron interval +function cron_get_interval ($element) { + # Not a range + if (!preg_match('/(\d+)\-(\d+)/', $element, $capture)) { + return array( + 'down' => $element, + 'up' => false + ); + } + return array( + 'down' => $capture[1], + 'up' => $capture[2] + ); +} + +// Returns if a date is in a cron. Recursive. +function cron_is_in_cron($elems_cron, $elems_curr_time) { - // Something went wrong, default to 5 minutes - return $cur_time + SECONDS_5MINUTES; + $elem_cron = array_shift($elems_cron); + $elem_curr_time = array_shift($elems_curr_time); + + // If there is no elements means that is in cron + if ($elem_cron === null || $elem_curr_time === null) return true; + + // Go to last element if current is a wild card + if ($elem_cron != '*') { + $elem_s = cron_get_interval($elem_cron); + // Check if there is no a range + if (($elem_s['up'] === false) && ($elem_s['down'] != $elem_curr_time)) { + return false; + } + // Check if there is on the range + if ($elem_s['up'] !== false) { + if ($elem_s['down'] < $elem_s['up']) { + if ($elem_curr_time < $elem_s['down'] || $elem_curr_time > $elem_s['up']){ + return false; + } + } else { + if ($elem_curr_time > $elem_s['down'] || $elem_curr_time < $elem_s['up']){ + return false; + } + } + } + } + return cron_is_in_cron($elems_cron, $elems_curr_time); +} + +function cron_valid_date ($da) { + $st = sprintf("%04d:%02d:%02d %02d:%02d:00", $da[4], $da[3], $da[2], $da[1], $da[0]); + $time = strtotime($st); + return $time; } // Check if cron is properly constructed diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index adf077ec6a..d037e773e7 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -202,6 +202,11 @@ function custom_graphs_print($id_graph, $height, $width, $period, $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', $id_graph); + $series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph); + $summatory = $series[0]['summatory_series']; + $average = $series[0]['average_series']; + $modules_series = $series[0]['modules_series']; + $modules = array (); $weights = array (); $labels = array (); @@ -262,7 +267,10 @@ function custom_graphs_print($id_graph, $height, $width, $period, $percentil, $from_interface, $id_widget_dashboard, - $fullscale); + $fullscale, + $summatory, + $average, + $modules_series); if ($return) return $output; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 06c85ef194..33f2a70453 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -81,7 +81,7 @@ function db_connect($host = null, $db = null, $user = null, $pass = null, $port $ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $config['homedir'] = $ownDir; $login_screen = 'error_authconfig'; - require($config['homedir'] . '/general/error_screen.php'); + require($config['homedir'] . '../general/error_screen.php'); exit; } else if ($error == 0) { @@ -416,12 +416,12 @@ function db_get_row ($table, $field_search, $condition, $fields = false) { * * @return mixed Array of the row or false in case of error. */ -function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND') { +function db_get_row_filter($table, $filter, $fields = false, $where_join = 'AND', $historydb = false) { global $config; switch ($config["dbtype"]) { case "mysql": - return mysql_db_get_row_filter($table, $filter, $fields, $where_join); + return mysql_db_get_row_filter($table, $filter, $fields, $where_join, $historydb); break; case "postgresql": return postgresql_db_get_row_filter($table, $filter, $fields, $where_join); @@ -481,9 +481,6 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d } } - - - /** * * Returns the time the module is in unknown status (by events) @@ -493,7 +490,7 @@ function db_get_all_rows_sql($sql, $search_history_db = false, $cache = true, $d * @param int $tend end of search * */ -function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false) { +function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend = false, $historydb = false) { global $config; if (!isset($id_agente_modulo)) { @@ -514,20 +511,19 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend return false; } - // Retrieve going unknown events in range $query = "SELECT utimestamp,event_type FROM tevento WHERE id_agentmodule = " . $id_agente_modulo; $query .= " AND event_type like 'going_%' "; $query .= " AND utimestamp >= $tstart AND utimestamp <= $tend "; $query .= " ORDER BY utimestamp ASC"; - $events = db_get_all_rows_sql($query); + $events = db_get_all_rows_sql($query, $historydb); if (! is_array($events)){ return false; } - $last_status = 0; // normal + $last_status = $events[0]["event_type"] != "going_unknown" ? 1:0; $return = array(); $i=0; foreach ($events as $event) { @@ -555,6 +551,9 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend } } } + if(!isset($return[0])){ + return false; + } return $return; } @@ -573,6 +572,16 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend * * Note: All "unknown" data are marked as NULL * Warning: Be careful with the amount of data, check your RAM size available + * We'll return a bidimensional array + * Structure returned: schema: + * + * uncompressed_data => + * pool_id (int) + * utimestamp (start of current slice) + * data + * array + * datos + * utimestamp * */ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = false) { @@ -582,17 +591,6 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f return false; } - if ((!isset($tstart)) || ($tstart === false)) { - // Return data from the begining - // Get first available utimestamp in active DB - $query_first_man_time = " SELECT utimestamp FROM tagente_datos "; - $query_first_man_time .= " WHERE id_agente_modulo = $id_agente_modulo"; - $query_first_man_time .= " ORDER BY utimestamp ASC LIMIT 1"; - - $first_man_time = db_get_all_rows_sql( $query_first_man_time, false); - $tstart = $first_man_time[0]['utimestamp']; - } - if ((!isset($tend)) || ($tend === false)) { // Return data until now $tend = time(); @@ -612,270 +610,263 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f } $module_type = $module['id_tipo_modulo']; $module_type_str = modules_get_type_name ($module_type); + if (strstr ($module_type_str, 'string') !== false) { $table = "tagente_datos_string"; } - - // Get first available utimestamp in active DB - $query = " SELECT utimestamp, datos FROM $table "; - $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp < $tstart"; - $query .= " ORDER BY utimestamp DESC LIMIT 1"; - - $ret = db_get_all_rows_sql( $query , $search_historydb); - - if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { - // Value older than first retrieved from active DB - $search_historydb = true; - - $ret = db_get_all_rows_sql( $query , $search_historydb); - - if ($ret) { - $tstart = $ret[0]["utimestamp"]; - } + + $flag_async = false; + if(strstr ($module_type_str, 'async_data') !== false) { + $flag_async = true; } - else { - $first_data["utimestamp"] = $ret[0]["utimestamp"]; - $first_data["datos"] = $ret[0]["datos"]; + if(strstr ($module_type_str, 'async_proc') !== false) { + $flag_async = true; } - if ( ( $ret === false ) || (( isset($ret[0]["utimestamp"]) && ($ret[0]["utimestamp"] > $tstart )))) { - // No previous data. -> not init - // Avoid false unknown status - $first_data["utimestamp"] = time(); + $result = modules_get_first_date($id_agente_modulo,$tstart); + $first_utimestamp = $result["first_utimestamp"]; + $search_historydb = $result["search_historydb"]; + + if ($first_utimestamp === false) { + $first_data["utimestamp"] = $tstart; $first_data["datos"] = false; } else { - $first_data["utimestamp"] = $ret[0]["utimestamp"]; - $first_data["datos"] = $ret[0]["datos"]; + $query = "SELECT datos,utimestamp FROM $table "; + $query .= " WHERE id_agente_modulo=$id_agente_modulo "; + $query .= " AND utimestamp=" . $first_utimestamp; + + $data = db_get_all_rows_sql($query,$search_historydb); + + if ($data === false) { + // first utimestamp not found in active database + // SEARCH HISTORY DB + $search_historydb = true; + $data = db_get_all_rows_sql($query,$search_historydb); + } + + if ($data === false) { // Not init + $first_data["utimestamp"] = $tstart; + $first_data["datos"] = false; + } + else { + $first_data["utimestamp"] = $data[0]["utimestamp"]; + $first_data["datos"] = $data[0]["datos"]; + + } } $query = " SELECT utimestamp, datos FROM $table "; $query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend"; $query .= " ORDER BY utimestamp ASC"; - // Retrieve all data from module in given range $raw_data = db_get_all_rows_sql($query, $search_historydb); - if (($raw_data === false) && ($ret === false)) { + $module_interval = modules_get_interval ($id_agente_modulo); + + if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) { // No data return false; } // Retrieve going unknown events in range - $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend); + $unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb); + + // Get the last event after inverval to know if graph start on unknown + $previous_unknown_events = db_get_row_filter ( + 'tevento', + array ('id_agentmodule' => $id_agente_modulo, + "utimestamp <= $tstart", + 'order' => 'utimestamp DESC' + ), + false, + 'AND', + $search_historydb + ); + + //show graph if graph is inside unknown + if( $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && + $unknown_events === false && $raw_data === false){ + $last_inserted_value = $first_data["datos"]; + $unknown_events[0]['time_from'] = $tstart+0.1; + } + + //if time to is missing in last event force time to outside range time + if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){ + $unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval; + } + + //if time to is missing in first event force time to outside range time + if ($first_data["datos"] === false && !$flag_async) { + $last_inserted_value = false; + }elseif( ($unknown_events && !isset($unknown_events[0]['time_from']) && + $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) || + ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){ + //$last_inserted_value = null; + $last_inserted_value = $first_data["datos"]; + $unknown_events[0]['time_from'] = $tstart+0.1; + } + else{ + $last_inserted_value = $first_data["datos"]; + } // Retrieve module_interval to build the template - $module_interval = modules_get_interval ($id_agente_modulo); $slice_size = $module_interval; - // We'll return a bidimensional array - // Structure returned: schema: - // - // uncompressed_data => - // pool_id (int) - // utimestamp (start of current slice) - // data - // array - // utimestamp - // datos - $return = array(); // Point current_timestamp to begin of the set and initialize flags $current_timestamp = $tstart; - $last_inserted_value = $first_data["datos"]; $last_timestamp = $first_data["utimestamp"]; - $data_found = 0; + $last_value = $first_data["datos"]; + + //reverse array data optimization + $raw_data = array_reverse($raw_data); // Build template $pool_id = 0; $now = time(); - $in_unknown_status = 0; - if (is_array($unknown_events)) { - $current_unknown = array_shift($unknown_events); + if($unknown_events){ + $current_unknown = array_shift($unknown_events); + } + else{ + $current_unknown = null; + } + + if($raw_data){ + $current_raw_data = array_pop($raw_data); + } + else{ + $current_raw_data = null; } - while ( $current_timestamp < $tend ) { - $expected_data_generated = 0; + while ( $current_timestamp < $tend ) { $return[$pool_id]["data"] = array(); $tmp_data = array(); - $data_found = 0; + $current_timestamp_end = $current_timestamp + $slice_size; - if (is_array($unknown_events)) { - $i = 0; - while ($current_timestamp >= $unknown_events[$i]["time_to"] ) { - // Skip unknown events in past - array_splice($unknown_events, $i,1); - $i++; - if (!isset($unknown_events[$i])) { - break; - } - } - if (isset($current_unknown)) { - - // check if recovered from unknown status - if(is_array($unknown_events) && isset($current_unknown)) { - if ( (($current_timestamp+$slice_size) > $current_unknown["time_to"]) - && ($current_timestamp < $current_unknown["time_to"]) - && ($in_unknown_status == 1) ) { - // Recovered from unknown - - if ( ($current_unknown["time_to"] > $current_timestamp) - && ($expected_data_generated == 0) ) { - // also add the "expected" data - $tmp_data["utimestamp"] = $current_timestamp; - if ($in_unknown_status == 1) { - $tmp_data["datos"] = null; - } - else { - $tmp_data["datos"] = $last_inserted_value; - } - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - $expected_data_generated = 1; - } - - - $tmp_data["utimestamp"] = $current_unknown["time_to"]; - $tmp_data["datos"] = $last_inserted_value; - // debug purpose - //$tmp_data["obs"] = "event recovery data"; - - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - $data_found = 1; - $in_unknown_status = 0; - } - - if ( (($current_timestamp+$slice_size) > $current_unknown["time_from"]) - && (($current_timestamp+$slice_size) < $current_unknown["time_to"]) - && ($in_unknown_status == 0) ) { - // Add unknown state detected - - if ( $current_unknown["time_from"] < ($current_timestamp+$slice_size)) { - if ( ($current_unknown["time_from"] > $current_timestamp) - && ($expected_data_generated == 0) ) { - // also add the "expected" data - $tmp_data["utimestamp"] = $current_timestamp; - if ($in_unknown_status == 1) { - $tmp_data["datos"] = null; - } - else { - $tmp_data["datos"] = $last_inserted_value; - } - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - $expected_data_generated = 1; - } - - $tmp_data["utimestamp"] = $current_unknown["time_from"]; - $tmp_data["datos"] = null; - // debug purpose - //$tmp_data["obs"] = "event data"; - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - $data_found = 1; - } - $in_unknown_status = 1; - } - - if ( ($in_unknown_status == 0) && ($current_timestamp >= $current_unknown["time_to"]) ) { - $current_unknown = array_shift($unknown_events); - } - } - } // unknown events handle - } - - // Search for data - $i=0; - if (is_array($raw_data)) { - foreach ($raw_data as $data) { - if ( ($data["utimestamp"] >= $current_timestamp) - && ($data["utimestamp"] < ($current_timestamp+$slice_size)) ) { - // Data in block, push in, and remove from $raw_data (processed) - - if ( ($data["utimestamp"] > $current_timestamp) - && ($expected_data_generated == 0) ) { - // also add the "expected" data - $tmp_data["utimestamp"] = $current_timestamp; - if ($in_unknown_status == 1) { - $tmp_data["datos"] = null; - } - else { - $tmp_data["datos"] = $last_inserted_value; - } - //$tmp_data["obs"] = "expected data"; - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - $expected_data_generated = 1; - } - - $tmp_data["utimestamp"] = intval($data["utimestamp"]); - $tmp_data["datos"] = $data["datos"]; - // debug purpose - //$tmp_data["obs"] = "real data"; - - $return[$pool_id]["utimestamp"] = $current_timestamp; - array_push($return[$pool_id]["data"], $tmp_data); - - $last_inserted_value = $data["datos"]; - $last_timestamp = intval($data["utimestamp"]); - - unset($raw_data[$i]); - $data_found = 1; - $in_unknown_status = 0; - } - elseif ($data["utimestamp"] > ($current_timestamp+$slice_size)) { - // Data in future, stop searching new ones - break; - } - } - $i++; - } - - if ($data_found == 0) { - // No data found, lug the last_value until SECONDS_1DAY + 2*modules_get_interval - // UNKNOWN! - - if (($current_timestamp > $now) || (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2*$module_interval))) { - if (isset($last_inserted_value)) { - // unhandled unknown status control - $unhandled_time_unknown = $current_timestamp - (SECONDS_1DAY + 2*$module_interval) - $last_timestamp; - if ($unhandled_time_unknown > 0) { - // unhandled unknown status detected. Add to previous pool - $tmp_data["utimestamp"] = intval($last_timestamp) + (SECONDS_1DAY + 2*$module_interval); - $tmp_data["datos"] = null; - // debug purpose - //$tmp_data["obs"] = "unknown extra"; - // add to previous pool if needed - if (isset($return[$pool_id-1])) { - array_push($return[$pool_id-1]["data"], $tmp_data); - } - } - } - $last_inserted_value = null; - } - - $tmp_data["utimestamp"] = $current_timestamp; - - if ($in_unknown_status == 1) { - $tmp_data["datos"] = null; - } - else { - $tmp_data["datos"] = $last_inserted_value; - } - // debug purpose - //$tmp_data["obs"] = "virtual data"; + if (( $current_timestamp > $now) || + ( ($current_timestamp_end - $last_timestamp) > + (SECONDS_1DAY + 2 * $module_interval) ) ) { + + $tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2 * $module_interval; - $return[$pool_id]["utimestamp"] = $current_timestamp; + //check not init + $tmp_data["datos"] = $last_value === false ? false : null; + + //async not unknown + if($flag_async && $tmp_data["datos"] === null){ + $tmp_data["datos"] = $last_inserted_value; + } + + // debug purpose + //$tmp_data["obs"] = "unknown extra"; array_push($return[$pool_id]["data"], $tmp_data); } + //insert first slice data + $tmp_data["utimestamp"] = $current_timestamp; + $tmp_data["datos"] = $last_inserted_value; + // debug purpose + //$tmp_data["obs"] = "virtual data"; + + $return[$pool_id]["utimestamp"] = $current_timestamp; + array_push($return[$pool_id]["data"], $tmp_data); + + //insert raw data + while ( ($current_raw_data != null) && + ( ($current_timestamp_end >= $current_raw_data['utimestamp']) && + ($current_timestamp < $current_raw_data['utimestamp']) ) ) { + + // Add unknown state detected + $tmp_data["utimestamp"] = $current_raw_data["utimestamp"]; + $tmp_data["datos"] = $current_raw_data["datos"]; + // debug purpose + //$tmp_data["obs"] = "real data"; + array_push($return[$pool_id]["data"], $tmp_data); + + $last_value = $current_raw_data["datos"]; + $last_timestamp = $current_raw_data["utimestamp"]; + if($raw_data){ + $current_raw_data = array_pop($raw_data); + } + else{ + $current_raw_data = null; + } + } + + //unknown + $data_slices = $return[$pool_id]["data"]; + if(!$flag_async){ + while ( ($current_unknown != null) && + ( ( ($current_unknown['time_from'] != null) && + ($current_timestamp_end >= $current_unknown['time_from']) ) || + ($current_timestamp_end >= $current_unknown['time_to']) ) ) { + + if( ( $current_timestamp <= $current_unknown['time_from']) && + ( $current_timestamp_end >= $current_unknown['time_from'] ) ){ + // Add unknown state detected + $tmp_data["utimestamp"] = $current_unknown["time_from"]; + $tmp_data["datos"] = null; + // debug purpose + //$tmp_data["obs"] = "event data unknown from"; + array_push($return[$pool_id]["data"], $tmp_data); + $current_unknown["time_from"] = null; + } + + if( ($current_timestamp <= $current_unknown['time_to']) && + ($current_timestamp_end >= $current_unknown['time_to'] ) ){ + $tmp_data["utimestamp"] = $current_unknown["time_to"]; + $i = count($data_slices) - 1; + while ($i >= 0) { + if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){ + $tmp_data["datos"] = + $data_slices[$i]['datos'] == null + ? $last_value + : $data_slices[$i]['datos']; + break; + } + $i--; + } + + // debug purpose + //$tmp_data["obs"] = "event data unknown to"; + array_push($return[$pool_id]["data"], $tmp_data); + if($unknown_events){ + $current_unknown = array_shift($unknown_events); + } + else{ + $current_unknown = null; + } + } + } + } + //sort current slice + usort( + $return[$pool_id]['data'], + function ($a, $b) { + if ($a['utimestamp'] == $b['utimestamp']) return 0; + return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1; + } + ); + //put the last slice data like first element of next slice + $last_inserted_value = end($return[$pool_id]['data']); + $last_inserted_value = $last_inserted_value['datos']; + + //increment $pool_id++; - $current_timestamp += $slice_size; + $current_timestamp = $current_timestamp_end; } + //slice to the end. + if($pool_id == 1){ + $end_array = array(); + $end_array['data'][0]['utimestamp'] = $tend; + $end_array['data'][0]['datos'] = $last_inserted_value; + //$end_array['data'][0]['obs'] = 'virtual data END'; + array_push($return, $end_array); + } return $return; } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 763f246bdf..4a33976377 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1687,7 +1687,7 @@ function events_page_responses ($event, $childrens_ids = array()) { $users[0]['id_user'] = $config['id_user']; $users[0]['fullname'] = $user_name; } else { - $users = groups_get_users($_user_groups, array('id_perfil' => $profiles_view_events), true, true); + $users = groups_get_users($_user_groups, array('id_perfil' => $profiles_view_events), true); } foreach($users as $u) { @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 1297ea50b2..a27d7d2ec2 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -151,7 +151,7 @@ if ($upload_file) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; @@ -219,7 +219,7 @@ if ($create_text_file) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; @@ -279,7 +279,7 @@ if ($upload_zip) { check_login (); - if (! check_acl ($config['id_user'], 0, "PM")) { + if (! check_acl ($config['id_user'], 0, "AW")) { db_pandora_audit("ACL Violation", "Trying to access File manager"); require ("general/noaccess.php"); return; diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index 8f1a02f9f0..ee14a2f707 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -573,14 +573,17 @@ function gis_get_agent_icon_map($idAgent, $state = false, $status = null) { switch ($status) { case 1: case 4: + case 100: //Critical (BAD or ALERT) $state = ".bad"; break; case 0: + case 300: //Normal (OK) $state = ".ok"; break; case 2: + case 200: //Warning $state = ".warning"; break; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index ccad237208..11260d6316 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -247,27 +247,23 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i // Event iterator $event_i = 0; - // Is unknown flag - $is_unknown = $start_unknown; - // Calculate chart data $last_known = $previous_data; + + $first_events_unknown = $start_unknown; for ($i = 0; $i <= $resolution; $i++) { $timestamp = $datelimit + ($interval * $i); - if ($fullscale && ($resolution > ($config['graph_res'] * 50))) { - $timestamp = $data[$i]['utimestamp']; - } - $total = 0; $count = 0; // Read data that falls in the current interval $interval_min = false; $interval_max = false; - - while (isset ($data[$data_i]) && $data[$data_i]['utimestamp'] >= $timestamp && $data[$data_i]['utimestamp'] < ($timestamp + $interval)) { + + while (isset ($data[$data_i]) && $data[$data_i]['utimestamp'] >= $timestamp + && $data[$data_i]['utimestamp'] < ($timestamp + $interval)) { if ($interval_min === false) { $interval_min = $data[$data_i]['datos']; } @@ -308,11 +304,17 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i $alert_value = 0; $unknown_value = 0; // Is the first point of a unknown interval + $check_unknown = false; $first_unknown = false; - + if($first_events_unknown){ + $is_unknown = true; + } + $event_ids = array(); $alert_ids = array(); - while (isset ($events[$event_i]) && $events[$event_i]['utimestamp'] >= $timestamp && $events[$event_i]['utimestamp'] <= ($timestamp + $interval)) { + + while (isset ($events[$event_i]) && $events[$event_i]['utimestamp'] >= $timestamp + && $events[$event_i]['utimestamp'] <= ($timestamp + $interval)) { if ($show_events == 1) { $event_value++; $event_ids[] = $events[$event_i]['id_evento']; @@ -327,8 +329,11 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i $first_unknown = true; } $is_unknown = true; + $check_unknown = true; } else if (substr ($events[$event_i]['event_type'], 0, 5) == 'going') { + $first_events_unknown = false; + $first_unknown = false; $is_unknown = false; } } @@ -489,9 +494,14 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i if (!isset($chart[$timestamp]['unknown'.$series_suffix])) { $chart[$timestamp]['unknown'.$series_suffix] = 0; } - $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; - $series_type['unknown'.$series_suffix] = 'area'; + + if($unknown_value == 0 && $check_unknown == true){ + $chart[$timestamp]['unknown'.$series_suffix] = 1; + $check_unknown = false; + } + + $series_type['unknown'.$series_suffix] = 'unknown'; } if (!empty($event_ids)) { @@ -502,6 +512,14 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i } } + //min paint graph 2 elements + if(count($chart) == 1){ + $timestamp_short = date($time_format, $date_limit); + foreach($chart as $key => $value){ + $chart[$timestamp_short] = $value; + } + } + if (!is_null($percentil) && $percentil) { $avg = array_map(function($item) { return $item['sum'];}, $chart); @@ -546,12 +564,15 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $start_unknown = false; // Set variables - if ($date == 0) $date = get_system_time(); + if ($date == 0) { + $date = get_system_time(); + } + $datelimit = $date - $period; + + $search_in_history_db = db_search_in_history_db($datelimit); - - if($force_interval){ $resolution = $period/$time_interval; } @@ -564,6 +585,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, } else{ $interval = (int) ($period / $resolution); + } $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); @@ -582,18 +604,29 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Get event data (contains alert data too) $events = array(); if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter ('tevento', + $events = db_get_all_rows_filter ( + 'tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('id_evento', 'evento', 'utimestamp', 'event_type')); + array ('id_evento', 'evento', 'utimestamp', 'event_type'), + 'AND', + $search_in_history_db + ); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ('tevento', + $prev_event = db_get_row_filter ( + 'tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC')); + 'order' => 'utimestamp DESC' + ), + false, + 'AND', + $search_in_history_db + ); + if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -608,7 +641,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, fullscale_data( $chart, $chart_data_extra, $long_index, $series_type, $agent_module_id, $datelimit, $date, $events, $show_events, $show_unknown, $show_alerts, - $series_suffix, $percentil, $flash_chart); + $series_suffix, $percentil, $flash_chart, false); if (count($chart) > $resolution) { $resolution = count($chart); //Number of points of the graph $interval = (int) ($period / $resolution); @@ -620,45 +653,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('datos', 'utimestamp'), 'AND', false); + array ('datos', 'utimestamp'), 'AND', $search_in_history_db); - if ($search_in_history_db) { - $cache = false; - $history = false; - - $sql = "SELECT datos, utimestamp FROM tagente_datos WHERE id_agente_modulo = " . (int)$agent_module_id . - " AND utimestamp > " . $datelimit . " AND utimestamp < " . $date . - " ORDER BY utimestamp ASC"; - - // Connect to the history DB - if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) { - $config['history_db_connection'] = db_connect($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false); - } - if ($config['history_db_connection'] !== false) { - $history = mysql_db_process_sql ($sql, 'affected_rows', $config['history_db_connection'], false); - } - - if ($history === false) { - $history = array (); - } - - $new_data = array(); - $last_timestamp = 0; - foreach($history as $h) { - $new_data[] = $h; - $last_timestamp = $h['utimestamp']; - } - foreach($data as $d) { - if ($d['utimestamp'] > $last_timestamp) { - $new_data[] = $d; - $last_timestamp = $d['utimestamp']; - } - } - $data = $new_data; - } - - - if ($data === false) { $data = array (); } @@ -746,6 +742,18 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, // Calculate chart data if($fullscale){ $avg_only = 1; + + //Percentil + if (!is_null($percentil) && $percentil) { + $avg = array_map(function($item) { return $item['sum'];}, $chart); + + $percentil_result = get_percentile($percentil, $avg); + + //Fill the data of chart + array_walk($chart, function(&$item) use ($percentil_result, $series_suffix) { + $item['percentil' . $series_suffix] = $percentil_result; }); + $series_type['percentil' . $series_suffix] = 'line'; + } } else{ grafico_modulo_sparse_data_chart ($chart, $chart_data_extra, $long_index, @@ -756,7 +764,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $percentil, $fullscale, $force_interval, $time_interval, $max_only, $min_only); } - + // Return chart data and don't draw if ($return_data == 1) { return $chart; @@ -773,8 +781,11 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $event_max = 5; } } - + foreach ($chart as $timestamp => $chart_data) { + if($chart_data['max'] > $event_max){ + $event_max = $chart_data['max']; + } if ($show_events && $chart_data['event' . $series_suffix] > 0) { $chart[$timestamp]['event' . $series_suffix] = $event_max * 1.2; } @@ -1114,14 +1125,15 @@ function graphic_combined_module ($module_list, $weight_list, $period, $name_list = array(), $unit_list = array(), $show_last = true, $show_max = true, $show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $vconsole = false, $percentil = null, $from_interface = false, - $id_widget_dashboard=false, $fullscale = false) { + $id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0, $modules_series = 0) { global $config; global $graphic_type; - + if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; + $unit_list_aux = array(); if ($projection != false) { if ($period < $prediction_period) @@ -1204,7 +1216,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, $weight_list[$i] = 1; } } - + + $aux_array = array(); // Set data containers for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i);/* @@ -1256,12 +1269,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, // If its a projection graph, // first module will be data and second will be the projection + if ($projection != false && $i != 0) { if ($automatic_custom_graph_meta) $agent_module_id = $module_list[0]['module']; else $agent_module_id = $module_list[0]; - $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1272,7 +1285,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, else $agent_module_id = $module_list[$i]; - $id_module_type = modules_get_agentmodule_type ($agent_module_id); $module_type = modules_get_moduletype_name ($id_module_type); $uncompressed_module = is_module_uncompressed ($module_type); @@ -1306,6 +1318,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, if ($data === false) { $data = array (); } + // Uncompressed module data if ($uncompressed_module) { @@ -1336,7 +1349,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $min_necessary = 2; } - + // Set initial conditions $graph_values[$i] = array(); @@ -1345,6 +1358,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, continue; } + // if(empty($aux_array)){ + // foreach ($data as $key => $value) { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } else { + // foreach ($data as $key => $value) { + // if(array_key_exists($value['utimestamp'],$aux_array)){ + // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos']; + // } else { + // $aux_array[$value['utimestamp']] = $value['datos']; + // } + // } + // } + + // html_debug($aux_array); if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) { if ($labels[$agent_module_id] != '') $module_name_list[$i] = $labels[$agent_module_id]; @@ -1370,6 +1398,10 @@ function graphic_combined_module ($module_list, $weight_list, $period, $agent_id = agents_get_agent_id ($agent_name); + if(empty($unit_list)){ + $unit_aux = modules_get_unit($agent_module_id); + array_push($unit_list_aux,$unit_aux); + } //Get and process module name $module_name = io_safe_output( modules_get_agentmodule_name ($agent_module_id)); @@ -1417,7 +1449,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $min = null; $avg = 0; $countAvg = 0; - + // Calculate chart data $last_known = $previous_data; for ($l = 0; $l <= $resolution; $l++) { @@ -1449,7 +1481,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $count++; $j++; } - + // Average if ($count > 0) { $total /= $count; @@ -1497,7 +1529,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $min = $temp_graph_values[$timestamp_short]; } $avg += $temp_graph_values[$timestamp_short]; - + // Added to support projection graphs if ($projection != false and $i != 0) { $projection_data = array(); @@ -1508,7 +1540,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $graph_values[$i] = $temp_graph_values; } } - + //Add the max, min and avg in the legend $avg = round($avg / $countAvg, 1); @@ -1553,6 +1585,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { $unit = $unit_list[$i]; + }else{ + $unit = $unit_list_aux[$i]; } if ($projection == false or ($projection != false and $i == 0)) { @@ -1586,8 +1620,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $temp = array(); if ($flash_charts === false && $stacked == CUSTOM_GRAPH_GAUGE) - $stacked = CUSTOM_GRAPH_BULLET_CHART; - + $stacked = CUSTOM_GRAPH_BULLET_CHART; switch ($stacked) { case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: case CUSTOM_GRAPH_BULLET_CHART: @@ -1705,7 +1738,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, else $module = $module_item; - $module_data = modules_get_agentmodule($module); $query_last_value = sprintf(' SELECT datos @@ -1888,6 +1920,16 @@ function graphic_combined_module ($module_list, $weight_list, $period, } } } + + //check min array two elements + if(count($temp) == 1){ + $timestamp_short = graph_get_formatted_date($date, $time_format, $time_format_2); + foreach($temp as $key => $value){ + foreach($value as $k => $v){ + $temp[$timestamp_short][$k] = $v; + } + } + } break; } } @@ -1897,7 +1939,13 @@ function graphic_combined_module ($module_list, $weight_list, $period, $flash_charts = false; } - $temp = fullscale_data_combined($module_list, $period, $date, $flash_charts); + $temp = fullscale_data_combined($module_list, $period, $date, $flash_charts, $percentil); + + if (!is_null($percentil) && $percentil) { + if(isset($temp['percentil'])){ + $percentil_result = array_pop($temp); + } + } $resolution = count($temp); //Number of points of the graph $interval = (int) ($period / $resolution); @@ -1926,10 +1974,20 @@ function graphic_combined_module ($module_list, $weight_list, $period, $module_name_list[$key] = $alias . " / " . $module_name; } } - } - - $graph_values = $temp; + if (!is_null($percentil) && $percentil) { + foreach ($module_list as $key => $value) { + $agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) ); + $alias = db_get_value ("alias","tagente","nombre",$agent_name); + $module_name = io_safe_output( modules_get_agentmodule_name ($value) ); + $module_name_list['percentil'.$key] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentil_result[$key][0] . ' ' . $unit . ') '; + $series_type[$key] = 'line'; + } + } + } + + $graph_values = $temp; + if($config["fixed_graph"] == false){ $water_mark = array( 'file' => $config['homedir'] . "/images/logo_vertical_water.png", @@ -2107,7 +2165,91 @@ function graphic_combined_module ($module_list, $weight_list, $period, $threshold_data['red_inverse'] = (bool)$red_inverse; } } + + //summatory and average series + if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) { + if($summatory && $average) { + foreach ($graph_values as $key => $value) { + $cont = count($value); + $summ = array_sum($value); + array_push($value,$summ); + array_push($value,$summ/$cont); + $graph_values[$key] = $value; + if(!$modules_series) { + array_splice($graph_values[$key],0,count($graph_values[$key])-2); + } + } + + if(!$modules_series) { + if(is_null($percentil)) { + array_splice($module_name_list,0,count($module_name_list)); + } else { + array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2)); + } + array_unshift($module_name_list,'' . __('summatory'). ''); + array_unshift($module_name_list,'' . __('average'). ''); + } else { + if(is_null($percentil)) { + array_push($module_name_list,'' . __('summatory'). ''); + array_push($module_name_list,'' . __('average'). ''); + } else { + array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('average'). ''); + array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('summatory'). ''); + } + + } + + } elseif($summatory) { + foreach ($graph_values as $key => $value) { + array_push($value,array_sum($value)); + $graph_values[$key] = $value; + if(!$modules_series){ + array_splice($graph_values[$key],0,count($graph_values[$key])-1); + } + } + if(!$modules_series) { + if(is_null($percentil)) { + array_splice($module_name_list,0,count($module_name_list)); + } else { + array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2)); + } + array_unshift($module_name_list,'' . __('summatory'). ''); + } else { + if(is_null($percentil)) { + array_push($module_name_list,'' . __('summatory'). ''); + } else { + array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('summatory'). ''); + } + } + + } elseif($average) { + foreach ($graph_values as $key => $value) { + $summ = array_sum($value) / count($value); + array_push($value,$summ); + $graph_values[$key] = $value; + if(!$modules_series){ + array_splice($graph_values[$key],0,count($graph_values[$key])-1); + } + } + + if(!$modules_series) { + if(is_null($percentil)) { + array_splice($module_name_list,0,count($module_name_list)); + } else { + array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2)); + } + array_unshift($module_name_list,'' . __('average'). ''); + } else { + if(is_null($percentil)) { + array_push($module_name_list,'' . __('average'). ''); + } else { + array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('average'). ''); + } + } + } + } + switch ($stacked) { case CUSTOM_GRAPH_AREA: return area_graph($flash_charts, $graph_values, $width, @@ -2177,8 +2319,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, } } -function fullscale_data_combined($module_list, $period, $date, $flash_charts){ - +function fullscale_data_combined($module_list, $period, $date, $flash_charts, $percentil){ + global $config; // Set variables if ($date == 0){ $date = get_system_time(); @@ -2187,6 +2329,10 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){ $datelimit = $date - $period; foreach ($module_list as $key_module => $value_module) { + if (!is_null($percentil) && $percentil) { + $array_percentil = array(); + } + $data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date); foreach ($data_uncompress as $key_data => $value_data) { foreach ($value_data['data'] as $k => $v) { @@ -2196,14 +2342,24 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){ else{ $real_date = $v['utimestamp']; } + + if (!is_null($percentil) && $percentil) { + $array_percentil[] = $v['datos']; + } + $data_all[$real_date][$key_module] = $v['datos']; } } + + if (!is_null($percentil) && $percentil) { + $percentil_value = get_percentile($config['percentil'], $array_percentil); + $percentil_result[$key_module] = array_fill (0, count($data_all), $percentil_value); + } } $data_prev = array(); - ksort($data_all); + //ksort($data_all); foreach ($data_all as $key => $value) { foreach ($module_list as $key_module => $value_module) { if(!isset($value[$key_module])){ @@ -2215,6 +2371,10 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts){ } } + if (!is_null($percentil) && $percentil) { + $data_all['percentil'] = $percentil_result; + } + return $data_all; } @@ -3937,7 +4097,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $datelimit = $date - $period; $search_in_history_db = db_search_in_history_db($datelimit); $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); + $interval = (float) ($period / $resolution); $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = agents_get_agent_id ($agent_name); $module_name = modules_get_agentmodule_name ($agent_module_id); @@ -3947,22 +4107,33 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($uncompressed_module) { $avg_only = 1; } - $search_in_history_db = db_search_in_history_db($datelimit); // Get event data (contains alert data too) if ($show_unknown == 1 || $show_events == 1 || $show_alerts == 1) { - $events = db_get_all_rows_filter('tevento', + $events = db_get_all_rows_filter( + 'tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp > $datelimit", "utimestamp < $date", - 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type', 'id_evento')); + 'order' => 'utimestamp ASC' + ), + array ('evento', 'utimestamp', 'event_type', 'id_evento'), + 'AND', + $search_in_history_db + ); // Get the last event after inverval to know if graph start on unknown - $prev_event = db_get_row_filter ('tevento', + $prev_event = db_get_row_filter ( + 'tevento', array ('id_agentmodule' => $agent_module_id, "utimestamp <= $datelimit", - 'order' => 'utimestamp DESC')); + 'order' => 'utimestamp DESC' + ), + false, + 'AND', + $search_in_history_db + ); + if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') { $start_unknown = true; } @@ -3976,7 +4147,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, fullscale_data( $chart, $chart_data_extra, $long_index, $series_type, $agent_module_id, $datelimit, $date, $events, $show_events, $show_unknown, $show_alerts, - $series_suffix, $percentil, $flash_chart); + $series_suffix, $percentil, $flash_chart,true); if (count($chart) > $resolution) { $resolution = count($chart); //Number of points of the graph $interval = (int) ($period / $resolution); @@ -4000,8 +4171,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, // Uncompressed module data if ($uncompressed_module) { $min_necessary = 1; - - // Compressed module data } else { // Get previous data @@ -4035,8 +4204,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, graphic_error (); } - - // Data iterator $j = 0; @@ -4053,21 +4220,18 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } $max_value = 0; - // Calculate chart data $last_known = $previous_data; + $first_events_unknown = $start_unknown; + for ($i = 0; $i <= $resolution; $i++) { $timestamp = $datelimit + ($interval * $i); - /* - if ($fullscale && ($resolution > ($config['graph_res'] * 50))) { - $timestamp = $data[$i]['utimestamp']; - } - */ + $zero = 0; $total = 0; $count = 0; - $is_unknown = false; + // Read data that falls in the current interval while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && @@ -4097,10 +4261,13 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $event_value = 0; $alert_value = 0; $unknown_value = 0; - // Is the first point of a unknown interval + $check_unknown = false; $first_unknown = false; - + if($first_events_unknown){ + $is_unknown = true; + } + $event_ids = array(); $alert_ids = array(); while (isset ($events[$k]) && @@ -4120,8 +4287,11 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $first_unknown = true; } $is_unknown = true; + $check_unknown = true; } else if (substr ($events[$k]['event_type'], 0, 5) == 'going') { + $first_events_unknown = false; + $first_unknown = false; $is_unknown = false; } } @@ -4163,12 +4333,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, if ($total > $max_value) { $max_value = $total; } - + // Data if ($show_events) { if (!isset($chart[$timestamp]['event'.$series_suffix])) { $chart[$timestamp]['event'.$series_suffix] = 0; } - + $chart[$timestamp]['event'.$series_suffix] += $event_value; $series_type['event'.$series_suffix] = 'points'; } @@ -4200,23 +4370,28 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } } + $series_type['sum' . $series_suffix] = 'boolean'; + if ($show_unknown) { if (!isset($chart[$timestamp]['unknown'.$series_suffix])) { $chart[$timestamp]['unknown'.$series_suffix] = 0; } $chart[$timestamp]['unknown'.$series_suffix] = $unknown_value; - $series_type['unknown'.$series_suffix] = 'area'; + + if($unknown_value == 0 && $check_unknown == true){ + $chart[$timestamp]['unknown'.$series_suffix] = 1; + $check_unknown = false; + } + + $series_type['unknown'.$series_suffix] = 'unknown'; } - $series_type['sum' . $series_suffix] = 'boolean'; - if (!empty($event_ids)) { $chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids); } if (!empty($alert_ids)) { $chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids); } - } } @@ -4230,6 +4405,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $graph_stats = get_statwin_graph_statistics($chart, $series_suffix); // Fix event and alert scale + $max_value = 1; foreach ($chart as $timestamp => $chart_data) { if ($show_events) { if ($chart_data['event'.$series_suffix] > 0) { @@ -4247,7 +4423,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } } } - /////////////////////////////////////////////////// if(!$fullscale){ // Set the title and time format @@ -4328,171 +4503,150 @@ function fullscale_data ( &$chart_data, &$chart_extra_data, &$long_index, $events = false, $show_events = false, $show_unknown = false, $show_alerts = false, $series_suffix = '', $percentil = false, - $flash_chart = true ){ + $flash_chart = true, $boolean_graph = false){ global $config; global $max_value; global $min_value; global $series_type; global $chart_extra_data; - - $ranges_unknown = db_get_module_ranges_unknown($agent_module_id, $datelimit, $date); - $table = "tagente_datos"; - $module_type_str = modules_get_type_name ($agent_module_id); - if (strstr ($module_type_str, 'string') !== false) { - $table = "tagente_datos_string"; - } + $first_data = 0; - $query = " SELECT utimestamp, datos FROM $table "; - $query .= " WHERE id_agente_modulo=$agent_module_id "; - $query .= " ORDER BY utimestamp ASC LIMIT 1"; - - $ret = db_get_all_rows_sql( $query , true); - - $first_data = $ret[0]['utimestamp']; $data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date); - $i = 0; - $max_value = 0; - $min_value = 0; - $timestamp_second = 0; - if(is_array($data_uncompress)){ - foreach ($data_uncompress as $v) { - foreach ($v['data'] as $key => $value) { - $real_date = date("Y M d H:i:s", $value['utimestamp']); + + $chart_data = array(); + + $min_value = PHP_INT_MAX-1; + $max_value = PHP_INT_MIN+1; + $previous_data = $first_data; + $previous_unknown = 0; + + $i=0; + $current_event = $events[0]; + $prueba = array(); + foreach ($data_uncompress as $k) { + foreach ($k["data"] as $v) { + $real_date = date("Y M d H:i:s", $v['utimestamp']); + + if(!$flash_chart){ + $real_date = date("Y/M/d", $v['utimestamp']); + $real_date .= "\n"; + $real_date .= date(" H:i:s", $v['utimestamp']); + } + + $event_ids = array(); + $alert_ids = array(); + while (isset($current_event) && ($v['utimestamp'] >= $current_event["utimestamp"]) ) { + $event_date = date("Y M d H:i:s", $current_event['utimestamp']); if(!$flash_chart){ - $real_date = date("Y/M/d", $value['utimestamp']); - $real_date .= "\n"; - $real_date .= date(" H:i:s", $value['utimestamp']); + $event_date = date("Y/M/d", $current_event['utimestamp']); + $event_date .= "\n"; + $event_date .= date(" H:i:s", $current_event['utimestamp']); } - // Read events and alerts that fall in the current interval - $event_value = 0; - $alert_value = 0; - $unknown_value = 0; - $event_i = 0; - // Is the first point of a unknown interval - $first_unknown = false; - - $event_ids = array(); - $alert_ids = array(); - - // - if($timestamp_second == 0){ - $timestamp_second = $value['utimestamp']; + + if ($show_events && (strpos($current_event["event_type"], "going") !== false)) { + $event_ids[$event_date][] = $current_event["id_evento"]; + + $chart_data[$event_date]["event" . $series_suffix] = 1; + $chart_data[$event_date]["alert" . $series_suffix] = NULL; + $chart_extra_data[count($chart_data)-1]['events'] = implode (',', $event_ids[$event_date]); + } + elseif ($show_alerts && (strpos($current_event["event_type"], "alert") !== false)) { + $alert_ids[$event_date][] = $current_event["id_evento"]; + + $chart_data[$event_date]["event" . $series_suffix] = NULL; + $chart_data[$event_date]["alert" . $series_suffix] = 1; + $chart_extra_data[count($chart_data)-1]['alerts'] = implode (',', $alert_ids[$event_date]); } - $timestamp_first = $timestamp_second; - $timestamp_second = $value['utimestamp']; - foreach ($events as $key => $val) { - if( $val['utimestamp'] > $timestamp_first && - $val['utimestamp'] <= $timestamp_second ){ - if ($show_events == 1) { - $event_ids[] = $val['id_evento']; - $event_value++; - } - if ($show_alerts == 1 && substr ($val['event_type'], 0, 5) == 'alert') { - $alert_ids[] = $val['id_evento']; - $alert_value++; - } - if ($show_unknown) { - if ($val['event_type'] == 'going_unknown') { - if ($is_unknown == false) { - $first_unknown = true; - } - $is_unknown = true; - } - else if (substr ($val['event_type'], 0, 5) == 'going') { - $is_unknown = false; - } - } + $chart_data[$event_date]["sum" . $series_suffix] = $previous_data; + if($show_unknown) { + $chart_data[$event_date]["unknown" . $series_suffix] = $previous_unknown; + } + $current_event = $events[$i++]; + } + + if ($v["datos"] === NULL) { + // Unknown + if (!isset($chart_data[$real_date]["event" . $series_suffix])) { + if($show_events) { + $chart_data[$real_date]["event" . $series_suffix] = NULL; + } + if($show_alerts) { + $chart_data[$real_date]["alert" . $series_suffix] = NULL; } } - - if(empty($value['datos'])){ - if($value['utimestamp'] < $first_data){ - //$chart_data[$real_date]['unknown'.$series_suffix] = 0; - $is_unknown = false; + + $chart_data[$real_date]["sum" . $series_suffix] = $previous_data; + if($show_unknown) { + $chart_data[$real_date]["unknown" . $series_suffix] = "1"; + } + $previous_unknown = "1"; + } + elseif($v["datos"] === false) { + // Not Init + $previous_data = $v["datos"]; + if (!isset($chart_data[$real_date]["event" . $series_suffix])) { + if ($show_events) { + $chart_data[$real_date]["event" . $series_suffix] = NULL; } - else{ - //$chart_data[$real_date]['unknown'.$series_suffix] = 1; - $first_unknown = true; + if ($show_alerts) { + $chart_data[$real_date]["alert" . $series_suffix] = NULL; } } - - $timestamp_short = date("Y M d H:i:s", $value['utimestamp']); - - if(!$flash_chart){ - $timestamp_short = date("Y/M/d", $value['utimestamp']); - $timestamp_short .= "\n"; - $timestamp_short .= date(" H:i:s", $value['utimestamp']); - } - - - $long_index[$timestamp_short] = date( - html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $value['utimestamp']); - // In some cases, can be marked as known because a recovery event - // was found in same interval. For this cases first_unknown is - // checked too - if ($is_unknown || $first_unknown) { - $unknown_value++; - } - - // Data - if ($show_events) { - if (!isset($chart_data[$real_date]['event'.$series_suffix])) { - $chart_data[$real_date]['event'.$series_suffix] = 0; - } - - $chart_data[$real_date]['event'.$series_suffix] += $event_value; - - $series_type['event'.$series_suffix] = 'points'; - } - - if ($show_alerts) { - if (!isset($chart_data[$real_date]['alert'.$series_suffix])) { - $chart_data[$real_date]['alert'.$series_suffix] = 0; - } - - $chart_data[$real_date]['alert'.$series_suffix] += $alert_value; - - $series_type['alert'.$series_suffix] = 'points'; - } - - $chart_data[$real_date]['sum'.$series_suffix] = $value['datos']; - - if($value['datos'] > $max_value){ - $max_value = $value['datos']; - } - - if($value['datos'] < $min_value){ - $min_value = $value['datos']; - } - if ($show_unknown) { - if (!isset($chart_data[$real_date]['unknown'.$series_suffix])) { - $chart_data[$real_date]['unknown'.$series_suffix] = 0; - } - $chart_data[$real_date]['unknown'.$series_suffix] = $unknown_value; - $series_type['unknown'.$series_suffix] = 'area'; + $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; + + if($v['datos'] >= $max_value){ + $max_value = $v['datos']; } - - if (!empty($event_ids)) { - $chart_extra_data[count($chart_data)-1]['events'] = implode(',',$event_ids); + + if($v['datos'] <= $min_value){ + $min_value = $v['datos']; } - if (!empty($alert_ids)) { - $chart_extra_data[count($chart_data)-1]['alerts'] = implode(',',$alert_ids); + + if($show_unknown) { + $chart_data[$real_date]["unknown" . $series_suffix] = NULL; + $previous_unknown = NULL; } } + else { + $previous_data = $v["datos"]; + if (!isset($chart_data[$real_date]["event" . $series_suffix])) { + if ($show_events) { + $chart_data[$real_date]["event" . $series_suffix] = NULL; + } + if ($show_alerts) { + $chart_data[$real_date]["alert" . $series_suffix] = NULL; + } + } + + $chart_data[$real_date]["sum" . $series_suffix] = $v["datos"]; + + if($v['datos'] >= $max_value){ + $max_value = $v['datos']; + } + + if($v['datos'] <= $min_value){ + $min_value = $v['datos']; + } + + if($show_unknown) { + $chart_data[$real_date]["unknown" . $series_suffix] = NULL; + $previous_unknown = NULL; + } + } } - - if (!is_null($percentil) && $percentil) { - $avg = array_map(function($item) { return $item['sum']; }, $chart_data); - $percentil_result = get_percentile($percentil, $avg); - //Fill the data of chart - array_walk($chart_data, function(&$item) use ($percentil_result, $series_suffix) { - $item['percentil' . $series_suffix] = $percentil_result; }); - $series_type['percentil' . $series_suffix] = 'line'; - } + } + $series_type['event'.$series_suffix] = 'points'; + $series_type['alert'.$series_suffix] = 'points'; + $series_type['unknown'.$series_suffix] = 'unknown'; + if($boolean_graph){ + $series_type['sum'.$series_suffix] = 'boolean'; + } + else{ + $series_type['sum'.$series_suffix] = 'area'; } } @@ -5802,17 +5956,47 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false; - $groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); + if ($filter['group'] != 0) { + $filter_subgroups = ""; + if (!$filter['dont_show_subgroups']) { + $filter_subgroups = " || parent = " . $filter['group']; + } + + $groups = db_get_all_rows_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group'] . $filter_subgroups); + + $groups_ax = array(); + foreach ($groups as $g) { + $groups_ax[$g['id_grupo']] = $g; + } + + $groups = $groups_ax; + } + else { + $groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); + } $data_groups = array(); if (!empty($groups)) { $groups_aux = $groups; - $data_groups = groups_get_tree($groups); + + $childrens = array(); + $data_groups = groups_get_tree_good($groups, false, $childrens); + + // When i want only one group + if (count($data_groups) > 1) { + foreach ($childrens as $id_c) { + unset($data_groups[$id_c]); + } + } + $data_groups_keys = array(); + groups_get_tree_keys($data_groups, $data_groups_keys); + $groups_aux = null; } if (!empty($data_groups)) { - $filter = array('id_grupo' => array_keys($data_groups)); + $filter = array('id_grupo' => array_keys($data_groups_keys)); + $fields = array('id_agente', 'id_parent', 'id_grupo', 'alias'); $agents = agents_get_agents($filter, $fields); @@ -5850,6 +6034,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $data_agents[$agent_id]['group'] = (int) $agents[$agent_id]['id_grupo']; $data_agents[$agent_id]['type'] = 'agent'; $data_agents[$agent_id]['size'] = 30; + $data_agents[$agent_id]['show_name'] = true; $data_agents[$agent_id]['children'] = array(); $tooltip_content = __('Agent') . ": " . $data_agents[$agent_id]['name'] . ""; @@ -6022,6 +6207,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $data_agents[$id]['name'] = io_safe_output($agent['alias']); $data_agents[$id]['type'] = 'agent'; $data_agents[$id]['color'] = COL_NOTINIT; + $data_agents[$id]['show_name'] = true; } } $agents = null; @@ -6029,7 +6215,6 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { } function iterate_group_array ($groups, &$data_agents) { - $data = array(); foreach ($groups as $id => $group) { @@ -6066,8 +6251,8 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $tooltip_content = html_print_image("images/groups_small/" . $group['icon'] . ".png", true) . " " . __('Group') . ": " . $group_aux['name'] . ""; $group_aux['tooltip_content'] = $tooltip_content; - if (!isset($group['children'])) - $group_aux['children'] = array(); + $group_aux['children'] = array(); + if (!empty($group['children'])) $group_aux['children'] = iterate_group_array($group['children'], $data_agents); @@ -6075,7 +6260,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { if (!empty($agents)) $group_aux['children'] = array_merge($group_aux['children'], $agents); - + $data[] = $group_aux; } @@ -6090,14 +6275,15 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { unset($agents[$id]); } } + if (!empty($valid_agents)) return $valid_agents; else return false; } - $graph_data = array('name' => __('Main node'), 'children' => iterate_group_array($data_groups, $data_agents), 'color' => '#3F3F3F'); - + $graph_data = array('name' => __('Main node'), 'type' => 'center_node', 'children' => iterate_group_array($data_groups, $data_agents), 'color' => '#3F3F3F'); + if (empty($graph_data['children'])) return fs_error_image(); diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 757e5014d5..33b78067c4 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -538,7 +538,7 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) { // If the user has ACLs on a gruop but not in his father, // we consider it as a son of group "all" - if(!in_array($group['parent'], array_keys($groups))) { + if(!isset($groups[$group['parent']])) { $group['parent'] = 0; } @@ -633,61 +633,55 @@ function groups_get_id ($group_name, $returnAllGroup = false) { * @param int $id_group The group id to look for * @param mixed filter array * @param bool True if users with all permissions in the group are retrieved - * @param bool Is id_group an array or not #Fix * * @return array An array with all the users or an empty array */ -function groups_get_users ($id_group, $filter = false, $return_user_all = false, $_is_array = false) { +function groups_get_users ($id_group, $filter = false, $return_user_all = false) { global $config; - + if (! is_array ($filter)) $filter = array (); - $filter['id_grupo'] = $id_group; - - $result_a = array(); - // Juanma (05/05/2014) Fix: Check for number/array id_group variable - if ($_is_array && is_array($id_group) && !empty($id_group)) { - $result_a = db_get_all_rows_filter ("tusuario_perfil", $filter); - } else { - if (!is_array($id_group) && !empty($id_group)) { - $result_a = db_get_all_rows_filter ("tusuario_perfil", $filter); + if($return_user_all){ + if (is_array($id_group)){ + $filter['id_grupo'] = $id_group; } - + else{ + $filter['id_grupo'][0] = $id_group; + } + array_push($filter['id_grupo'], 0); } - - $result_b = array(); - if ($return_user_all) { - // The users of the group All (0) will be also returned - $filter['id_grupo'] = 0; - $result_b = db_get_all_rows_filter ("tusuario_perfil", $filter); + else{ + $filter['id_grupo'] = $id_group; } - - if ($result_a == false && $result_b == false) - $result = false; - elseif ($result_a == false) - $result = $result_b; - elseif ($result_b == false) - $result = $result_a; - else - $result = array_merge($result_a, $result_b); - - if ($result === false) + + $query = "SELECT tu.* + FROM tusuario tu, tusuario_perfil tup + WHERE tup.id_usuario = tu.id_user" ; + + if(is_array($filter)){ + foreach ($filter as $key => $value) { + if($key != 'limit' && $key != 'order' && + $key != 'offset' &&$key != 'group'){ + $filter_array["tup.".$key] = $value; + } + else{ + $filter_array[$key] = $value; + } + } + $clause_sql = mysql_db_format_array_where_clause_sql($filter_array,'AND',false); + if($clause_sql){ + $query .= " AND " . $clause_sql; + } + } + + $result = db_get_all_rows_sql($query); + + if ($result === false){ return array (); - - //This removes stale users from the list. This can happen if switched to another auth scheme - //(internal users still exist) or external auth has users removed/inactivated from the list (eg. LDAP) - $retval = array (); - foreach ($result as $key => $user) { - if (!is_user ($user)) { - unset ($result[$key]); - } - else { - array_push ($retval, get_user_info ($user)); - } } - return $retval; + return $result; } /** @@ -2241,6 +2235,9 @@ function groups_get_tree(&$groups, $parent = false) { if (!empty($children)) { $return[$id]['children'] = $children; } + else { + $return[$id]['children'] = array(); + } } else if ($parent && isset($group['parent']) && $group['parent'] == $parent) { $return[$id] = $group; @@ -2250,6 +2247,9 @@ function groups_get_tree(&$groups, $parent = false) { if (!empty($children)) { $return[$id]['children'] = $children; } + else { + $return[$id]['children'] = array(); + } } else { continue; @@ -2258,6 +2258,55 @@ function groups_get_tree(&$groups, $parent = false) { return $return; } + +function groups_get_tree_good (&$groups, $parent = false, &$childs) { + $return = array(); + + foreach ($groups as $id => $group) { + if ($group['parent'] != 0) { + $childs[$id] = $id; + } + if ($parent === false && (!isset($group['parent']) || $group['parent'] == 0 || !in_array($group['parent'], $groups))) { + $return[$id] = $group; + //unset($groups[$id]); + $children = groups_get_tree_good($groups, $id); + + if (!empty($children)) { + $return[$id]['children'] = $children; + } + else { + $return[$id]['children'] = array(); + } + } + else if ($parent && isset($group['parent']) && $group['parent'] == $parent) { + $return[$id] = $group; + //unset($groups[$id]); + $children = groups_get_tree_good($groups, $id); + + if (!empty($children)) { + $return[$id]['children'] = $children; + } + else { + $return[$id]['children'] = array(); + } + } + else { + continue; + } + } + + return $return; +} + +function groups_get_tree_keys ($groups, &$group_keys) { + foreach ($groups as $id => $group) { + $group_keys[$id] = $id; + if (isset($group['children'])) { + groups_get_tree_keys($groups[$id]['children'], $group_keys); + } + } +} + function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) { global $config; @@ -2289,6 +2338,8 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) { return $hierarchy; } + + function group_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $mode = 'group', $agent_filter = array(), $module_filter = array()) { global $config; if ($id_user == false) { @@ -3036,4 +3087,5 @@ function groups_get_group_deep ($id_group) { return $deep; } + ?> diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index f0cf25587e..625e8109be 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -235,12 +235,6 @@ function io_safe_output($value, $utf8 = true) //Replace the html entitie of > for the char $value = str_replace(">", '>', $value); - //Revert html entities to chars - for ($i = 0; $i < 33; $i++) { - $value = str_ireplace("&#x" . dechex($i) . ";", - io_html_to_ascii(dechex($i)), $value); - } - if ($utf8) { $value = html_entity_decode ($value, ENT_QUOTES, "UTF-8"); } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index bcdeb6819c..15058a3a4b 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -987,6 +987,29 @@ function modules_is_string($id_agentmodule) { return modules_is_string_type($id_type); } + +/** + * Know if a module type is a boolean or not + * + * @param int $id_type Type id + * + * @return bool true if boolean. false if not + */ +function modules_is_boolean_type ($id_type) { + $type_name = modules_get_type_name($id_type); + + if ($type_name === "keep_alive") return true; + return (bool)preg_match('/_proc$/', $type_name); +} + +function modules_is_boolean($id_agentmodule) { + $id_type = db_get_value('id_tipo_modulo', + 'tagente_modulo', 'id_agente_modulo', + (int) $id_agentmodule); + + return modules_is_boolean_type($id_type); +} + /** * Get the icon of a module type * @@ -1716,11 +1739,19 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0) * @param int Agent module id * @param int Period of time to check (in seconds) * @param int Top date to check the values. Default current time. + * @param + * @param + * @param string 'ASC' od 'DESC' + * @param string with a json with parameters to filter data + * string object: + * value: Text to search + * exact: Boolean. True if search exact phrase or false to content * * @return array The module value and the timestamp */ function modules_get_agentmodule_data ($id_agent_module, $period, - $date = 0, $trash=false, $conexion = false, $order = 'ASC') { + $date = 0, $trash=false, $conexion = false, $order = 'ASC', + $freesearch = '') { global $config; $module = db_get_row('tagente_modulo', 'id_agente_modulo', @@ -1742,12 +1773,28 @@ function modules_get_agentmodule_data ($id_agent_module, $period, case 17: //async_string case 23: - $sql = sprintf ("SELECT datos AS data, utimestamp - FROM tagente_datos_string - WHERE id_agente_modulo = %d - AND utimestamp > %d AND utimestamp <= %d - ORDER BY utimestamp %s", - $id_agent_module, $datelimit, $date, $order); + // Free search is a json with value and exact modifier + $freesearch = json_decode($freesearch, true); + $freesearch_sql = ''; + if (isset($freesearch['value']) && !empty($freesearch['value'])) { + $freesearch_sql = " AND datos "; + if ($freesearch['exact']){ + $freesearch_sql .= "='" . $freesearch['value'] . "' "; + } else { + $freesearch_sql .= " LIKE '%" . $freesearch['value'] . "%' "; + } + } + $sql = sprintf ( + "SELECT datos AS data, utimestamp FROM tagente_datos_string + WHERE id_agente_modulo = %d + %s + AND utimestamp > %d AND utimestamp <= %d + ORDER BY utimestamp %s", + $id_agent_module, + $freesearch_sql, + $datelimit, $date, + $order + ); break; //log4x case 24: @@ -2261,50 +2308,53 @@ function modules_change_relation_lock ($id_relation) { return ($result !== false ? $new_value : $old_value); } - - -function modules_get_count_datas($id_agent_module, $date_init, $date_end) { - $interval = modules_get_interval ($id_agent_module); - - // TODO REMOVE THE TIME IN PLANNED DOWNTIME - - if (!is_numeric($date_init)) { - $date_init = strtotime($date_init); - } - - if (!is_numeric($date_end)) { - $date_end = strtotime($date_end); - } - - - - $first_date = modules_get_first_contact_date($id_agent_module); - - - - if ($date_init < $first_date) { - $date_init = $first_date; - } - - $diff = $date_end - $date_init; - - - return ($diff / $interval); -} - - -function modules_get_first_contact_date($id_agent_module) { +/* + * @return utimestamp with the first contact of the module or first contact before datelimit, false if not-init + */ +function modules_get_first_date($id_agent_module, $datelimit = 0) { global $config; - // TODO REMOVE THE TIME IN PLANNED DOWNTIME + //check datatype string or normal + $table = "tagente_datos"; + $module_type_str = modules_get_type_name ($id_agent_module); + if (strstr ($module_type_str, 'string') !== false) { + $table = "tagente_datos_string"; + } + + $search_historydb = false; + + // tagente_estado.first_utimestamp is not valid or is not updated. Scan DBs for first utimestamp + if ($datelimit > 0) { + // get last data before datelimit + $query = " SELECT max(utimestamp) as utimestamp FROM $table "; + $query .= " WHERE id_agente_modulo=$id_agent_module "; + $query .= " AND utimestamp < $datelimit "; - // TODO FOR OTHER KIND OF DATA + } + else { + // get first utimestamp + $query = " SELECT min(utimestamp) as utimestamp FROM $table "; + $query .= " WHERE id_agente_modulo=$id_agent_module "; + } - $first_date = db_get_value('utimestamp', 'tagente_datos', - 'id_agente_modulo', $id_agent_module, - $config['history_db_enabled']); - - return $first_date; + + // SEARCH ACTIVE DB + $data = db_get_all_rows_sql($query,$search_historydb); + if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { + // first utimestamp not found in active database + // SEARCH HISTORY DB + $search_historydb = true; + $data = db_get_all_rows_sql($query,$search_historydb); + } + + if (($data === false) || ($data[0]["utimestamp"] === NULL) || ($data[0]["utimestamp"] <= 0)) { + // Nor active DB nor history DB have the data, the module is not-init + return array ("first_utimestamp" => false, "search_historydb" => $search_historydb); + } + + // The data has been found + return array ("first_utimestamp" => $data[0]["utimestamp"], "search_historydb" => $search_historydb); + } /** diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index aea248e829..b88fb07510 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -254,7 +254,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true, $relative = false, $text_filter = '', $ip_mask = null, $dont_show_subgroups = false, $strict_user = false, $size_canvas = null, - $old_mode = false) { + $old_mode = false, $map_filter = array()) { global $config; $nooverlap = 1; @@ -361,7 +361,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, // Open Graph $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas); + $ranksep, $font_size, $size_canvas, $map_filter); // Parse agents $nodes = array (); @@ -1396,7 +1396,7 @@ function networkmap_close_group () { // Opens a graph definition function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas) { + $ranksep, $font_size, $size_canvas, $map_filter = array()) { global $config; @@ -1412,42 +1412,79 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $size = ''; } - - if ($layout == 'radial') { - $overlap = 'true'; - } - - if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2") { - if ($nooverlap != '') { - $overlap = 'scalexy'; - } - } - if ($zoom > 0) { $size_x *= $zoom; $size_y *= $zoom; } + $size = $size_x . ',' . $size_y; if (!is_null($size_canvas)) { $size = ($size_canvas['x'] / 100) . "," . ($size_canvas['y'] / 100); } - + + // Graphviz custom values + if (isset($map_filter['node_sep'])) { + $node_sep = $map_filter['node_sep']; + } + else { + $node_sep = 0.25; + } + if (isset($map_filter['rank_sep'])) { + $rank_sep = $map_filter['rank_sep']; + } + else { + if ($layout == "radial") { + $rank_sep = 1.0; + } + else { + $rank_sep = 0.5; + } + } + if (isset($map_filter['mindist'])) { + $mindist = $map_filter['mindist']; + } + else { + $mindist = 1.0; + } + if (isset($map_filter['kval'])) { + $kval = $map_filter['kval']; + } + else { + $kval = 0.3; + } + // BEWARE: graphwiz DONT use single ('), you need double (") $head = "graph networkmap { dpi=100; bgcolor=\"transparent\"; labeljust=l; margin=0; pad=\"0.75,0.75\";"; if ($nooverlap != '') { - $head .= "overlap=\"$overlap\";"; - $head .= "ranksep=\"$ranksep\";"; + $head .= "overlap=\"false\";"; $head .= "outputorder=edgesfirst;"; } + + if ($layout == 'flat' || $layout == 'spring1' || $layout == "spring2") { + if ($nooverlap != '') { + $head .= "overlap=\"scalexy\";"; + } + if ($layout == 'flat') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'spring2') { + $head .= "K=\"$kval\";"; + } + } + if ($layout == 'radial') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'circular') { + $head .= "mindist=\"$mindist\";"; + } $head .= "ratio=fill;"; $head .= "root=0;"; - $head .= "nodesep=\"0.02\";"; + $head .= "nodesep=\"$node_sep\";"; $head .= "size=\"$size\";"; $head .= "\n"; - return $head; } diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 6af64e1b8f..4058294bbe 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -231,7 +231,8 @@ function networkmap_process_networkmap($id = 0) { $dont_show_subgroups, false, null, - $old_mode); + $old_mode, + $map_filter); switch (PHP_OS) { case "WIN32": @@ -476,6 +477,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area $item['py'] = (int)$node['y']; $item['z'] = (int)$node['z']; $item['state'] = $node['state']; + $item['deleted'] = $node['deleted']; if ($item['state'] == 'holding_area') { //40 = DEFAULT NODE RADIUS //30 = for to align @@ -659,8 +661,10 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_start'] = (int)$id_source_agent; $item['id_module_end'] = 0; $item['id_agent_end'] = (int)$id_target_agent; + $item['link_color'] = "#999"; $item['target'] = -1; $item['source'] = -1; + $item['deleted'] = $relation['deleted']; if (enterprise_installed()) { $target_and_source = array(); @@ -713,14 +717,42 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $agent2 = 0; if (($relation['parent_type'] == 1) && ($relation['child_type'] == 1)) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + $mod2_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if (($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) || ($mod2_status == AGENT_MODULE_STATUS_CRITICAL_BAD)) { + $item['link_color'] = "#FC4444"; + } + else if (($mod1_status == AGENT_MODULE_STATUS_WARNING) || ($mod2_status == AGENT_MODULE_STATUS_WARNING)) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['child_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = $relation['id_parent_source_data']; $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['parent_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = $relation['id_child_source_data']; } @@ -858,7 +890,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $item = networkmap_db_node_to_js_node( $node, $count, $count_item_holding_area); - + if ($item['deleted']) { + continue; + } echo "networkmap.nodes.push(" . json_encode($item) . ");\n"; $nodes_graph[$item['id']] = $item; } @@ -874,6 +908,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $links_js = networkmap_links_to_js_links($relations, $nodes_graph); foreach ($links_js as $link_js) { + if ($link_js['deleted']) { + continue; + } if ($link_js['target'] == -1) continue; if ($link_js['source'] == -1) @@ -931,6 +968,12 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das echo "var set_center_menu = '" . __('Set center') . "';\n"; echo "var refresh_menu = '" . __('Refresh') . "';\n"; echo "var refresh_holding_area_menu = '" . __('Refresh Holding area') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var message_to_confirm = '" . __('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.') . "';\n"; + echo "var warning_message = '" . __('WARNING') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var cancel_button = '" . __('Cancel') . "';\n"; + echo "var restart_map_menu = '" . __('Restart map') . "';\n"; echo "var abort_relationship_interface = '" . __('Abort the interface relationship') . "';\n"; echo "var abort_relationship_menu = '" . __('Abort the action of set relationship') . "';\n"; @@ -1476,7 +1519,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = } .link { - stroke: #999; stroke-opacity: .6; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php old mode 100644 new mode 100755 index 26ea84367a..16387091be --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -127,7 +127,7 @@ function reporting_make_reporting_data($report = null, $id_report, } $metaconsole_on = is_metaconsole(); - + $index_content = 0; foreach ($contents as $content) { $server_name = $content['server_name']; @@ -519,29 +519,41 @@ function reporting_make_reporting_data($report = null, $id_report, break; case 'agent_detailed_event': case 'event_report_agent': - $report['contents'][] = reporting_event_report_agent( + $report_control = reporting_event_report_agent( $report, $content, $type, $force_width_chart, $force_height_chart); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'event_report_module': - $report['contents'][] = reporting_event_report_module( + $report_control = reporting_event_report_module( $report, $content, $type, $force_width_chart, $force_height_chart, $pdf); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'event_report_group': - $report['contents'][] = reporting_event_report_group( + $report_control = reporting_event_report_group( $report, $content, $type, $force_width_chart, $force_height_chart); + if($report_control['total_events'] == 0 && $content['hide_no_data'] == 1){ + continue; + } + $report['contents'][] = $report_control; break; case 'top_n': $report['contents'][] = reporting_event_top_n( @@ -589,6 +601,7 @@ function reporting_make_reporting_data($report = null, $id_report, $pdf); break; } + $index_content++; } return reporting_check_structure_report($report); @@ -3848,9 +3861,6 @@ function reporting_value($report, $content, $type,$pdf) { $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; - html_debug($pdf,true); - html_debug($only_image,true); - if($pdf){ $only_image = 1; } @@ -7763,19 +7773,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7875,7 +7885,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 60e9ffc7e8..33ed8e8bfd 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -167,6 +167,7 @@ function servers_get_performance () { case SERVER_TYPE_INVENTORY: case SERVER_TYPE_EVENT: case SERVER_TYPE_RECON: + case SERVER_TYPE_SYSLOG: break; } @@ -449,6 +450,11 @@ function servers_get_info ($id_server = -1) { $server["type"] = "wux"; $id_modulo = 0; break; + case SERVER_TYPE_SYSLOG: + $server["img"] = html_print_image ("images/syslog.png", true, array ("title" => __('Syslog server'))); + $server["type"] = "syslog"; + $id_modulo = 0; + break; default: $server["img"] = ''; $server["type"] = "unknown"; diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 1f80421fa5..390d6ec151 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -725,35 +725,38 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height }); // Prepare the AJAX call - var params = [ - "target_ip=" + target_ip, - "community=" + community, - "oids=" + oids, - "snmp_browser_version=" + snmp_version, - "snmp3_browser_auth_user=" + snmp3_auth_user, - "snmp3_browser_security_level=" + snmp3_security_level, - "snmp3_browser_auth_method=" + snmp3_auth_method, - "snmp3_browser_auth_pass=" + snmp3_auth_pass, - "snmp3_browser_privacy_method=" + snmp3_privacy_method, - "snmp3_browser_privacy_pass=" + snmp3_privacy_pass, - "action=" + "create_modules_snmp", - "custom_action=" + custom_action, - "page=include/ajax/snmp_browser.ajax" - ]; + var params = {}; + params["target_ip"] = target_ip; + params["community"] = community; + params["oids"] = oids; + params["snmp_browser_version"] = snmp_version; + params["snmp3_browser_auth_user"] = snmp3_auth_user; + params["snmp3_browser_security_level"] = snmp3_security_level; + params["snmp3_browser_auth_method"] = snmp3_auth_method; + params["snmp3_browser_auth_pass"] = snmp3_auth_pass; + params["snmp3_browser_privacy_method"] = snmp3_privacy_method; + params["snmp3_browser_privacy_pass"] = snmp3_privacy_pass; + params["action"] = "create_modules_snmp"; + params["custom_action"] = custom_action; + params["page"] = "include/ajax/snmp_browser.ajax"; $.ajax({ type: "GET", url: "ajax.php", - data: params.join ("&"), - dataType: "json", + data: params, + dataType: "html", success: function(data) { + + var dato = data.replace(/[^]+(?=\[)/,""); $('input[name*=create_network_component]').removeClass("sub spinn"); $('input[name*=create_network_component]').addClass("sub add"); - if(data.length !== 0){ + dato = JSON.parse(dato); + + if(dato.length !== 0){ $('#error_text').text(""); - data.forEach( function(valor, indice, array) { - console.log(valor); + + dato.forEach( function(valor, indice, array) { $('#error_text').append('
'+ valor ); }); $("#dialog_error") diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 957c8c569e..60e0fc7cb1 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -888,21 +888,24 @@ function users_get_user_users($id_user = false, $privilege = "AR", global $config; $user_groups = users_get_groups($id_user, $privilege, $returnAllGroup); - + $user_users = array(); + $array_user_group = array(); + foreach ($user_groups as $id_user_group => $name_user_group) { - $group_users = groups_get_users($id_user_group, false, $returnAllGroup); + $array_user_group[] = $id_user_group; + } + + $group_users = groups_get_users($array_user_group, false, $returnAllGroup); - - foreach ($group_users as $gu) { - if (empty($fields)) { - $user_users[$gu['id_user']] = $gu['id_user']; - } - else { - $fields = (array)$fields; - foreach ($fields as $field) { - $user_users[$gu['id_user']][$field] = $gu[$field]; - } + foreach ($group_users as $gu) { + if (empty($fields)) { + $user_users[$gu['id_user']] = $gu['id_user']; + } + else { + $fields = (array)$fields; + foreach ($fields as $field) { + $user_users[$gu['id_user']][$field] = $gu[$field]; } } } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 65e51f57c0..803ddc0990 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -450,7 +450,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -621,7 +621,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -670,11 +670,11 @@ function visual_map_print_item($mode = "read", $layoutData, $url = $server["server_url"] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = - $config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + $config['homeurl'].'/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } } else { @@ -738,7 +738,7 @@ function visual_map_print_item($mode = "read", $layoutData, else { if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -1600,8 +1600,12 @@ function visual_map_print_item($mode = "read", $layoutData, if (!empty($unit_text)) $value .= " " . $unit_text; - $img_style_title .= "
" . __("Last value: ") . - $value; + // Hide value on boolean modules + if (!modules_is_boolean($layoutData['id_agente_modulo'])) { + $img_style_title .= + "
" . __("Last value: ") + . $value; + } } if(get_parameter('action') == 'edit'){ @@ -2957,6 +2961,9 @@ function visual_map_get_status_element($layoutData) { } else { $status = VISUAL_MAP_STATUS_NORMAL; + if (count($elements_to_compare) == 0) { + $status = VISUAL_MAP_STATUS_UNKNOWN; + } } } } @@ -3354,13 +3361,32 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, * @return array A list of layouts the user can see. */ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) { - if (! is_array ($filter)) + if (! is_array ($filter)){ $filter = array (); - - if ($returnAllGroup) + } else { + if(!empty($filter['name'])){ + $where .= "name LIKE '%".io_safe_output($filter['name'])."%'"; + unset($filter['name']); + } + } + + if ($returnAllGroup) { $groups = users_get_groups ($id_user, 'VR'); - else - $groups = users_get_groups ($id_user, 'VR', false); + } else { + if(!empty($filter['group'])) { + $permissions_group = users_get_groups ($id_user, 'VR', false); + if(empty($permissions_group)){ + $permissions_group = users_get_groups ($id_user, 'VM', false); + } + $groups = array_intersect_key($filter['group'], $permissions_group); + } else { + $groups = users_get_groups ($id_user, 'VR', false); + if(empty($groups)) { + $groups = users_get_groups ($id_user, 'VM', false); + } + } + unset($filter['group']); + } if (!empty($groups)) { if (empty($where)) @@ -3436,7 +3462,21 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_ 'element_group')); if ($result === false) return VISUAL_MAP_STATUS_NORMAL; - + + $stcount = 0; + $stcount_u = 0; + foreach ($result as $data) { + if ($data['type'] == 0) { + $stcount++; + if ($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) { + $stcount_u++; + } + } + } + if ($stcount == 0 || $stcount_u == $stcount) { + return VISUAL_MAP_STATUS_UNKNOWN; + } + foreach ($result as $data) { $layout_group = $data['element_group']; if (!check_acl ($config['id_user'], $layout_group, "VR")) { @@ -3475,8 +3515,12 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_ if (($data["id_layout_linked"] == 0 && $data["id_agente_modulo"] == 0 && $data["id_agent"] == 0) || - $data['type'] != 0) - continue; + $data['type'] != 0){ + if($data['type'] == 0){ + $temp_total = VISUAL_MAP_STATUS_UNKNOWN; + } + continue; + } // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { @@ -3507,12 +3551,18 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_ } else { $status = VISUAL_MAP_STATUS_NORMAL; + if (count($elements_in_child) == 0) { + $status = VISUAL_MAP_STATUS_UNKNOWN; + } } } } // Module elseif ($data["id_agente_modulo"] != 0) { $status = modules_get_agentmodule_status($data["id_agente_modulo"]); + if ($status == 4){ + $status = 3; + } } // Agent else { @@ -3770,4 +3820,4 @@ function visual_map_macro($label,$module){ return $label; } -?> +?> \ 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 78c968c54f..682b78d3e5 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -680,16 +680,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { '90' => '90%', '100' => '100%'), 'map_linked_weight', '', '', __('By default'), 0, true) . - ui_print_help_tip ( - __("This percentage value specifies the number of items that must be present in the visual - console for it to transmit its status to the icon linked here. For example, if 20% is - specified and there are five elements in the console, it would be enough if you were in - WARNING or CRITICAL to pass that value to the icon. If it were 40%, you would need at - least two elements to be in CRITICAL or WARNING to go into that status. If it had one - element in critical and another in warning, it would not forward any status to the icon - associated with the visual console. If we had three in warning and one in critical, - it would only convey the warning status. If there were two in warning and two in critical, - it would show the CRITICAL because it is more serious. The same applies to unknown status."), true) . + ui_print_help_icon ("linked_map_weight", true) . ''; $form_items_advance['line_case']['items'] = array('line_item'); @@ -703,8 +694,10 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'percentile_item', 'module_graph', 'simple_value', 'icon', 'label', 'datos'); $form_items_advance['element_group_row']['html'] = '' . - '' . + ''; //Insert and modify before the buttons to create or update. diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index ba88a64434..591397d7e9 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -622,7 +622,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', - $tick_color = "white") { + $tick_color = "white", $val_min=null, $val_max=null) { setup_watermark($water_mark, $water_mark_file, $water_mark_url); @@ -632,7 +632,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_hcolumn_chart( - $chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color); + $chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max); } else { diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 6fe97ae606..20915b9249 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -326,8 +326,7 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, } function pandoraFlotHBars(graph_id, values, labels, water_mark, - maxvalue, water_mark, separator, separator2, font, font_size, background_color, - tick_color) { + maxvalue, water_mark, separator, separator2, font, font_size, background_color, tick_color, min, max) { var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27']; values = values.split(separator2); @@ -402,7 +401,13 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, // with all 0 values. options['yaxis']['tickDecimals'] = 0; } - + + if (max) { + options['xaxis']['max'] = max; + } + if (min) { + options['xaxis']['min'] = min; + } var plot = $.plot($('#' + graph_id), datas, options ); @@ -937,6 +942,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, filled = false; steps_chart = false break; + case 'unknown': case 'boolean': line_show = true; points_show = false; @@ -1767,9 +1773,11 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, if (timesize+timenewpos > canvaslimit) { $('#timestamp_'+graph_id).css('left', timenewpos - timesize); + $('#timestamp_'+graph_id).css('top', 50); } else { $('#timestamp_'+graph_id).css('left', timenewpos); + $('#timestamp_'+graph_id).css('top', 50); } } else { @@ -1812,24 +1820,16 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, plot.unhighlight(); if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) { plot.unhighlight(); - var canvaslimit = parseInt(plot.offset().left + plot.width()); var dataset = plot.getData(); - var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left); - var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); - - var left_pos; - if (extrasize+timenewpos > canvaslimit) { - left_pos = timenewpos - extrasize - 20; - } - else { - left_pos = timenewpos - (extrasize / 2); - } var extra_info = 'No info to show'; var extra_show = false; - $('#extra_'+graph_id).css('left',left_pos); - $('#extra_'+graph_id).css('top',plot.offset().top + 25); + var coord_x = (item.dataIndex/item.series.xaxis.datamax)* (event.target.clientWidth - event.target.offsetLeft + 1) + event.target.offsetLeft; + + + $('#extra_'+graph_id).css('left',coord_x); + $('#extra_'+graph_id).css('top', event.target.offsetTop + 55 ); switch(item.series.label) { case legend_alerts+series_suffix_str: diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 4f8943ed8f..2c77fdd812 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -185,7 +185,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, include_javascript_dependencies_flot_graph(); $menu = (int)$menu; - // Get a unique identifier to graph $graph_id = uniqid('graph_'); @@ -338,7 +337,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, } foreach ($chart_data as $label => $values) { - $labels[] = io_safe_output($label); + $labels[] = $label; foreach($values as $key => $value) { $jsvar = "data_" . $graph_id . "_" . $key; @@ -500,6 +499,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $short_data = false; } + // Javascript code $return .= ""; @@ -807,7 +818,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon $max = 0; $i = count($graph_data); foreach ($graph_data as $label => $values) { - $labels[] = io_safe_output($label); + $labels[] = $label; $i--; foreach ($values as $key => $value) { @@ -931,7 +942,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ $c = 0; $acumulate_data = array(); foreach ($graph_data as $label => $values) { - $labels[] = io_safe_output($label); + $labels[] = $label; $i--; foreach ($values as $key => $value) { diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index b343044b46..dce72fea79 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -24,54 +24,67 @@ When it comes to creating the action these are the only 3 fields we can set. Wit

Apart from the defined module macros, the following macros are also available:

    -
  • _field1_ : User defined field 1.
  • -
  • _field2_ : User defined field 2.
  • -
  • _field3_ : User defined field 3.
  • -
  • _agent_ : Name of the agent that fired the alert.
  • -
  • _agentdescription_ : Description of the agent who fired alert.
  • -
  • _agentgroup_ : Agent group name.
  • -
  • _agentstatus_ : Current status of the agent.
  • -
  • _agentos_: Agent's operative system.
  • -
  • _address_ : Address of the agent that fired the alert.
  • -
  • _all_address_ : All address of the agent that fired the alert.
  • -
  • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2_
  • -
  • _timestamp_ : Time when the alert was fired (yy-mm-dd hh:mm:ss).
  • -
  • _timezone_ : Timezone name that _timestamp_ represents in.
  • -
  • _data_ : Module data that caused the alert to fire.
  • -
  • _prevdata_ : Module data previus the alert to fire.
  • -
  • _alert_description_ : Alert description.
  • -
  • _alert_threshold_ : Alert threshold.
  • -
  • _alert_times_fired_ : Number of times the alert has been fired.
  • -
  • _module_ : Module name.
  • -
  • _modulegroup_ : Module group name.
  • -
  • _moduledescription_ : Description of the module who fired the alert.
  • -
  • _modulestatus_ : Status of the module.
  • -
  • _moduletags_ : Tags associated to the module.
  • -
  • _alert_name_ : Alert name.
  • -
  • _alert_priority_ : Numerical alert priority.
  • -
  • _alert_text_severity_ : Text alert severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • -
  • _event_text_severity_ : (Only event alerts) Text event (who fire the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • -
  • _event_id_ : (Only event alerts) Id of the event that fired the alert.
  • -
  • _event_extra_id_ : (Only event alerts) Extra id.
  • -
  • _id_agent_ : Id of agent, useful to build direct URL to redirect to a Pandora FMS console webpage.
  • -
  • _id_group_ : Id of agent group.
  • -
  • _id_module_ : Id of module.
  • -
  • _id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software
  • -
  • _policy_ : Name of the policy the module belongs to (if applies).
  • -
  • _interval_ : Execution interval of the module.
  • -
  • _server_ip_ : Ip of server assigned to agent.
  • -
  • _server_name_ : Name of server assigned to agent.
  • -
  • _target_ip_ : IP address of the target of the module.
  • -
  • _target_port_ : Port number of the target of the module.
  • -
  • _plugin_parameters_ : Plug-in Parameters of the module.
  • -
  • _groupcontact_ : Group contact information. Configured when the group is created.
  • -
  • _groupother_ : Other information about the group. Configured when the group is created.
  • -
  • _email_tag_ : Emails associated to the module tags.
  • -
  • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
  • -
  • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
  • -
  • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
  • -
  • _modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.
  • -
  • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
  • +
  • _address_: Address of the agent that triggered the alert.
  • +
  • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2__
  • +
  • _agent_: Name of the agent that triggered the alert.
  • +
  • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
  • +
  • _agentcustomid_: Agent custom ID.
  • +
  • _agentdescription_: Description of the agent that triggered the alert.
  • +
  • _agentgroup_ : Agent group name.
  • +
  • _agentos_: Agent's operative system.
  • +
  • _agentstatus_ : Current status of the agent.
  • +
  • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
  • +
  • _alert_description_: Alert description.
  • +
  • _alert_name_: Alert name.
  • +
  • _alert_priority_: Alert’s numeric priority.
  • +
  • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
  • +
  • _alert_threshold_: Alert threshold.
  • +
  • _alert_times_fired_: Number of times the alert has been triggered.
  • +
  • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
  • +
  • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
  • +
  • _all_address_ : All address of the agent that fired the alert.
  • +
  • _data_: Module data that caused the alert to fire.
  • +
  • _email_tag_: Emails associated to the module’s tags.
  • +
  • _event_extra_id_ : (Only event alerts) Extra id.
  • +
  • _event_id_: (Only event alerts) ID of the event that triggered the alert.
  • +
  • _event_text_severity_: (Only event alerts) event text (that triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • +
  • _field1_: User defined field 1.
  • +
  • _field2_: User defined field 2.
  • +
  • _field3_: User defined field 3.
  • +
  • _field4_: User defined field 4.
  • +
  • _field5_: User defined field 5.
  • +
  • _field6_: User defined field 6.
  • +
  • _field7_: User defined field 7.
  • +
  • _field8_: User defined field 8.
  • +
  • _field9_: User defined field 9.
  • +
  • _field10_: User defined field 10.
  • +
  • _groupcontact_: Group’s contact information. Configured when the group is created.
  • +
  • _groupcustomid_: Group’s custom ID.
  • +
  • _groupother_: Other information about the group. Configured when the group is created.
  • +
  • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
  • +
  • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
  • +
  • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
  • +
  • _id_group_ : Agent group ID.
  • +
  • _id_module_: The module's ID.
  • +
  • _interval_: Module’s execution interval.
  • +
  • _module_: Module name.
  • +
  • _modulecustomid_: Module custom ID.
  • +
  • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
  • +
  • _moduledescription_: Description of the module that triggered the alert.
  • +
  • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
  • +
  • _modulegraphth_nh_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.
  • +
  • _modulegroup_: Module’s group name.
  • +
  • _modulestatus_: Module status.
  • +
  • _moduletags_: URLs asociadas a los tags de módulos.
  • +
  • _name_tag_: Names of the tags related to the module.
  • +
  • _phone_tag_: Phone numbers related to the module’s tags.
  • +
  • _plugin_parameters_: Module’s Plugin parameters.
  • +
  • _policy_: Name of the policy that the module belongs to (if applies).
  • +
  • _prevdata_ : Module data previus the alert to fire.
  • +
  • _target_ip_: IP address for the module’s target.
  • +
  • _target_port_: Port number for the module’s target.
  • +
  • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
  • +
  • _timezone_: Timezone that is represented on _timestamp_.

diff --git a/pandora_console/include/help/en/help_alert_macros.php b/pandora_console/include/help/en/help_alert_macros.php index e1afee57a3..4ec42f797e 100644 --- a/pandora_console/include/help/en/help_alert_macros.php +++ b/pandora_console/include/help/en/help_alert_macros.php @@ -9,6 +9,30 @@ Besides the defined module macros, the following macros are available:

    +
  • _address_: Address of the agent that triggered the alert.
  • +
  • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2__
  • +
  • _agent_: Name of the agent that triggered the alert.
  • +
  • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
  • +
  • _agentcustomid_: Agent custom ID.
  • +
  • _agentdescription_: Description of the agent that triggered the alert.
  • +
  • _agentgroup_ : Agent group name.
  • +
  • _agentos_: Agent's operative system.
  • +
  • _agentstatus_ : Current status of the agent.
  • +
  • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
  • +
  • _alert_description_: Alert description.
  • +
  • _alert_name_: Alert name.
  • +
  • _alert_priority_: Alert’s numeric priority.
  • +
  • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
  • +
  • _alert_threshold_: Alert threshold.
  • +
  • _alert_times_fired_: Number of times the alert has been triggered.
  • +
  • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
  • +
  • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
  • +
  • _all_address_ : All address of the agent that fired the alert.
  • +
  • _data_: Module data that caused the alert to fire.
  • +
  • _email_tag_: Emails associated to the module’s tags.
  • +
  • _event_extra_id_: (Only event alerts) Extra id.
  • +
  • _event_id_: (Only event alerts) ID of the event that triggered the alert.
  • +
  • _event_text_severity_: (Only event alerts) event text (that triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • _field1_: User defined field 1.
  • _field2_: User defined field 2.
  • _field3_: User defined field 3.
  • @@ -19,58 +43,34 @@ Besides the defined module macros, the following macros are available:
  • _field8_: User defined field 8.
  • _field9_: User defined field 9.
  • _field10_: User defined field 10.
  • -
  • _agent_: Name of the agent that triggered the alert.
  • -
  • _agentcustomfield_n_: Agent custom field number n (eg. _agentcustomfield_9_).
  • -
  • _agentcustomid_: Agent custom ID.
  • -
  • _agentdescription_: Description of the agent that triggered the alert.
  • -
  • _agentgroup_: Agent’s group name.
  • -
  • _agentstatus_: Current agent status.
  • -
  • _agentos_: Agent's operative system.
  • -
  • _address_: Address of the agent that triggered the alert.
  • -
  • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
  • -
  • _timezone_: Timezone that is represented on _timestamp_.
  • -
  • _data_: Module data that caused the alert to fire.
  • -
  • _prevdata_ : Module data previus the alert to fire.
  • -
  • _alert_description_: Alert description.
  • -
  • _alert_threshold_: Alert threshold.
  • -
  • _alert_times_fired_: Number of times the alert has been triggered.
  • -
  • _module_: Module name.
  • -
  • _modulecustomid_: Module custom ID.
  • -
  • _modulegroup_: Module’s group name.
  • -
  • _moduledescription_: Description of the module that triggered the alert.
  • -
  • _modulestatus_: Module status.
  • -
  • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
  • -
  • _alert_name_: Alert name.
  • -
  • _alert_priority_: Alert’s numeric priority.
  • -
  • _alert_text_severity_: Priority level, in text, for the alert (Maintenance, Informational, Normal Minor, Major, Critical).
  • -
  • _event_text_severity_: (Only event alerts) Text event (which triggered the alert) severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
  • -
  • _event_id_: (Only event alerts) ID of the event that triggered the alert.
  • -
  • _event_extra_id_: (Only event alerts) Extra id.
  • -
  • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
  • -
  • _id_group_ : Agent group ID.
  • -
  • _id_module_ : ID of module.
  • -
  • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
  • -
  • _policy_: Name of the policy that the module belongs to (if applies).
  • -
  • _interval_: Module’s execution interval
  • -
  • _target_ip_: IP address for the module’s target.
  • -
  • _target_port_: Port number for the module’s target.
  • -
  • _plugin_parameters_: Module’s Plugin parameters.
  • -
  • _server_ip_ : Ip of server assigned to agent.
  • -
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_: Group’s contact information. Configured when the group is created.
  • _groupcustomid_: Group’s custom ID.
  • _groupother_: Other information about the group. Configured when the group is created.
  • +
  • _homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.
  • +
  • _id_agent_: Agent’s ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.
  • +
  • _id_alert_: Alert’s numeric ID (unique), used to correlate the alert with third party software.
  • +
  • _id_group_ : Agent group ID.
  • +
  • _id_module_: The module's ID.
  • +
  • _interval_: Module’s execution interval.
  • +
  • _module_: Module name.
  • +
  • _modulecustomid_: Module custom ID.
  • +
  • _moduledata_X_: Last data of module X (module name, cannot have white spaces).
  • +
  • _moduledescription_: Description of the module that triggered the alert.
  • +
  • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
  • +
  • _modulegraphth_nh_:Same operation as the previous macro only with the critical and warning thresholds of the module provided they are defined.
  • +
  • _modulegroup_: Module’s group name.
  • +
  • _modulestatus_: Module status.
  • +
  • _moduletags_: URLs asociadas a los tags de módulos.
  • _name_tag_: Names of the tags related to the module.
  • -
  • _email_tag_: Emails associated to the module’s tags.
  • _phone_tag_: Phone numbers related to the module’s tags.
  • -
  • _moduletags_: URLs associated to the module’s tags.
  • -
  • _alert_critical_instructions_: Instructions for CRITICAL status contained in the module.
  • -
  • _alert_warning_instructions_: Instructions for WARNING status contained in the module.
  • -
  • _alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.
  • -
  • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) -Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). -A correct setup of the connection between the server and the console's API is required. -This setup is done on the server's configuration file.
  • +
  • _plugin_parameters_: Module’s Plugin parameters.
  • +
  • _policy_: Name of the policy that the module belongs to (if applies).
  • +
  • _prevdata_ : Module data previus the alert to fire.
  • +
  • _target_ip_: IP address for the module’s target.
  • +
  • _target_port_: Port number for the module’s target.
  • +
  • _timestamp_: Time and date on which the alert was triggered (yy-mm-dd hh:mm:ss).
  • +
  • _timezone_: Timezone that is represented on _timestamp_.
  • +

diff --git a/pandora_console/include/help/en/help_cron.php b/pandora_console/include/help/en/help_cron.php new file mode 100644 index 0000000000..a1e235d06e --- /dev/null +++ b/pandora_console/include/help/en/help_cron.php @@ -0,0 +1,45 @@ + +

Cron for server modules

+ +Using the configuration parameter sets Cron from and Cron to makes +it possible for a module to run only for certain periods of time. +The way in which it is configured is similar to the syntax of +cron. +Just as they appear in the Pandora console, each one of the parameters +has three options. + +

Cron from: any

+ +The module will not have restrictions in that parameter. Whatever the value is +will be executed, and it is equivalent to the asterisk (*) in the cron nomenclature. In this +case Cron to is ignored. + +

Cron from: different from any. Cron to: any

+ +The module will run only during the time in which the date matches that +parameter. It is equivalent to writingjust one number in cron nomenclature. + +

Cron from: different from any. Cron to: different from any

+ +The module will run only during the time specified between Cron from and Cron to. +It is equivalent to writing number dash number (n-n) in cron nomenclature. + +

Agent interval

+ +As long as cron conditions are met, the agent will run following +its execution interval. + +

Examples

+ +
    +
  • * * * * *: No cron configured.
  • +
  • 15 20 * * *: It will run every day at 20:15.
  • +
  • * 20 * * *: It will run every day during the hour 20, that is, from 20:00 to 20:59.
  • +
  • * 8-19 * * *: It will run everyday from 8:00 to 19:59.
  • +
  • 15-45 * 1-16 * *: It will run every first 16 days of the month every hour, from quarter past to quarter to.
  • +
  • * * * 5 *: It will run only in May.
  • +
      diff --git a/pandora_console/include/help/en/help_graphs.php b/pandora_console/include/help/en/help_graphs.php new file mode 100644 index 0000000000..0fc35349a9 --- /dev/null +++ b/pandora_console/include/help/en/help_graphs.php @@ -0,0 +1,148 @@ + + + + + + +

      INTERPRETING GHRAPHS IN PANDORA FMS

      + + +

      In Pandora FMS, graphs represent the values a module has had during a given period.

      +

      Due to the large amount of data that Pandora FMS stores, two different types of functionality are offered

      + + +

      NORMAL GRAPHS

      + +images/help/chart_normal_sample.png" alt="regular chart sample" /> + +

      General characteristics

      +

      These are graphs that represent the information stored by the module at a basic level.

      +

      They allow us to see an approximation of the values in which our module oscillates.

      +

      The module data are divided into boxes in such a way that a sample of the module values is represented, not all values are shown. This is complemented by dividing the view into three graphs, Max (maximum values), min (minimum values) and avg (average values)

      + +
        +
      • Advantages: They are generated very quickly without consuming hardly any resources.
      • +
      • Disadvantages: The information provided is approximate. The status of the monitors they represent are calculated on an event-driven basis.
      • + + + +

        Display options

        + +
        +
        Refresh time
        +
        Time the graph will take to be created again.
        + +
        Avg. Only
        +
        Only the averages graph will be created.
        + +
        Starting date
        +
        Date until which the graphic will be created.
        + +
        Startup time
        +
        Hour minutes and seconds until the graphic is created.
        + +
        Zoom factor
        +
        Graph viewfinder size, multiplicative.
        + +
        Time Range
        +
        Sets the time period from which data will be collected.
        + +
        Show events
        +
        Displays indicator points with event information at the top.
        + +
        Show alerts
        +
        Shows indicator points with triggered alert information at the top.
        + +
        Show percentile
        +
        Adds a graph that indicates the percentile line (configurable in general visual options of Pandora).
        + +
        Time comparison (superimposed)
        +
        Displays the same graphic overlay, but in the period before the selected one. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown superimposed.
        + +
        Time comparison (independent)
        +
        Displays the same graph, but in the period before the selected one, in a separate area. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown.
        + +
        Display unknown graphic
        +
        It shows boxes in grey shading covering the periods in which Pandora FMS cannot guarantee the module's status, either due to data loss, disconnection of a software agent, etc.
        + +
        Show Full Scale Graph (TIP)
        +
        Switches the creation mode from "normal" to "TIP". In this mode, the graphs will show real data rather than approximations, so the time it will take to generate them will be longer. More detailed information on this type of graphs can be found in the following section.
        + +
        + + + + +
        +
        + + +

        TIP GRAPS

        +images/help/chart_tip_sample.png" alt="TIP chart sample" /> + +

        General characteristics

        +

        These are graphs that represent real data.

        +

        They show us a true representation of the data reported by our module.

        +

        As these are real data, it will not be necessary to supplement the information with extra graphs (avg, min, max).

        +

        The calculation of periods in unknown state is supported by events, such as normal graphs, but is complemented by extra detection if there is any.

        +

        Examples of resolution offered by normal and TIP methods:

        + +
        Example of normal graph in unknown interval
        +images/help/chart_normal_detail.png" alt="TIP chart detail" /> + +
        Example of TIP graph in unknown interval
        +images/help/chart_tip_detail.png" alt="TIP chart detail" /> + +
        + +
          +
        • Advantages: The data represented are real data. This is the most realistic way to review module data.
        • +
        • Disadvantages: Processing is slower than in normal graphs. Depending on the time range and the volume of data to be displayed, your display may be less fluid.
        • +
        + + + diff --git a/pandora_console/include/help/en/help_linked_map_weight.php b/pandora_console/include/help/en/help_linked_map_weight.php new file mode 100644 index 0000000000..aff63a93c4 --- /dev/null +++ b/pandora_console/include/help/en/help_linked_map_weight.php @@ -0,0 +1,19 @@ + +

        Associated map status weight

        + +

        +Only "static image" type elements can have this option. Through it we establish a percentage of elements in a status other than the normal one so that our element linked to that map picks up its status. +

        +

        +For example: +

        +

        +If we have a map 1 with a "static image" type element that points to map 2 and has its weight set at 50%, you will only see its status modified if at least half of the elements (items that must return a status from an agent, module or other linked console) of map 2 are not in normal status. +

        +

        +We can also have an element linked to a console with 10 elements that return a status, which in turn can have elements linked to other consoles. If our element from the first console has a weight of 20%, it is because we want it to show a critical (or warning) status if at least 2 of the 10 elements of the second console have a critical (or warning) status. Similarly, if the weight is 80%, 8 out of 10 elements must be in a non-normal status. +

        \ No newline at end of file diff --git a/pandora_console/include/help/en/help_module_definition.php b/pandora_console/include/help/en/help_module_definition.php index 8173a8093b..81bdaf95ea 100644 --- a/pandora_console/include/help/en/help_module_definition.php +++ b/pandora_console/include/help/en/help_module_definition.php @@ -5,11 +5,12 @@ ?>

        Module definition

        -There are two modes for an agent: +There are three modes for an agent:

          -
        • Learning mode: all the modules sent by the agent are accepted. If modules are not defined, they will be automatically defined by the system. It is recommended to activate the agents in this mode and change it once the user is familiar with Pandora FMS.
          From version 4.0.3, in this mode, Pandora console collect all the configuration specified by the agent configuration file the first time and thereafter any changes should be made through console, will not catch changes in config file. -
        • +
        • Learning mode: All the modules sent by the agent are accepted. If modules are not defined, they will be automatically defined by the system. It is recommended to activate the agents in this mode and change it once the user is familiar with Pandora FMS.
          From version 4.0.3, in this mode, Pandora console collect all the configuration specified by the agent configuration file the first time and thereafter any changes should be made through console, will not catch changes in config file.

        • -
        • Normal mode: the modules in this mode must be conï¬gured manually. The self definition of the modules is not allowed in this mode.
        • +
        • Normal mode: The modules in this mode must be conï¬gured manually. The self definition of the modules is not allowed in this mode.
        • +
          +
        • Autodisable mode: It behaves exactly the same as an agent in learning mode: when the first XML reaches it, the first agent is created and, on each report, if there are new modules they can also be added automatically. Nevertheless, when all modules from an agent that are in autodisable mode are also marked as unknown, the agent is automatically disabled. In any case, if the agent reports again, it gets enabled again on its own.
        diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 40d4813cae..40a88b19eb 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -26,55 +26,67 @@ A la hora de crear la acción podemos definir únicamente estos 3 campos. Dentro Además de las macros de módulo definidas, las siguientes macros están disponibles:

          -
        • _field1_: Campo 1 definido por el usuario.
        • -
        • _field2_: Campo 2 definido por el usuario.
        • -
        • _field3_: Campo 3 definido por el usuario.
        • -
        • _agent_: Nombre del agente que disparó la alerta.
        • -
        • _agentdescription_ : Descripción del agente que disparó la alerta.
        • -
        • _agentgroup_ : Nombre del grupo del agente.
        • -
        • _agentstatus_ : Estado actual del agente.
        • -
        • _address_: Dirección del agente que disparó la alerta.
        • -
        • _all_address_ : Todas las direcciones del agente que disparo la alerta.
        • -
        • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
        • -
        • _agentos_: Sistema operativo del agente.
        • -
        • _timestamp_: Hora y fecha en que se disparó la alerta.
        • -
        • _timezone_: Area Nombre _timestamp_ que representa en.
        • -
        • _data_: Dato que hizo que la alerta se disparase.
        • -
        • _prevdata_: Dato previo antes de disparase la alerta.
        • -
        • _alert_description_: Descripción de la alerta.
        • -
        • _alert_threshold_: Umbral de la alerta.
        • -
        • _alert_times_fired_: Número de veces que se ha disparado la alerta.
        • -
        • _module_: Nombre del módulo
        • -
        • _modulegroup_ : Nombre del grupo del módulo.
        • -
        • _moduledescription_: Descripcion del modulo.
        • -
        • _modulestatus_ : Estado del módulo.
        • -
        • _moduletags_ : Etiquetas asociadas al módulo.
        • -
        • _alert_name_: Nombre de la alerta.
        • -
        • _alert_priority_: Prioridad numérica de la alerta.
        • -
        • _alert_text_severity_: Prioridad en texto de la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
        • -
        • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta. (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
        • -
        • _event_id_ : (Solo alertas de evento) Id del evento que disparó la alerta.
        • -
        • _event_extra_id_ : (Solo alertas de evento) Id extra.
        • -
        • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
        • -
        • _id_group_ : Id del grupo de agente.
        • -
        • _id_module_ : ID del módulo.
        • -
        • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
        • -
        • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
        • -
        • _interval_ : Intervalo de la ejecución del módulo.
        • -
        • _target_ip_ : Dirección IP del objetivo del módulo.
        • -
        • _target_port_ : Puerto del objetivo del módulo.
        • -
        • _plugin_parameters_ : Parámetros del Plug-in del módulo.
        • -
        • _server_ip_ : Ip del servidor al que el agente está asignado.
        • -
        • _server_name_ : Nombre del servidor al que el agente está asignado.
        • -
        • _groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.
        • -
        • _groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.
        • -
        • _email_tag_ : Emails asociados a los tags de módulos.
        • -
        • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
        • -
        • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
        • -
        • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
        • -
        • _modulegraph_nh_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.
        • -
        • _modulegraphth_nh_:mismo funcionamiento que la macro anterior solo que con los umbrales critical y warning del modulo siempre que estos esten definidos
        • -
        • _homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
        • +
        • _address_: Dirección del agente que disparó la alerta.
        • +
        • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
        • +
        • _agent_: Nombre del agente que disparó la alerta.
        • +
        • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
        • +
        • _agentcustomid_:ID personalizado del agente.
        • +
        • _agentdescription_: Descripción del agente que disparó la alerta.
        • +
        • _agentgroup_ : Nombre del grupo del agente.
        • +
        • _agentos_: Sistema operativo del agente.
        • +
        • _agentstatus_ : Estado actual del agente.
        • +
        • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
        • +
        • _alert_description_: Descripción de la alerta.
        • +
        • _alert_name_: Nombre de la alerta.
        • +
        • _alert_priority_: Prioridad numérica de la alerta.
        • +
        • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
        • +
        • _alert_threshold_: Umbral de la alerta.
        • +
        • _alert_times_fired_: Número de veces que se ha disparado la alerta.
        • +
        • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
        • +
        • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
        • +
        • _all_address_ : Todas las direcciones del agente que disparo la alerta.
        • +
        • _data_: Dato que hizo que la alerta se disparase.
        • +
        • _email_tag_: Emails asociados a los tags de módulos.
        • +
        • _event_extra_id_ : (Solo alertas de evento) Id extra.
        • +
        • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
        • +
        • _event_text_severity_: (Solo alertas de evento) Texto del evento (que disparó la alerta) gravedad (Mantenimiento, Informativo, Normal Menor, Advertencia, Mayor, Crítico).
        • +
        • _field1_: Campo 1 definido por el usuario.
        • +
        • _field2_: Campo 2 definido por el usuario.
        • +
        • _field3_: Campo 3 definido por el usuario.
        • +
        • _field4_: Campo 4 definido por el usuario.
        • +
        • _field5_: Campo 5 definido por el usuario.
        • +
        • _field6_: Campo 6 definido por el usuario.
        • +
        • _field7_: Campo 7 definido por el usuario.
        • +
        • _field8_: Campo 8 definido por el usuario.
        • +
        • _field9_: Campo 9 definido por el usuario.
        • +
        • _field10_: Campo 10 definido por el usuario.
        • +
        • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
        • +
        • _groupcustomid_: ID personalizado del grupo.
        • +
        • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
        • +
        • _homeurl_: Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
        • +
        • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
        • +
        • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
        • +
        • _id_group_ : ID del grupo de agente.
        • +
        • _id_module_: ID del módulo.
        • +
        • _interval_: Intervalo de la ejecución del módulo.
        • +
        • _module_: Nombre del módulo.
        • +
        • _modulecustomid_: ID personalizado del módulo.
        • +
        • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
        • +
        • _moduledescription_: Descripcion del modulo.
        • +
        • _modulegraph_nh_: (>=6.0) (Only for alerts that use the command eMail) Returns an image encoded in base64 of a module’s graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's API is required. This setup is done on the server's configuration file.
        • +
        • _modulegraphth_nh_: Misma operación que la macro anterior pero sólo con los umbrales crítico y de advertencia del módulo, en caso de que estén definidos.
        • +
        • _modulegroup_: Nombre del grupo del módulo.
        • +
        • _modulestatus_: Estado del módulo.
        • +
        • _moduletags_: URLs asociadas a los tags de módulos.
        • +
        • _name_tag_: Nombre de los tags asociados al módulo.
        • +
        • _phone_tag_: Teléfonos asociados a los tags de módulos.
        • +
        • _plugin_parameters_: Parámetros del Plug-in del módulo.
        • +
        • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
        • +
        • _prevdata_ : Dato previo antes de disparase la alerta.
        • +
        • _target_ip_: Dirección IP del objetivo del módulo.
        • +
        • _target_port_: Puerto del objetivo del módulo.
        • +
        • _timestamp_: Hora y fecha en que se disparó la alerta.
        • +
        • _timezone_: Area Nombre _timestamp_ que representa en.

        Ejemplo: Error en el agente _agent_: _alert_description_ diff --git a/pandora_console/include/help/es/help_alert_macros.php b/pandora_console/include/help/es/help_alert_macros.php index 15ff187f56..36f6755d1e 100644 --- a/pandora_console/include/help/es/help_alert_macros.php +++ b/pandora_console/include/help/es/help_alert_macros.php @@ -9,68 +9,69 @@ Además de las macros de módulo definidas, las siguientes macros están disponibles:

          -
        • _field1_: Campo 1 definido por el usuario.
        • -
        • _field2_: Campo 2 definido por el usuario.
        • -
        • _field3_: Campo 3 definido por el usuario.
        • -
        • _field4_: Campo 4 definido por el usuario.
        • -
        • _field5_: Campo 5 definido por el usuario.
        • -
        • _field6_: Campo 6 definido por el usuario.
        • -
        • _field7_: Campo 7 definido por el usuario.
        • -
        • _field8_: Campo 8 definido por el usuario.
        • -
        • _field9_: Campo 9 definido por el usuario.
        • -
        • _field10_: Campo 10 definido por el usuario.
        • -
        • _agent_: Nombre del agente que disparó la alerta.
        • -
        • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
        • -
        • _agentcustomid_: ID personalizado del agente.
        • -
        • _agentdescription_: Descripción del agente que disparó la alerta.
        • -
        • _agentgroup_: Nombre del grupo del agente.
        • -
        • _agentstatus_: Estado actual del agente.
        • -
        • _agentos_: Sistema operativo del agente.
        • -
        • _address_: Dirección del agente que disparó la alerta.
        • -
        • _timestamp_: Hora y fecha en que se disparó la alerta.
        • -
        • _timezone_: Area Nombre _timestamp_ que representa en.
        • -
        • _data_: Dato que hizo que la alerta se disparase.
        • -
        • _prevdata_: Dato previo antes de disparase la alerta.
        • -
        • _alert_description_: Descripción de la alerta.
        • -
        • _alert_threshold_: Umbral de la alerta.
        • -
        • _alert_times_fired_: Número de veces que se ha disparado la alerta.
        • -
        • _module_: Nombre del módulo.
        • -
        • _modulecustomid_: ID personalizado del módulo.
        • -
        • _modulegroup_: Nombre del grupo del módulo.
        • -
        • _moduledescription_: Descripcion del modulo.
        • -
        • _modulestatus_: Estado del módulo.
        • -
        • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
        • -
        • _alert_name_: Nombre de la alerta.
        • -
        • _alert_priority_: Prioridad numérica de la alerta.
        • -
        • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
        • -
        • _eventt_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
        • -
        • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
        • -
        • _event_extra_id_: (Solo alertas de evento) Id extra.
        • -
        • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
        • -
        • _id_group_ : Id del grupo de agente.
        • -
        • _id_module_ : ID del módulo.
        • -
        • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
        • -
        • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
        • -
        • _interval_: Intervalo de la ejecución del módulo.
        • -
        • _target_ip_: Dirección IP del objetivo del módulo.
        • -
        • _target_port_: Puerto del objetivo del módulo.
        • -
        • _plugin_parameters_: Parámetros del plugin del módulo.
        • -
        • _server_ip_ : Ip del servidor al que el agente está asignado.
        • -
        • _server_name_ : Nombre del servidor al que el agente está asignado.
        • -
        • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
        • -
        • _groupcustomid_: ID personalizado del grupo.
        • -
        • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
        • -
        • _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.
        • -
        • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
        • -
        • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
        • -
        • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
        • -
        • _modulegraph_nh_: (>=6.0) (Solo para alertas que usen el comando eMail) -Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). -Requiere de una configuración correcta de la conexión del servidor a la consola vía api, -la cual se realiza en el fichero de configuración del servidor.
        • + +
        • _address_: Dirección del agente que disparó la alerta.
        • +
        • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
        • +
        • _agent_: Nombre del agente que disparó la alerta.
        • +
        • _agentcustomfield_n_: Campo personalizado número n del agente (eg. _agentcustomfield_9_).
        • +
        • _agentcustomid_:ID personalizado del agente.
        • +
        • _agentdescription_: Descripción del agente que disparó la alerta.
        • +
        • _agentgroup_ : Nombre del grupo del agente.
        • +
        • _agentos_: Sistema operativo del agente.
        • +
        • _agentstatus_ : Estado actual del agente.
        • +
        • _alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.
        • +
        • _alert_description_: Descripción de la alerta.
        • +
        • _alert_name_: Nombre de la alerta.
        • +
        • _alert_priority_: Prioridad numérica de la alerta.
        • +
        • _alert_text_severity_: Prioridad en texto de la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).
        • +
        • _alert_threshold_: Umbral de la alerta.
        • +
        • _alert_times_fired_: Número de veces que se ha disparado la alerta.
        • +
        • _alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.
        • +
        • _alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.
        • +
        • _all_address_ : Todas las direcciones del agente que disparo la alerta.
        • +
        • _data_: Dato que hizo que la alerta se disparase.
        • +
        • _email_tag_: Emails asociados a los tags de módulos.
        • +
        • _event_extra_id_: (Solo alertas de evento) Id extra.
        • +
        • _event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.
        • +
        • _event_text_severity_: (Solo alertas de evento) Texto del evento (que disparó la alerta) de la gravedad (Mantenimiento, Informativo, Normal Menor, Advertencia, Mayor, Crítico).
        • +
        • _field1_: Campo 1 definido por el usuario.
        • +
        • _field2_: Campo 2 definido por el usuario.
        • +
        • _field3_: Campo 3 definido por el usuario.
        • +
        • _field4_: Campo 4 definido por el usuario.
        • +
        • _field5_: Campo 5 definido por el usuario.
        • +
        • _field6_: Campo 6 definido por el usuario.
        • +
        • _field7_: Campo 7 definido por el usuario.
        • +
        • _field8_: Campo 8 definido por el usuario.
        • +
        • _field9_: Campo 9 definido por el usuario.
        • +
        • _field10_: Campo 10 definido por el usuario.
        • +
        • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
        • +
        • _groupcustomid_: ID personalizado del grupo.
        • +
        • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
        • +
        • _homeurl_: Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.
        • +
        • _id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.
        • +
        • _id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.
        • +
        • _id_group_ : ID del grupo de agente.
        • +
        • _id_module_: ID del módulo.
        • +
        • _interval_: Intervalo de la ejecución del módulo.
        • +
        • _module_: Nombre del módulo.
        • +
        • _modulecustomid_: ID personalizado del módulo.
        • +
        • _moduledata_X_: Último dato del módulo X (nombre del módulo, no puede tener espacios).
        • +
        • _moduledescription_: Descripcion del modulo.
        • +
        • _modulegraph_nh_: (>=6.0) (Solo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.
        • +
        • _modulegraphth_nh_: Misma operación que la macro anterior pero sólo con los umbrales crítico y de advertencia del módulo, en caso de que estén definidos.
        • +
        • _modulegroup_: Nombre del grupo del módulo.
        • +
        • _modulestatus_: Estado del módulo.
        • +
        • _moduletags_: URLs asociadas a los tags de módulos.
        • +
        • _name_tag_: Nombre de los tags asociados al módulo.
        • +
        • _phone_tag_: Teléfonos asociados a los tags de módulos.
        • +
        • _plugin_parameters_: Parámetros del Plug-in del módulo.
        • +
        • _policy_: Nombre de la política a la que pertenece el módulo (si aplica).
        • +
        • _prevdata_ : Dato previo antes de disparase la alerta.
        • +
        • _target_ip_: Dirección IP del objetivo del módulo.
        • +
        • _target_port_: Puerto del objetivo del módulo.
        • +
        • _timestamp_: Hora y fecha en que se disparó la alerta.
        • +
        • _timezone_: Area Nombre _timestamp_ que representa en.
        • +

        diff --git a/pandora_console/include/help/es/help_cron.php b/pandora_console/include/help/es/help_cron.php new file mode 100644 index 0000000000..2902c81928 --- /dev/null +++ b/pandora_console/include/help/es/help_cron.php @@ -0,0 +1,46 @@ + +

        Cron para módulos de servidor

        + +Mediante los grupos de parámetros de configuración Cron desde y Cron hasta se +puede hacer que un módulo solo se ejecute durante ciertos periodos de tiempo. El +modo en el que se configura es parecido a la sintaxis de +cron. +Tal y como aparecen en la consola de Pandora, cada uno de los parámetros +tiene tres opciones. + +

        Cron desde: cualquiera

        + +El módulo no tendrá restricciones en ese parámetro. Se ejecutará cualquiera que +que sea el valor y equivale al asterisco (*) en la nomenclatura de cron. En este +caso se ignora Cron desde. + +

        Cron desde: distinto de cualquiera. Cron hasta: cualquiera

        + +El módulo se ejecutará solamente el tiempo en el que la fecha coincida con ese +parámetro. Equivale a escribir solamente un número en la nomenclatura de cron. + +

        Cron desde: distinto de cualquiera. Cron hasta: distinto de cualquiera

        + +El módulo se ejecutará entre el tiempo indicado en el Cron desde y el Cron hasta. +Equivale a escribir el número guión número (n-n) en la nomenclatura de cron. + +

        Intervalo del agente

        + +Mientras que se cumplan las condiciones de cron, el agente se ejecutará siguiendo +su intervalo de ejecución. + +

        Ejemplos

        + +
          +
        • * * * * *: No hay cron configurado.
        • +
        • 15 20 * * *: Se ejecutará todos los días a las 20:15.
        • +
        • * 20 * * *: Se ejecutará todos los días durante las 20 horas, es decir, entre las 20:00 y las 20:59.
        • +
        • * 8-19 * * *: Se ejecutará todos los días entre las 8:00 y las 19:59.
        • +
        • 15-45 * 1-16 * *: Se ejecutará todos los primeros 16 días del mes a todas horas entre y cuarto y menos cuarto.
        • +
        • * * * 5 *: Se ejecutará solamente en mayo.
        • +
            + diff --git a/pandora_console/include/help/es/help_graphs.php b/pandora_console/include/help/es/help_graphs.php new file mode 100644 index 0000000000..2f98d43ccf --- /dev/null +++ b/pandora_console/include/help/es/help_graphs.php @@ -0,0 +1,148 @@ + + + + + + +

            Interpretar las gráficas en Pandora FMS

            + + +

            Las gráficas en Pandora representan los valores que un módulo ha tenido a lo largo de un período.

            +

            Debido a la gran cantidad de datos que Pandora FMS almacena, se ofrecen dos tipos diferentes de funcionalidad:

            + + +

            Gráficas Normales

            + +images/help/chart_normal_sample.png" alt="regular chart sample" /> + +

            Características generales

            +

            Son gráficas que representan la información almacenada por el módulo a un nivel básico.

            +

            Nos permite ver una aproximación de los valores en los que oscila nuestro módulo.

            +

            Dividen los datos del módulo en cajas de tal manera que se representa una muestra de los valores del módulo, no se pintan todos los valores. Esta carencia se complementa dividiendo la vista en tres gráficas, Max (valores máximos), min (valores mínimos) y avg (valores promedios)

            + +
              +
            • Ventajas: Se generan muy rápidamente sin consumir apenas recursos.
            • +
            • Inconvenientes: La información que proveen es aproximada. Los estados de los monitores que representan se calculan en base a eventos.
            • + + + +

              Opciones de visualización

              + +
              +
              Tiempo de refresco
              +
              Tiempo en que se pintará la gráfica de nuevo.
              + +
              Avg. Only
              +
              Solo se pintará la gráfica de promedios.
              + +
              Fecha de inicio
              +
              Fecha hasta la que se pintará la gráfica.
              + +
              Tiempo de inicio
              +
              Hora minutos y segundos hasta los que se pintará la gráfica.
              + +
              Factor de zoom
              +
              Tamaño del visor de la gráfica, multiplicativo.
              + +
              Rango de tiempo
              +
              Establece el período de tiempo desde el que se recogerán los datos.
              + +
              Mostrar eventos
              +
              Muestra puntos indicadores con la información de eventos en la parte superior.
              + +
              Mostrar alertas
              +
              Muestra puntos indicadores con la información de alertas disparadas en la parte superior.
              + +
              Mostrar percentil
              +
              Agrega una gráfica que indica la línea del percentil (configurable en opciones visuales generales de Pandora).
              + +
              Comparación de tiempo (superpuesto)
              +
              Muestra superpuesta la misma gráfica, pero en el período anterior al seleccionado. Por ejemplo, si solicitamos un período de una semana y activamos esta opción, la semana anterior a la elegida también se mostrará superpuesta.
              + +
              Comparación de tiempo (independiente)
              +
              Muestra la misma gráfica, pero en el período anterior al seleccionado, en un area independiente. Por ejemplo, si solicitamos un período de una semana y activamos esta opción, la semana anterior a la elegida también se mostrará.
              + +
              Mostrar gráfica de desconocidos
              +
              Muestra cajas en sombreado gris cubriendo los períodos en que Pandora FMS no puede garantizar el estado del módulo, ya sea por pérdida de datos, desconexión de un agente software, etc.
              + +
              Mostrar gráfica de escala completa (TIP)
              +
              Cambia el modo de pintado de "normal" a "TIP". En este modo, las gráficas mostrarán datos reales en vez de aproximaciones, por lo que el tiempo que emplearán para su generación será mayor. Podrá encontrar información más detallada de este tipo de gráficas en el siguiente apartado.
              + +
              + + + + +
              +
              + + +

              Gráficas TIP

              +images/help/chart_tip_sample.png" alt="TIP chart sample" /> + +

              Características generales

              +

              Son gráficas que representan datos reales.

              +

              Nos muestra una representación veraz de los datos reportados por nuestro módulo.

              +

              Al ser datos reales no será necesario complementar la información con gráficas extra (avg,min,max).

              +

              El cálculo de períodos en estado desconocido se apoya en eventos, tal y como funcionan las gráficas normales, pero se complementa con una detección extra en caso de haberlos.

              +

              Ejemplos de resolución ofrecidas por metodos normal y TIP:

              + +
              Ejemplo de gráfica normal en intervalo desconocido
              +images/help/chart_normal_detail.png" alt="TIP chart detail" /> + +
              Ejemplo de gráfica TIP en intervalo desconocido
              +images/help/chart_tip_detail.png" alt="TIP chart detail" /> + +
              + +
                +
              • Ventajas: Los datos representados son datos reales. Es la forma más realista de revisar los datos de un módulo.
              • +
              • Inconvenientes: Su procesado es más lento que en las gráficas normales. Dependiendo del rango de tiempo y el volumen de datos a mostrar es posible que su visualización sea menos fluída.
              • +
              + + + diff --git a/pandora_console/include/help/es/help_linked_map_weight.php b/pandora_console/include/help/es/help_linked_map_weight.php new file mode 100644 index 0000000000..430179c134 --- /dev/null +++ b/pandora_console/include/help/es/help_linked_map_weight.php @@ -0,0 +1,19 @@ + +

              Peso de estado del mapa asociado

              + +

              +Solo los elementos de tipo "imagen estática" pueden llevar esta opción. Mediante ella establecemos un porcentaje de elementos en un estado diferente al normal para que nuestro elemento enlazado a ese mapa recoja su estado. +

              +

              +Por ejemplo: +

              +

              +Si tenemos un mapa 1 con un elemento de tipo "imagen estática" que apunta a un mapa 2 y tiene su peso establecido en un 50%, solo verá modificado su estado si al menos la mitad de los elementos (elementos que deben devolver un estado tanto de agente, de módulo o de otra consola enlazada) del mapa 2 no están en un estado normal. +

              +

              +También podemos tener un elemento enlazado a una consola con 10 elementos que devuelvan un estado, que a su vez pueden tener elementos enlazados a otras consolas. Si nuestro elemento de la primera consola tiene establecido un peso del 20% es porque queremos que nos muestre un estado crítico (o de advertencia) si al menos 2 de los 10 elementos de la segunda consola tienen un estado crítico (o de advertencia). Del mismo modo si el peso fuese del 80%, se tendrán que tener 8 elementos de 10 en un estado no normal. +

              \ No newline at end of file diff --git a/pandora_console/include/help/es/help_module_definition.php b/pandora_console/include/help/es/help_module_definition.php index e31ac65d6c..ff85f8b326 100644 --- a/pandora_console/include/help/es/help_module_definition.php +++ b/pandora_console/include/help/es/help_module_definition.php @@ -6,10 +6,12 @@

              Definición de módulo

              -Existen dos modos para un agente: +Existen tres modos para un agente:

                -
              • Modo aprendizaje: todos los módulos enviados por el agente se aceptan. Si los módulos no están definidos, el sistema los creará automáticamente. Se recomienda activar los agentes en este modo y cambiarlo una vez que se el operador se ha familiarizado con Pandora FMS. A partir de la versión 4.0.3, en este modo Pandora recogerá en consola toda la configuración indicada por el fichero de configuración del agente la primera vez y a partir de entonces todas las modificaciones se deberán realizar a través de consola, no cogerá cambios en el fichero de configuración.
              • +
              • Modo aprendizaje:Si el XML recibido del agente software contiene nuevos módulos, éstos serán automáticamente creados. Este es el comportamiento por defecto.

              • -
              • Modo normal: los módulos en este modo se deben configurar manualmente. No se permite la definición automática en este modo.
              • +
              • Modo normal:No se crearán nuevos módulos que lleguen en el XML si no han sido declarados previamente en la consola.
              • +
                +
              • Modo auto deshabilitado:Similar al modo aprendizaje, en este modo, además, si todos los módulos pasan a estado desconocido el agente se deshabilitará automáticamente, pasando a habilitarse de nuevo si recibe nueva información.
              diff --git a/pandora_console/include/help/es/help_network_map_enterprise.php b/pandora_console/include/help/es/help_network_map_enterprise.php index 32cde09e4c..70d19af16f 100644 --- a/pandora_console/include/help/es/help_network_map_enterprise.php +++ b/pandora_console/include/help/es/help_network_map_enterprise.php @@ -4,21 +4,18 @@ */ ?> -

              Networkmap console

              +

              Mapas de red

              -

              Con la version Enterprise puede crear mapas de red editables de una manera mas interactiva comparado con la version Open que esta actualmente en la subseccion "Ver agentes".

              +

              Con la version Enterprise puede crear mapas de red editables de una manera mas interactiva comparado con la version Open que no cuenta con muchas de las opciones de manipulación de elementos.

              -

              En contraste con la version Open, el mapa de red proprociona mas funcionalidades como:

              +

              El mapa de red proprociona algunas funcionalidades como:

              - -
            • Mapa de red mas grande, con mas de 1000 agentes para monitorizar.
            • Monitorizar en tiempo real toda la topologia de la red con sus sistemas.
            • Diferentes vistas de la topologia de red, definidas de una forma manual o generadas automaticamente con grupos de agentes.
            • Enlazar diferentes vistas mediante el uso de puntos ficticios.
            • -
            • Manipular la topologia representada en cada una de las vistas.
            • Añadir nuevos nodos, uno por uno o de forma masiva.
            • -
            • Editando las caracteristicas de los nodos.
            • -
            • Organizandolos dentro de la vista:
              +
            • Editar las caracteristicas de los nodos.
            • +
            • Organizar dentro de la vista:
              - La posición de los nodos.
              - Las relaciones entre los nodos.
            • @@ -44,78 +41,71 @@

              -

              Panel de control

              +

              Menú del mapa

              -

              Desde el panel de control puedes realizar tareas mas complejas sobre el mapa de red.

              +

              Desde el menú contextual del mapa de red puedes realizar tareas mas complejas sobre el.

              -

              Se encuentra oculto en la esquina superior derecha, como en el minimapa se puede mostrar pulsando en la flecha.

              - '550px')); ?> +

              Se muestra si hacemos click derecho en alguna sección del mapa vacía.

              + '550px')); ?>

              Y las opciones disponibles son:

              -
            • Cambiar la frecuencia de refresco de los estado de los nodos.
            • +
            • Añadir agente, por medio del control inteligente que permite buscar de forma rápida el agente y añadirlo (tanto ficticio como añadido masivo de agentes), el nuevo nodo aparece en el punto donde hiciste click en el mapa.
            • +
            • Escoger el centro del mapa de red.
            • Forzar el refresco.
            • -
            • Añadir agente, por medio del control inteligente que permite buscar de forma rápida el agente y añadirlo, el nuevo nodo aparece en el punto (0, 0) del mapa que esta en la parte superior izquierda del mapa.
            • -
            • Añadir varios agentes, por medio del filtrado por grupo que mostrará los agentes de ese grupo en una lista de selección múltiple y que no estén ya en el mapa.
            • -
            • Hacer una captura de la parte visible del mapa.
            • -
            • Añadir un punto ficticio, donde puedes elegir, el texto como nombre de este punto, el tamaño definido por el radio, la forma del punto, color por defecto y si quieres que el punto ficticio sea un link a un mapa.
            • -
            • Buscar agente, por medio de también de un control inteligente, una vez elegido el mapa va automáticamente al punto donde esta el nodo del agente.
            • -
            • Zoom, cambiar el nivel de zoom del mapa de red.
            • +
            • Refrescar la zona de espera para buscar nuevos nodos.
            • -

              Ventana vista detalle

              +

              Menú del nodo

              -

              La ventana vista detalle es una vista visual de un agente, la cual se refresca a la misma velocidad que el mapa del que se abrió, y las ventanas son totalmente independientes por lo que puedes tener varias ventanas de estas abiertas.

              +

              Desde el menú contextual del nodo puedes realizar tareas mas complejas sobre el.

              +

              Se muestra si hacemos click derecho en algún nodo.

              + '550px')); ?> - '550px')); ?>

              +

              Y las opciones disponibles son:

              - - -

              Muestra una caja que el borde se pone del color del estado del agente.
              - El nombre del agente es un link a la página del agente de Pandora.
              - Dentro de la caja aparecen todos los módulos que no están en estado desconocido, los cuales según si el estado del modulo estará verde o rojo.
              - Estos módulos son clickables y muestran un tooltip con los datos principales del módulo.
              - En el borde de la caja aparece los módulos de tipo SNMP Proc, que suelen corresponder a interfaces de red cuando se monitoriza un agente relacionado con sistemas de red.

              - -

              Paleta de punto ficticio -

              -

              Si seleccionas ver detalles sobre un punto ficticio, este te mostrara una ventana emergente con una paleta de opciones para modificar el punto ficticio.

              - - '550px')); ?>

              - - -

              Disponemos de un formulario con las opciones de:

              - -
            • Nombre del punto ficticio.
            • -
            • Radio del punto ficticio.
            • -
            • Forma del punto ficticio.
            • -
            • Color del punto ficticio.
            • -
            • Mapa que linka el punto ficticio.
            • +
            • Mostrar una vista en detalle con datos del nodo. Además en esta vista podremos consultar sus interfaces (si las tiene), editar su nombre y su forma o ver que enlaces tiene disponibles para editarlos o borrarlos.
            • + '550px')); ?> +
            • Añadir un enlace entre interfaces. Con esto podremos enlazar dos módulos de interfaz entre si, o uno de ellos con otro agente. Primero seleccionamos el hijo de la unión y posteriormente el padre
            • + '550px')); ?> + '550px')); ?> + '550px')); ?> +
            • Definir un enlace padre-hijo entre agentes, siguiendo la misma metodología que con los enlaces de interfaz, primero se seleccionaría el hijo, y posteriormente, el padre.
            • + '550px')); ?> + '550px')); ?> +
            • Eliminar el nodo seleccionado (y todos sus enlaces).
            • Creación de un mapa de red

              Para la creación de un mapa de red puedes hacerlo como:

            • Despliegue de todos los agentes contenidos en un grupo.
            • + '550px')); ?>
            • Creación de un mapa de red en blanco.
            • + '550px')); ?> - - - -

              Vamos a hacer una vista rápida de los campos que tiene el formulario de creación:

              +

              Vamos a hacer una vista rápida de los campos que tiene el formulario de creación (habrá muchos menos valores para la creación de un mapa vacío):

            • Nombre: nombre del mapa de red.
            • Grupo: el grupo al que pertenece el mapa de red para las ACL, y además el grupo del que generar el mapa a partir de los agentes que hay contenidos en ese grupo.
            • -
            • Generación del mapa de red desde: opción solo disponible en la creación y es la forma de crear el mapa de red, si a partir de los agentes que existen en el grupo elegido previamente o por el contrario queremos un mapa de red vacío.
            • -
            • Tamaño del mapa de red: en el cual se puede definir el tamaño del mapa de red, por defecto es 3000 pixeles de ancho por 3000 pixeles alto.
            • -
            • Método de generación del mapa de red: el método de distribución de los nodos que formarán el mapa de red, por defecto es radial, pero existen los siguientes:
            • +
            • Radio de los nodos: Opción para establecer un tamaño de radio para los nodos.
            • +
            • Descripción: Descripción para el mapa de red.
            • +
            • Desplazamiento en X: Desplazamiento en el eje x para establecer una vision por defecto al gusto.
            • +
            • Desplazamiento en Y: Desplazamiento en el eje y para establecer una vision por defecto al gusto.
            • +
            • Nivel de zoom: Desplazamiento en el zoom para establecer una vision por defecto de escala al gusto.
            • +
            • Origen: Establece si el mapa se genera a partir de un grupo, de una tarea de reconocimiento o de una mascara ip.
            • +
            • No mostrar subgrupos: No mostrará subgrupos si el origen es por grupo.
            • +
            • Tarea de reconocimiento de origen: Nos permite seleccionar la tarea de reconocimiento para generar el mapa.
            • +
            • IP: Nos permite seleccionar la IP generar el mapa (solo generación por máscara ip).
            • +
            • Método de generación del mapa de red: el método de distribución de los nodos que formarán el mapa de red, por defecto es spring2, pero existen los siguientes:
            • - Radial: en el cual todos los nodos se dispondrán alrededor del nodo ficticio que simboliza el Pandora.
              - Circular: en el cual se dispondrá los nodos en círculos concentricos.
              - Flat: en el cual se dispondrá los nodos de forma arborescente.
              - spring1, spring2: son variaciones del Flat.
              -

            • Refresco del networkmap: la velocidad de refresco de los estados de los nodos contenidos en el networkmap, por defecto es cada 5 minutos.

              - -El resto de los campos que estén deshabilitados como por ejemplo "redimensionar mapa" es porque solo están activos en la edición de un mapa ya creado.

              - + - Radial dinámico: Mapa circular con la jerarquía de grupos y agentes dentro de ellos (y módulos en última instancia).
              +
            • Separación entre nodos: Separación entre los nodos del mapa.
            • +
            • Distancia minima entre nodos (solo circular): Establece la distancia minima entre los nodos del mapa.
            • +
            • separación entre flechas (solo flat y radial): Separación entre las flechas del mapa.
            • +
            • Separación por defecto para nodos (solo spring2): Establece la distancia minima entre los nodos del mapa.


            • Para más información sobre la edición de mapas consulte http://openideas.info/wiki/index.php?title=Pandora:Documentation_es:Presentacion_datos#Consola_Network_Enteprise diff --git a/pandora_console/include/help/ja/help_alert_config.php b/pandora_console/include/help/ja/help_alert_config.php index 66cbcdd9e4..d3157ea75d 100644 --- a/pandora_console/include/help/ja/help_alert_config.php +++ b/pandora_console/include/help/ja/help_alert_config.php @@ -54,6 +54,7 @@ email アクションを設定ã™ã‚‹ã«ã¯ã€_field1_ (é€ä¿¡å…ˆã‚¢ãƒ‰ãƒ¬ã‚¹)ã€
            • _event_text_severity_ : (イベントアラートã®ã¿) イベント(アラートã®ç™ºç”Ÿå…ƒ)ã®ãƒ†ã‚­ã‚¹ãƒˆã§ã®é‡è¦åº¦ (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
            • _event_id_ : (イベントアラートã®ã¿) アラート発生元ã®ã‚¤ãƒ™ãƒ³ãƒˆID
            • _event_extra_id_: (Only event alerts) Extra id.
            • +
            • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
            • _id_agent_ : エージェントã®ID / Webコンソールã¸ã®ãƒªãƒ³ã‚¯ã‚’生æˆã™ã‚‹ã®ã«ä¾¿åˆ©ã§ã™
            • _id_group_ : エージェントグループã®ID
            • _id_module_ : モジュールID
            • diff --git a/pandora_console/include/help/ja/help_alert_macros.php b/pandora_console/include/help/ja/help_alert_macros.php index 756e0208ed..5c14073067 100644 --- a/pandora_console/include/help/ja/help_alert_macros.php +++ b/pandora_console/include/help/ja/help_alert_macros.php @@ -46,6 +46,7 @@
            • _event_text_severity_ : (イベントアラートã®ã¿) イベント(アラートã®ç™ºç”Ÿå…ƒ)ã®ãƒ†ã‚­ã‚¹ãƒˆã§ã®é‡è¦åº¦ (Maintenance, Informational, Normal Minor, Warning, Major, Critical)
            • _event_id_ : (イベントアラートã®ã¿) アラート発生元ã®ã‚¤ãƒ™ãƒ³ãƒˆID
            • _event_extra_id_: (Only event alerts) Extra id.
            • +
            • _event_cfX_ : (Only event alerts) Key of the event custom field that fired the alert.
            • _id_agent_ : エージェントã®ID / Webコンソールã¸ã®ãƒªãƒ³ã‚¯ã‚’生æˆã™ã‚‹ã®ã«ä¾¿åˆ©ã§ã™
            • _id_group_ : エージェントグループã®ID
            • _id_module_ : モジュール ID
            • diff --git a/pandora_console/include/help/ja/help_cron.php b/pandora_console/include/help/ja/help_cron.php new file mode 100644 index 0000000000..6608ae60cf --- /dev/null +++ b/pandora_console/include/help/ja/help_cron.php @@ -0,0 +1,46 @@ + +

              Cron for server modules

              + +Using the configuration parameter sets Cron from and Cron to makes +it possible for a module to run only for certain periods of time. +The way in which it is configured is similar to the syntax of +cron. +Just as they appear in the Pandora console, each one of the parameters +has three options. + +

              Cron from: any

              + +The module will not have restrictions in that parameter. Whatever the value is +will be executed, and it is equivalent to the asterisk (*) in the cron nomenclature. In this +case Cron to is ignored. + +

              Cron from: different from any. Cron to: any

              + +The module will run only during the time in which the date matches that +parameter. It is equivalent to writingjust one number in cron nomenclature. + +

              Cron from: different from any. Cron to: different from any

              + +The module will run only during the time specified between Cron from and Cron to. +It is equivalent to writing number dash number (n-n) in cron nomenclature. + +

              Agent interval

              + +As long as cron conditions are met, the agent will run following +its execution interval. + +

              Examples

              + +
                +
              • * * * * *: No cron configured.
              • +
              • 15 20 * * *: It will run every day at 20:15.
              • +
              • * 20 * * *: It will run every day during the hour 20, that is, from 20:00 to 20:59.
              • +
              • * 8-19 * * *: It will run everyday from 8:00 to 19:59.
              • +
              • 15-45 * 1-16 * *: It will run every first 16 days of the month every hour, from quarter past to quarter to.
              • +
              • * * * 5 *: It will run only in May.
              • +
                  + diff --git a/pandora_console/include/help/ja/help_graphs.php b/pandora_console/include/help/ja/help_graphs.php new file mode 100644 index 0000000000..0fc35349a9 --- /dev/null +++ b/pandora_console/include/help/ja/help_graphs.php @@ -0,0 +1,148 @@ + + + + + + +

                  INTERPRETING GHRAPHS IN PANDORA FMS

                  + + +

                  In Pandora FMS, graphs represent the values a module has had during a given period.

                  +

                  Due to the large amount of data that Pandora FMS stores, two different types of functionality are offered

                  + + +

                  NORMAL GRAPHS

                  + +images/help/chart_normal_sample.png" alt="regular chart sample" /> + +

                  General characteristics

                  +

                  These are graphs that represent the information stored by the module at a basic level.

                  +

                  They allow us to see an approximation of the values in which our module oscillates.

                  +

                  The module data are divided into boxes in such a way that a sample of the module values is represented, not all values are shown. This is complemented by dividing the view into three graphs, Max (maximum values), min (minimum values) and avg (average values)

                  + +
                    +
                  • Advantages: They are generated very quickly without consuming hardly any resources.
                  • +
                  • Disadvantages: The information provided is approximate. The status of the monitors they represent are calculated on an event-driven basis.
                  • + + + +

                    Display options

                    + +
                    +
                    Refresh time
                    +
                    Time the graph will take to be created again.
                    + +
                    Avg. Only
                    +
                    Only the averages graph will be created.
                    + +
                    Starting date
                    +
                    Date until which the graphic will be created.
                    + +
                    Startup time
                    +
                    Hour minutes and seconds until the graphic is created.
                    + +
                    Zoom factor
                    +
                    Graph viewfinder size, multiplicative.
                    + +
                    Time Range
                    +
                    Sets the time period from which data will be collected.
                    + +
                    Show events
                    +
                    Displays indicator points with event information at the top.
                    + +
                    Show alerts
                    +
                    Shows indicator points with triggered alert information at the top.
                    + +
                    Show percentile
                    +
                    Adds a graph that indicates the percentile line (configurable in general visual options of Pandora).
                    + +
                    Time comparison (superimposed)
                    +
                    Displays the same graphic overlay, but in the period before the selected one. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown superimposed.
                    + +
                    Time comparison (independent)
                    +
                    Displays the same graph, but in the period before the selected one, in a separate area. For example, if we request a period of one week and activate this option, the week before the chosen one will also be shown.
                    + +
                    Display unknown graphic
                    +
                    It shows boxes in grey shading covering the periods in which Pandora FMS cannot guarantee the module's status, either due to data loss, disconnection of a software agent, etc.
                    + +
                    Show Full Scale Graph (TIP)
                    +
                    Switches the creation mode from "normal" to "TIP". In this mode, the graphs will show real data rather than approximations, so the time it will take to generate them will be longer. More detailed information on this type of graphs can be found in the following section.
                    + +
                    + + + + +
                    +
                    + + +

                    TIP GRAPS

                    +images/help/chart_tip_sample.png" alt="TIP chart sample" /> + +

                    General characteristics

                    +

                    These are graphs that represent real data.

                    +

                    They show us a true representation of the data reported by our module.

                    +

                    As these are real data, it will not be necessary to supplement the information with extra graphs (avg, min, max).

                    +

                    The calculation of periods in unknown state is supported by events, such as normal graphs, but is complemented by extra detection if there is any.

                    +

                    Examples of resolution offered by normal and TIP methods:

                    + +
                    Example of normal graph in unknown interval
                    +images/help/chart_normal_detail.png" alt="TIP chart detail" /> + +
                    Example of TIP graph in unknown interval
                    +images/help/chart_tip_detail.png" alt="TIP chart detail" /> + +
                    + +
                      +
                    • Advantages: The data represented are real data. This is the most realistic way to review module data.
                    • +
                    • Disadvantages: Processing is slower than in normal graphs. Depending on the time range and the volume of data to be displayed, your display may be less fluid.
                    • +
                    + + + diff --git a/pandora_console/include/help/ja/help_module_definition.php b/pandora_console/include/help/ja/help_module_definition.php index e7e4055d18..570c7cd236 100644 --- a/pandora_console/include/help/ja/help_module_definition.php +++ b/pandora_console/include/help/ja/help_module_definition.php @@ -11,4 +11,6 @@
                  • 通常モード: ã“ã®ãƒ¢ãƒ¼ãƒ‰ã§ã¯ã€ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«è¨­å®šã‚’手動ã§å®Ÿæ–½ã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚自動設定ã¯è¡Œã‚ã‚Œã¾ã›ã‚“。
                  • +
                    +
                  • Autodisable mode: In terms of creating agents and modules it behaves exactly the same as an agent in learning mode: when the first XML reaches it, the first agent is created and, on each report, if there are new modules they can also be added automatically. Nevertheless, when all modules from an agent that are in autodisable mode are also marked as unknown, the agent is automatically disabled. In any case, if the agent reports again, it gets enabled again on its own.
                  diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 6b4cd0d415..42ca46e4ba 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -821,6 +821,12 @@ function get_interface_data_to_table(node_selected, selected_links) { } else { jQuery.each(data, function (j, interface) { + if (interface['graph'] == "") { + var interf_graph = "--"; + } + else { + var interf_graph = interface['graph']; + } $("#interface_information").find('tbody') .append($('
') .append($('
'. - __('Element group') . '' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) . + __('Restrict access to group') . '' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) . + ui_print_help_tip ( + __("If selected, restrict visualization of this item in the visual console to users who have access to selected group. This is also used on calculating child visual consoles."), true) . '
') @@ -830,7 +836,7 @@ function get_interface_data_to_table(node_selected, selected_links) { .html(interface['status']) ) .append($('') - .html(interface['graph']) + .html(interf_graph) ) .append($('') .html(interface['ip']) @@ -1900,6 +1906,21 @@ function show_menu(item, data) { refresh_holding_area(); } }; + items_list["restart_map"] = { + name: restart_map_menu, + icon: "restart_map", + disabled: function () { + if (enterprise_installed) { + return false; + } + else { + return true; + } + }, + "callback": function (key, options) { + restart_map(); + } + }; if (flag_setting_relationship_running) { items_list["cancel_set_parent"] = { @@ -2140,6 +2161,7 @@ function refresh_holding_area() { temp_node['image_url'] = node['image_url']; temp_node['image_width'] = node['image_width']; temp_node['image_height'] = node['image_width']; + temp_node['deleted'] = false; graph.nodes.push(temp_node); }); @@ -2210,6 +2232,130 @@ function refresh_holding_area() { } } +function restart_map () { + $("
").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 250, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + proceed_to_restart_map(); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var dialog_confirm_text = "
"; + dialog_confirm_text = dialog_confirm_text + "
"; + dialog_confirm_text = dialog_confirm_text + "

" + warning_message + "

"; + dialog_confirm_text = dialog_confirm_text + "

" + message_to_confirm + "

"; + dialog_confirm_text = dialog_confirm_text + "
"; + + $('#restart_map_confirm').html(dialog_confirm_text); + $('#restart_map_confirm').dialog('open'); +} + +function proceed_to_restart_map () { + $("
").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 450, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + var new_elements = []; + new_elements[0] = $("#text-name").val(); + new_elements[1] = $("#id_group").val(); + new_elements[2] = $("#text-node_radius").val(); + new_elements[3] = $("#textarea_description").val(); + new_elements[4] = $("input[name=source]:checked").val(); + if (new_elements[4] == 'group') { + new_elements[5] = $("#checkbox-dont_show_subgroups").is(':checked'); + } + else if (new_elements[4] == 'recon_task') { + new_elements[5] = $("#recon_task_id").val(); + } + else { + new_elements[5] = $("#text-ip_mask").val(); + } + new_elements[6] = $("#method").val(); + new_elements[7] = $("#text-pos_x").val(); + new_elements[8] = $("#text-pos_y").val(); + new_elements[9] = $("#text-scale_z").val(); + new_elements[10] = $("#text-node_sep").val(); + new_elements[11] = $("#text-mindist").val(); + new_elements[12] = $("#text-rank_sep").val(); + new_elements[13] = $("#text-kval").val(); + reset_map_from_form(new_elements); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var params = []; + params.push("get_reset_map_form=1"); + params.push("map_id=" + networkmap_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + jQuery.ajax({ + data: params.join("&"), + dataType: 'html', + type: 'POST', + url: action = "ajax.php", + success: function (data) { + $('#restart_map_form').html(data); + $('#restart_map_form').dialog('open'); + } + }); +} + +function reset_map_from_form (new_elements) { + var params = []; + params.push("reset_map=1"); + params.push("map_id=" + networkmap_id); + params.push("elems[]=" + new_elements) + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + jQuery.ajax({ + data: params.join("&"), + dataType: 'json', + type: 'POST', + url: action = "ajax.php", + success: function (data) { + if (!data['error']) { + window.location = "index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + networkmap_id; + } + } + }); +} + function set_parent(parent_data) { if (enterprise_installed) { var selection = d3.selectAll('.node_children'); @@ -3017,9 +3163,18 @@ function myMouseoutRhombusFunction(node_id) { } function draw_elements_graph() { - link = link.data(force.links(), function (d) { - return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random(); + link = link.data(force.links().filter(function(d, i) { + if (d['deleted']) { + return false; + } + else { + return true; + } + }), + function (d) { + return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random(); }); + link_temp = link.enter() .append("g") @@ -3063,6 +3218,7 @@ function draw_elements_graph() { "id_module_start_" + d.id_module_start + " " + "id_module_end_" + d.id_module_end; }) + .attr("stroke", function (d) { return d.link_color; }) .attr("stroke-width", 3) .attr("d", null) .attr('marker-start', function (d) { @@ -3201,7 +3357,14 @@ function draw_elements_graph() { return (Array(25).join(" ")) + text_link; }); - node = node.data(force.nodes(), function (d) { return d.id; }); + node = node.data(force.nodes().filter(function(d, i) { + if (d['deleted']) { + return false; + } + else { + return true; + } + }), function (d) { return d.id; }); node_temp = node.enter() .append("g") diff --git a/pandora_console/include/javascript/jquery.contextMenu.css b/pandora_console/include/javascript/jquery.contextMenu.css index 3a844d4a7e..b0b04223bf 100644 --- a/pandora_console/include/javascript/jquery.contextMenu.css +++ b/pandora_console/include/javascript/jquery.contextMenu.css @@ -117,6 +117,7 @@ .context-menu-item.icon-set_parent { background-image: url(../../images/father.png); } .context-menu-item.icon-add_node { background-image: url(../../images/add.png); } .context-menu-item.icon-refresh_holding_area { background-image: url(../../images/refresh_holding_area.png); } +.context-menu-item.icon-restart_map { background-image: url(../../images/reset.png); } .context-menu-item.icon-interface_link_children { background-image: url(../../images/icono_link_hijo.png); } .context-menu-item.icon-interface_link_parent { background-image: url(../../images/icono_link_padre.png); } .context-menu-item.icon-interface_link_cancel { background-image: url(../../images/link_abortar.png); } diff --git a/pandora_console/include/javascript/openlayers.pandora.js b/pandora_console/include/javascript/openlayers.pandora.js index 801ecf7bd5..e0599c709f 100755 --- a/pandora_console/include/javascript/openlayers.pandora.js +++ b/pandora_console/include/javascript/openlayers.pandora.js @@ -286,7 +286,7 @@ function EventZoomEnd (evt,zoom = map.zoom) { * @return none */ function changeShowStatus(newShowStatus) { - statusShow = newShowStatus; + statusShow = newShowStatus; hideAgentsStatus(); EventZoomEnd(null,map.zoom); js_refreshParentLines(); @@ -305,19 +305,19 @@ function hideFeatureByStatus(feature, status) { switch (statusShow) { case 'bad': - if ((status == 1) || (status == 4)) + if ((status == 1) || (status == 4) || (status == 100)) feature.style.display = ''; break; case 'warning': - if (status == 2) + if ((status == 2) || (status == 200)) feature.style.display = ''; break; case 'ok': - if (status == 0) + if ((status == 0) || (status == 300)) feature.style.display = ''; break; case 'default': - if ((status != 1) && (status != 4) && (status != 2) && (status != 0)) + if ((status != 1) && (status != 4) && (status != 2) && (status != 0) && (status != 100) && (status != 200) && (status != 300)) feature.style.display = ''; break; case 'all': @@ -337,19 +337,19 @@ function isHideFeatureByStatus(status) { switch (statusShow) { case 'bad': - if ((status == 1) || (status == 4)) + if ((status == 1) || (status == 4) || (status == 100)) returnVar = false; break; case 'warning': - if (status == 2) + if ((status == 2) || (status == 200)) returnVar = false; break; case 'ok': - if (status == 0) + if ((status == 0) || (status == 300)) returnVar = false; break; case 'default': - if ((status != 1) && (status != 4) && (status != 2) && (status != 0)) + if ((status != 1) && (status != 4) && (status != 2) && (status != 0) && (status != 100) && (status != 200) && (status != 300)) returnVar = false; break; case 'all': diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index a7ddd6074f..12018f23dd 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -622,7 +622,6 @@ function post_process_select_init_unit(name,selected) { } }); - console.log(select_or_text); if(select_or_text) { $('#' + name + '_select option[value='+ selected +']').attr("selected",true); $('#text-' + name + '_text').val(""); @@ -1265,4 +1264,288 @@ function pagination_show_more(params, message){ }, datatype: "html" }); +} +/* +*function use d3.js for paint graph +*/ +function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical) { + + //Check if they are numbers + if(isNaN(min_w)){ min_w = 0; }; + if(isNaN(max_w)){ max_w = 0; }; + if(isNaN(min_c)){ min_c = 0; }; + if(isNaN(max_c)){ max_c = 0; }; + + //if haven't errors + if (error_w == 0 && error_c == 0){ + //parse element + min_w = parseFloat(min_w); + min_c = parseFloat(min_c); + max_w = parseFloat(max_w); + max_c = parseFloat(max_c); + + //inicialize var + var range_min = 0; + var range_max = 0; + var range_max_min = 0; + var range_max_min = 0; + + //Find the lowest possible value + if(min_w < 0 || min_c < 0){ + if(min_w < min_c){ + range_min = min_w - 100; + } else { + range_min = min_c - 100; + } + } else if (min_w > 0 || min_c > 0) { + if(min_w > min_c){ + range_max_min = min_w; + } else { + range_max_min = min_c; + } + } else { + if(min_w < min_c){ + range_min = min_w - 100; + } else { + range_min = min_c - 100; + } + } + + //Find the maximum possible value + if(max_w > max_c){ + range_max = max_w + 100 + range_max_min; + } else { + range_max = max_c + 100 + range_max_min; + } + + //Controls whether the maximum = 0 is infinite + if((max_w == 0 || max_w == 0.00) && min_w != 0){ + max_w = range_max; + } + if((max_c == 0 || max_c == 0.00) && min_c != 0){ + max_c = range_max; + } + + //Scale according to the position + position = 200 / (range_max-range_min); + + //axes + var yScale = d3.scale.linear() + .domain([range_min, range_max]) + .range([100, -100]); + + var yAxis = d3.svg.axis() + .scale(yScale) + .orient("left"); + + //create svg + var svg = d3.select("#svg_dinamic"); + //delete elements + svg.selectAll("g").remove(); + + width_x = 201; + height_x = 50; + + svg.append("g") + .attr("transform", "translate(200, 150)") + .call(yAxis); + + //legend Normal text + svg.append("g") + .attr("width", 300) + .attr("height", 300) + .append("text") + .attr("x", width_x) + .attr("y", height_x - 20) + .attr("fill", 'black') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", '8pt') + .html(legend_normal) + .style("text-anchor", "first") + .attr("width", 300) + .attr("height", 300); + + //legend Normal rect + svg.append("g") + .append("rect") + .attr("id", "legend_normal") + .attr("x", width_x + 80) + .attr("y", height_x - 30) + .attr("width", 10) + .attr("height", 10) + .style("fill", "#82B92E"); + + //legend Warning text + svg.append("g") + .append("text") + .attr("x", width_x + 100) + .attr("y", height_x - 20) + .attr("fill", 'black') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", '8pt') + .html(legend_warning) + .style("text-anchor", "first"); + + //legend Warning rect + svg.append("g") + .append("rect") + .attr("id", "legend_warning") + .attr("x", width_x + 185) + .attr("y", height_x - 30) + .attr("width", 10) + .attr("height", 10) + .style("fill", "#ffd731"); + + //legend Critical text + svg.append("g") + .append("text") + .attr("x", width_x + 205) + .attr("y", height_x - 20) + .attr("fill", 'black') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", '8pt') + .html(legend_critical) + .style("text-anchor", "first"); + + //legend critical rect + svg.append("g") + .append("rect") + .attr("id", "legend_critical") + .attr("x", width_x + 285) + .attr("y", height_x - 30) + .attr("width", 10) + .attr("height", 10) + .style("fill", "#fc4444"); + + //styles for number and axes + svg.selectAll("g .domain") + .style("stroke-width", 2) + .style("fill", "none") + .style("stroke", "black"); + + svg.selectAll("g .tick text") + .style("font-size", "9pt") + .style("font-weight", "initial"); + + //estatus normal + svg.append("g") + .append("rect") + .attr("id", "status_rect") + .attr("x", width_x) + .attr("y", height_x) + .attr("width", 300) + .attr("height", 200) + .style("fill", "#82B92E"); + + //controls the inverse warning + if(inverse_w == 0){ + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "warning_rect") + .attr("x", width_x) + .attr("y", (height_x +(range_max - min_w) * position) - ((max_w - min_w) * position)) + .attr("width", 300) + .attr("height", ((max_w - min_w) * position)) + .style("fill", "#ffd731"); + } + else { + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "warning_rect") + .attr("x", width_x) + .attr("y", height_x + 200 - ((min_w -range_min) * position)) + .attr("width", 300) + .attr("height", (min_w -range_min) * position) + .style("fill", "#ffd731"); + + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "warning_inverse_rect") + .attr("x", width_x) + .attr("y", height_x) + .attr("width", 300) + .attr("height", ((range_max - min_w) * position) - ((max_w - min_w) * position)) + .style("fill", "#ffd731"); + + } + //controls the inverse critical + if(inverse_c == 0){ + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "critical_rect") + .attr("x", width_x) + .attr("y", (height_x + (range_max - min_c) * position) - ((max_c - min_c) * position)) + .attr("width", 300) + .attr("height", ((max_c - min_c) * position)) + .style("fill", "#fc4444"); + } + else { + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "critical_rect") + .attr("x", width_x) + .attr("y", height_x + 200 - ((min_c -range_min) * position)) + .attr("width", 300) + .attr("height", (min_c -range_min) * position) + .style("fill", "#fc4444"); + svg.append("g") + .append("rect").transition() + .duration(600) + .attr("id", "critical_inverse_rect") + .attr("x", width_x) + .attr("y", height_x) + .attr("width", 300) + .attr("height", ((range_max - min_c) * position) - ((max_c - min_c) * position)) + .style("fill", "#fc4444"); + } + + } + else { + d3.select("#svg_dinamic rect").remove(); + //create svg + var svg = d3.select("#svg_dinamic"); + svg.selectAll("g").remove(); + + //message error warning + if (error_w == 1) { + $("#text-max_warning").addClass("input_error"); + svg.append("g") + .append("text") + .attr("x", width_x) + .attr("y", height_x) + .attr("fill", 'black') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 14) + .style("fill", "red") + .html(message_error_warning) + .style("text-anchor", "first"); + } + //message error critical + if (error_c == 1) { + $("#text-max_critical").addClass("input_error"); + svg.append("g") + .append("text") + .attr("x", width_x) + .attr("y", height_x) + .attr("fill", 'black') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 14) + .style("fill", "red") + .html(message_error_critical) + .style("text-anchor", "first"); + } + + } } \ No newline at end of file diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index 271bd75f05..75acddc3f6 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -572,6 +572,12 @@ var TreeController = { }); } } + // Get hash and user. + var public_hash = $("#hidden-publi_dash_tree_view_hash" ).val(); + if (typeof(public_hash) === 'undefined') public_hash = 0; + var public_user = $("#hidden-publi_dash_tree_view_id_user" ).val(); + if (typeof(public_user) === 'undefined') public_user = 0; + if (typeof element.searchChildren != 'undefined' && element.searchChildren) { $node .removeClass("leaf-empty") @@ -598,7 +604,9 @@ var TreeController = { rootID: element.rootID, serverID: element.serverID, rootType: element.rootType, - filter: controller.filter + filter: controller.filter, + hash: public_hash, + id_user: public_user }, complete: function(xhr, textStatus) { $node.removeClass("leaf-loading"); diff --git a/pandora_console/include/styles/install.css b/pandora_console/include/styles/install.css index 59b1fb98cc..6c558fdcba 100644 --- a/pandora_console/include/styles/install.css +++ b/pandora_console/include/styles/install.css @@ -192,6 +192,7 @@ div.installation_step { -o-transition-property: background-color, color; -o-transition-duration: 1s; color:#82b92e; + font-family: Sans, Arial, sans; } .btn_install_next:hover .btn_install_next_text { transition-property: background-color, color; diff --git a/pandora_console/index.php b/pandora_console/index.php index 683490f646..2ffe3ee2f3 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -583,6 +583,10 @@ if (! isset ($config['id_user'])) { if ($pass1 == $pass2) { $res = update_user_password ($id_user, $pass1); if ($res) { + + db_process_sql_insert ('tsesion', array('id_sesion' => '','id_usuario' => $id_user,'ip_origen' => $_SERVER['REMOTE_ADDR'],'accion' => 'Reset change', + 'descripcion' => 'Successful reset password process ','fecha' => date("Y-m-d H:i:s"),'utimestamp' => time())); + $correct_reset_pass_process = __('Password changed successfully'); register_pass_change_try($id_user, 1); @@ -675,6 +679,7 @@ if (! isset ($config['id_user'])) { } } else { + $cod_hash = $user_reset_pass . "::::" . md5(rand(10, 1000000) . rand(10, 1000000) . rand(10, 1000000)); $subject = '[Pandora] '.__('Reset password'); @@ -714,6 +719,29 @@ if (! isset ($config['id_user'])) { } } else { + + if ( ($_GET["loginhash_data"]) && ($_GET["loginhash_data"])) { + + $loginhash_data = get_parameter("loginhash_data", ""); + $loginhash_user = str_rot13(get_parameter("loginhash_user", "")); + $iduser = $_SESSION["id_usuario"]; + //logoff_db ($iduser, $_SERVER["REMOTE_ADDR"]); check why is not available + unset($_SESSION["id_usuario"]); + unset($iduser); + + if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) { + db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']); + $_SESSION['id_usuario'] = $loginhash_user; + $config["id_user"] = $loginhash_user; + } + else { + require_once ('general/login_page.php'); + db_pandora_audit("Logon Failed (loginhash", "", "system"); + while (@ob_end_flush ()); + exit (""); + } + } + $user_in_db = db_get_row_filter('tusuario', array('id_user' => $config['id_user']), '*'); if ($user_in_db == false) { diff --git a/pandora_console/install.php b/pandora_console/install.php index d85ec5ec47..8a88a5fc43 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -70,8 +70,8 @@
'; echo __('Search') . ' '; -html_print_input_text ("search", $search, '', 12); +html_print_input_text ("search", $search, '', 15); echo ''; @@ -222,6 +223,11 @@ html_print_select ($fields, "status", $status, 'this.form.submit()', __('All'), echo ''; +echo __('Search in custom fields') . ' '; +html_print_input_text ("search_custom", $search_custom, '', 15); + +echo ''; + html_print_submit_button (__('Search'), "srcbutton", '', array ("class" => "sub search")); @@ -384,7 +390,6 @@ switch ($sortField) { $search_sql = ''; if ($search != "") { - //$search_sql = " AND ( nombre " . $order_collation . " LIKE '%$search%' OR direccion LIKE '%$search%' OR comentarios LIKE '%$search%') "; $sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress INNER JOIN taddress_agent ON taddress.id_a = taddress_agent.id_a @@ -409,6 +414,14 @@ if ($search != "") { } } + +if(!empty($search_custom)){ + $search_sql_custom = " AND EXISTS (SELECT * FROM tagent_custom_data + WHERE id_agent = id_agente AND description LIKE '%$search_custom%')"; +} else { + $search_sql_custom = ""; +} + // Show only selected groups if ($group_id > 0) { $groups = array($group_id); @@ -464,6 +477,7 @@ else { 'disabled' => 0, 'id_grupo' => $groups, 'search' => $search_sql, + 'search_custom' => $search_sql_custom, 'status' => $status), array ('COUNT(*) as total'), $access, false); $total_agents = isset ($total_agents[0]['total']) ? @@ -474,6 +488,7 @@ else { 'id_grupo' => $groups, 'disabled' => 0, 'status' => $status, + 'search_custom' => $search_sql_custom, 'search' => $search_sql, 'offset' => (int) get_parameter ('offset'), 'limit' => (int) $config['block_size']), diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index f5c870dc83..3fceedda4e 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -364,6 +364,19 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to; } + + // Get the free text in both options + var freesearch = $('#text-freesearch').val(); + if (freesearch != null && freesearch !== '') { + var free_checkbox = $('input[name=free_checkbox]:checked').val(); + extra_parameters += '&freesearch=' + freesearch; + if (free_checkbox == 1) { + extra_parameters += '&free_checkbox=1'; + } else { + extra_parameters += '&free_checkbox=0'; + } + } + title = ; $.ajax({ type: "POST", diff --git a/pandora_console/operation/agentes/networkmap.dinamic.php b/pandora_console/operation/agentes/networkmap.dinamic.php index 01b0e54bc6..5b7392b0f6 100644 --- a/pandora_console/operation/agentes/networkmap.dinamic.php +++ b/pandora_console/operation/agentes/networkmap.dinamic.php @@ -136,11 +136,20 @@ if ($activeTab == "radial_dynamic") { echo "
"; $filter = array(); - if (!empty($group)) - $filter['group'] = $group; - if (!empty($module_group)) + if ($networkmap['source'] == 0) { + $filter['group'] = $networkmap['source_data']; + } + $map_filter = json_decode($networkmap['filter'], true); + if (isset($map_filter['dont_show_subgroups']) && $map_filter['dont_show_subgroups']) { + $filter['dont_show_subgroups'] = true; + } + else { + $filter['dont_show_subgroups'] = false; + } + if (!empty($module_group)) { $filter['module_group'] = $module_group; - + } + echo graph_monitor_wheel($width, $height, $filter, $strict_user); echo "
"; diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 3c401b2985..98752770b3 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -41,6 +41,10 @@ if ($new_networkmap) { $offset_x = ""; $offset_y = ""; $scale_z = 0.5; + $node_sep = 0.25; + $rank_sep = 1.0; + $mindist = 1.0; + $kval = 0.3; } $disabled_generation_method_select = false; @@ -82,6 +86,36 @@ if ($edit_networkmap) { $offset_x = $filter['x_offs']; $offset_y = $filter['y_offs']; $scale_z = $filter['z_dash']; + + if (isset($filter['node_sep'])) { + $node_sep = $filter['node_sep']; + } + else { + $node_sep = 0.25; + } + if (isset($filter['rank_sep'])) { + $rank_sep = $filter['rank_sep']; + } + else { + if ($values['generation_method'] == "twopi") { + $rank_sep = 1.0; + } + else { + $rank_sep = 0.5; + } + } + if (isset($filter['mindist'])) { + $mindist = $filter['mindist']; + } + else { + $mindist = 1.0; + } + if (isset($filter['kval'])) { + $kval = $filter['kval']; + } + else { + $kval = 0.3; + } $node_radius = $filter['node_radius']; @@ -244,7 +278,23 @@ else { $table->data[7][1] = html_print_select($methods, 'method', $method, '', '', 'twopi', true, false, true, '', $disabled_generation_method_select); + + $itemClass = ""; + if ($disabled_source) { + $itemClass = "disabled"; + } + $table->data['nodesep'][0] = __('Node separation'); + $table->data['nodesep'][1] = html_print_input_text ('node_sep', $node_sep, '', 5, 10,true, $disabled_source, false, $itemClass) . ui_print_help_tip (__('Separation between nodes. By default 0.25'), true); + $table->data['ranksep'][0] = __('Rank separation'); + $table->data['ranksep'][1] = html_print_input_text ('rank_sep', $rank_sep, '', 5, 10,true, $disabled_source, false, $itemClass) . ui_print_help_tip (__('Only flat and radial. Separation between arrows. By default 0.5 in flat and 1.0 in radial'), true); + + $table->data['mindist'][0] = __('Min nodes dist'); + $table->data['mindist'][1] = html_print_input_text ('mindist', $mindist, '', 5, 10,true, $disabled_source, false, $itemClass) . ui_print_help_tip (__('Only circular. Minimum separation between all nodes. By default 1.0'), true); + + $table->data['kval'][0] = __('Default ideal node separation'); + $table->data['kval'][1] = html_print_input_text ('kval', $kval, '', 5, 10,true, $disabled_source, false, $itemClass) . ui_print_help_tip (__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); + echo '
'; html_print_table($table); @@ -296,7 +346,73 @@ $(document).ready(function() { .css('display', ''); } }); + + $("#method").on('change', function () { + var method = $("#method").val(); + + if (method == 'circo') { + $("#form_editor-ranksep") + .css('display', 'none'); + $("#form_editor-mindist") + .css('display', ''); + $("#form_editor-kval") + .css('display', 'none'); + $("#form_editor-nodesep") + .css('display', ''); + } + else if (method == 'dot') { + $("#form_editor-ranksep") + .css('display', ''); + $("#form_editor-mindist") + .css('display', 'none'); + $("#form_editor-kval") + .css('display', 'none'); + $("#form_editor-nodesep") + .css('display', ''); + } + else if (method == 'twopi') { + $("#form_editor-ranksep") + .css('display', ''); + $("#form_editor-mindist") + .css('display', 'none'); + $("#form_editor-kval") + .css('display', 'none'); + $("#form_editor-nodesep") + .css('display', ''); + } + else if (method == 'neato') { + $("#form_editor-ranksep") + .css('display', 'none'); + $("#form_editor-mindist") + .css('display', 'none'); + $("#form_editor-kval") + .css('display', 'none'); + $("#form_editor-nodesep") + .css('display', ''); + } + else if (method == 'radial_dinamic') { + $("#form_editor-ranksep") + .css('display', 'none'); + $("#form_editor-mindist") + .css('display', 'none'); + $("#form_editor-kval") + .css('display', 'none'); + $("#form_editor-nodesep") + .css('display', 'none'); + } + else if (method == 'fdp') { + $("#form_editor-ranksep") + .css('display', 'none'); + $("#form_editor-mindist") + .css('display', 'none'); + $("#form_editor-kval") + .css('display', ''); + $("#form_editor-nodesep") + .css('display', ''); + } + }); $("input[name='source']").trigger("change"); + $("#method").trigger("change"); }); diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 53478a65c5..2234f1180a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -218,6 +218,16 @@ if ($new_networkmap || $save_networkmap) { $offset_x = get_parameter('pos_x'); $offset_y = get_parameter('pos_y'); $scale_z = get_parameter('scale_z', 0.5); + + $node_sep = get_parameter('node_sep', "0.25"); + if ($method == "twopi") { + $rank_sep = get_parameter('rank_sep', "1.0"); + } + else { + $rank_sep = get_parameter('rank_sep', "0.5"); + } + $mindist = get_parameter('mindist', "1.0"); + $kval = get_parameter('kval', "0.3"); $values = array(); $values['name'] = $name; @@ -278,6 +288,11 @@ if ($new_networkmap || $save_networkmap) { $filter['x_offs'] = $offset_x; $filter['y_offs'] = $offset_y; $filter['z_dash'] = $scale_z; + $filter['node_sep'] = $node_sep; + $filter['rank_sep'] = $rank_sep; + $filter['mindist'] = $mindist; + $filter['kval'] = $kval; + $values['filter'] = json_encode($filter); $result = false; @@ -347,7 +362,6 @@ else if ($update_networkmap || $copy_networkmap || $delete) { } $name = (string) get_parameter('name', ''); - $method = (string) get_parameter('method', 'fdp'); $recon_task_id = (int) get_parameter( 'recon_task_id', 0); @@ -362,30 +376,6 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $values['name'] = $name; $values['id_group'] = $id_group; - switch ($method) { - case 'twopi': - $values['generation_method'] = 2; - break; - case 'dot': - $values['generation_method'] = 1; - break; - case 'circo': - $values['generation_method'] = 0; - break; - case 'neato': - $values['generation_method'] = 3; - break; - case 'fdp': - $values['generation_method'] = 4; - break; - case 'radial_dinamic': - $values['generation_method'] = 6; - break; - default: - $values['generation_method'] = 2; - break; - } - $description = get_parameter('description', ''); $values['description'] = $description; diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index fc57e6ceed..d2a7830f83 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -13,13 +13,29 @@ // Load global variables global $config; -// Check user credentials -check_login(); - require_once ('include/functions_pandora_networkmap.php'); enterprise_include_once('include/functions_policies.php'); +enterprise_include_once('include/functions_dashboard.php'); require_once ('include/functions_modules.php'); +$public_hash = get_parameter('hash', false); + +// Try to authenticate by hash on public dashboards +if ($public_hash === false) { + // Login check + check_login(); +} else { + $validate_hash = enterprise_hook( + 'dasboard_validate_public_hash', + array($public_hash, get_parameter('networkmap_id'), 'network_map') + ); + if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) { + db_pandora_audit("Invalid public hash", "Trying to access report builder"); + require ("general/noaccess.php"); + exit; + } +} + //--------------INIT AJAX----------------------------------------------- if (is_ajax ()) { $update_refresh_state = (bool)get_parameter('update_refresh_state',false); @@ -686,7 +702,7 @@ else { $dash_mode = 0; $map_dash_details = array(); - +$networkmap = db_get_row('tmap', 'id', $id); if (enterprise_installed()) { include_once("enterprise/dashboard/widgets/network_map.php"); if ($id_networkmap) { @@ -702,8 +718,6 @@ if (enterprise_installed()) { $networkmap = db_get_row('tmap', 'id', $id); } else { - $networkmap = db_get_row('tmap', 'id', $id); - $networkmap_filter = json_decode($networkmap['filter'], true); if ($networkmap_filter['x_offs'] != null) { $map_dash_details['x_offs'] = $networkmap_filter['x_offs']; diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index ba7965fd63..dd647e185a 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -106,13 +106,11 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); " . html_print_image('images/wrench_blanco.png', true, array('width' => '16px'), false, false, true) . ' ' . __('Pandora FMS Graph configuration menu') . ""; + $params['top_text'] = "
" . html_print_image('images/wrench_blanco.png', true, array('width' => '16px'), false, false, true) . ' ' . __('Pandora FMS Graph configuration menu') . ui_print_help_icon ("graphs",true, $config["homeurl"], "images/help_w.png") . "
"; $params['body_text'] = "