diff --git a/extras/bin/gotty b/extras/bin/gotty new file mode 100755 index 0000000000..1a1de33cf6 Binary files /dev/null and b/extras/bin/gotty differ diff --git a/pandora_agents/Dockerfile b/pandora_agents/Dockerfile index 945a74b1c9..69117e2ca7 100644 --- a/pandora_agents/Dockerfile +++ b/pandora_agents/Dockerfile @@ -9,6 +9,7 @@ RUN yum -y install \ epel-release \ unzip \ perl \ + python3 \ sed \ "perl(Sys::Syslog)" diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index f3657d3a7a..b242e667c1 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.740, AIX version +# Version 7.0NG.742, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/DEBIAN/make_deb_package.sh b/pandora_agents/pc/DEBIAN/make_deb_package.sh index f44dfec8f4..691918b54e 100644 --- a/pandora_agents/pc/DEBIAN/make_deb_package.sh +++ b/pandora_agents/pc/DEBIAN/make_deb_package.sh @@ -36,6 +36,8 @@ mkdir -p temp_package/usr/bin/ mkdir -p temp_package/usr/sbin/ mkdir -p temp_package/etc/pandora/plugins mkdir -p temp_package/etc/pandora/collections +mkdir -p temp_package/etc/pandora/trans +mkdir -p temp_package/etc/pandora/commands mkdir -p temp_package/etc/init.d/ mkdir -p temp_package/var/log/pandora/ mkdir -p temp_package/usr/share/man/man1/ diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 95fd1090ad..4fd4b92596 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.740, FreeBSD Version +# Version 7.0NG.742, 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 04122feb30..e0af4e7490 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.740, HP-UX Version +# Version 7.0NG.742, 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 b083e7f3aa..fe67398b8a 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.740, GNU/Linux +# Version 7.0NG.742, 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 4bb88c5b4e..092436f485 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.740, GNU/Linux +# Version 7.0NG.742, 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 a90b7227ca..a2162ac29f 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.740, Solaris Version +# Version 7.0NG.742, 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 d750898b70..e582bbd963 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.740 +# Version 7.0NG.742 # 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/pc/pandora_agent_installer b/pandora_agents/pc/pandora_agent_installer index ab2a00877e..469364abf1 100644 --- a/pandora_agents/pc/pandora_agent_installer +++ b/pandora_agents/pc/pandora_agent_installer @@ -324,6 +324,11 @@ install () { cp -r collections $PANDORA_BASE$PANDORA_HOME chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections ln -s $PANDORA_BASE$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG + + echo "Copying Pandora FMS Agent commands to $PANDORA_BASE$PANDORA_HOME/commands..." + cp -r commands $PANDORA_BASE$PANDORA_HOME + chmod -R 700 $PANDORA_BASE$PANDORA_HOME/commands + ln -s $PANDORA_BASE$PANDORA_HOME/commands $PANDORA_BASE$PANDORA_CFG echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER" cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 6a663d6331..80762acbb7 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.740, AIX version +# Version 7.0NG.742, 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 99e4c62462..4ac18ede49 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.740 +# Version 7.0NG.742 # 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 7a9d2c4347..925081e62c 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.740, HPUX Version +# Version 7.0NG.742, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index a55d96a952..68ced2a378 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.740 +# Version 7.0NG.742 # 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 a24a24d16e..495c2516d4 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.740 +# Version 7.0NG.742 # 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 74d515cb4e..f18f326a05 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.740 +# Version 7.0NG.742 # 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 dc915ef18e..e319d9695f 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.740, Solaris version +# Version 7.0NG.742, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index de7e97911b..604509d18d 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.740, AIX version +# Version 7.0NG.742, 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 ce165fde19..37b2c8e329 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.740-191029 +Version: 7.0NG.742-200108 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 a4a8dce448..a1b4728047 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.740-191029" +pandora_version="7.0NG.742-200108" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null @@ -36,6 +36,8 @@ mkdir -p temp_package/usr/bin/ mkdir -p temp_package/usr/sbin/ mkdir -p temp_package/etc/pandora/plugins mkdir -p temp_package/etc/pandora/collections +mkdir -p temp_package/etc/pandora/trans +mkdir -p temp_package/etc/pandora/commands mkdir -p temp_package/etc/init.d/ mkdir -p temp_package/lib/systemd/system/ mkdir -p temp_package/var/log/pandora/ diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 34dd1bf4fc..1daa7b6ddc 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.740, GNU/Linux +# Version 7.0NG.742, 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 e4ad74ffe7..e8d62cc68f 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.740, FreeBSD Version +# Version 7.0NG.742, 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 e55445fe13..05770c02aa 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.740, HP-UX Version +# Version 7.0NG.742, 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 54ace6a811..3aafa0fc85 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.740, GNU/Linux +# Version 7.0NG.742, 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 94e32e8056..a99efbc9c8 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.740, GNU/Linux +# Version 7.0NG.742, 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 71e7d14192..228d95c9f1 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.740, NetBSD Version +# Version 7.0NG.742, 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 cc89dee501..7fc6e08f1d 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.740, Solaris Version +# Version 7.0NG.742, 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 4bbac522b1..03d80acda7 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -24,6 +24,7 @@ Version 6.0 use strict; use warnings; +use Scalar::Util qw(looks_like_number); use POSIX qw(strftime floor); use Sys::Hostname; use File::Basename; @@ -32,6 +33,18 @@ use IO::Socket; use Sys::Syslog; use Time::Local; +my $YAML = 0; +# Dynamic load. Avoid unwanted behaviour. +eval { + eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available'); +}; +if ($@) { + $YAML = 0; + print STDERR $@; +} else { + $YAML = 1; +} + # Agent XML data my $Xml; @@ -41,8 +54,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.740'; -use constant AGENT_BUILD => '191029'; +use constant AGENT_VERSION => '7.0NG.742'; +use constant AGENT_BUILD => '200108'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -187,6 +200,7 @@ my %DefaultConf = ( 'custom_id' => '', 'url_address' => '', 'standby' => 0, + 'cmd_file' => undef, ); my %Conf = %DefaultConf; @@ -268,6 +282,91 @@ sub error ($) { exit 1; } +################################################################################ +# Try to load extra libraries.c +################################################################################ +sub load_libraries() { + # Dynamic load. Avoid unwanted behaviour. + eval {eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available');}; + if ($@) { + $YAML = 0; + print STDERR $@; + } else { + $YAML = 1; + } +} + +################################################################################ +# Erase blank spaces before and after the string +################################################################################ +sub trim { + my $string = shift; + if (empty($string)){ + return ""; + } + + $string =~ s/\r//g; + + chomp($string); + $string =~ s/^\s+//g; + $string =~ s/\s+$//g; + + return $string; +} + +################################################################################ +# Mix hashses +################################################################################ +sub merge_hashes { + my $_h1 = shift; + my $_h2 = shift; + + if (ref($_h1) ne "HASH") { + return \%{$_h2} if (ref($_h2) eq "HASH"); + } + + if (ref($_h2) ne "HASH") { + return \%{$_h1} if (ref($_h1) eq "HASH"); + } + + if ((ref($_h1) ne "HASH") && (ref($_h2) ne "HASH")) { + return {}; + } + + my %ret = (%{$_h1}, %{$_h2}); + + return \%ret; +} + +################################################################################ +# Empty +################################################################################ +sub empty { + my $str = shift; + + if (!(defined($str)) ){ + return 1; + } + + if(looks_like_number($str)){ + return 0; + } + + if (ref($str) eq "ARRAY") { + return (($#{$str}<0)?1:0); + } + + if (ref($str) eq "HASH") { + my @tmp = keys %{$str}; + return (($#tmp<0)?1:0); + } + + if ($str =~ /^\ *[\n\r]{0,2}\ *$/) { + return 1; + } + return 0; +} + ################################################################################ # Check a regular expression. Returns 1 if its valid, 0 otherwise. ################################################################################ @@ -284,6 +383,27 @@ sub valid_regexp ($) { return 1; } +################################################################################ +# Reads a file and returns entire content or undef if error. +################################################################################ +sub read_file { + my $path = shift; + + my $_FILE; + if( !open($_FILE, "<", $path) ) { + # failed to open, return undef + return undef; + } + + # Slurp configuration file content. + my $content = do { local $/; <$_FILE> }; + + # Close file + close($_FILE); + + return $content; +} + ################################################################################ # Recursively delete files and directories. ################################################################################ @@ -776,7 +896,21 @@ sub read_config (;$) { next if ($line =~ /^module\s*\w*/); #Configuration token - if ($line =~ /^\s*(\S+)\s+(.*)$/) { + if ($line =~ /^\s*(\S+)\s+(.*)$/) { + # Reserved keyword. + next if ($1 eq "commands"); + + if ($1 eq "cmd_file") { + # Commands + if (ref ($Conf{'commands'}) ne "HASH") { + $Conf{'commands'} = {}; + } + # Initialize empty command hash. + $Conf{'commands'}->{$2} = {}; + log_message('setup', "Command required $2"); + next; + } + log_message ('setup', "$1 is $2"); $Conf{$1} = $2; @@ -923,6 +1057,7 @@ sub read_config (;$) { $Conf{'secondary_server_opts'} = '-x \'' . $Conf{'secondary_server_pwd'} . '\' ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_pwd'} ne ''); $Conf{'secondary_server_opts'} = '-c ' . $Conf{'secondary_server_opts'} if ($Conf{'secondary_server_ssl'} eq '1'); } + } ################################################################################# @@ -1157,14 +1292,14 @@ sub recv_file { }; if ($@) { - log_message ('error', "Error retrieving file: File transfer command is not responding."); + log_message ('error', "Error retrieving file: '.$file.' File transfer command is not responding."); exit 1; } # Get the errorlevel my $rc = $? >> 8; if ($rc != 0) { - log_message ('error', "Error retrieving file: $output"); + log_message ('error', "Error retrieving file: '$file' $output"); } exit $rc; } @@ -1233,6 +1368,10 @@ sub check_remote_config () { %Collections = (); %Conf = %DefaultConf; + # Supposed to discard current configuration but not. + # Cleanup old commands configuration. + $Conf{'commands'} = {}; + # Reload the new configuration read_config (); @@ -1362,6 +1501,336 @@ sub check_collections () { } } +################################################################################ +# Check for remote commands defined. +################################################################################ +sub prepare_commands { + if ($YAML == 0) { + log_message( + 'error', + 'Cannot use commands without YAML dependency, please install it.' + ); + return; + } + + # Force configuration file read. + my @commands = read_config('cmd_file'); + + if (empty(\@commands)) { + $Conf{'commands'} = {}; + } else { + foreach my $rcmd (@commands) { + $Conf{'commands'}->{trim($rcmd)} = {}; + } + } + + # Cleanup old commands. Not registered. + cleanup_old_commands(); + + foreach my $ref (keys %{$Conf{'commands'}}) { + my $file_content; + my $download = 0; + my $rcmd_file = $ConfDir.'/commands/'.$ref.'.rcmd'; + + # Check for local .rcmd.done files + if (-e $rcmd_file.'.done') { + # Ignore. + delete $Conf{'commands'}->{$ref}; + next; + } + + # Search for local .rcmd file + if (-e $rcmd_file) { + my $remote_md5_file = $Conf{'temporal'}.'/'.$ref.'.md5'; + + $file_content = read_file($rcmd_file); + if (recv_file($ref.'.md5', $remote_md5_file) != 0) { + # Remote file could not be retrieved, skip. + delete $Conf{'commands'}->{$ref}; + next; + } + + my $local_md5 = md5($file_content); + my $remote_md5 = md5(read_file($remote_md5_file)); + + if ($local_md5 ne $remote_md5) { + # Must be downloaded again. + $download = 1; + } + } else { + $download = 1; + } + + # Search for remote .rcmd file + if ($download == 1) { + # Download .rcmd file + if (recv_file($ref.'.rcmd') != 0) { + # Remote file could not be retrieved, skip. + delete $Conf{'commands'}->{$ref}; + next; + } else { + # Success + move($Conf{'temporal'}.'/'.$ref.'.rcmd', $rcmd_file); + } + } + + # Parse and prepare in memory skel. + eval { + $Conf{'commands'}->{$ref} = YAML::Tiny->read($rcmd_file); + }; + if ($@) { + # Failed. + log_message('error', 'Failed to decode command. ' . "\n".$@); + delete $Conf{'commands'}->{$ref}; + next; + } + + } +} + +################################################################################ +# Command report. +################################################################################ +sub report_command { + my ($ref, $err_level) = @_; + + # Retrieve content from .stdout and .stderr + my $stdout_file = $Conf{'temporal'}.'/'.$ref.'.stdout'; + my $stderr_file = $Conf{'temporal'}.'/'.$ref.'.stderr'; + + my $return; + eval { + $return = { + 'error_level' => $err_level, + 'stdout' => read_file($stdout_file), + 'stderr' => read_file($stderr_file), + }; + + $return->{'name'} = $Conf{'commands'}->{$ref}->[0]->{'name'}; + }; + if ($@) { + log_message('error', 'Failed to report command output. ' . $@); + } + + # Cleanup + unlink($stdout_file) if (-e $stdout_file); + unlink($stderr_file) if (-e $stderr_file); + + # Mark command as done. + open (my $R_FILE, '> '.$ConfDir.'/commands/'.$ref.'.rcmd.done'); + print $R_FILE $err_level; + close($R_FILE); + + + $return->{'stdout'} = '' unless defined ($return->{'stdout'}); + $return->{'stderr'} = '' unless defined ($return->{'stderr'}); + + return $return; +} + +################################################################################ +# Cleanup unreferenced rcmd and rcmd.done files. +################################################################################ +sub cleanup_old_commands { + # Cleanup old .rcmd and .rcmd.done files. + my %registered = map { $_.'.rcmd' => 1 } keys %{$Conf{'commands'}}; + if(opendir(my $dir, $ConfDir.'/commands/')) { + while (my $item = readdir($dir)) { + + # Skip other files. + next if ($item !~ /\.rcmd$/); + + # Clean .rcmd.done file if its command is not referenced in conf. + if (!defined($registered{$item})) { + if (-e $ConfDir.'/commands/'.$item) { + unlink($ConfDir.'/commands/'.$item); + } + if (-e $ConfDir.'/commands/'.$item.'.done') { + unlink($ConfDir.'/commands/'.$item.'.done'); + } + } + } + + # Close dir. + closedir($dir); + } + +} + +################################################################################ +# Executes a command using defined timeout. +################################################################################ +sub execute_command_timeout { + my ($cmd, $timeout) = @_; + + if (!defined($timeout) + || !looks_like_number($timeout) + || $timeout <= 0 + ) { + `$cmd`; + return $?>>8; + } + + my $remaining_timeout = $timeout; + + my $RET; + my $output; + + my $pid = open ($RET, "-|"); + if (!defined($pid)) { + # Failed to fork. + log_message('error', '[command] Failed to fork.'); + return undef; + } + if ($pid == 0) { + # Child. + my $ret; + eval { + local $SIG{ALRM} = sub { die "timeout\n" }; + alarm $timeout; + `$cmd`; + alarm 0; + }; + + my $result = ($?>>8); + print $result; + + # Exit child. + # Child finishes. + exit; + + } else { + # Parent waiting. + while( --$remaining_timeout > 0 ){ + if (wait == -1) { + last; + } + # Wait child up to timeout seconds. + sleep 1; + } + } + + if ($remaining_timeout > 0) { + # Retrieve output from child. + $output = do { local $/; <$RET> }; + $output = $output>>8; + } + else { + # Timeout expired. + return 124; + } + + close($RET); + + return $output; +} + +################################################################################ +# Executes a block of commands, returns error level, leaves output in +# redirection set by $std_files. E.g: +# $std_files = ' >> /tmp/stdout 2>> /tmp/stderr +################################################################################ +sub execute_command_block { + my ($commands, $std_files, $timeout, $retry) = @_; + + return 0 unless defined($commands); + + my $retries = $retry; + + $retries = 1 unless looks_like_number($retries) && $retries > 0; + + my $err_level = 0; + $std_files = '' unless defined ($std_files); + + if (ref($commands) ne "ARRAY") { + return 0 if $commands eq ''; + + do { + $err_level = execute_command_timeout( + "($commands) $std_files", + $timeout + ); + + # Do not retry if success. + last if looks_like_number($err_level) && $err_level == 0; + } while ((--$retries) > 0); + + } else { + foreach my $comm (@{$commands}) { + next unless defined($comm); + $retries = $retry; + $retries = 1 unless looks_like_number($retries) && $retries > 0; + + do { + $err_level = execute_command_timeout( + "($comm) $std_files", + $timeout + ); + + # Do not retry if success. + last if looks_like_number($err_level) && $err_level == 0; + + } while ((--$retries) > 0); + + # Do not continue evaluating block if failed. + last unless ($err_level == 0); + } + } + + return $err_level; +} + +################################################################################ +# Evalate given command. +################################################################################ +sub evaluate_command { + my ($ref) = @_; + + # Not found. + return unless defined $Conf{'commands'}->{$ref}; + + # Already completed. + return if (-e $ConfDir.'/commands/'.$ref.'.rcmd.done'); + + # [0] because how library works. + my $cmd = $Conf{'commands'}->{$ref}->[0]; + + my $std_files = ' >> '.$Conf{'temporal'}.'/'.$ref.'.stdout '; + $std_files .= ' 2>> '.$Conf{'temporal'}.'/'.$ref.'.stderr '; + + # Check preconditions + my $err_level; + + $err_level = execute_command_block( + $cmd->{'preconditions'}, + $std_files, + $cmd->{'timeout'} + ); + + # Precondition not satisfied. + return report_command($ref, $err_level) unless ($err_level == 0); + + # Main run. + $err_level = execute_command_block( + $cmd->{'script'}, + $std_files, + $cmd->{'timeout'} + ); + + # Script not success. + return report_command($ref, $err_level) unless ($err_level == 0); + + # Check postconditions + $err_level = execute_command_block( + $cmd->{'postconditions'}, + $std_files, + $cmd->{'timeout'} + ); + + # Return results. + return report_command($ref, $err_level); +} + ################################################################################ # Sleep function ################################################################################ @@ -2413,7 +2882,7 @@ sub cron_valid_date { my $utime; eval { local $SIG{__DIE__} = sub {}; - $utime = timelocal(0, $min, $hour, $mday, $month, $year); + $utime = strftime("%s", 0, $min, $hour, $mday, $month, $year); }; if ($@) { return 0; @@ -2985,6 +3454,8 @@ my $iter_base_time = time(); $LogFileIdx = -1; # Loop while (1) { + load_libraries(); + if (-e $Conf{'logfile'} && (stat($Conf{'logfile'}))[7] > $Conf{'logsize'}) { rotate_log(); } @@ -2999,6 +3470,9 @@ while (1) { # Check file collections check_collections () unless ($Conf{'debug'} eq '1'); + # Check scheduled commands + prepare_commands() unless ($Conf{'debug'} eq '1'); + # Launch broker agents @BrokerPid = (); my @broker_agents = read_config ('broker_agent'); @@ -3128,6 +3602,24 @@ while (1) { } } + if (ref ($Conf{'commands'}) eq "HASH") { + foreach my $command (keys %{$Conf{'commands'}}) { + my $result = evaluate_command($command); + if (ref($result) eq "HASH") { + # Process command result. + $Xml .= "\n"; + $Xml .= " \n"; + $Xml .= " {'name'}."]]>\n"; + $Xml .= " \n"; + $Xml .= " {'error_level'}."]]>\n"; + $Xml .= " {'stdout'}."]]>\n"; + $Xml .= " {'stderr'}."]]>\n"; + $Xml .= " \n"; + $Xml .= "\n"; + } + } + } + # Wait for all the threads $ThreadSem->down ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); $ThreadSem->up ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 79f2310c11..23c28162e5 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.740 -%define release 191029 +%define version 7.0NG.742 +%define release 200108 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel Requires: fileutils textutils unzip Requires: util-linux procps grep Requires: /sbin/ip /bin/awk -Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip) +Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny) # Required by plugins #Requires: sh-utils sed passwd net-tools rpm AutoReq: 0 @@ -99,6 +99,11 @@ if [ ! -e /etc/pandora/collections ]; then ln -s /usr/share/pandora_agent/collections /etc/pandora fi +if [ ! -e /etc/pandora/commands ]; then + mkdir -p /usr/share/pandora_agent/commands + ln -s /usr/share/pandora_agent/commands /etc/pandora +fi + mkdir -p /var/spool/pandora/data_out if [ ! -d /var/log/pandora ]; then mkdir -p /var/log/pandora diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 392fa174ce..f6e70b2de6 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.740 -%define release 191029 +%define version 7.0NG.742 +%define release 200108 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -19,7 +19,7 @@ Prefix: /usr/share BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot BuildArch: noarch PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd -Requires: coreutils unzip perl +Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny) AutoReq: 0 Provides: %{name}-%{version} @@ -90,6 +90,11 @@ fi if [ ! -e /etc/pandora/collections ]; then mkdir /etc/pandora/collections fi + +if [ ! -e /etc/pandora/commands ]; then + mkdir /etc/pandora/commands +fi + cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent # Enable the service on SystemD diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index cc4b78b51c..9a5c66a6f2 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.740" -PI_BUILD="191029" +PI_VERSION="7.0NG.742" +PI_BUILD="200108" OS_NAME=`uname -s` FORCE=0 @@ -89,7 +89,7 @@ fi [ "$4" ] && PANDORA_PERL_PATH=$4 # Check for Perl 5.6.x or higher available -PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[12][0-9]' | grep perl` +PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.[6-9]|v5.[1-3][0-9]' | grep perl` if [ -z "$PERL_VERSION" ] then @@ -400,6 +400,11 @@ install () { mkdir -p $PANDORA_BASE$PANDORA_HOME/collections chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG + + echo "Creating the commands directory in $PANDORA_BASE$PANDORA_HOME/commands..." + mkdir -p $PANDORA_BASE$PANDORA_HOME/commands + chmod -R 700 $PANDORA_BASE$PANDORA_HOME/commands + ln -s $PANDORA_BASE_REAL$PANDORA_HOME/commands $PANDORA_BASE$PANDORA_CFG if [ $WITHOUT_TENTACLE_SERVER -eq 0 ] then diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 79660e5b5d..3e519fa738 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.740 +# Version 7.0NG.742 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 730edbe5de..c94e8d4333 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.740} +{Pandora FMS Windows Agent v7.0NG.742} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{191029} +{200108} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index 7cbde21ca7..59e8af0a5b 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -1708,3 +1708,17 @@ void Pandora_Module::setExecutions (long executions) { this->executions = executions; } + +/** + * Checks if the module has intensive conditions. + * + * @return true if the module's intensive condition list is not empty, false if it is. + */ +bool +Pandora_Module::isIntensive () { + if (this->intensive_condition_list == NULL || this->intensive_condition_list->size () <= 0) { + return false; + } + + return true; +} diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 3b9d6c15a4..f38cac5f80 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -303,6 +303,7 @@ namespace Pandora_Modules { time_t getTimestamp (); void setIntensiveMatch (unsigned char intensive_match); unsigned char getIntensiveMatch (); + bool isIntensive (); }; } diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 823b486b0e..40bdd444e5 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.740(Build 191029)") +#define PANDORA_VERSION ("7.0NG.742(Build 200108)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/pandora_windows_service.cc b/pandora_agents/win32/pandora_windows_service.cc index b62fc1f70d..73d0a5d482 100644 --- a/pandora_agents/win32/pandora_windows_service.cc +++ b/pandora_agents/win32/pandora_windows_service.cc @@ -1918,16 +1918,19 @@ Pandora_Windows_Service::pandora_run_broker (string config, long executions) { } /* Evaluate intensive conditions */ - intensive_match = module->evaluateIntensiveConditions (); - if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) { - module->setNoOutput (); - this->broker_modules->goNext (); - continue; - } - module->setIntensiveMatch (intensive_match); - - if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) { - module->setTimestamp (this->run_time); + if (module->isIntensive()) { + intensive_match = module->evaluateIntensiveConditions (); + if (intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) { + module->setNoOutput (); + this->broker_modules->goNext (); + continue; + } + + if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) { + module->setTimestamp (this->run_time); + } + + module->setIntensiveMatch (intensive_match); } /* Evaluate module conditions */ @@ -2038,16 +2041,19 @@ Pandora_Windows_Service::pandora_run (int forced_run) { } /* Evaluate intensive conditions */ - intensive_match = module->evaluateIntensiveConditions (); - if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) { - module->setNoOutput (); - this->modules->goNext (); - continue; - } - module->setIntensiveMatch (intensive_match); - - if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) { - module->setTimestamp (this->run_time); + if (module->isIntensive()) { + intensive_match = module->evaluateIntensiveConditions (); + if (forced_run != 1 && intensive_match == module->getIntensiveMatch () && module->getTimestamp () + module->getInterval () * this->interval_sec > this->run_time) { + module->setNoOutput (); + this->modules->goNext (); + continue; + } + + if (module->getTimestamp () + module->getInterval () * this->interval_sec <= this->run_time) { + module->setTimestamp (this->run_time); + } + + module->setIntensiveMatch (intensive_match); } /* Evaluate module conditions */ diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d714543482..f590c417b6 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.740(Build 191029))" + VALUE "ProductVersion", "(7.0NG.742(Build 200108))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index cab514f37e..789c1d5744 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.740-191029 +Version: 7.0NG.742-200108 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 64140d02ad..be3de30f74 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.740-191029" +pandora_version="7.0NG.742-200108" package_pear=0 package_pandora=1 diff --git a/pandora_console/DEBIAN/postinst b/pandora_console/DEBIAN/postinst index eb8e4872f3..a899c6bf0a 100755 --- a/pandora_console/DEBIAN/postinst +++ b/pandora_console/DEBIAN/postinst @@ -11,4 +11,11 @@ echo Restart the apache. /etc/init.d/apache2 restart fi +# Install pandora_websocket_engine service. +cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/ +chmod +x /etc/init.d/pandora_websocket_engine + +echo "You can now start the Pandora FMS Websocket service by executing" +echo " /etc/init.d/pandora_websocket_engine start" + echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it." diff --git a/pandora_console/composer.json b/pandora_console/composer.json index 208e2d3d14..4138dc77c2 100644 --- a/pandora_console/composer.json +++ b/pandora_console/composer.json @@ -1,5 +1,5 @@ { - "name": "Pandora FMS", + "name": "pandorafms/console", "description": "Pandora Flexible Monitoring System ", "authors": [ { @@ -14,7 +14,9 @@ "autoload": { "psr-4": { "Models\\": "include/rest-api/models", - "Enterprise\\Models\\": "enterprise/include/rest-api/models" + "Enterprise\\Models\\": "enterprise/include/rest-api/models", + "PandoraFMS\\": "include/lib", + "PandoraFMS\\Enterprise\\": "enterprise/include/lib" } }, "autoload-dev": { diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 97657f5189..f492f5e437 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -13,7 +13,264 @@ * GNU General Public License for more details. */ +// Begin. + +/** + * Extra JS. + * + * @return void + */ +function agents_modules_load_js() +{ + $ignored_params['refresh'] = ''; + + ?> + + + + - - - diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 546ee463fa..6d41459d90 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -22,6 +22,17 @@ function dbmanager_query($sql, &$error, $dbconnection) } $sql = html_entity_decode($sql, ENT_QUOTES); + + // Extract the text in quotes to add html entities before query db. + $patttern = '/(?:"|\')+([^"\']*)(?:"|\')+/m'; + $sql = preg_replace_callback( + $patttern, + function ($matches) { + return '"'.io_safe_input($matches[1]).'"'; + }, + $sql + ); + if ($config['mysqli']) { $result = mysqli_query($dbconnection, $sql); if ($result === false) { diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 8b5075f77c..35519e144d 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -30,6 +30,15 @@ global $config; check_login(); +// ACL Check +if (!check_acl($config['id_user'], 0, 'AR')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access Module Groups view' + ); + include 'general/noaccess.php'; + exit; +} if (is_ajax()) { $get_info_alert_module_group = (bool) get_parameter('get_info_alert_module_group'); @@ -82,6 +91,16 @@ function mainModuleGroups() $agent_group_search = get_parameter('agent_group_search', ''); $module_group_search = get_parameter('module_group_search', ''); + // Check the user's group permissions. + $user_groups = users_get_groups($config['user'], 'AR'); + $info = array_filter( + $info, + function ($v, $k) use ($user_groups) { + return $user_groups[$v['id']] != null; + }, + ARRAY_FILTER_USE_BOTH + ); + $info = array_filter( $info, function ($v, $k) use ($agent_group_search) { @@ -265,7 +284,7 @@ function mainModuleGroups() text-align: center; '; - if (true) { + if ($info && $array_module_group) { $table = new StdClass(); $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->width = '100%'; @@ -296,22 +315,22 @@ function mainModuleGroups() $url = 'index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group='.$key.'&modulegroup='.$k; if ($array_data[$key][$k]['alerts_module_count'] != 0) { - $color = '#FFA631'; + $color = COL_ALERTFIRED; // Orange when the cell for this model group and agent has at least one alert fired. } else if ($array_data[$key][$k]['critical_module_count'] != 0) { - $color = '#e63c52'; + $color = COL_CRITICAL; // Red when the cell for this model group and agent has at least one module in critical state and the rest in any state. } else if ($array_data[$key][$k]['warning_module_count'] != 0) { - $color = '#f3b200'; + $color = COL_WARNING; // Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state. } else if ($array_data[$key][$k]['unknown_module_count'] != 0) { - $color = '#B2B2B2 '; + $color = COL_UNKNOWN; // Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state. } else if ($array_data[$key][$k]['normal_module_count'] != 0) { - $color = '#82b92e'; + $color = COL_NORMAL; // Green when the cell for this model group and agent has OK state all modules. } else if ($array_data[$key][$k]['notInit_module_count'] != 0) { - $color = '#5BB6E5'; + $color = COL_NOTINIT; // Blue when the cell for this module group and all modules have not init value. } @@ -359,7 +378,7 @@ function mainModuleGroups() echo "
".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').''; echo "
".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').''; echo "
".__('Green cell when the module group and agent have all modules in OK status').''; - echo "
".__('Blue cell when the module group and agent have all modules in not init status.').''; + echo "
".__('Blue cell when the module group and agent have all modules in not init status.').''; echo ''; echo ''; } else { diff --git a/pandora_console/extensions/net_tools.php b/pandora_console/extensions/net_tools.php index ba66cae68e..3896a10155 100644 --- a/pandora_console/extensions/net_tools.php +++ b/pandora_console/extensions/net_tools.php @@ -312,7 +312,7 @@ function main_net_tools() $ips = db_get_all_rows_sql( sprintf( 'SELECT ip FROM taddress WHERE id_a IN (%s)', - join($ids) + join(',', $ids) ) ); diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index ef08e34bae..6cf20858ab 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -23,12 +23,12 @@ function pluginreg_extension_main() return; } - ui_require_css_file('firts_task'); + ui_require_css_file('first_task'); ui_print_page_header(__('Plugin registration'), 'images/extensions.png', false, '', true, ''); echo '
'; - echo html_print_image('images/firts_task/icono_grande_import.png', true, ['title' => __('Plugin Registration') ]); + echo html_print_image('images/first_task/icono_grande_import.png', true, ['title' => __('Plugin Registration') ]); echo '
'; echo '
'; echo '

'.__('Plugin registration').'

'; diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php new file mode 100644 index 0000000000..6b70ae21e8 --- /dev/null +++ b/pandora_console/extensions/quick_shell.php @@ -0,0 +1,519 @@ +printForm( + [ + 'form' => [ + 'method' => 'POST', + 'action' => '#', + ], + 'inputs' => [ + [ + 'class' => 'w100p', + 'arguments' => [ + 'name' => 'submit', + 'label' => __('Retry'), + 'type' => 'submit', + 'attributes' => 'class="sub next"', + 'return' => true, + ], + ], + ], + ] + ); + + return; + } + + $wiz->printForm( + [ + 'form' => [ + 'action' => '#', + 'class' => 'wizard', + 'method' => 'post', + ], + 'inputs' => [ + [ + 'label' => __('Username'), + 'arguments' => [ + 'type' => 'text', + 'name' => 'username', + ], + ], + [ + 'label' => __('Port'), + 'arguments' => [ + 'type' => 'text', + 'id' => 'port', + 'name' => 'port', + 'value' => 22, + ], + ], + [ + 'label' => __('Method'), + 'arguments' => [ + 'type' => 'select', + 'name' => 'method', + 'fields' => [ + 'ssh' => __('SSH'), + 'telnet' => __('Telnet'), + ], + 'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);", + ], + ], + [ + 'arguments' => [ + 'type' => 'submit', + 'label' => __('Connect'), + 'attributes' => 'class="sub next"', + ], + ], + ], + ], + false, + true + ); + + return; + } + + // Initialize Gotty Client. + $host = $config['gotty_host']; + if ($method == 'ssh') { + // SSH. + $port = $config['gotty_ssh_port']; + $command_arguments = "var args = '?arg=".$username.'@'.$address; + $command_arguments .= '&arg=-p '.$method_port."';"; + } else if ($method == 'telnet') { + // Telnet. + $port = $config['gotty_telnet_port']; + $command_arguments = "var args = '?arg=-l ".$username; + $command_arguments .= '&arg='.$address; + $command_arguments .= '&arg='.$method_port."';"; + } else { + ui_print_error_message(__('Please use SSH or Telnet.')); + return; + } + + // If rediretion is enabled, we will try to connect to http:// or https:// endpoint. + $test = get_headers($ws_url); + if ($test === false) { + if (empty($wiz) === true) { + $wiz = new Wizard(); + } + + ui_print_error_message(__('WebService engine has not been started, please check documentation.')); + echo $wiz->printGoBackButton('#'); + return; + } + + // Check credentials. + $auth_str = ''; + $gotty_url = $host.':'.$port; + if (empty($config['gotty_user']) === false + && empty($config['gotty_pass']) === false + ) { + $auth_str = io_safe_output($config['gotty_user']); + $auth_str .= ':'.io_output_password($config['gotty_pass']); + $gotty_url = $auth_str.'@'.$host.':'.$port; + } + + $r = file_get_contents('http://'.$gotty_url.'/js/hterm.js'); + if (empty($r) === true) { + if (empty($wiz) === true) { + $wiz = new Wizard(); + } + + ui_print_error_message(__('WebService engine is not working properly, please check documentation.')); + echo $wiz->printGoBackButton('#'); + return; + } + + // Override gotty client settings. + if (empty($auth_str) === true) { + $r .= "var gotty_auth_token = '';"; + } else { + $r .= "var gotty_auth_token = '"; + $r .= $auth_str."';"; + } + + // Set websocket target and method. + $gotty = file_get_contents('http://'.$gotty_url.'/js/gotty.js'); + $url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';"; + if (empty($config['ws_proxy_url']) === true) { + $new = "var url = (httpsEnabled ? 'wss://' : 'ws://')"; + $new .= " + window.location.host + ':"; + $new .= $config['ws_port'].'/'.$method."';"; + } else { + $new = "var url = '"; + $new .= $config['ws_proxy_url'].'/'.$method."';"; + } + + // Update url. + $gotty = str_replace($url, $new, $gotty); + + // Update websocket arguments. + $args = 'var args = window.location.search;'; + $new = $command_arguments; + + // Update arguments. + $gotty = str_replace($args, $new, $gotty); + + ?> + +
+ + + 0) { + $msg = __('%d Updated', $changes); + if ($critical > 0) { + $msg = __( + '%d Updated, please restart WebSocket engine service', + $changes + ); + } + + ui_print_success_message($msg); + } + + // Form. Using old style. + echo '
'; + echo ''.__('Quickshell').''; + + $t = new StdClass(); + $t->data = []; + $t->width = '100%'; + $t->class = 'databox filters'; + $t->data = []; + $t->style = []; + $t->style[0] = 'font-weight: bold; width: 40%;'; + + $t->data[0][0] = __('Gotty path'); + $t->data[0][1] = html_print_input_text( + 'gotty', + $config['gotty'], + '', + 30, + 100, + true + ); + + $t->data[1][0] = __('Gotty host'); + $t->data[1][1] = html_print_input_text( + 'gotty_host', + $config['gotty_host'], + '', + 30, + 100, + true + ); + + $t->data[2][0] = __('Gotty ssh port'); + $t->data[2][1] = html_print_input_text( + 'gotty_ssh_port', + $config['gotty_ssh_port'], + '', + 30, + 100, + true + ); + + $t->data[3][0] = __('Gotty telnet port'); + $t->data[3][1] = html_print_input_text( + 'gotty_telnet_port', + $config['gotty_telnet_port'], + '', + 30, + 100, + true + ); + + $hidden = new StdClass(); + $hidden->data = []; + $hidden->width = '100%'; + $hidden->class = 'databox filters'; + $hidden->data = []; + $hidden->style[0] = 'font-weight: bold;width: 40%;'; + + $hidden->data[0][0] = __('Gotty user').ui_print_help_tip( + __('Optional, set a user to access gotty service'), + true + ); + $hidden->data[0][1] = html_print_input_text( + 'gotty_user', + $config['gotty_user'], + '', + 30, + 100, + true + ); + + $hidden->data[1][0] = __('Gotty password').ui_print_help_tip( + __('Optional, set a password to access gotty service'), + true + ); + $hidden->data[1][1] = html_print_input_password( + 'gotty_pass', + io_output_password($config['gotty_pass']), + '', + 30, + 100, + true + ); + + html_print_table($t); + + ui_print_toggle( + [ + 'content' => html_print_table($hidden, true), + 'name' => __('Advanced options'), + 'clean' => false, + 'main_class' => 'no-border-imp', + 'container_class' => 'no-border-imp', + ] + ); + + echo '
'; + +} + + +// This extension is usefull only if the agent has associated IP. +$agent_id = get_parameter('id_agente'); +if (empty($agent_id) === false + && get_parameter('sec2', '') == 'operation/agentes/ver_agente' +) { + $address = agents_get_address($agent_id); + if (empty($address) === false) { + // Extension registration. + extensions_add_opemode_tab_agent( + // TabId. + 'quick_shell', + // TabName. + __('QuickShell'), + // TabIcon. + 'images/ehorus/terminal.png', + // TabFunction. + 'quickShell', + // Version. + 'N/A', + // Acl. + 'PM' + ); + } +} + +extensions_add_godmode_function('quickShellSettings'); diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index ddfa9866ad..14384aaec3 100755 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -238,19 +238,6 @@ function output_xml_report($id) echo ''; echo ''; break; - - /* - case 'TTRT': - break; - - case 'TTO': - break; - - case 'MTBF': - break; - - case 'MTTR': - break;*/ } echo "\n"; diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index ea9a5f50e8..dae61e3a78 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -375,19 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0) $values['line_separator'] = io_safe_input($item['line_separator']); $values['column_separator'] = io_safe_input($item['column_separator']); break; - - /* - case 'TTRT': - break; - - case 'TTO': - break; - - case 'MTBF': - break; - - case 'MTTR': - break;*/ } if (empty($agents_item)) { diff --git a/pandora_console/extensions/sample_agent.php b/pandora_console/extensions/sample_agent.php new file mode 100644 index 0000000000..ba92debae9 --- /dev/null +++ b/pandora_console/extensions/sample_agent.php @@ -0,0 +1,66 @@ + $id_agente], 'id_agente_modulo'); + $count_modules = count($modules); + + // Update of layout 1 (Rack sample). + $images_rack_server = [ + 'rack_server_rack', + 'rack_server', + 'rack_switch', + 'rack_firewall', + 'rack_double_server', + 'rack_frame', + 'rack_pdu', + ]; + $query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE '; + for ($i = 0; $i < $count_modules; $i++) { + $query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' '; + } + + $query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");'; + + db_process_sql($query); + // Update of layout 2 (Dashboard). + $query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE '; + $query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' '; + $query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);'; + + db_process_sql($query); + + // This setting will avoid regenerate all the times the visual consoles. + config_update_value('sample_agent_deployed', 1); +} + +extensions_add_main_function('sample_agent_deployment'); diff --git a/pandora_console/extras/mr/33.sql b/pandora_console/extras/mr/33.sql new file mode 100644 index 0000000000..3a25268e6d --- /dev/null +++ b/pandora_console/extras/mr/33.sql @@ -0,0 +1,95 @@ +START TRANSACTION; + +ALTER TABLE `treport_template` ADD COLUMN `agent_regex` varchar(600) NOT NULL default ''; +ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0; + +INSERT INTO `ttipo_modulo` VALUES +(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'), +(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'), +(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'), +(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png'); + +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('N. total processes','Number of running processes in a Windows system.',11,34,0,0,300,0,'tasklist /NH | find /c /v ""','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Free space in C:','Free space available in C:',11,34,0,0,300,0,'powershell $obj=(Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2") ; $obj.FreeSpace[0] * 100 /$obj.Size[0]','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux uptime','System uptime',43,36,0,0,300,0,'uptime |sed s/us\.*$//g | sed s/,\.*$//g','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux processes','Running processes',43,34,0,0,300,0,'ps elf | wc -l','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux system load','Current load (5 min)',43,34,0,0,300,0,'uptime | awk '{print $(NF-1)}' | tr -d ','','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available memory percent','Available memory %',43,34,0,0,300,0,'free | grep Mem | awk '{print $NF/$2 * 100}'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available disk /','Available free space in mountpoint /',43,34,0,0,300,0,'df / | tail -n +2 | awk '{print $(NF-1)}' | tr -d '%'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'0.00',0.00,0.00,'',0,'','inherited','',0,0,0.000000000000000,'','nowizard','','nowizard','0','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); + +ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` enum('','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal') default ''; +ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` int(4) unsigned DEFAULT NULL; +ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` mediumint(4) DEFAULT NULL; + +ALTER TABLE `tevent_rule` ADD COLUMN `log_content` TEXT; +ALTER TABLE `tevent_rule` ADD COLUMN `log_source` TEXT; +ALTER TABLE `tevent_rule` ADD COLUMN `log_agent` TEXT; + +ALTER TABLE `tevent_rule` ADD COLUMN `operator_agent` text COMMENT 'Operator for agent'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_usuario` text COMMENT 'Operator for id_usuario'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_grupo` text COMMENT 'Operator for id_grupo'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_evento` text COMMENT 'Operator for evento'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_event_type` text COMMENT 'Operator for event_type'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_module` text COMMENT 'Operator for module'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_alert` text COMMENT 'Operator for alert'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_criticity` text COMMENT 'Operator for criticity'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_user_comment` text COMMENT 'Operator for user_comment'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_tag` text COMMENT 'Operator for id_tag'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_content` text COMMENT 'Operator for log_content'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_source` text COMMENT 'Operator for log_source'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_agent` text COMMENT 'Operator for log_agent'; + +UPDATE `tevent_rule` SET `operator_agent` = "REGEX" WHERE `agent` != ''; +UPDATE `tevent_rule` SET `operator_id_usuario` = "REGEX" WHERE `id_usuario` != ''; +UPDATE `tevent_rule` SET `operator_id_grupo` = "REGEX" WHERE `id_grupo` > 0; +UPDATE `tevent_rule` SET `operator_evento` = "REGEX" WHERE `evento` != ''; +UPDATE `tevent_rule` SET `operator_event_type` = "REGEX" WHERE `event_type` != ''; +UPDATE `tevent_rule` SET `operator_module` = "REGEX" WHERE `module` != ''; +UPDATE `tevent_rule` SET `operator_alert` = "REGEX" WHERE `alert` != ''; +UPDATE `tevent_rule` SET `operator_criticity` = "REGEX" WHERE `criticity` != '99'; +UPDATE `tevent_rule` SET `operator_user_comment` = "REGEX" WHERE `user_comment` != ''; +UPDATE `tevent_rule` SET `operator_id_tag` = "REGEX" WHERE `id_tag` > 0; +UPDATE `tevent_rule` SET `operator_log_content` = "REGEX" WHERE `log_content` != ''; +UPDATE `tevent_rule` SET `operator_log_source` = "REGEX" WHERE `log_source` != ''; +UPDATE `tevent_rule` SET `operator_log_agent` = "REGEX" WHERE `log_agent` != ''; + +ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0; +ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400; + +CREATE TABLE `tremote_command` ( + `id` SERIAL, + `name` varchar(150) NOT NULL, + `timeout` int(10) unsigned NOT NULL default 30, + `retries` int(10) unsigned NOT NULL default 3, + `preconditions` text, + `script` text, + `postconditions` text, + `utimestamp` int(20) unsigned NOT NULL default 0, + `id_group` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `tremote_command_target` ( + `id` SERIAL, + `rcmd_id` bigint unsigned NOT NULL, + `id_agent` int(10) unsigned NOT NULL, + `utimestamp` int(20) unsigned NOT NULL default 0, + `stdout` MEDIUMTEXT, + `stderr` MEDIUMTEXT, + `errorlevel` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`), + FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`) + ON UPDATE CASCADE ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1); + + +ALTER TABLE `tcredential_store` MODIFY COLUMN `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM'; +ALTER TABLE `tevent_filter` ADD COLUMN `id_source_event` int(10); + + +ALTER TABLE `tmetaconsole_agent_secondary_group` ADD INDEX `id_tagente` (`id_tagente`); +ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`); + +COMMIT; diff --git a/pandora_console/extras/mr/34.sql b/pandora_console/extras/mr/34.sql new file mode 100644 index 0000000000..446709ab10 --- /dev/null +++ b/pandora_console/extras/mr/34.sql @@ -0,0 +1,10 @@ +START TRANSACTION; + +ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; + +ALTER TABLE `tevent_response` ADD COLUMN `command_timeout` int(5) unsigned NOT NULL DEFAULT 90; + +COMMIT; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index eb9a199456..b047106679 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -1,796 +1,2 @@ - - $value) { - db_process_sql_update( - 'tupdate_settings', - [db_escape_key_identifier('value') => $value], - [db_escape_key_identifier('key') => $key] - ); - } - - ui_print_success_message(__('License updated')); -} - -ui_require_javascript_file_enterprise('load_enterprise'); -enterprise_include_once('include/functions_license.php'); -$license = enterprise_hook('license_get_info'); - -$rows = db_get_all_rows_in_table('tupdate_settings'); - -$settings = new StdClass; -foreach ($rows as $row) { - $settings->{$row['key']} = $row['value']; -} - -echo ''; - - -function render_info($table) -{ - global $console_mode; - - $info = db_get_sql("SELECT COUNT(*) FROM $table"); - render_row($info, "DB Table $table"); -} - - -function render_info_data($query, $label) -{ - global $console_mode; - - $info = db_get_sql($query); - render_row($info, $label); -} - - -function render_row($data, $label) -{ - global $console_mode; - - if ($console_mode == 1) { - echo $label; - echo '|'; - echo $data; - echo "\n"; - } else { - echo ''; - echo "
".$label; - echo '
'; - echo "
".$data; - echo '
'; - echo ''; - } -} - - -function get_value_sum($arr) -{ - foreach ($arr as $clave) { - foreach ($clave as $valor) { - if (is_numeric($valor) === true) { - $result += $valor; - } - } - } - - return $result; -} - - -function execution_time() -{ - $times = db_get_all_rows_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = 29 ORDER BY utimestamp DESC LIMIT 2'); - if ($times[0]['datos'] > ($times[1]['datos'] * 1.2)) { - return "Warning Status   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph"; - } else { - return "Normal Status   The execution time is correct. For more information about this data, check the Execution Time graph"; - } -} - - -function get_logs_size($file) -{ - $file_name = '/var'.$file.''; - $size_server_log = filesize($file_name); - return $size_server_log; - -} - - -function get_status_logs($path) -{ - $status_server_log = ''; - $size_server_log = number_format(get_logs_size($path)); - $size_server_log = (0 + str_replace(',', '', $size_server_log)); - if ($size_server_log <= 10485760) { - $status_server_log = "Normal Status   You have less than 10 MB of logs"; - } else { - $status_server_log = "Warning Status   You have more than 10 MB of logs"; - } - - return $status_server_log; -} - - -function percentage_modules_per_agent() -{ - $status_average_modules = ''; - $total_agents = db_get_value_sql('SELECT count(*) FROM tagente'); - $total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo'); - $average_modules_per_agent = ($total_modules / $total_agents); - if ($average_modules_per_agent <= 40) { - $status_average_modules = "Normal Status   The average of modules per agent is less than 40"; - } else { - $status_average_modules = "Warning Status  The average of modules per agent is more than 40. You can have performance problems"; - } - - return $status_average_modules; -} - - -function license_capacity() -{ - $license = enterprise_hook('license_get_info'); - $license_limit = $license['limit']; - $status_license_capacity = ''; - $current_count = db_get_value_sql('SELECT count(*) FROM tagente'); - if ($current_count > ($license_limit * 90 / 100)) { - $status_license_capacity = "Warning Status   License capacity exceeds 90 percent"; - } else { - $status_license_capacity = "Normal Status   License capacity is less than 90 percent"; - } - - return $status_license_capacity; -} - - -function status_license_params($license_param) -{ - $status_license_par = ''; - if ($license_param <= 0) { - $status_license_par = 'OFF'; - } else { - $status_license_par = 'ON'; - } - - return $status_license_par; -} - - -function interval_average_of_network_modules() -{ - $total_network_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18'); - $total_module_interval_time = db_get_value_sql('SELECT SUM(module_interval) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18'); - $average_time = ((int) $total_module_interval_time / $total_network_modules); - - if ($average_time < 180) { - $status_average_modules = "Warning Status   The system is overloaded (average time $average_time) and a very fine configuration is required"; - } else { - $status_average_modules = "Normal Status   The system is not overloaded (average time $average_time) "; - } - - if ($average_time == 0) { - $status_average_modules = "Normal Status   The system has no load"; - } - - return $status_average_modules; -} - - -$attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLOB_BRACE)); - - -function files_attachment_folder($total_files) -{ - if ($total_files <= 700) { - $status_total_files = "Normal Status   The attached folder contains less than 700 files."; - } else { - $status_total_files = "Warning Status   The attached folder contains more than 700 files."; - } - - return $status_total_files; -} - - -$tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos'); - - -function status_tagente_datos($tagente_datos_size) -{ - if ($tagente_datos_size <= 3000000) { - $tagente_datos_size = "Normal Status   The tagente_datos table contains an acceptable amount of data."; - } else { - $tagente_datos_size = "Warning Status   The tagente_datos table contains too much data. A historical database is recommended."; - } - - return $tagente_datos_size; -} - - -function status_values($val_rec, $val) -{ - if ($val_rec <= $val) { - return $val." (Min. Recommended Value ".$val_rec.')'; - } else { - return $val." (Min. Recommended Value ".$val_rec.") Warning Status"; - } -} - - -$tables_fragmentation = db_get_sql( - "SELECT (data_free/(index_length+data_length)) -as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'" -); -$db_size = db_get_all_rows_sql( - 'SELECT table_schema, -ROUND(SUM(data_length+index_length)/1024/1024,3) -FROM information_schema.TABLES -GROUP BY table_schema;' -); - -if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $total_server_threads = shell_exec('ps -T aux | grep pandora_server | grep -v grep | wc -l'); - $percentage_threads_ram = shell_exec("ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'"); - $percentage_threads_cpu = shell_exec("ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'"); - $innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'"); -} - -$path_server_logs = '/log/pandora/pandora_server.log'; -$path_err_logs = '/log/pandora/pandora_server.error'; -$path_console_logs = '/www/html/pandora_console/pandora_console.log'; -$innodb_log_file_size_min_rec_value = '64M'; -$innodb_log_buffer_size_min_rec_value = '16M'; -$innodb_flush_log_at_trx_commit_min_rec_value = 0; -$query_cache_limit_min_rec_value = 2; -$max_allowed_packet_min_rec_value = 32; -$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'"); -$sort_buffer_size_min_rec_value = 32; -$join_buffer_size_min_rec_value = 265; -$query_cache_type_min_rec_value = 'ON'; -$query_cache_size_min_rec_value = 24; -$innodb_lock_wait_timeout_max_rec_value = 120; -$tables_fragmentation_max_rec_value = 10; -$thread_cache_size_max_rec_value = 8; -$thread_stack_min_rec_value = 256; -$max_connections_max_rec_value = 150; -$key_buffer_size_min_rec_value = 256; -$read_buffer_size_min_rec_value = 32; -$read_rnd_buffer_size_min_rec_value = 32; -$query_cache_min_res_unit_min_rec_value = 2; -$innodb_file_per_table_min_rec_value = 1; - - -function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation) -{ - $status_tables_frag = ''; - if ($tables_fragmentation > $tables_fragmentation_max_rec_value) { - $status_tables_frag = "Warning Status   Table fragmentation is higher than recommended. They should be defragmented."; - } else { - $status_tables_frag = "Normal Status   Table fragmentation is correct."; - } - - return $status_tables_frag; -} - - -$console_mode = 1; -if (!isset($argc)) { - $console_mode = 0; -} - -if ($console_mode == 1) { - echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n"; - - if ($argc == 1 || in_array($argv[1], ['--help', '-help', '-h', '-?'])) { - echo "\nThis command line script contains information about Pandora FMS database. - This program can only be executed from the console, and it needs a parameter, the - full path to Pandora FMS 'config.php' file. - - Usage: - php pandora_diag.php path_to_pandora_console - - Example: - php pandora_diag.php /var/www/pandora_console - -"; - exit; - } - - if (preg_match('/[^a-zA-Z0-9_\/\.]|(\/\/)|(\.\.)/', $argv[1])) { - echo "Invalid path: $argv[1]. Always use absolute paths."; - exit; - } - - include $argv[1].'/include/config.php'; -} else { - if (file_exists('../include/config.php')) { - include '../include/config.php'; - } - - // Not from console, this is a web session. - if ((!isset($config['id_user'])) || (!check_acl($config['id_user'], 0, 'PM'))) { - echo "

You don't have privileges to use diagnostic tool

"; - echo '

Please login with an administrator account before try to use this tool

'; - exit; - } - - // Header. - ui_print_page_header( - __('Pandora FMS Diagnostic tool'), - '', - false, - 'diagnostic_tool_tab', - true - ); - - echo ""; - echo "'; -} - -render_row($build_version, 'Pandora FMS Build'); -render_row($pandora_version, 'Pandora FMS Version'); -render_info_data("SELECT value FROM tconfig where token ='MR'", 'Minor Release'); -render_row($config['homedir'], 'Homedir'); -render_row($config['homeurl'], 'HomeUrl'); -render_info_data( - "SELECT `value` - FROM tconfig - WHERE `token` = 'enterprise_installed'", - 'Enterprise installed' -); - - $full_key = db_get_sql( - "SELECT value - FROM tupdate_settings - WHERE `key` = 'customer_key'" - ); - - $compressed_key = substr($full_key, 0, 5).'...'.substr($full_key, -5); - - render_row($compressed_key, 'Update Key'); - - render_info_data( - "SELECT value - FROM tupdate_settings - WHERE `key` = 'updating_code_path'", - 'Updating code path' - ); - - render_info_data( - "SELECT value - FROM tupdate_settings - WHERE `key` = 'current_update'", - 'Current Update #' - ); - - - echo "'; - - - render_row(phpversion(), 'PHP Version'); - - render_row(ini_get('max_execution_time').' seconds', 'PHP Max execution time'); - - render_row(ini_get('max_input_time').' seconds', 'PHP Max input time'); - - render_row(ini_get('memory_limit'), 'PHP Memory limit'); - - render_row(ini_get('session.cookie_lifetime'), 'Session cookie lifetime'); - - echo "'; - - render_info_data('SELECT COUNT(*) FROM tagente', 'Total agents'); - render_info_data('SELECT COUNT(*) FROM tagente_modulo', 'Total modules'); - render_info_data('SELECT COUNT(*) FROM tgrupo', 'Total groups'); - render_info_data('SELECT COUNT(*) FROM tagente_datos', 'Total module data records'); - render_info_data('SELECT COUNT(*) FROM tagent_access', 'Total agent access record'); - render_info_data('SELECT COUNT(*) FROM tevento', 'Total events'); - - if ($config['enterprise_installed']) { - render_info_data('SELECT COUNT(*) FROM ttrap', 'Total traps'); - } - - render_info_data('SELECT COUNT(*) FROM tusuario', 'Total users'); - render_info_data('SELECT COUNT(*) FROM tsesion', 'Total sessions'); - - echo "'; - - render_info_data( - 'SELECT COUNT( DISTINCT tagente.id_agente) - FROM tagente_estado, tagente, tagente_modulo - WHERE tagente.disabled = 0 - AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo - AND tagente_modulo.disabled = 0 - AND tagente_estado.id_agente = tagente.id_agente - AND tagente_estado.estado = 3', - 'Total unknown agents' - ); - - render_info_data( - 'SELECT COUNT(tagente_estado.estado) - FROM tagente_estado - WHERE tagente_estado.estado = 4', - 'Total not-init modules' - ); - - - $last_run_difference = ''; - - $diferencia = (time() - date( - db_get_sql( - "SELECT `value` - FROM tconfig - WHERE `token` = 'db_maintance'" - ) - )); - - $last_run_difference_months = 0; - $last_run_difference_weeks = 0; - $last_run_difference_days = 0; - $last_run_difference_minutos = 0; - $last_run_difference_seconds = 0; - - while ($diferencia >= 2419200) { - $diferencia -= 2419200; - $last_run_difference_months++; - } - - while ($diferencia >= 604800) { - $diferencia -= 604800; - $last_run_difference_weeks++; - } - - while ($diferencia >= 86400) { - $diferencia -= 86400; - $last_run_difference_days++; - } - - while ($diferencia >= 3600) { - $diferencia -= 3600; - $last_run_difference_hours++; - } - - while ($diferencia >= 60) { - $diferencia -= 60; - $last_run_difference_minutes++; - } - - $last_run_difference_seconds = $diferencia; - - if ($last_run_difference_months > 0) { - $last_run_difference .= $last_run_difference_months.'month/s '; - } - - if ($last_run_difference_weeks > 0) { - $last_run_difference .= $last_run_difference_weeks.' week/s '; - } - - if ($last_run_difference_days > 0) { - $last_run_difference .= $last_run_difference_days.' day/s '; - } - - if ($last_run_difference_hours > 0) { - $last_run_difference .= $last_run_difference_hours.' hour/s '; - } - - if ($last_run_difference_minutes > 0) { - $last_run_difference .= $last_run_difference_minutes.' minute/s '; - } - - $last_run_difference .= $last_run_difference_seconds.' second/s ago'; - - render_row( - date( - 'Y/m/d H:i:s', - db_get_sql( - "SELECT `value` - FROM tconfig - WHERE `token` = 'db_maintance'" - ) - ).' ('.$last_run_difference.')'.' *', - 'PandoraDB Last run' - ); - - echo "'; - - switch ($config['dbtype']) { - case 'mysql': - render_info_data( - "SELECT `value` - FROM tconfig - WHERE `token` = 'db_scheme_first_version'", - 'DB Schema Version (first installed)' - ); - render_info_data( - "SELECT `value` - FROM tconfig - WHERE `token` = 'db_scheme_version'", - 'DB Schema Version (actual)' - ); - render_info_data( - "SELECT `value` - FROM tconfig - WHERE `token` = 'db_scheme_build'", - 'DB Schema Build' - ); - - render_row(get_value_sum($db_size).'M', 'DB Size'); - - - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - echo "'; - - $output = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"'; - $output2 = 'cat /proc/cpuinfo | grep "processor" | wc -l'; - - render_row(exec($output).' x '.exec($output2), 'CPU'); - - $output = 'cat /proc/meminfo | grep "MemTotal"'; - - render_row(exec($output), 'RAM'); - } - break; - - case 'postgresql': - render_info_data( - "SELECT \"value\" - FROM tconfig - WHERE \"token\" = 'db_scheme_version'", - 'DB Schema Version' - ); - render_info_data( - "SELECT \"value\" - FROM tconfig - WHERE \"token\" = 'db_scheme_build'", - 'DB Schema Build' - ); - render_info_data( - "SELECT \"value\" - FROM tconfig - WHERE \"token\" = 'enterprise_installed'", - 'Enterprise installed' - ); - render_row( - date( - 'Y/m/d H:i:s', - db_get_sql( - "SELECT \"value\" - FROM tconfig WHERE \"token\" = 'db_maintance'" - ) - ), - 'PandoraDB Last run' - ); - - render_info_data( - "SELECT value - FROM tupdate_settings - WHERE \"key\" = 'customer_key';", - 'Update Key' - ); - render_info_data( - "SELECT value - FROM tupdate_settings - WHERE \"key\" = 'updating_code_path'", - 'Updating code path' - ); - render_info_data( - "SELECT value - FROM tupdate_settings - WHERE \"key\" = 'current_update'", - 'Current Update #' - ); - break; - - case 'oracle': - render_info_data( - "SELECT value - FROM tconfig - WHERE token = 'db_scheme_version'", - 'DB Schema Version' - ); - render_info_data( - "SELECT value - FROM tconfig - WHERE token = 'db_scheme_build'", - 'DB Schema Build' - ); - render_info_data( - "SELECT value - FROM tconfig - WHERE token = 'enterprise_installed'", - 'Enterprise installed' - ); - render_row( - db_get_sql( - "SELECT value - FROM tconfig - WHERE token = 'db_maintance'" - ), - 'PandoraDB Last run' - ); - - render_info_data( - 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings - WHERE \"key\" = 'customer_key'", - 'Update Key' - ); - render_info_data( - 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings - WHERE \"key\" = 'updating_code_path'", - 'Updating code path' - ); - render_info_data( - 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings - WHERE \"key\" = 'current_update'", - 'Current Update #' - ); - break; - } - - $innodb_log_file_size = (db_get_value_sql('SELECT @@innodb_log_file_size') / 1048576); - $innodb_log_buffer_size = (db_get_value_sql('SELECT @@innodb_log_buffer_size') / 1048576); - $innodb_flush_log_at_trx_commit = db_get_value_sql('SELECT @@innodb_flush_log_at_trx_commit'); - $max_allowed_packet = (db_get_value_sql('SELECT @@max_allowed_packet') / 1048576); - $innodb_buffer_pool_size = (db_get_value_sql('SELECT @@innodb_buffer_pool_size') / 1024); - $sort_buffer_size = number_format((db_get_value_sql('SELECT @@sort_buffer_size') / 1024), 2); - $join_buffer_size = (db_get_value_sql('SELECT @@join_buffer_size') / 1024); - $query_cache_type = db_get_value_sql('SELECT @@query_cache_type'); - $query_cache_size = (db_get_value_sql('SELECT @@query_cache_size') / 1048576); - $query_cache_limit = (db_get_value_sql('SELECT @@query_cache_limit') / 1048576); - $innodb_lock_wait_timeout = db_get_value_sql('SELECT @@innodb_lock_wait_timeout'); - $thread_cache_size = db_get_value_sql('SELECT @@thread_cache_size'); - $thread_stack = (db_get_value_sql('SELECT @@thread_stack') / 1024); - $max_connections = db_get_value_sql('SELECT @@max_connections'); - $key_buffer_size = (db_get_value_sql('SELECT @@key_buffer_size') / 1024); - $read_buffer_size = (db_get_value_sql('SELECT @@read_buffer_size') / 1024); - $read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024); - $query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024); - $innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table'); - echo "'; - - render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size '); - render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size '); - render_row(status_values($innodb_flush_log_at_trx_commit_min_rec_value, $innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ', 'InnoDB flush log at trx-commit '); - render_row(status_values($max_allowed_packet_min_rec_value, $max_allowed_packet), 'Maximun allowed packet ', 'Maximun allowed packet '); - render_row(status_values($innodb_buffer_pool_size_min_rec_value, $innodb_buffer_pool_size), 'InnoDB buffer pool size ', 'InnoDB buffer pool size '); - render_row(status_values($sort_buffer_size_min_rec_value, $sort_buffer_size), 'Sort buffer size ', 'Sort buffer size '); - render_row(status_values($join_buffer_size_min_rec_value, $join_buffer_size), 'Join buffer size ', 'Join buffer size '); - render_row(status_values($query_cache_type_min_rec_value, $query_cache_type), 'Query cache type ', 'Query cache type '); - render_row(status_values($query_cache_size_min_rec_value, $query_cache_size), 'Query cache size ', 'Query cache size '); - render_row(status_values($query_cache_limit_min_rec_value, $query_cache_limit), 'Query cache limit ', 'Query cache limit '); - render_row(status_values($innodb_lock_wait_timeout_max_rec_value, $innodb_lock_wait_timeout), 'InnoDB lock wait timeout ', 'InnoDB lock wait timeout '); - render_row(status_values($thread_cache_size_max_rec_value, $thread_cache_size), 'Thread cache size ', 'Thread cache size '); - render_row(status_values($thread_stack_min_rec_value, $thread_stack), 'Thread stack ', 'Thread stack '); - render_row(status_values($max_connections_max_rec_value, $max_connections), 'Maximum connections ', 'Maximun connections '); - render_row(status_values($key_buffer_size_min_rec_value, $key_buffer_size), 'Key buffer size ', 'Key buffer size '); - render_row(status_values($read_buffer_size_min_rec_value, $read_buffer_size), 'Read buffer size ', 'Read buffer size '); - render_row(status_values($read_rnd_buffer_size_min_rec_value, $read_rnd_buffer_size), 'Read rnd-buffer size ', 'Read rnd-buffer size '); - render_row(status_values($query_cache_min_res_unit_min_rec_value, $query_cache_min_res_unit), 'Query cache min-res-unit ', 'Query cache min-res-unit '); - render_row(status_values($innodb_file_per_table_min_rec_value, $innodb_file_per_table), 'InnoDB file per table ', 'InnoDB file per table '); - echo "'; - - - - render_row($tables_fragmentation_max_rec_value.'%', 'Tables fragmentation (maximum recommended value)'); - render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)'); - render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Table fragmentation status'); - - echo "'; - - render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)'); - render_row(get_status_logs($path_server_logs), 'Status server logs'); - render_row(number_format((get_logs_size($path_err_logs) / 1048576), 3).'M', 'Size error logs (current value)'); - render_row(get_status_logs($path_err_logs), 'Status error logs'); - render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)'); - render_row(get_status_logs($path_console_logs), 'Status console logs'); - - echo "'; - - render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key'); - render_row($license['expiry_date'], $license['expiry_caption']); - render_row($license['limit'].' agents', 'Platform Limit'); - render_row($license['count'].' agents', 'Current Platform Count'); - render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)'); - render_row($license['count_disabled'].' agents', 'Current Platform Count (disabled: items)'); - render_row($license['license_mode'], 'License Mode'); - render_row(status_license_params($license['nms']), 'Network Management System'); - render_row(status_license_params($license['dhpm']), 'Satellite'); - render_row($license['licensed_to'], 'Licensed to'); - render_row(license_capacity(), 'Status of agents capacity'); - render_row(percentage_modules_per_agent(), 'Status of average modules per agent'); - render_row(interval_average_of_network_modules(), 'Interval average of the network modules'); - - echo "'; - - render_row($attachment_total_files, 'Total files in the attached folder'); - render_row(files_attachment_folder($attachment_total_files), 'Status of the attachment folder'); - - echo "'; - - render_row($tagente_datos_size, 'Total data in tagente_datos table'); - render_row(status_tagente_datos($tagente_datos_size), 'Tangente_datos table status'); - render_row(execution_time(), 'Execution time degradation when executing a count'); - - echo "'; - - render_row($total_server_threads, 'Total server threads'); - render_row($percentage_threads_ram.'%', 'Percentage of threads used by the RAM'); - render_row($percentage_threads_cpu.'%', 'Percentage of threads used by the CPU'); - - echo "'; - - $server_name = db_get_value_sql('SELECT name FROM tserver WHERE master = 1'); - $agent_id = db_get_value_sql("SELECT id_agente FROM tagente WHERE nombre = '$server_name'"); - - $id_modules = agents_get_modules($agent_id); - - $id_modules = [ - modules_get_agentmodule_id('Agents_Unknown', $agent_id), - modules_get_agentmodule_id('Database Maintenance', $agent_id), - modules_get_agentmodule_id('FreeDisk_SpoolDir', $agent_id), - modules_get_agentmodule_id('Free_RAM', $agent_id), - modules_get_agentmodule_id('Queued_Modules', $agent_id), - modules_get_agentmodule_id('Status', $agent_id), - modules_get_agentmodule_id('System_Load_AVG', $agent_id), - modules_get_agentmodule_id('Execution_time', $agent_id), - ]; - - foreach ($id_modules as $id_module) { - $params = [ - 'agent_module_id' => $id_module['id_agente_modulo'], - 'period' => SECONDS_1MONTH, - 'date' => time(), - 'height' => '150', - ]; - render_row(grafico_modulo_sparse($params), 'Graph of the '.$id_module['nombre'].' module.'); - } - - if ($console_mode == 0) { - echo '
".__('Pandora status info').'
".__('PHP setup').'
".__('Database size stats').'
".__('Database sanity').'
".__('Database status info').'
".__('System info').'
".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).'
".__('Tables fragmentation in the Pandora FMS database').'
".__(' Pandora FMS logs dates').'
".__(' Pandora FMS Licence Information').'
".__(' Status of the attachment folder').'
".__(' Information from the tagente_datos table').'
".__(' Pandora FMS server threads').'
".__(' Graphs modules that represent the self-monitoring system').'
'; - } - - echo "
"; - - echo ''.__( - '(*) Please check your Pandora Server setup and make sure that the database maintenance daemon is running. It\' is very important to - keep the database up-to-date to get the best performance and results in Pandora' - ).'


'; +// remove 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 6476e79e2b..ca415cd52a 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 @@ -60,6 +60,10 @@ ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL def ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` MODIFY COLUMN `ff_type` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0', + MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0'; + -- ----------------------------------------------------- -- Table `tpolicy_modules` -- ----------------------------------------------------- @@ -138,6 +142,10 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` ( ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tpolicy_modules` MODIFY COLUMN `ip_target` varchar(100) NULL DEFAULT '', + MODIFY COLUMN `ff_type` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0', + MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tpolicies` @@ -187,6 +195,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` ( ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0'; ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`); +ALTER TABLE `tpolicy_agents` DROP INDEX `id_policy`, ADD UNIQUE INDEX `id_policy` (`id_policy`, `id_agent`, `id_node`), DROP INDEX `id_policy_2`; -- ----------------------------------------------------- -- Table `tpolicy_groups` @@ -377,6 +386,12 @@ ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text; ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text; ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text; +ALTER TABLE `tmetaconsole_setup` MODIFY COLUMN `meta_dbuser` text NULL, + MODIFY COLUMN `meta_dbpass` text NULL, + MODIFY COLUMN `meta_dbhost` text NULL, + MODIFY COLUMN `meta_dbport` text NULL, + MODIFY COLUMN `meta_dbname` text NULL; + -- --------------------------------------------------------------------- -- Table `tprofile_view` -- --------------------------------------------------------------------- @@ -564,6 +579,39 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0; +ALTER TABLE `tevent_rule` ADD COLUMN `log_content` TEXT; +ALTER TABLE `tevent_rule` ADD COLUMN `log_source` TEXT; +ALTER TABLE `tevent_rule` ADD COLUMN `log_agent` TEXT; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_agent` text COMMENT 'Operator for agent'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_usuario` text COMMENT 'Operator for id_usuario'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_grupo` text COMMENT 'Operator for id_grupo'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_evento` text COMMENT 'Operator for evento'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_event_type` text COMMENT 'Operator for event_type'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_module` text COMMENT 'Operator for module'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_alert` text COMMENT 'Operator for alert'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_criticity` text COMMENT 'Operator for criticity'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_user_comment` text COMMENT 'Operator for user_comment'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_id_tag` text COMMENT 'Operator for id_tag'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_content` text COMMENT 'Operator for log_content'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_source` text COMMENT 'Operator for log_source'; +ALTER TABLE `tevent_rule` ADD COLUMN `operator_log_agent` text COMMENT 'Operator for log_agent'; +ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` enum('','unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal') default ''; +ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` int(4) unsigned DEFAULT NULL; +ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` mediumint(4) DEFAULT NULL; + +UPDATE `tevent_rule` SET `operator_agent` = "REGEX" WHERE `agent` != ''; +UPDATE `tevent_rule` SET `operator_id_usuario` = "REGEX" WHERE `id_usuario` != ''; +UPDATE `tevent_rule` SET `operator_id_grupo` = "REGEX" WHERE `id_grupo` > 0; +UPDATE `tevent_rule` SET `operator_evento` = "REGEX" WHERE `evento` != ''; +UPDATE `tevent_rule` SET `operator_event_type` = "REGEX" WHERE `event_type` != ''; +UPDATE `tevent_rule` SET `operator_module` = "REGEX" WHERE `module` != ''; +UPDATE `tevent_rule` SET `operator_alert` = "REGEX" WHERE `alert` != ''; +UPDATE `tevent_rule` SET `operator_criticity` = "REGEX" WHERE `criticity` != '99'; +UPDATE `tevent_rule` SET `operator_user_comment` = "REGEX" WHERE `user_comment` != ''; +UPDATE `tevent_rule` SET `operator_id_tag` = "REGEX" WHERE `id_tag` > 0; +UPDATE `tevent_rule` SET `operator_log_content` = "REGEX" WHERE `log_content` != ''; +UPDATE `tevent_rule` SET `operator_log_source` = "REGEX" WHERE `log_source` != ''; +UPDATE `tevent_rule` SET `operator_log_agent` = "REGEX" WHERE `log_agent` != ''; -- ----------------------------------------------------- -- Table `tevent_alert` @@ -612,6 +660,9 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0; +ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400; + -- ----------------------------------------------------- -- Table `tevent_alert_action` -- ----------------------------------------------------- @@ -713,6 +764,8 @@ CREATE TABLE IF NOT EXISTS `treport_template` ( `footer` MEDIUMTEXT default NULL, `custom_font` varchar(200) default NULL, `metaconsole` tinyint(1) DEFAULT 0, + `agent_regex` varchar(600) NOT NULL default '', + PRIMARY KEY(`id_report`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -764,23 +817,6 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; --- ---------------------------------------------------------------------- --- Table `tnews` --- ---------------------------------------------------------------------- -CREATE TABLE IF NOT EXISTS `tnews` ( - `id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `author` varchar(255) NOT NULL DEFAULT '', - `subject` varchar(255) NOT NULL DEFAULT '', - `text` TEXT NOT NULL, - `timestamp` DATETIME NOT NULL DEFAULT 0, - `id_group` int(10) NOT NULL default 0, - `modal` tinyint(1) DEFAULT 0, - `expire` tinyint(1) DEFAULT 0, - `expire_timestamp` DATETIME NOT NULL DEFAULT 0, - PRIMARY KEY(`id_news`) -) ENGINE = InnoDB DEFAULT CHARSET=utf8; - - ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0'; ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300'; @@ -802,6 +838,28 @@ ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEF ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0'; +ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `lapse_calc` tinyint(1) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `lapse` int(11) unsigned NOT NULL DEFAULT '300', + MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; + +-- ---------------------------------------------------------------------- +-- Table `tnews` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tnews` ( + `id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `author` varchar(255) NOT NULL DEFAULT '', + `subject` varchar(255) NOT NULL DEFAULT '', + `text` TEXT NOT NULL, + `timestamp` DATETIME NOT NULL DEFAULT 0, + `id_group` int(10) NOT NULL default 0, + `modal` tinyint(1) DEFAULT 0, + `expire` tinyint(1) DEFAULT 0, + `expire_timestamp` DATETIME NOT NULL DEFAULT 0, + PRIMARY KEY(`id_news`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) @@ -913,6 +971,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` ( ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL; ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0'; +ALTER TABLE `tmetaconsole_event` ADD INDEX `server_id` (`server_id`); -- --------------------------------------------------------------------- -- Table `tmetaconsole_event_history` @@ -1048,6 +1107,14 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tmetaconsole_agent` ADD COLUMN `remote` tinyint(1) NOT NULL DEFAULT '0', + ADD COLUMN `cascade_protection_module` int(10) unsigned NULL DEFAULT '0', + ADD COLUMN `transactional_agent` tinyint(1) NOT NULL DEFAULT '0', + ADD COLUMN `alias` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + MODIFY COLUMN `update_secondary_groups` tinyint(1) NOT NULL DEFAULT '0', + MODIFY COLUMN `alias_as_name` tinyint(2) NOT NULL DEFAULT '0', + ADD INDEX `id_tagente_idx` (`id_tagente`); + -- --------------------------------------------------------------------- -- Table `ttransaction` -- --------------------------------------------------------------------- @@ -1103,6 +1170,8 @@ CREATE TABLE IF NOT EXISTS `titem` ( PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `titem` MODIFY COLUMN `source_data` varchar(250) NULL DEFAULT ''; + -- --------------------------------------------------------------------- -- Table `tmap` -- --------------------------------------------------------------------- @@ -1129,7 +1198,6 @@ CREATE TABLE IF NOT EXISTS `tmap` ( PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; - -- --------------------------------------------------------------------- -- Table `trel_item` -- --------------------------------------------------------------------- @@ -1147,6 +1215,10 @@ CREATE TABLE IF NOT EXISTS `trel_item` ( PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `trel_item` MODIFY COLUMN `id_map` int(10) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `id_parent_source_data` int(10) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `id_child_source_data` int(10) unsigned NOT NULL DEFAULT '0'; + -- --------------------------------------------------------------------- -- Table `talert_templates` -- --------------------------------------------------------------------- @@ -1170,6 +1242,11 @@ ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; +ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL, + MODIFY COLUMN `al_field12` text NOT NULL, + MODIFY COLUMN `al_field13` text NOT NULL, + MODIFY COLUMN `al_field14` text NOT NULL, + MODIFY COLUMN `al_field15` text NOT NULL; -- --------------------------------------------------------------------- -- Table `talert_snmp_action` @@ -1184,6 +1261,7 @@ ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT ""; -- Table `tserver` -- ---------------------------------------------------------------------- ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0; +ALTER TABLE `tserver` MODIFY COLUMN `server_keepalive` int(11) NOT NULL DEFAULT '0'; -- ---------------------------------------------------------------------- -- Table `tagente_estado` @@ -1195,6 +1273,11 @@ ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL de ALTER TABLE `tagente_estado` ADD COLUMN `ff_normal` int(4) unsigned default '0'; ALTER TABLE `tagente_estado` ADD COLUMN `ff_warning` int(4) unsigned default '0'; ALTER TABLE `tagente_estado` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tagente_estado` MODIFY COLUMN `datos` mediumtext NOT NULL, + MODIFY COLUMN `known_status` tinyint(4) NULL DEFAULT '0', + MODIFY COLUMN `last_known_status` tinyint(4) NULL DEFAULT '0', + MODIFY COLUMN `last_dynamic_update` bigint(20) NOT NULL DEFAULT '0', + MODIFY COLUMN `last_unknown_update` bigint(20) NOT NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `talert_actions` @@ -1218,6 +1301,11 @@ ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT " ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT ""; +ALTER TABLE `talert_actions` MODIFY COLUMN `field11` text NOT NULL, + MODIFY COLUMN `field12` text NOT NULL, + MODIFY COLUMN `field13` text NOT NULL, + MODIFY COLUMN `field14` text NOT NULL, + MODIFY COLUMN `field15` text NOT NULL; -- --------------------------------------------------------------------- -- Table `talert_commands` @@ -1231,15 +1319,12 @@ UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/ht DELETE FROM `talert_commands` WHERE `id` = 11; +ALTER TABLE `talert_commands` MODIFY COLUMN `id_group` mediumint(8) unsigned NULL DEFAULT '0'; + -- --------------------------------------------------------------------- -- Table `tmap` -- --------------------------------------------------------------------- -ALTER TABLE tmap MODIFY `id_user` varchar(128); - --- --------------------------------------------------------------------- --- Table `titem` --- --------------------------------------------------------------------- -ALTER TABLE titem MODIFY `source_data` int(10) unsigned; +ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT ''; -- --------------------------------------------------------------------- -- Table `tconfig` @@ -1247,13 +1332,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 32); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 34); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '739'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '742'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; @@ -1314,6 +1399,9 @@ ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL; ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL; +ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10); +ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL; + -- --------------------------------------------------------------------- -- Table `tusuario` -- --------------------------------------------------------------------- @@ -1328,7 +1416,11 @@ ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL de ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_user` VARCHAR(60); ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_pass` VARCHAR(45); ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_enabled` TINYINT(1); - +ALTER TABLE `tusuario` MODIFY COLUMN `default_event_filter` int(10) unsigned NOT NULL DEFAULT '0', + ADD INDEX `fk_filter_id` (`id_filter`), + ADD CONSTRAINT `fk_filter_id` FOREIGN KEY `fk_filter_id` (`id_filter`) REFERENCES `tevent_filter` (`id_filter`) ON DELETE SET NULL ON UPDATE RESTRICT, + DROP FOREIGN KEY `fk_id_filter`, + DROP INDEX `fk_id_filter`; -- --------------------------------------------------------------------- @@ -1339,14 +1431,23 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned d ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0; ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0; ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0'; -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0'; -ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0'; +ALTER TABLE `tagente_modulo` DROP COLUMN `ff_normal`, + DROP COLUMN `ff_warning`, + DROP COLUMN `ff_critical`, + MODIFY COLUMN `ff_type` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `dynamic_next` bigint(20) NOT NULL DEFAULT '0', + MODIFY COLUMN `dynamic_two_tailed` tinyint(1) unsigned NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tagente_datos` -- --------------------------------------------------------------------- ALTER TABLE tagente_datos MODIFY `datos` double(22,5); +ALTER TABLE `tagente_datos` DROP INDEX `data_index1`, ADD INDEX `data_index1` (`id_agente_modulo`, `utimestamp`); + +-- --------------------------------------------------------------------- +-- Table `tagente_datos_string` +-- --------------------------------------------------------------------- +ALTER TABLE `tagente_datos_string` MODIFY COLUMN `datos` mediumtext NOT NULL, DROP INDEX `data_string_index_1`, ADD INDEX `data_string_index_1` (`id_agente_modulo`, `utimestamp`); -- --------------------------------------------------------------------- -- Table `tagente_datos_inc` @@ -1362,6 +1463,7 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` MODIFY COLUMN `ff_type` tinyint(1) unsigned NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tagente` @@ -1376,6 +1478,12 @@ ALTER TABLE `tagente` ADD COLUMN `cps` int NOT NULL default 0; UPDATE tagente SET tagente.alias = tagente.nombre; +ALTER TABLE `tagente` MODIFY COLUMN `remote` tinyint(1) NOT NULL DEFAULT '0', + MODIFY COLUMN `cascade_protection_module` int(10) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `update_secondary_groups` tinyint(1) NOT NULL DEFAULT '0', + MODIFY COLUMN `alias` varchar(600) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + MODIFY COLUMN `alias_as_name` tinyint(2) NOT NULL DEFAULT '0'; + -- --------------------------------------------------------------------- -- Table `tservice` -- --------------------------------------------------------------------- @@ -1395,6 +1503,8 @@ ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL; UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^\\['; +ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0'; + -- --------------------------------------------------------------------- -- Table `tlayout_data` -- --------------------------------------------------------------------- @@ -1413,6 +1523,13 @@ ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0; ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0; ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `tlayout_data` MODIFY COLUMN `type_graph` varchar(50) NOT NULL DEFAULT 'area', + MODIFY COLUMN `label_position` varchar(50) NOT NULL DEFAULT 'down', + MODIFY COLUMN `linked_layout_node_id` int(10) NOT NULL DEFAULT '0', + MODIFY COLUMN `linked_layout_status_type` enum('default','weight','service') NULL DEFAULT 'default', + MODIFY COLUMN `element_group` int(10) NOT NULL DEFAULT '0', + MODIFY COLUMN `linked_layout_status_as_service_warning` float(20,3) NOT NULL DEFAULT '0.000', + MODIFY COLUMN `linked_layout_status_as_service_critical` float(20,3) NOT NULL DEFAULT '0.000'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1434,6 +1551,7 @@ ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL de 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'; ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE `tgraph` MODIFY COLUMN `percentil` tinyint(1) unsigned NOT NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` @@ -1479,12 +1597,21 @@ ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0'; ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0'; ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL; ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0'; +ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `lapse_calc` tinyint(1) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `lapse` int(11) unsigned NOT NULL DEFAULT '300', + MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0', + MODIFY COLUMN `failover_mode` tinyint(1) NULL DEFAULT '1', + MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; +ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` -- --------------------------------------------------------------------- ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct'; +ALTER TABLE `tmodule_relationship` MODIFY COLUMN `id_server` varchar(100) NOT NULL DEFAULT ''; -- --------------------------------------------------------------------- -- Table `tpolicy_module` @@ -1515,6 +1642,14 @@ ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0'; ALTER TABLE trecon_task ADD `auth_strings` text; ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0'; ALTER TABLE trecon_task ADD `summary` text; +ALTER TABLE `trecon_task` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0', + MODIFY COLUMN `alias_as_name` tinyint(2) NOT NULL DEFAULT '0', + MODIFY COLUMN `snmp_enabled` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `vlan_enabled` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `wmi_enabled` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `auth_strings` text NULL, + MODIFY COLUMN `autoconfiguration_enabled` tinyint(1) unsigned NULL DEFAULT '0', + MODIFY COLUMN `summary` text NULL; -- --------------------------------------------------------------------- -- Table `twidget` AND Table `twidget_dashboard` @@ -1627,12 +1762,14 @@ 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; +ALTER TABLE `tgraph_source` MODIFY COLUMN `id_server` int(11) NOT NULL DEFAULT '0', + MODIFY COLUMN `field_order` int(10) NULL DEFAULT '0'; -- --------------------------------------------------------------------- -- Table `tserver_export_data` -- --------------------------------------------------------------------- -ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) BINARY NOT NULL default ''; +ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) NOT NULL default ''; -- --------------------------------------------------------------------- -- Table `tserver` @@ -1643,6 +1780,7 @@ ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0 -- Table `tevent_response` -- --------------------------------------------------------------------- ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0; +ALTER TABLE tevent_response ADD COLUMN command_timeout int(5) unsigned NOT NULL DEFAULT 90; -- --------------------------------------------------------------------- -- Table `tmodule` @@ -1654,7 +1792,12 @@ INSERT INTO tmodule VALUES (8, 'Wux module'); -- Table `ttipo_modulo` -- --------------------------------------------------------------------- -INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); +INSERT INTO `ttipo_modulo` VALUES +(25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'), +(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'), +(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'), +(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'), +(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png'); -- --------------------------------------------------------------------- -- Table `tdashboard` @@ -1808,6 +1951,7 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`( ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tusuario_perfil ADD COLUMN `no_hierarchy` tinyint(1) NOT NULL default '0'; +ALTER TABLE `tmetaconsole_agent_secondary_group` ADD INDEX `id_tagente` (`id_tagente`); -- --------------------------------------------------------------------- -- Table `tautoconfig` @@ -1907,10 +2051,16 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` ( `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0, `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0, `linked_layout_node_id` INT(10) NOT NULL default 0, + `cache_expiration` INTEGER UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`), FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tlayout_template_data` MODIFY COLUMN `linked_layout_node_id` int(10) NOT NULL DEFAULT '0', + MODIFY COLUMN `linked_layout_status_type` enum('default','weight','service') NULL DEFAULT 'default', + MODIFY COLUMN `linked_layout_status_as_service_warning` float(20,3) NOT NULL DEFAULT '0.000', + MODIFY COLUMN `linked_layout_status_as_service_critical` float(20,3) NOT NULL DEFAULT '0.000'; + -- --------------------------------------------------------------------- -- Table `tlog_graph_models` -- --------------------------------------------------------------------- @@ -1956,6 +2106,7 @@ INSERT INTO tlog_graph_models VALUES (7, 'Users login', ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0; ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical'; +ALTER TABLE `treport` MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT '0' AFTER `non_interactive`; ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1'; ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default ''; @@ -2092,7 +2243,8 @@ ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0'; ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL; ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT ''; ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - +ALTER TABLE `tmensajes` DROP COLUMN `id_usuario_destino`, + ADD UNIQUE INDEX `id_mensaje` (`id_mensaje`); -- ---------------------------------------------------------------------- -- Table `tnotification_user` @@ -2194,7 +2346,7 @@ ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT -- Add column in table `tnetflow_filter` -- ---------------------------------------------------------------------- ALTER TABLE `tnetflow_filter` DROP COLUMN `output`; - +ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL; -- ---------------------------------------------------------------------- -- Update table `tuser_task` @@ -2213,6 +2365,17 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); +ALTER TABLE `talert_templates` MODIFY COLUMN `field11` text NOT NULL, + MODIFY COLUMN `field12` text NOT NULL, + MODIFY COLUMN `field13` text NOT NULL, + MODIFY COLUMN `field14` text NOT NULL, + MODIFY COLUMN `field15` text NOT NULL, + MODIFY COLUMN `field11_recovery` text NOT NULL, + MODIFY COLUMN `field12_recovery` text NOT NULL, + MODIFY COLUMN `field13_recovery` text NOT NULL, + MODIFY COLUMN `field14_recovery` text NOT NULL, + MODIFY COLUMN `field15_recovery` text NOT NULL; + -- --------------------------------------------------------------------- -- Table `tvisual_console_items_cache` -- --------------------------------------------------------------------- @@ -2240,7 +2403,7 @@ CREATE TABLE `tvisual_console_elements_cache` ( CREATE TABLE IF NOT EXISTS `tcredential_store` ( `identifier` varchar(100) NOT NULL, `id_group` mediumint(4) unsigned NOT NULL DEFAULT 0, - `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM', + `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE', 'SAP') default 'CUSTOM', `username` text, `password` text, `extra_1` text, @@ -2293,3 +2456,55 @@ CREATE TABLE `tdeployment_hosts` ( FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`) ON UPDATE CASCADE ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tremote_command` +-- ---------------------------------------------------------------------- +CREATE TABLE `tremote_command` ( + `id` SERIAL, + `name` varchar(150) NOT NULL, + `timeout` int(10) unsigned NOT NULL default 30, + `retries` int(10) unsigned NOT NULL default 3, + `preconditions` text, + `script` text, + `postconditions` text, + `utimestamp` int(20) unsigned NOT NULL default 0, + `id_group` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------------------------------------------------- +-- Table `tremote_command_target` +-- ---------------------------------------------------------------------- +CREATE TABLE `tremote_command_target` ( + `id` SERIAL, + `rcmd_id` bigint unsigned NOT NULL, + `id_agent` int(10) unsigned NOT NULL, + `utimestamp` int(20) unsigned NOT NULL default 0, + `stdout` MEDIUMTEXT, + `stderr` MEDIUMTEXT, + `errorlevel` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`), + FOREIGN KEY (`rcmd_id`) REFERENCES `tremote_command`(`id`) + ON UPDATE CASCADE ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +========= +-- --------------------------------------------------------------------- +-- Table `trecon_script` +-- --------------------------------------------------------------------- +ALTER TABLE `trecon_script` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0'; + +-- --------------------------------------------------------------------- +-- Table `tusuario_perfil` +-- --------------------------------------------------------------------- +ALTER TABLE `tusuario_perfil` MODIFY COLUMN `no_hierarchy` tinyint(1) NOT NULL DEFAULT '0'; + + +-- Extra tnetwork_component +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('N. total processes','Number of running processes in a Windows system.',11,34,0,0,300,0,'tasklist /NH | find /c /v ""','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Free space in C:','Free space available in C:',11,34,0,0,300,0,'powershell $obj=(Get-WmiObject -class "Win32_LogicalDisk" -namespace "root\CIMV2") ; $obj.FreeSpace[0] * 100 /$obj.Size[0]','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux uptime','System uptime',43,36,0,0,300,0,'uptime |sed s/us\.*$//g | sed s/,\.*$//g','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux processes','Running processes',43,34,0,0,300,0,'ps elf | wc -l','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux system load','Current load (5 min)',43,34,0,0,300,0,'uptime | awk '{print $(NF-1)}' | tr -d ','','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available memory percent','Available memory %',43,34,0,0,300,0,'free | grep Mem | awk '{print $NF/$2 * 100}'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); +INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux available disk /','Available free space in mountpoint /',43,34,0,0,300,0,'df / | tail -n +2 | awk '{print $(NF-1)}' | tr -d '%'','','','',4,2,0,'','','',0,0,1,0.00,0.00,'0.00',0.00,0.00,'',0,'','inherited','',0,0,0.000000000000000,'','nowizard','','nowizard','0','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0); diff --git a/pandora_console/general/alert_enterprise.php b/pandora_console/general/alert_enterprise.php index 69a09d2998..4cb4a29740 100644 --- a/pandora_console/general/alert_enterprise.php +++ b/pandora_console/general/alert_enterprise.php @@ -105,7 +105,7 @@ if (check_login()) { echo __( "This is the online help for %s console. This help is -in best cases- just a brief contextual help, not intented to teach you how to use %s. Official documentation of %s is about 900 pages, and you probably don't need to read it entirely, but sure, you should download it and take a look.

- Download the official documentation", + Download the official documentation", get_product_name(), get_product_name(), get_product_name(), diff --git a/pandora_console/general/firts_task/HA_cluster_builder.php b/pandora_console/general/first_task/HA_cluster_builder.php similarity index 95% rename from pandora_console/general/firts_task/HA_cluster_builder.php rename to pandora_console/general/first_task/HA_cluster_builder.php index 6d82d94ad0..7ae56a4287 100644 --- a/pandora_console/general/firts_task/HA_cluster_builder.php +++ b/pandora_console/general/first_task/HA_cluster_builder.php @@ -33,13 +33,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) { exit; } -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]); ?>
- __('Clusters')]); ?> + __('Clusters')]); ?>

diff --git a/pandora_console/general/firts_task/cluster_builder.php b/pandora_console/general/first_task/cluster_builder.php similarity index 96% rename from pandora_console/general/firts_task/cluster_builder.php rename to pandora_console/general/first_task/cluster_builder.php index ba9d8c311a..e80d4e4b15 100644 --- a/pandora_console/general/firts_task/cluster_builder.php +++ b/pandora_console/general/first_task/cluster_builder.php @@ -24,7 +24,7 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], return; } -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no clusters defined yet.') ]); @@ -32,7 +32,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
- __('Clusters')]); ?> + __('Clusters')]); ?>

diff --git a/pandora_console/general/firts_task/collections.php b/pandora_console/general/first_task/collections.php similarity index 98% rename from pandora_console/general/firts_task/collections.php rename to pandora_console/general/first_task/collections.php index 8e27ce6ee3..2ca4583bb9 100755 --- a/pandora_console/general/firts_task/collections.php +++ b/pandora_console/general/first_task/collections.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no collections defined yet.') ]); ?> diff --git a/pandora_console/general/firts_task/custom_fields.php b/pandora_console/general/first_task/custom_fields.php similarity index 94% rename from pandora_console/general/firts_task/custom_fields.php rename to pandora_console/general/first_task/custom_fields.php index 7d07ff9495..30f5b839c6 100644 --- a/pandora_console/general/firts_task/custom_fields.php +++ b/pandora_console/general/first_task/custom_fields.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no custom fields defined yet.') ]); @@ -21,7 +21,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
- __('Custom Fields')]); ?> + __('Custom Fields')]); ?>

diff --git a/pandora_console/general/firts_task/custom_graphs.php b/pandora_console/general/first_task/custom_graphs.php similarity index 94% rename from pandora_console/general/firts_task/custom_graphs.php rename to pandora_console/general/first_task/custom_graphs.php index e22187c6f5..d49001449a 100644 --- a/pandora_console/general/firts_task/custom_graphs.php +++ b/pandora_console/general/first_task/custom_graphs.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no custom graphs defined yet.') ]); @@ -21,7 +21,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom

- __('Custom Graphs')]); ?> + __('Custom Graphs')]); ?>

diff --git a/pandora_console/general/firts_task/fields_manager.php b/pandora_console/general/first_task/fields_manager.php similarity index 94% rename from pandora_console/general/firts_task/fields_manager.php rename to pandora_console/general/first_task/fields_manager.php index f81de216db..2ef6e70f55 100755 --- a/pandora_console/general/firts_task/fields_manager.php +++ b/pandora_console/general/first_task/fields_manager.php @@ -13,13 +13,13 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no custom fields defined yet.') ]); ?>

- __('Fields Manager')]); ?> + __('Fields Manager')]); ?>

diff --git a/pandora_console/general/firts_task/incidents.php b/pandora_console/general/first_task/incidents.php similarity index 95% rename from pandora_console/general/firts_task/incidents.php rename to pandora_console/general/first_task/incidents.php index daa83588e3..20630ff5e3 100644 --- a/pandora_console/general/firts_task/incidents.php +++ b/pandora_console/general/first_task/incidents.php @@ -15,7 +15,7 @@ global $config; global $incident_w; global $incident_m; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no incidents defined yet.') ]); @@ -25,7 +25,7 @@ if ($incident_w || $incident_m) {

- __('Incidents')]); ?> + __('Incidents')]); ?>

diff --git a/pandora_console/general/firts_task/map_builder.php b/pandora_console/general/first_task/map_builder.php similarity index 95% rename from pandora_console/general/firts_task/map_builder.php rename to pandora_console/general/first_task/map_builder.php index 352f7374e5..509f967195 100755 --- a/pandora_console/general/firts_task/map_builder.php +++ b/pandora_console/general/first_task/map_builder.php @@ -15,7 +15,7 @@ global $config; global $vconsoles_write; global $vconsoles_manage; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ui_print_info_message( [ @@ -28,7 +28,7 @@ if ($vconsoles_write || $vconsoles_manage) {

- __('Visual Console')]); ?> + __('Visual Console')]); ?>

diff --git a/pandora_console/general/firts_task/network_map.php b/pandora_console/general/first_task/network_map.php similarity index 95% rename from pandora_console/general/firts_task/network_map.php rename to pandora_console/general/first_task/network_map.php index 0526f936aa..f1de76c08b 100755 --- a/pandora_console/general/firts_task/network_map.php +++ b/pandora_console/general/first_task/network_map.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no network map defined yet.') ]); @@ -23,7 +23,7 @@ $networkmap_types = networkmap_get_types($strict_user);

- __('Network Map')]); ?> + __('Network Map')]); ?>

diff --git a/pandora_console/general/first_task/omnishell.php b/pandora_console/general/first_task/omnishell.php new file mode 100644 index 0000000000..948204917c --- /dev/null +++ b/pandora_console/general/first_task/omnishell.php @@ -0,0 +1,56 @@ + + true, 'message' => __('There is no command defined yet.') ]); ?> + +

+
+ __('Omnishell')]); ?> +
+
+

+ '.__( + 'Omnishell is an enterprise feature which allows you to execute a structured command along any agent in your %s. The only requirement is to have remote configuration enabled in your agent.', + io_safe_output(get_product_name()) + ).'

'; + + echo '

'.__( + 'You can execute any command on as many agents you need, and check the execution on all of them using the Omnishell Command View' + ).'

'; + ?> +

+ +
+ +
+ +
+
diff --git a/pandora_console/general/firts_task/planned_downtime.php b/pandora_console/general/first_task/planned_downtime.php similarity index 89% rename from pandora_console/general/firts_task/planned_downtime.php rename to pandora_console/general/first_task/planned_downtime.php index dcd98fdebb..83c6cd9384 100644 --- a/pandora_console/general/firts_task/planned_downtime.php +++ b/pandora_console/general/first_task/planned_downtime.php @@ -13,13 +13,13 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no planned downtime defined yet.') ]); ?>
- __('Planned Downtime')]); ?> + __('Planned Downtime')]); ?>

@@ -33,7 +33,7 @@ ui_require_css_file('firts_task'); ); ?>

-
+
diff --git a/pandora_console/general/firts_task/recon_view.php b/pandora_console/general/first_task/recon_view.php similarity index 95% rename from pandora_console/general/firts_task/recon_view.php rename to pandora_console/general/first_task/recon_view.php index 8c59b23f64..9eee373dec 100755 --- a/pandora_console/general/firts_task/recon_view.php +++ b/pandora_console/general/first_task/recon_view.php @@ -13,13 +13,13 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no discovery tasks defined yet.') ]); ?>
- __('Discovery server')]); ?> + __('Discovery server')]); ?>

diff --git a/pandora_console/general/firts_task/service_list.php b/pandora_console/general/first_task/service_list.php similarity index 95% rename from pandora_console/general/firts_task/service_list.php rename to pandora_console/general/first_task/service_list.php index 424bc60400..f4a56a826b 100755 --- a/pandora_console/general/firts_task/service_list.php +++ b/pandora_console/general/first_task/service_list.php @@ -15,14 +15,14 @@ global $config; global $agent_w; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no services defined yet.') ]); ?>

- __('Services')]); ?> + __('Services')]); ?>

diff --git a/pandora_console/general/firts_task/snmp_filters.php b/pandora_console/general/first_task/snmp_filters.php similarity index 95% rename from pandora_console/general/firts_task/snmp_filters.php rename to pandora_console/general/first_task/snmp_filters.php index 602702da69..724c9da31f 100755 --- a/pandora_console/general/firts_task/snmp_filters.php +++ b/pandora_console/general/first_task/snmp_filters.php @@ -13,13 +13,13 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no SNMP filter defined yet.') ]); ?>

- __('SNMP Filter')]); ?> + __('SNMP Filter')]); ?>

diff --git a/pandora_console/general/firts_task/tags.php b/pandora_console/general/first_task/tags.php similarity index 94% rename from pandora_console/general/firts_task/tags.php rename to pandora_console/general/first_task/tags.php index 38c006d3b2..ea8086357c 100755 --- a/pandora_console/general/firts_task/tags.php +++ b/pandora_console/general/first_task/tags.php @@ -13,13 +13,13 @@ // GNU General Public License for more details. global $config; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no tags defined yet.') ]); ?>

- __('Tags')]); ?> + __('Tags')]); ?>

diff --git a/pandora_console/general/firts_task/transactional_list.php b/pandora_console/general/first_task/transactional_list.php similarity index 95% rename from pandora_console/general/firts_task/transactional_list.php rename to pandora_console/general/first_task/transactional_list.php index 6edc964ad7..40381f2da8 100644 --- a/pandora_console/general/firts_task/transactional_list.php +++ b/pandora_console/general/first_task/transactional_list.php @@ -15,7 +15,7 @@ global $config; global $networkmaps_write; global $networkmaps_manage; check_login(); -ui_require_css_file('firts_task'); +ui_require_css_file('first_task'); ?> true, 'message' => __('There are no transactions defined yet.') ]); @@ -25,7 +25,7 @@ if ($networkmaps_write || $networkmaps_manage) {

- __('Transactions')]); ?> + __('Transactions')]); ?>

diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 99bb38cc21..b0bc0bf1d1 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -13,6 +13,8 @@ require_once 'include/functions_messages.php'; require_once 'include/functions_servers.php'; require_once 'include/functions_notifications.php'; +require_once 'include/ajax/order_interpreter.php'; +ui_require_css_file('order_interpreter'); // Check permissions // Global errors/warnings checking. @@ -99,7 +101,8 @@ if ($config['menu_type'] == 'classic') { if ($acl_head_search) { // Search bar. - $search_bar = '

'; + $search_bar = ''; + ''; if (!isset($config['search_keywords'])) { $search_bar .= ''; } else { @@ -110,7 +113,7 @@ if ($config['menu_type'] == 'classic') { } } - $search_bar .= ''; + $search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" + onkeyup="showinterpreter()" class="search_input"/>'; + + $search_bar .= '
'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; $search_bar .= ""; $search_bar .= '
'; @@ -328,22 +333,40 @@ if ($config['menu_type'] == 'classic') { $header_autorefresh_counter .= $autorefresh_additional; $header_autorefresh_counter .= '
'; + // Button for feedback pandora. + if (enterprise_installed()) { + $header_feedback = '
'; + $header_feedback .= ''; + $header_feedback .= ''; + $header_feedback .= html_print_image( + '/images/feedback-header.png', + true, + [ + 'title' => __('Feedback'), + 'id' => 'feedback-header', + 'alt' => __('Feedback'), + 'style' => 'cursor: pointer;', + ] + ); + $header_feedback .= '
'; + } + // Support. - if (defined('PANDORA_ENTERPRISE')) { - $header_support_link = 'https://support.artica.es/'; + if (enterprise_installed()) { + $header_support_link = $config['custom_support_url']; } else { $header_support_link = 'https://pandorafms.com/forums/'; } $header_support = ''; // Documentation. $header_docu = ''; @@ -388,9 +411,9 @@ if ($config['menu_type'] == 'classic') { echo '
'.$config['custom_title_header'].''.$config['custom_subtitle_header'].'
'.$header_searchbar.'
-
'.$header_chat, $header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_support, $header_docu, $header_user, $header_logout.'
'; +
'.$header_chat, $header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'
'; ?> -
+
@@ -604,14 +627,126 @@ if ($config['menu_type'] == 'classic') { }); } - // Resize event + // Resize event. window.addEventListener("resize", function() { attatch_to_image(); }); var fixed_header = ; - + var new_chat = ; + + function showinterpreter(){ + + document.onclick = function(e) { + $('#result_order').hide(); + $('#keywords').addClass('search_input'); + $('#keywords').removeClass('results-found'); + $('#keywords').value = ''; + $('#keywords').attr('placeholder','Enter keywords to search'); + } + + if(event.keyCode == 13 && $("#result_items li.active").length != 0 ) + { + window.location = $('#result_items').find("li.active a").attr('href'); + } + var code = event.key; + switch (code){ + case 'ArrowDown': + if($("#result_items li.active").length!=0) + { + var storeTarget = $('#result_items').find("li.active").next(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowUp': + if($("#result_items li.active")) + { + var storeTarget = $('#result_items').find("li.active").prev(); + $("#result_items li.active").removeClass("active"); + storeTarget.focus().addClass("active"); + } + else + { + $('#result_items').find("li:first").focus().addClass("active"); + } + return; + + case 'ArrowRight': + return; + case 'ArrowLeft': + return; + + } + + if( $('#keywords').val() === ''){ + $('#keywords').addClass('search_input'); + $('#keywords').removeClass('results-found'); + $('#result_order').hide(); + $('#keywords').attr('placeholder','Enter keywords to search'); + }else { + $.ajax({ + type: "POST", + url: "ajax.php", + dataType: "html", + data: { + page: 'include/ajax/order_interpreter', + method: 'getResult', + text: $('#keywords').val(), + }, + success: function (data) { + $('#result_order').html(data); + console.log(data); + }, + error: function (data) { + console.error("Fatal error in AJAX call to interpreter order", data) + } + }); + $('#keywords').removeClass('search_input'); + $('#keywords').addClass('results-found'); + $('#result_order').show(); + + } + } + /** + * Loads modal from AJAX to add feedback. + */ + function show_feedback() { + var btn_ok_text = ''; + var btn_cancel_text = ''; + var title = ''; + var url = ''; + + load_modal({ + target: $('#modal-feedback-form'), + form: 'modal_form_feedback', + url: '', + modal: { + title: title, + ok: btn_ok_text, + cancel: btn_cancel_text, + }, + onshow: { + page: url, + method: 'formFeedback', + }, + onsubmit: { + page: url, + method: 'createdScheduleFeedbackTask', + dataType: 'json', + }, + ajax_callback: generalShowMsg, + idMsgCallback: 'msg-header', + }); + } + $(document).ready (function () { // Check new notifications on a periodic way @@ -661,7 +796,17 @@ if ($config['menu_type'] == 'classic') { $("#ui_close_dialog_titlebar").click(function () { $("#agent_access").css("display",""); }); - + + + // Feedback. + $("#feedback-header").click(function () { + // Clean DOM. + $("#feedback-header").empty(); + // Function charge Modal. + show_feedback(); + }); + + function blinkpubli(){ $(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli); } diff --git a/pandora_console/general/help_feedback.php b/pandora_console/general/help_feedback.php new file mode 100644 index 0000000000..1f702d6d36 --- /dev/null +++ b/pandora_console/general/help_feedback.php @@ -0,0 +1,77 @@ + '[HelpFeedBack]'.$e->getMessage() ]); + exit; + } else { + echo '[HelpFeedBack]'.$e->getMessage(); + } + + // Stop this execution, but continue 'globally'. + return; +} + +// Ajax controller. +if (is_ajax()) { + $method = get_parameter('method', ''); + + if (method_exists($helpfeedback, $method) === true) { + if ($helpfeedback->ajaxMethod($method) === true) { + $helpfeedback->{$method}(); + } else { + $helpfeedback->error('Unavailable method.'); + } + } else { + $helpfeedback->error('Method not found. ['.$method.']'); + } + + + // Stop any execution. + exit; +} else { + // Run. + $helpfeedback->run(); +} diff --git a/pandora_console/general/login_help_dialog.php b/pandora_console/general/login_help_dialog.php index 323b465d5a..b02c47cea9 100644 --- a/pandora_console/general/login_help_dialog.php +++ b/pandora_console/general/login_help_dialog.php @@ -87,7 +87,7 @@ echo '
'; - echo ''.html_print_image( + echo ''.html_print_image( 'images/documentation.png', true, [ @@ -96,7 +96,7 @@ echo '
'; - echo ''.__('Documentation').''; + echo ''.__('Documentation').''; echo ''; echo ''; echo ''; diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 5aecfcc92c..2410094c41 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -82,33 +82,71 @@ if (!empty($page) && !empty($sec)) { } $login_body_style = ''; +$login_body_class = ''; // Overrides the default background with the defined by the user. if (!empty($config['login_background'])) { $background_url = 'images/backgrounds/'.$config['login_background']; $login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\""; } +// Support for Internet Explorer and Microsoft Edge browsers +if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) { + $login_body_class = "class='login_body_trident'"; +} + +// Get alternative custom in case of db fail. +$custom_fields = [ + 'custom_logo_login', + 'custom_splash_login', + 'custom_title1_login', + 'custom_title2_login', + 'rb_product_name', + 'custom_docs_url', + 'custom_support_url', +]; + +foreach ($custom_fields as $field) { + if (!isset($config[$field])) { + if (isset($config[$field.'_alt'])) { + $config[$field] = $config[$field.'_alt']; + $custom_conf_enabled = true; + } + } +} + // Get the custom icons. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); -echo '
'; +echo '
'; echo '
'; - echo '
diff --git a/pandora_console/general/news_dialog.php b/pandora_console/general/news_dialog.php index 37ca016edf..9ab685d39f 100644 --- a/pandora_console/general/news_dialog.php +++ b/pandora_console/general/news_dialog.php @@ -40,7 +40,7 @@ if (!empty($news)) { // Prints news dialog template echo '