diff --git a/extras/build_rpm_rhel7.sh b/extras/build_rpm_rhel7.sh new file mode 100755 index 0000000000..3684bd42e5 --- /dev/null +++ b/extras/build_rpm_rhel7.sh @@ -0,0 +1,26 @@ +#!/bin/bash +source build_vars.sh + +if [ ! -d $RPMHOME/RPMS ]; then + mkdir -p $RPMHOME/RPMS || exit 1 +fi + +echo "Creating RPM packages in $RPMHOME/RPMS" + +# Console +rpmbuild -ba $CODEHOME/pandora_console/pandora_console.rhel7.spec || exit 1 + +# Server +#rpmbuild -ba $CODEHOME/pandora_server/pandora_server.rhel7.spec || exit 1 + +# Unix agent +#rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.rhel7.spec || exit 1 + +# Enterprise console +rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec || exit 1 + +# Enterprise server +#rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.rhel7.spec || exit 1 + +exit 0 + diff --git a/extras/docker/build_and_push.sh b/extras/docker/build_and_push.sh index 980087cfe5..91e6fa15e5 100755 --- a/extras/docker/build_and_push.sh +++ b/extras/docker/build_and_push.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker build --rm=true --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ +docker build --rm=true --pull --no-cache --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ docker push pandorafms/pandorafms:7 diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 7d143f0f03..edab1affeb 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -26,9 +26,11 @@ $CODEHOME/pandora_server/pandora_server.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ $CODEHOME/pandora_console/pandora_console.redhat.spec \ +$CODEHOME/pandora_console/pandora_console.rhel7.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \ +$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec" DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \ $CODEHOME/pandora_server/DEBIAN \ diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index 07054ee2e1..30fb45624c 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.732, AIX version +# Version 7.0NG.736, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 9d8a49bb99..fc704fb87b 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.732, FreeBSD Version +# Version 7.0NG.736, 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 c02e4647e1..46789e8bea 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.732, HP-UX Version +# Version 7.0NG.736, 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 153113e070..ce69b462a5 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.732, GNU/Linux +# Version 7.0NG.736, 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 6ddeba7edc..904015a997 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.732, GNU/Linux +# Version 7.0NG.736, 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 502317f893..d2d0661065 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.732, Solaris Version +# Version 7.0NG.736, 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 96b20ea7e3..d0593ebcc9 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.732 +# Version 7.0NG.736 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 200ff9db97..74c397dc94 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.732, AIX version +# Version 7.0NG.736, 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 2002f4db65..b7a30f962e 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.732 +# Version 7.0NG.736 # 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 f9c19dbd06..9114cd7348 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.732, HPUX Version +# Version 7.0NG.736, HPUX Version # General Parameters # ================== diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index dc272a7a71..8eb9c0bbc8 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.732 +# Version 7.0NG.736 # 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 5a466677d2..24d44d51fc 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.732 +# Version 7.0NG.736 # 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 170188cc6f..a940b58a89 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.732 +# Version 7.0NG.736 # 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 aad04ca60d..13611f36c0 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.732, Solaris version +# Version 7.0NG.736, Solaris version # General Parameters # ================== diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 3ce7da3c7e..6a826afd8b 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.732, AIX version +# Version 7.0NG.736, 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 a49b305f83..460dd6b7f9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.732-190320 +Version: 7.0NG.736-190702 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 e95df185e1..90ce64b6d8 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.732-190320" +pandora_version="7.0NG.736-190702" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 35202fcbe5..35a24de477 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.732, GNU/Linux +# Version 7.0NG.736, 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 c505d5f75e..fba8f9fa24 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.732, FreeBSD Version +# Version 7.0NG.736, 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 237bffb291..36164100be 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.732, HP-UX Version +# Version 7.0NG.736, 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 5a65e0e095..6012f59705 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.732, GNU/Linux +# Version 7.0NG.736, 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 1394067390..300c03a3f5 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.732, GNU/Linux +# Version 7.0NG.736, 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 677615a47c..e899eed824 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.732, NetBSD Version +# Version 7.0NG.736, 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 89d5b46100..be7904794d 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.732, Solaris Version +# Version 7.0NG.736, 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 da29933562..8e46849482 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,8 +41,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.732'; -use constant AGENT_BUILD => '190320'; +use constant AGENT_VERSION => '7.0NG.736'; +use constant AGENT_BUILD => '190702'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -536,6 +536,12 @@ sub parse_conf_modules($) { # Check for invalid modules next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin); + # Skip disabled modules. + if (defined($module->{'disabled'}) && $module->{'disabled'} == 1) { + log_message('setup', 'Skipping disabled module "' . $module->{'name'} . '"'); + next; + } + # Set the intensive interval if ($module->{'is_intensive'} == 1) { $module->{'intensive_interval'} = $module->{'interval'}; @@ -662,6 +668,8 @@ sub parse_conf_modules($) { $module->{'ff_timeout'} = $1; } elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) { $module->{'each_ff'} = $1; + } elsif ($line =~ /^\s*module_ff_type\s+(\d+)\s*$/) { + $module->{'ff_type'} = $1; # Macros } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { $module->{'macros'}{$1} = $2; @@ -1073,6 +1081,10 @@ sub send_buffered_xml_files ($;$) { unlink ("$temporal_file/$xml_file"); } } + # Do not get stuck trying to send buffered XML files to a secondary server. + elsif ($flag_always == 2) { + last; + } } if (defined($flag_always) && ($flag_always == 2)){ swap_servers (); @@ -2101,45 +2113,28 @@ sub cron_next_execution { } # Get day of the week and month from cron config - my ($mday, $wday) = (split (/\s/, $cron))[2, 4]; + my ($wday) = (split (/\s/, $cron))[4]; + # Check the wday values to avoid infinite loop + my ($wday_down, $wday_up) = cron_get_interval($wday); + if ($wday_down ne "*" && ($wday_down > 6 || (defined($wday_up) && $wday_up > 6))) { + log_message('setup', "Invalid cron configuration $cron. Day of the week is out of limits."); + $wday = "*"; + } # Get current time and day of the week my $cur_time = time(); my $cur_wday = (localtime ($cur_time))[6]; - # Any day of the week - if ($wday eq '*') { - my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval); - return $nex_time - time(); - } - # A range? - else { - $wday = cron_get_closest_in_range ($cur_wday, $wday); + my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval); + + # Check the day + while (!cron_check_interval($wday, (localtime ($nex_time))[6])) { + # If it does not acomplish the day of the week, go to the next day. + $nex_time += 86400; + $nex_time = cron_next_execution_date ($cron, $nex_time, 0); } - # A specific day of the week - my $count = 0; - my $nex_time = $cur_time; - do { - $nex_time = cron_next_execution_date ($cron, $nex_time, $interval); - my $nex_time_wd = $nex_time; - my ($nex_mon, $nex_wday) = (localtime ($nex_time_wd))[4, 6]; - my $nex_mon_wd; - do { - # Check the day of the week - if ($nex_wday == $wday) { - return $nex_time_wd - time(); - } - - # Move to the next day of the month - $nex_time_wd += 86400; - ($nex_mon_wd, $nex_wday) = (localtime ($nex_time_wd))[4, 6]; - } while ($mday eq '*' && $nex_mon_wd == $nex_mon); - $count++; - } while ($count < 60); - - # Something went wrong, default to 5 minutes - return $interval; + return $nex_time - time(); } ############################################################################### @@ -2151,7 +2146,30 @@ sub cron_check_syntax ($) { return 0 if !defined ($cron); return ($cron =~ m/^(\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+$/); } +############################################################################### +# Check if a value is inside an interval. +############################################################################### +sub cron_check_interval { + my ($elem_cron, $elem_curr_time) = @_; + # Return 1 if wildcard. + return 1 if ($elem_cron eq "*"); + + my ($down, $up) = cron_get_interval($elem_cron); + # Check if it is not a range + if (!defined($up)) { + return ($down == $elem_curr_time) ? 1 : 0; + } + + # Check if it is on the range + if ($down < $up) { + return 0 if ($elem_curr_time < $down || $elem_curr_time > $up); + } else { + return 0 if ($elem_curr_time > $down || $elem_curr_time < $up); + } + + return 1; +} ############################################################################### # Get the next execution date for the given cron entry in seconds since epoch. ############################################################################### @@ -2189,8 +2207,7 @@ sub cron_next_execution_date { my @nex_time_array = @curr_time_array; # Update minutes - my ($min_down, undef) = cron_get_interval ($min); - $nex_time_array[0] = ($min_down eq '*') ? 0 : $min_down; + $nex_time_array[0] = cron_get_next_time_element($min); $nex_time = cron_valid_date(@nex_time_array, $cur_year); if ($nex_time >= $cur_time) { @@ -2224,8 +2241,7 @@ sub cron_next_execution_date { return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); #Update the hour if fails - my ($hour_down, undef) = cron_get_interval ($hour); - $nex_time_array[1] = ($hour_down eq '*') ? 0 : $hour_down; + $nex_time_array[1] = cron_get_next_time_element($hour); # When an overflow is passed check the hour update again $nex_time = cron_valid_date(@nex_time_array, $cur_year); @@ -2253,10 +2269,9 @@ sub cron_next_execution_date { return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); #Update the day if fails - my ($mday_down, undef) = cron_get_interval ($mday); - $nex_time_array[2] = ($mday_down eq '*') ? 1 : $mday_down; + $nex_time_array[2] = cron_get_next_time_element($mday, 1); - # When an overflow is passed check the day update in the next execution + # When an overflow is passed check the hour update in the next execution $nex_time = cron_valid_date(@nex_time_array, $cur_year); if ($nex_time >= $cur_time) { return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); @@ -2276,8 +2291,7 @@ sub cron_next_execution_date { return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); #Update the month if fails - my ($mon_down, undef) = cron_get_interval ($mon); - $nex_time_array[3] = ($mon_down eq '*') ? 0 : $mon_down; + $nex_time_array[3] = cron_get_next_time_element($mon); # When an overflow is passed check the month update in the next execution $nex_time = cron_valid_date(@nex_time_array, $cur_year); @@ -2308,23 +2322,30 @@ sub cron_is_in_cron { #If there is no elements means that is in cron return 1 unless (defined($elem_cron) || defined($elem_curr_time)); - # Go to last element if current is a wild card - if ($elem_cron ne '*') { - my ($down, $up) = cron_get_interval($elem_cron); - # Check if there is no a range - return 0 if (!defined($up) && ($down != $elem_curr_time)); - # Check if there is on the range - if (defined($up)) { - if ($down < $up) { - return 0 if ($elem_curr_time < $down || $elem_curr_time > $up); - } else { - return 0 if ($elem_curr_time > $down || $elem_curr_time < $up); - } - } - } + # Check the element interval + return 0 unless (cron_check_interval($elem_cron, $elem_curr_time)); + return cron_is_in_cron(\@deref_elems_cron, \@deref_elems_curr_time); } +################################################################################ +#Get the next tentative time for a cron value or interval in case of overflow. +#Floor data is the minimum localtime data for a position. Ex: +#Ex: +# * should returns floor data. +# 5 should returns 5. +# 10-55 should returns 10. +# 55-10 should retunrs floor data. +################################################################################ +sub cron_get_next_time_element { + # Default floor data is 0 + my ($curr_element, $floor_data) = @_; + $floor_data = 0 unless defined($floor_data); + my ($elem_down, $elem_up) = cron_get_interval ($curr_element); + return ($elem_down eq '*' || (defined($elem_up) && $elem_down > $elem_up)) + ? $floor_data + : $elem_down; +} ############################################################################### # Returns the interval of a cron element. If there is not a range, # returns an array with the first element in the first place of array @@ -2416,12 +2437,11 @@ sub check_module_cron { return 1 unless ($is_first); # Check if current timestamp is a valid cron date - my $next_execution = cron_next_execution_date( + my $next_execution = cron_next_execution( $module->{'cron'}, - $now - $interval, - $interval + 0 ); - return 1 if ($next_execution == $now); + return 1 if (time() + $next_execution == $now); return 0; } @@ -2532,6 +2552,7 @@ sub write_module_xml ($@) { $Xml .= " " . $module->{'min_ff_event_critical'} . "\n" if (defined ($module->{'min_ff_event_critical'})); $Xml .= " " . $module->{'ff_timeout'} . "\n" if (defined ($module->{'ff_timeout'})); $Xml .= " " . $module->{'each_ff'} . "\n" if (defined ($module->{'each_ff'})); + $Xml .= " " . $module->{'ff_type'} . "\n" if (defined ($module->{'ff_type'})); # Data list if ($#data > 0) { @@ -3017,10 +3038,10 @@ while (1) { my @address_list; if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) { - @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`; + @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`; } else { - @address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`; + @address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`; } for (my $i = 0; $i <= $#address_list; $i++) { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 6d7e12d845..62c86be6c3 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.732 -%define release 190320 +%define version 7.0NG.736 +%define release 190702 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 5a10c17f69..5c6cebed00 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.732 -%define release 190320 +%define version 7.0NG.736 +%define release 190702 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 345bf0c832..30e9725bda 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.732" -PI_BUILD="190320" +PI_VERSION="7.0NG.736" +PI_BUILD="190702" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/grep_log b/pandora_agents/unix/plugins/grep_log index 2e17210a51..76661c5230 100755 --- a/pandora_agents/unix/plugins/grep_log +++ b/pandora_agents/unix/plugins/grep_log @@ -6,17 +6,17 @@ # # grep_log Perl script to search log files for a matching pattern. The last # searched position is saved in an index file so that consecutive -# runs do not return the same results. The log file inode number is +# runs do not return the same results. The log file inode number is # also saved to detect log rotation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# GNU General Public License for more details. # ############################################################################### use strict; @@ -30,7 +30,7 @@ my $Output = 'module'; my $Verbose = 0; # Index file storage directory, with a trailing '/' -my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/'; +my $Idx_dir=($^O =~ /win/i)?"$ENV{'TMP'}\\":"/tmp/"; # Log file my $Log_file = ''; @@ -64,7 +64,7 @@ if ( (defined ($ENV{GREP_LOG_TMP})) && (-d $ENV{GREP_LOG_TMP}) ) { } ######################################################################################## -# Erase blank spaces before and after the string +# Erase blank spaces before and after the string ######################################################################################## sub trim($){ my $string = shift; @@ -226,7 +226,7 @@ sub parse_log (;$$) { open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " . $!); - # Go to starting position. + # Go to starting position. seek(LOGFILE, $Idx_pos, 0); # Parse log file @@ -318,7 +318,7 @@ sub print_log ($) { print_summary() if ($summary_flag == 1); return; } - + # Log module if ($Output eq 'log_module') { my $output = "\n"; diff --git a/pandora_agents/unix/plugins/inventory b/pandora_agents/unix/plugins/inventory index a6d9a8bc83..6ef6233d23 100755 --- a/pandora_agents/unix/plugins/inventory +++ b/pandora_agents/unix/plugins/inventory @@ -4,23 +4,44 @@ # Copyright (c) 2009 Artica Soluciones Tecnologicas S.L. # # inventory Generate a hardware/software inventory. -# +# # Sample usage: ./inventory [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [process] [users] # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# GNU General Public License for more details. # ############################################################################### use strict; use constant TSTAMP_FILE => '/tmp/pandora_inventory.tstamp'; +use Scalar::Util qw(looks_like_number); +use Data::Dumper; +# Set environment language to English +$ENV{"LANG"} = "en_US"; + +# Check AIX system +my $AIX=0; +my $system = `uname -a | awk '{print $1}'`; +if ($system =~ 'AIX') { + $AIX=1; +} + +sub is_enabled { + my $value = shift; + if ((defined ($value)) && looks_like_number($value) && ($value > 0)){ + # return true + return 1; + } + #return false + return 0; +} # Operation mode (LSHW or HWINFO) my $Mode; @@ -31,12 +52,12 @@ my $Separator; sub get_module_data ($$$$) { my ($name, $hwinfo, $keys, $modules) = @_; my %module; - - # Store keys + $Separator='\s+\*\-'; + # Store keys foreach my $key (@{$keys}) { push (@{$module{'_keys'}}, $key); } - + # Parse module data while (my $line = shift (@{$hwinfo})) { if ($line =~ /$Separator/) { @@ -46,7 +67,7 @@ sub get_module_data ($$$$) { foreach my $key (@{$keys}) { if ($line =~ /$key:\s+(.+)/) { $module{$key} = $1; - # Replace semicolon by comma to avoid parse errors + # Replace semicolon by comma to avoid parse errors $module{$key} =~ s/;/,/g; } } @@ -58,12 +79,65 @@ sub get_module_data ($$$$) { push (@{$modules->{$name}}, \%module); } +sub test_contain ($$) { + my ($value, $array)=@_; + if ( grep( /$value/, @{$array} ) ) { + return 1; + } +} +sub get_module_data_aix_ram_cpu ($$$$) { + my ($name, $hwinfo, $keys, $modules) = @_; + my %module; + # Store keys + foreach my $key (@{$keys}) { + push (@{$module{'_keys'}}, $key); + } + # Parse module data + foreach my $line (@{$hwinfo}) { + foreach my $key (@{$keys}) { + if ($line =~ /$key:\s+(.+)/) { + $module{$key} = $1; + $module{$key} =~ s/,/ /g; + } + } + } + + # No data found + #my @data = keys (%module); + #return unless ($#data >= 0); + + push (@{$modules->{$name}}, \%module); +} +sub get_module_data_aix ($$$$) { + my ($name,$hwinfo,$regex,$modules) = @_; + my %module; + foreach my $line (@{$hwinfo}) { + $line =~ s/\s{2,}/;/g; + $line =~ s/\+ //g; + $line =~ s/\* //g; + } + foreach my $line (@{$hwinfo}) { + if ($line =~ /$regex/){ + my ($var1, $var2, $var3) = split /;/, $line; + my %module; + $module{'device'} = $var1; + $module{'serial'} = $var2; + $module{'description'}=$var3; + $module{'_keys'} = ['device','serial','description']; + push (@{$modules->{$name}}, \%module); + } + } +} # Get a list of information file system in machine sub get_file_system($$) { my ($name, $modules) = @_; - - my @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns + my @fileSystems; + if (is_enabled $AIX){ + @fileSystems = `df -gP | tail -n +2`; + } else { + @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns + } foreach my $row (@fileSystems) { next unless ($row =~ /^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+(\S+)/); @@ -73,94 +147,110 @@ sub get_file_system($$) { $module{'used'} = $2; $module{'avail'} = $3; $module{'mount'} = $4; - $module{'_keys'} = ['filesystem', 'used','avail', 'mount']; - push (@{$modules->{$name}}, \%module); - } + $module{'_keys'} = ['filesystem', 'used','avail', 'mount']; + push (@{$modules->{$name}}, \%module); + } } # Get a list of services init in machine sub get_servicies_init_machine($$) { my ($name, $modules) = @_; - my $runlevel = `who -r | awk '{print \$2}'`; + my $runlevel; + if (is_enabled $AIX) { + $runlevel = `who -r | awk '{print \$3}'`; + } else { + $runlevel = `who -r | awk '{print \$2}'`; + } #ini trim($runlevel) $runlevel =~ s/^\s*//; #ltrim $runlevel =~ s/\s*$//; #rtrim #end trim($runlevel) - my $script = ""; - + my $script; + if (-e "/etc/rc" . $runlevel .".d/") { - $script = "ls /etc/rc" . $runlevel .".d/ -l | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; + $script = "ls -l /etc/rc" . $runlevel .".d/ | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; } else { - $script = "ls /etc/rc.d/rc" . $runlevel .".d/ -l | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; - + $script = "ls -l /etc/rc.d/rc" . $runlevel .".d/ | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; } - + my @services = `$script`; foreach my $row (@services) { - my %module; - $row =~ s/\n//; - $module{'service'} = $row; - $module{'_keys'} = ['service']; - push (@{$modules->{$name}}, \%module); + $row =~ s/\n//; + $module{'service'} = $row; + $module{'_keys'} = ['service']; + push (@{$modules->{$name}}, \%module); } } # Get a list of running processes sub get_processes ($$) { my ($name, $modules) = @_; + my $script; + if (is_enabled $AIX) { + $script = "ps -eo args | tail -n +2"; + } else { + $script = "ps -eo command | tail -n +2"; + } - my $script = "ps -eo command"; - - my @services = `$script`; - foreach my $row (@services) { - my %module; - # Remove carriage returns - $row =~ s/[\n\l\f]//g; - # Replace semicolon by comma to avoid parse errors - $row =~ s/;/,/g; - $module{'service'} = $row; - $module{'_keys'} = ['service']; - push (@{$modules->{$name}}, \%module); - } + my @services = `$script`; + foreach my $row (@services) { + my %module; + # Remove carriage returns + $row =~ s/[\n\l\f]//g; + # Replace semicolon by comma to avoid parse errors + $row =~ s/;/,/g; + $module{'service'} = $row; + $module{'_keys'} = ['service']; + push (@{$modules->{$name}}, \%module); + } } # Get a list of valid users in the system sub get_users ($$) { - my ($name, $modules) = @_; - - my $script = "cat /etc/passwd"; + my ($name, $modules) = @_; + my $script = "cat /etc/passwd"; my $user = ""; my $estado = ""; - my @services = `$script`; - foreach my $row (@services) { - my %module; + my @services = `$script`; + foreach my $row (@services) { + my %module; - next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); - - $user = $1; - $script = `passwd -S $user`; - if ( $script =~ /^(\S+)\sP./){ - $module{'user'} = $user; - $module{'_keys'} = ['user']; - push (@{$modules->{$name}}, \%module); + next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); + if (is_enabled $AIX) { + $user = $1; + $script = `lsuser $user`; + if ( $script =~ /^(\S+)\sid./){ + $module{'user'} = $user; + $module{'_keys'} = ['user']; + push (@{$modules->{$name}}, \%module); + } + } else { + $user = $1; + $script = `passwd -S $user`; + if ( $script =~ /^(\S+)\sP./){ + $module{'user'} = $user; + $module{'_keys'} = ['user']; + push (@{$modules->{$name}}, \%module); } } + + } } # Show Kernel Information sub get_kernel_info ($$) { - my ($name, $modules) = @_; - my $script = `uname -a | tr -d \";\"`; - my %module; + my ($name, $modules) = @_; + my $script = `uname -a | tr -d \";\"`; + my %module; - $module{'Kernel'} = $script; - $module{'_keys'} = ['Kernel']; - push (@{$modules->{$name}}, \%module); + $module{'Kernel'} = $script; + $module{'_keys'} = ['Kernel']; + push (@{$modules->{$name}}, \%module); } @@ -171,11 +261,13 @@ sub get_software_module_data ($$) { # Guess the current distribution my $distrib_id = ""; - if ( -e "/etc/SuSE-release"){ + if (is_enabled $AIX) { + $distrib_id = "AIX"; + }elsif ( -e "/etc/SuSE-release"){ $distrib_id = "SUSE"; - } elsif ( -e "/etc/redhat-release"){ + }elsif ( -e "/etc/redhat-release"){ $distrib_id = "REDHAT"; - } else { + }else { $distrib_id = "DEBIAN"; } @@ -183,7 +275,9 @@ sub get_software_module_data ($$) { my @soft; if ($distrib_id eq 'DEBIAN') { @soft = `dpkg -l | grep ii`; - } else { + }elsif ($distrib_id eq 'AIX') { + @soft = `lslpp -Lcq | awk -F: '{print "ii "\$1" "\$3" "\$8}'`; + }else { # Sometimes rpm return data splitted in two lines, and with dupes. Thats bad for our inventory system @soft = `rpm -q -a --qf "ii %{NAME} %{VERSION} %{SUMMARY}\n" | grep "^ii" | sort -u`; } @@ -197,7 +291,7 @@ sub get_software_module_data ($$) { $module{'program'} = $1; $module{'version'} = $2; $module{'description'} = $3; - # Replace semicolon by comma to avoid parse errors + # Replace semicolon by comma to avoid parse errors $module{'program'} =~ s/;/,/g; $module{'version'} =~ s/;/,/g; $module{'description'} =~ s/;/,/g; @@ -211,67 +305,95 @@ sub get_software_module_data ($$) { #Get the list of interfaces with the ip assigned sub get_ips ($$) { my ($name, $modules) = @_; + my @interfaces; + my $ifconfig; + if (is_enabled $AIX) { + $ifconfig = `ifconfig -a`; + } else { + $ifconfig = `ifconfig`; + } - my $ifconfig = `ifconfig`; - - my @ifconfig_array = split("\n", $ifconfig); - - for(my $i = 0; $i<$#ifconfig_array; $i++) { - - #Check for an interface - if ($ifconfig_array[$i] =~ /Link/) { - my %info; - - my @line_split = split(" ", $ifconfig_array[$i]); - - #Get interface name - $info{'interface'} = $line_split[0]; - #Get IP address - my $line = $ifconfig_array[$i+1]; - - $line =~ s/\s+//g; + my @ifconfig_array = split("\n", $ifconfig); - @line_split = split(":", $line); - - if($line_split[1] =~ /(\d+\.\d+\.\d+\.\d+).+/) { - $info{'ip'} = $1; - } - - $info{'_keys'} = ['interface', 'ip']; - push (@{$modules->{$name}}, \%info); - - } + foreach (@ifconfig_array){ + if ($_=~/(.*)flags/){ + my $match; + ($match)=$_=~/^(.*?)\: flags/; + $match=~s/://; + push @interfaces,$match; + } + } + foreach (@interfaces) { + my $ifconfig_item=`ifconfig $_`; + my $interface=$_; + my @ip_array = split("\n", $ifconfig_item); + foreach (@ip_array) { + if ($_=~/(?<=inet )(.*)(?= netmask)/){ + my $ip; + ($ip)=$_=~/inet (.*) netmask/; + my %info; + $info{'interface'} = $interface; + $info{'ip'} = $ip; + $info{'_keys'} = ['interface','ip']; + push (@{$modules->{$name}}, \%info); + } + } } } #Get route table sub get_route_table ($$) { - my ($name, $modules) = @_; - - my $route_table = `route`; - - my @table_split = split("\n", $route_table); - - for (my $i=2; $i<=$#table_split; $i++) { - - my @split = split(" ", $table_split[$i]); - - my %info; - - $info{'destination'} = $split[0]; - $info{'gateway'} = $split[1]; - $info{'mask'} = $split[2]; - $info{'flags'} = $split[3]; - $info{'metric'} = $split[4]; - $info{'ref'} = $split[5]; - $info{'use'} = $split[6]; - $info{'interface'} = $split[7]; - - $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; - - push (@{$modules->{$name}}, \%info); - } + my ($name, $modules) = @_; + my $route_table; + my @table_split; + if (is_enabled $AIX) { + $route_table = `netstat -rn`; + @table_split = split("\n", $route_table); + my $length=scalar @table_split; + for (my $i=4; $i<=$length-4; $i++) { + + my @split = split(" ", $table_split[$i]); + + my %info; + + $info{'destination'} = $split[0]; + $info{'gateway'} = $split[1]; + $info{'mask'} = $split[2]; + $info{'flags'} = $split[3]; + $info{'metric'} = $split[4]; + $info{'ref'} = $split[5]; + $info{'use'} = $split[6]; + $info{'interface'} = $split[7]; + + $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; + + push (@{$modules->{$name}}, \%info); + } + } else { + $route_table = `route`; + my @table_split = split("\n", $route_table); + + for (my $i=2; $i<=$#table_split; $i++) { + + my @split = split(" ", $table_split[$i]); + + my %info; + + $info{'destination'} = $split[0]; + $info{'gateway'} = $split[1]; + $info{'mask'} = $split[2]; + $info{'flags'} = $split[3]; + $info{'metric'} = $split[4]; + $info{'ref'} = $split[5]; + $info{'use'} = $split[6]; + $info{'interface'} = $split[7]; + + $info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface']; + + push (@{$modules->{$name}}, \%info); + } + } } # Print module data sub print_module ($$) { @@ -309,14 +431,18 @@ my $enable_all = 0; $interval = $ARGV[0]; if ($#ARGV == 0){ - $enable_all = 1; + $enable_all = 1; +} +if ($interval!=/[:alpha:]/){ + splice @ARGV,0,1; } -foreach my $module (@ARGV) { +foreach my $module (@ARGV) { if ($module eq "all"){ - $enable_all = 1; - } - $enabled{$module} = 1; + $enable_all = 1; + }else { + $enabled{$module} = 1; + } } # Check execution interval @@ -333,76 +459,107 @@ close (FILE); # Retrieve hardware information $Mode = 'LSHW'; $Separator = '\s+\*\-'; -my @hwinfo = `lshw 2>/dev/null`; -if ($? != 0) { - $Mode = 'HWINFO'; - $Separator = 'Hardware Class:'; - @hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; +my @hwinfo; +if (is_enabled $AIX) { + $Separator = '^\s*$'; + @hwinfo=`prtconf 2>/dev/null`; +} else { + @hwinfo = `lshw 2>/dev/null`; + if ($? != 0) { + $Mode = 'HWINFO'; + $Separator = 'Hardware Class:'; + @hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; + } } -# Parse hardware information my %modules; -while (my $line = shift (@hwinfo)) { + + if (is_enabled $AIX) { + #CPU + # VIDEO + ### Not avilable in AIX ### + # NIC + ### Not relevant in AIX ### + if ((test_contain('ent',\@hwinfo)) && ($enable_all == 1 || $enabled{'nic'} == 1)) { + get_module_data_aix ('NIC',\@hwinfo,'^ent',\%modules); + } + if ((test_contain('hdisk',\@hwinfo)) && ($enable_all == 1 || $enabled{'hd'} == 1)) { + get_module_data_aix ('HD',\@hwinfo,'^hdisk',\%modules); + } + + foreach my $line (@hwinfo) { + chomp ($line); + #CPU + if (($line =~ /^Memory Size:/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { + get_module_data_aix_ram_cpu ('RAM', \@hwinfo, ['Memory Size','Good Memory Size'], \%modules); + } + + if (($line =~ /^System Model/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { + get_module_data_aix_ram_cpu ('CPU', \@hwinfo, ['System Model', 'Processor Implementation Mode', 'Number Of Processors'], \%modules); + } + } +} else { + # Parse hardware information + while (my $line= shift (@hwinfo)) { chomp ($line); + # CPU + if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules); + } else { + get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules); + } + } - # CPU - if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules); - } else { - get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules); - } - } + # RAM + if (($line =~ /\*\-bank/ || $line =~ /\*\-memory/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); + } else { + get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules); + } + } - # RAM - if (($line =~ /\*\-bank/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); - } else { - get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules); - } - } + # VIDEO + if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); + } + } - # VIDEO - if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); - } - } + # NIC + if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules); + } + } - # NIC - if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules); - } - } - - # CDROM - if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules); - } else { - # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor - get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); - } - } + # CDROM + if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules); + } else { + # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor + get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); + } + } - # HD - if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) { - if ($Mode eq 'LSHW') { - get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules); - } else { - get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules); - } - } + # HD + if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) { + if ($Mode eq 'LSHW') { + get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules); + } else { + get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules); + } + } + } } - # Software if ($enable_all == 1 || $enabled{'software'} == 1) { get_software_module_data ('Software', \%modules); @@ -410,12 +567,12 @@ if ($enable_all == 1 || $enabled{'software'} == 1) { #init_services if ($enable_all == 1 || $enabled{'init_services'} == 1) { - get_servicies_init_machine ('Init services', \%modules); + get_servicies_init_machine ('Init_services', \%modules); } #filesystem if ($enable_all == 1 || $enabled{'filesystem'} == 1) { - get_file_system('File system', \%modules); + get_file_system('Filesystem', \%modules); } #processes @@ -442,7 +599,6 @@ if ($enable_all == 1 || $enabled{'route'} == 1) { if ($enable_all == 1 || $enabled{'kernel'} == 1){ get_kernel_info ('Kernel', \%modules); } - # Print module data print "\n"; while (my ($name, $module) = each (%modules)) { diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 3d1e208de8..9c2fe6d01d 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.732 +# Version 7.0NG.736 # 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 @@ -44,6 +44,8 @@ remote_config 0 #agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs" agent_name_cmd __rand__ +# Agent alias. Name should be unique rather than alias. Hostname by default +# agent_alias $Alias$ #Parent agent_name #parent_agent_name caprica diff --git a/pandora_agents/win32/bin/util/grep_log.exe b/pandora_agents/win32/bin/util/grep_log.exe index a21e080805..4e4029fb60 100644 Binary files a/pandora_agents/win32/bin/util/grep_log.exe and b/pandora_agents/win32/bin/util/grep_log.exe differ diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index bde8ab969b..d202a71b65 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.732} +{Pandora FMS Windows Agent v7.0NG.736} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190320} +{190702} ViewReadme {Yes} diff --git a/pandora_agents/win32/misc/cron.cc b/pandora_agents/win32/misc/cron.cc index 2d3e5e0440..409a43f726 100644 --- a/pandora_agents/win32/misc/cron.cc +++ b/pandora_agents/win32/misc/cron.cc @@ -214,7 +214,7 @@ int Cron::getResetValue (int position) { int default_value = 0; // Days start in 1 if (position == 2) default_value = 1; - return isWildCard(position) + return (isWildCard(position) || !isNormalInterval(position)) ? default_value : this->params[position][CRDOWN]; } diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index eac38c8fa1..e7c751d367 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -78,6 +78,7 @@ Pandora_Module::Pandora_Module (string name) { this->warning_inverse = ""; this->quiet = ""; this->module_ff_interval = ""; + this->module_ff_type = ""; this->module_alert_template = ""; this->module_crontab = ""; } @@ -733,6 +734,13 @@ Pandora_Module::getXml () { module_xml += this->module_ff_interval; module_xml += "\n"; } + + /* Module FF type */ + if (this->module_ff_type != "") { + module_xml += "\t"; + module_xml += this->module_ff_type; + module_xml += "\n"; + } /* Module Alert template */ if (this->module_alert_template != "") { @@ -1028,6 +1036,16 @@ Pandora_Module::setModuleFFInterval (string value) { this->module_ff_interval = value; } +/** + * Set the module FF type for the module. + * + * @param value module FF type value to set. + */ +void +Pandora_Module::setModuleFFType (string value) { + this->module_ff_type = value; +} + /** * Set the module Alert template for the module. * diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index 9fb29e1183..c766766950 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -176,6 +176,7 @@ namespace Pandora_Modules { string unit, custom_id, str_warning, str_critical; string module_group, warning_inverse, critical_inverse, quiet; string module_ff_interval, module_alert_template, module_crontab; + string module_ff_type; string critical_instructions, warning_instructions, unknown_instructions, tags; protected: @@ -277,6 +278,7 @@ namespace Pandora_Modules { void setWarningInverse (string value); void setQuiet (string value); void setModuleFFInterval (string value); + void setModuleFFType (string value); void setModuleAlertTemplate (string value); void setModuleCrontab (string value); diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index 658ff724fd..a4d9553c20 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -119,6 +119,7 @@ using namespace Pandora_Strutils; #define TOKEN_WARNING_INVERSE ("module_warning_inverse ") #define TOKEN_QUIET ("module_quiet ") #define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ") +#define TOKEN_MODULE_FF_TYPE ("module_ff_type ") #define TOKEN_MACRO ("module_macro") #define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_ALERT_TEMPLATE ("module_alert_template") @@ -176,7 +177,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; - string module_native_encoding, module_alert_template; + string module_native_encoding, module_alert_template, module_ff_type; string macro; Pandora_Module *module; bool numeric; @@ -254,6 +255,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_warning_inverse = ""; module_quiet = ""; module_ff_interval = ""; + module_ff_type = ""; module_native_encoding = ""; module_alert_template = ""; module_user_session = ""; @@ -507,6 +509,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_ff_interval == "") { module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL); } + + if (module_ff_type == "") { + module_ff_type = parseLine (line, TOKEN_MODULE_FF_TYPE); + } if (module_alert_template == "") { module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); @@ -1087,6 +1093,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + if (module_ff_type != "") { + pos_macro = module_ff_type.find(macro_name); + if (pos_macro != string::npos){ + module_ff_type.replace(pos_macro, macro_name.size(), macro_value); + } + } + if (module_alert_template != "") { pos_macro = module_alert_template.find(macro_name); if (pos_macro != string::npos){ @@ -1104,6 +1117,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + /* Skip disabled modules */ + if (module_disabled == "1") { + pandoraLog ("Skipping disabled module \"%s\"", module_name.c_str ()); + return NULL; + } + /* Create module objects */ if (module_exec != "") { module = new Pandora_Module_Exec (module_name, @@ -1447,6 +1466,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_ff_interval != "") { module->setModuleFFInterval (module_ff_interval); } + + if (module_ff_type != "") { + module->setModuleFFType (module_ff_type); + } if (module_alert_template != "") { module->setModuleAlertTemplate (module_alert_template); diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f17f4c9e0e..658a85c414 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.732(Build 190320)") +#define PANDORA_VERSION ("7.0NG.736(Build 190702)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 75b43cc61d..a572727e12 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.732(Build 190320))" + VALUE "ProductVersion", "(7.0NG.736(Build 190702))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9ff1d9b4e7..a3e4c8a1ba 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.732-190320 +Version: 7.0NG.736-190702 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 f359088899..110cc566c1 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.732-190320" +pandora_version="7.0NG.736-190702" package_pear=0 package_pandora=1 diff --git a/pandora_console/composer.json b/pandora_console/composer.json index acc6a3e352..208e2d3d14 100644 --- a/pandora_console/composer.json +++ b/pandora_console/composer.json @@ -10,5 +10,16 @@ "require": { "mpdf/mpdf": "^7.1", "swiftmailer/swiftmailer": "^6.0" + }, + "autoload": { + "psr-4": { + "Models\\": "include/rest-api/models", + "Enterprise\\Models\\": "enterprise/include/rest-api/models" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } } } diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 46272504f6..54e0ec6b12 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -138,8 +138,15 @@ function mainAgentsAlerts() $onheader['combo_refr'] = $comborefr; } - // Header - ui_print_page_header(__('Agents/Alerts'), 'images/op_alerts.png', false, '', false, $updated_time); + // Header. + ui_print_page_header( + __('Agents/Alerts'), + 'images/op_alerts.png', + false, + 'agents_alerts_view', + false, + $updated_time + ); // Old style table, we need a lot of special formatting,don't use table function // Prepare old-style table @@ -291,7 +298,7 @@ function mainAgentsAlerts() $table2->data[2][0] = __('Threshold'); $table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true); - $table2->data[2][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true); + $table2->data[2][1] .= ' '.__('seconds'); $content2 = '
'; $content2 .= html_print_table($table2, true); @@ -378,7 +385,8 @@ function mainAgentsAlerts() 'alerts_agents' ); - echo ''; + echo '
'; + echo ''; echo "'; if ($hor_offset > 0) { @@ -421,9 +429,10 @@ function mainAgentsAlerts() continue; } - echo ''; + echo ''; } + echo ''; if (($hor_offset + $block) < $ntemplates) { $new_hor_offset = ($hor_offset + $block); echo "
".__('Agents').' / '.__('Alert templates').''.io_safe_output($tname).html_print_image('images/information_alerts.png', true, ['title' => io_safe_output($tname), 'style' => 'margin-left:5px' ]).''.io_safe_output($tname).'
@@ -455,7 +464,7 @@ function mainAgentsAlerts() $cellstyle = 'background:'.COL_ALERTFIRED.';'; } - echo ' '; + echo ' '; $uniqid = uniqid(); echo '
'; @@ -478,6 +487,23 @@ function mainAgentsAlerts() } echo '
'; + + ui_pagination( + $nagents, + false, + 0, + 0, + false, + 'offset', + true, + 'pagination-bottom', + '', + [ + 'count' => '', + 'offset' => 'offset_param', + ], + 'alerts_agents' + ); } } @@ -487,7 +513,7 @@ function mainAgentsAlerts() function print_alerts_summary_modal_window($id, $alerts) { $table->width = '98%'; - $table->class = 'databox'; + $table->class = 'info_table'; $table->data = []; $table->head[0] = __('Module'); diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 798f4e140e..97657f5189 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -1,23 +1,24 @@ '.__('Group').''; $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); $filter_recursion_label = ''.__('Recursion').''; $filter_recursion = html_print_checkbox('recursion', 1, 0, true); - // groups module + // Groups module. $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql( 'SELECT * FROM tmodule_group ORDER BY name', @@ -146,7 +147,7 @@ function mainAgentsModules() 'width: auto;' ); - // agent + // Agent. $agents = agents_get_group_agents($group_id); if ((empty($agents)) || $agents == -1) { $agents = []; @@ -155,7 +156,7 @@ function mainAgentsModules() $filter_agents_label = ''.__('Agents').''; $filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;'); - // type show + // Type show. $selection = [ 0 => __('Show common modules'), 1 => __('Show all modules'), @@ -163,12 +164,12 @@ function mainAgentsModules() $filter_type_show_label = ''.__('Show common modules').''; $filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;'); - // modules + // Modules. $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false); $filter_modules_label = ''.__('Module').''; $filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;'); - // update + // Update. $filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true); $onheader = [ @@ -178,11 +179,21 @@ function mainAgentsModules() 'combo_groups' => $filter_groups, ]; - // Old style table, we need a lot of special formatting,don't use table function - // Prepare old-style table + /* + * Old style table, we need a lot of special formatting,don't use table function. + * Prepare old-style table. + */ + if ($config['pure'] == 0) { - // Header - ui_print_page_header(__('Agents/Modules'), 'images/module_mc.png', false, '', false, $updated_time); + // Header. + ui_print_page_header( + __('Agents/Modules'), + 'images/module_mc.png', + false, + 'agents_module_view', + false, + $updated_time + ); echo ''; echo ''; echo "'; @@ -193,38 +204,51 @@ function mainAgentsModules() $full_modules = urlencode(implode(';', $full_modules_selected)); $full_agents = urlencode(implode(';', $full_agents_id)); - $url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset + $url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset &group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules - &full_agents_id=$full_agents&selection_agent_module=$selection_a_m"; + &full_agents_id=$full_agents&selection_agent_module=$selection_a_m'; } else { - $url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr"; + $url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr'; } - // Floating menu - Start + // Floating menu - Start. echo '
'; echo ''; echo '
'; - // Floating menu - End + // Floating menu - End. ui_require_jquery_file('countdown'); } if ($config['pure'] != 1) { - echo ''; - - echo '
".$fullscreen['text'].'
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo "'; - echo ''; - echo '
'.$filter_groups_label.''.$filter_groups.'   '.$filter_recursion_label.$filter_recursion.''.$filter_module_groups_label.''.$filter_module_groups.'
'.$filter_agents_label.''.$filter_agents.''.$filter_type_show_label.''.$filter_type_show.''.$filter_modules_label.''.$filter_modules.'
".$filter_update.'
'; - echo '
'; + $show_filters = '
'; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= "'; + $show_filters .= ''; + $show_filters .= '
'.$filter_groups_label.''.$filter_groups.'   '.$filter_recursion_label.$filter_recursion.''.$filter_module_groups_label.''.$filter_module_groups.'
'.$filter_agents_label.''.$filter_agents.''.$filter_type_show_label.''.$filter_type_show.''.$filter_modules_label.''.$filter_modules.'
".$filter_update.'
'; + $show_filters .= '
'; + ui_toggle($show_filters, __('Filters')); } if ($agents_id[0] != -1) { @@ -284,7 +308,7 @@ function mainAgentsModules() $count = 0; foreach ($agents as $agent) { - // TODO TAGS agents_get_modules + // TODO TAGS agents_get_modules. $module = agents_get_modules( $agent, false, @@ -332,7 +356,7 @@ function mainAgentsModules() } } } else { - // TODO TAGS agents_get_modules + // TODO TAGS agents_get_modules. $all_modules = agents_get_modules( $agents, false, @@ -407,11 +431,11 @@ function mainAgentsModules() if ($hor_offset > 0) { $new_hor_offset = ($hor_offset - $block); - echo ""."".html_print_image( - 'images/arrow_left.png', + echo "".html_print_image( + 'images/arrow_left_green.png', true, ['title' => __('Previous modules')] - ).''.''; + ).''; } $nmodules = 0; @@ -433,11 +457,11 @@ function mainAgentsModules() if (($hor_offset + $block) < $nmodules) { $new_hor_offset = ($hor_offset + $block); - echo ""."".html_print_image( - 'images/arrow.png', + echo "".html_print_image( + 'images/arrow_right_green.png', true, ['title' => __('More modules')] - ).''.''; + ).''; } echo ''; @@ -450,12 +474,12 @@ function mainAgentsModules() $filter_agents['id_grupo'] = $group_id; } - // Prepare pagination - $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&'.'hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; + // Prepare pagination. + $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; ui_pagination($total_pagination, $url); foreach ($agents as $agent) { - // Get stats for this group + // Get stats for this group. $agent_status = agents_get_status($agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); if (empty($alias['alias'])) { @@ -464,29 +488,29 @@ function mainAgentsModules() switch ($agent_status) { case 4: - // Alert fired status + // Alert fired status. $rowcolor = 'group_view_alrm'; break; case 1: - // Critical status + // Critical status. $rowcolor = 'group_view_crit'; break; case 2: - // Warning status + // Warning status. $rowcolor = 'group_view_warn'; break; case 0: - // Normal status + // Normal status. $rowcolor = 'group_view_ok'; break; case 3: case -1: default: - // Unknown status + // Unknown status. $rowcolor = 'group_view_unk'; break; } @@ -495,7 +519,7 @@ function mainAgentsModules() echo " ".$alias['alias'].''; - // TODO TAGS agents_get_modules + // TODO TAGS agents_get_modules. $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true); $nmodules = 0; @@ -565,18 +589,23 @@ function mainAgentsModules() echo ''; - echo "
"; + $show_legend = "
"; + $show_legend .= "
+
".__('Orange cell when the module has fired alerts').'
'; + $show_legend .= "
+
".__('Red cell when the module has a critical status').' +
'; + $show_legend .= "
+
".__('Yellow cell when the module has a warning status').'
'; + $show_legend .= "
+
".__('Green cell when the module has a normal status').'
'; + $show_legend .= "
+
".__('Grey cell when the module has an unknown status').'
'; + $show_legend .= "
+
".__("Cell turns blue when the module is in 'not initialize' status").'
'; + $show_legend .= '
'; + ui_toggle($show_legend, __('Legend')); - echo ''; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo '
".__('Legend').'
".__('Orange cell when the module has fired alerts').'
".__('Red cell when the module has a critical status').'
".__('Yellow cell when the module has a warning status').'
".__('Green cell when the module has a normal status').'
".__('Grey cell when the module has an unknown status').'
".__("Cell turns blue when the module is in 'not initialize' status").'
'; - echo '
'; $pure_var = $config['pure']; if ($pure_var) { $pure_var = 1; @@ -620,16 +649,14 @@ $ignored_params['refresh'] = ''; $.each($('.th_class_module_r'), function (i, elem) { id = $(elem).attr('id').replace('th_module_r_', ''); $("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px'); - - //$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px'); $("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px'); $("#div_module_r_" + id).show(); }); - var refr =" . $refr . "; - var pure =" . $pure_var . "; - var href ='" . ui_get_url_refresh ($ignored_params) . "'; - + var refr = ''; + var pure = ''; + var href =' '; + if (pure) { var startCountDown = function (duration, cb) { $('div.vc-countdown').countdown('destroy'); @@ -639,7 +666,7 @@ $ignored_params['refresh'] = ''; $('div.vc-countdown').countdown({ until: t, format: 'MS', - layout: '(%M%nn%M:%S%nn%S Until refresh)', + layout: '(%M%nn%M:%S%nn%S ) ', alwaysExpire: true, onExpiry: function () { $('div.vc-countdown').countdown('destroy'); @@ -648,8 +675,11 @@ $ignored_params['refresh'] = ''; } }); } - - startCountDown(refr, false); + + if(refr>0){ + startCountDown(refr, false); + } + var controls = document.getElementById('vc-controls'); autoHideElement(controls, 1000); @@ -661,7 +691,7 @@ $ignored_params['refresh'] = ''; else { var agentes_id = $("#id_agents2").val(); - var id_agentes = $.get("full_agents_id"); + var id_agentes = getQueryParam("full_agents_id"); if (agentes_id === null && id_agentes !== null) { id_agentes = id_agentes.split(";") id_agentes.forEach(function(element) { @@ -799,7 +829,7 @@ $ignored_params['refresh'] = ''; $("#module").append (option); }); - var id_modules = $.get("full_modules_selected"); + var id_modules = getQueryParam("full_modules_selected"); if(id_modules !== null) { id_modules = id_modules.split(";"); id_modules.forEach(function(element) { @@ -812,20 +842,18 @@ $ignored_params['refresh'] = ''; ); } - (function($) { - $.get = function(key) { - key = key.replace(/[[]/, '['); - key = key.replace(/[]]/, ']'); - var pattern = "[?&]" + key + "=([^&#]*)"; - var regex = new RegExp(pattern); - var url = unescape(window.location.href); - var results = regex.exec(url); - if (results === null) { - return null; - } else { - return results[1]; - } - } - })(jQuery); + function getQueryParam (key) { + key = key.replace(/[[]/, '['); + key = key.replace(/[]]/, ']'); + var pattern = "[?&]" + key + "=([^&#]*)"; + var regex = new RegExp(pattern); + var url = unescape(window.location.href); + var results = regex.exec(url); + if (results === null) { + return null; + } else { + return results[1]; + } + } - \ No newline at end of file + diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 435474dc53..5659ed6d9b 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -25,7 +25,7 @@ function extension_db_status() __('DB Schema check'), 'images/extensions.png', false, - '', + 'db_status_tab', true, '' ); @@ -69,7 +69,7 @@ function extension_db_status() echo "
"; html_print_input_hidden('db_status_execute', 1); - html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"'); + html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"'); echo '
'; echo ''; @@ -215,7 +215,7 @@ function extension_db_check_tables_differences( $diff_tables = array_diff($tables_test, $tables_system); ui_print_result_message( - !empty($diff_tables), + empty($diff_tables), __('Success! %s DB contains all tables', get_product_name()), __( '%s DB could not retrieve all tables. The missing tables are (%s)', diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 2aface6996..546ee463fa 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -148,7 +148,7 @@ function dbmgr_extension_main() echo "
"; $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->head = array_keys($result[0]); $table->data = $result; diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 1d01cd1418..80de4563ae 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -45,11 +45,9 @@ if (!empty($files)) { $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->style = []; $table->style[1] = 'max-width: 200px;'; - $table->style[2] = 'text-align: center;'; - $table->style[3] = 'text-align: center;'; $table->style[4] = 'text-align: center;'; $table->head = []; $table->head[0] = __('Name'); @@ -81,6 +79,7 @@ if (!empty($files)) { // Last modification // Public URL $data[4] = ''; + $table->cellclass[][4] = 'action_buttons'; if (!empty($file['hash'])) { $public_url = ui_get_full_url(EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']); $message = __('Copy to clipboard').': Ctrl+C -> Enter'; @@ -92,7 +91,7 @@ if (!empty($files)) { } $data[4] .= ""; - $data[4] .= html_print_image('images/download.png', true, ['title' => __('Download')]); + $data[4] .= html_print_image('images/download.png', true, ['title' => __('Download'), 'style' => 'padding:3px' ]); // Download image $data[4] .= ''; diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 1a505538ed..d9843f9860 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -1,17 +1,32 @@ 0, 1, 0)) AS alerts_module_count, - SUM(IF($condition_warning, 1, 0)) AS warning_module_count, - SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count, - SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count, - SUM(IF($condition_critical, 1, 0)) AS critical_module_count, - SUM(IF($condition_normal, 1, 0)) AS normal_module_count, - COUNT(tae.id_agente_modulo) AS total_count, - tmg.id_mg, - tmg.name as n, - tg.id_grupo - FROM ( - SELECT tam.id_agente_modulo, - tam.id_module_group, - ta.id_grupo AS g, - tae.estado, - SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired - FROM tagente_modulo tam - LEFT JOIN talert_template_modules tatm - ON tatm.id_agent_module = tam.id_agente_modulo - AND tatm.times_fired = 1 - LEFT JOIN tagente_estado tae - ON tae.id_agente_modulo = tam.id_agente_modulo - INNER JOIN tagente ta - ON ta.id_agente = tam.id_agente - WHERE ta.disabled = 0 - AND tam.disabled = 0 - AND tam.delete_pending = 0 - AND ta.id_grupo IN ($ids_group) - GROUP BY tam.id_agente_modulo - UNION ALL - SELECT tam.id_agente_modulo, - tam.id_module_group, - tasg.id_group AS g, - tae.estado, - SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired - FROM tagente_modulo tam - LEFT JOIN talert_template_modules tatm - ON tatm.id_agent_module = tam.id_agente_modulo - AND tatm.times_fired = 1 - LEFT JOIN tagente_estado tae - ON tae.id_agente_modulo = tam.id_agente_modulo - INNER JOIN tagente ta - ON ta.id_agente = tam.id_agente - INNER JOIN tagent_secondary_group tasg - ON ta.id_agente = tasg.id_agent - WHERE ta.disabled = 0 - AND tam.disabled = 0 - AND tam.delete_pending = 0 - AND tasg.id_group IN ($ids_group) - GROUP BY tam.id_agente_modulo, tasg.id_group - ) AS tae - RIGHT JOIN tgrupo tg - ON tg.id_grupo = tae.g - INNER JOIN ( - SELECT * FROM tmodule_group - UNION ALL - SELECT 0 AS 'id_mg', 'Nothing' AS 'name' - ) AS tmg - ON tae.id_module_group = tmg.id_mg - GROUP BY tae.g, tmg.id_mg"; + $sql = sprintf( + "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count, + SUM(IF(%s, 1, 0)) AS warning_module_count, + SUM(IF(%s, 1, 0)) AS unknown_module_count, + SUM(IF(%s, 1, 0)) AS notInit_module_count, + SUM(IF(%s, 1, 0)) AS critical_module_count, + SUM(IF(%s, 1, 0)) AS normal_module_count, + COUNT(tae.id_agente_modulo) AS total_count, + tmg.id_mg, + tmg.name as n, + tg.id_grupo + FROM ( + SELECT tam.id_agente_modulo, + tam.id_module_group, + ta.id_grupo AS g, + tae.estado, + SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired + FROM tagente_modulo tam + LEFT JOIN talert_template_modules tatm + ON tatm.id_agent_module = tam.id_agente_modulo + AND tatm.times_fired = 1 + LEFT JOIN tagente_estado tae + ON tae.id_agente_modulo = tam.id_agente_modulo + INNER JOIN tagente ta + ON ta.id_agente = tam.id_agente + WHERE ta.disabled = 0 + AND tam.disabled = 0 + AND tam.delete_pending = 0 + AND ta.id_grupo IN (%s) + GROUP BY tam.id_agente_modulo + UNION ALL + SELECT tam.id_agente_modulo, + tam.id_module_group, + tasg.id_group AS g, + tae.estado, + SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired + FROM tagente_modulo tam + LEFT JOIN talert_template_modules tatm + ON tatm.id_agent_module = tam.id_agente_modulo + AND tatm.times_fired = 1 + LEFT JOIN tagente_estado tae + ON tae.id_agente_modulo = tam.id_agente_modulo + INNER JOIN tagente ta + ON ta.id_agente = tam.id_agente + INNER JOIN tagent_secondary_group tasg + ON ta.id_agente = tasg.id_agent + WHERE ta.disabled = 0 + AND tam.disabled = 0 + AND tam.delete_pending = 0 + AND tasg.id_group IN (%s) + GROUP BY tam.id_agente_modulo, tasg.id_group + ) AS tae + RIGHT JOIN tgrupo tg + ON tg.id_grupo = tae.g + INNER JOIN ( + SELECT * FROM tmodule_group + UNION ALL + SELECT 0 AS 'id_mg', 'Nothing' AS 'name' + ) AS tmg + ON tae.id_module_group = tmg.id_mg + GROUP BY tae.g, tmg.id_mg", + $condition_warning, + $condition_unknown, + $condition_not_init, + $condition_critical, + $condition_normal, + $ids_group, + $ids_group + ); $array_data_prev = db_get_all_rows_sql($sql); @@ -192,7 +225,14 @@ function mainModuleGroups() $array_data[$value['id_grupo']][$value['id_mg']] = $value; } - ui_print_page_header(__('Combined table of agent group and module group'), 'images/module_group.png', false, '', false, ''); + ui_print_page_header( + __('Combined table of agent group and module group'), + 'images/module_group.png', + false, + 'module_groups_view', + false, + '' + ); echo ""; @@ -213,9 +253,21 @@ function mainModuleGroups() echo '
'; echo '
'; + $cell_style = ' + min-width: 60px; + width: 100%; + margin: 0; + overflow:hidden; + text-align: center; + padding: 5px; + padding-bottom:10px; + font-size: 18px; + text-align: center; + '; + if (true) { $table = new StdClass(); - $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;'; + $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->width = '100%'; $head[0] = __('Groups'); @@ -241,28 +293,28 @@ function mainModuleGroups() $color = '#FFA631'; // 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 = '#FC4444'; + $color = '#e63c52'; // 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 = '#FAD403'; + $color = '#f3b200'; // 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 '; // 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 = '#80BA27'; + $color = '#82b92e'; // 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'; // Blue when the cell for this module group and all modules have not init value. } - $data[$i][$j] = "
"; + $data[$i][$j] = "'; } else { - $data[$i][$j] = "
"; + $data[$i][$j] = "
"; $data[$i][$j] .= 0; $data[$i][$j] .= '
'; } @@ -271,7 +323,7 @@ function mainModuleGroups() } } else { foreach ($value['gm'] as $k => $v) { - $data[$i][$j] = "
"; + $data[$i][$j] = "
"; $data[$i][$j] .= 0; $data[$i][$j] .= '
'; $j++; diff --git a/pandora_console/extensions/net_tools.php b/pandora_console/extensions/net_tools.php index e6ec05977b..ba66cae68e 100644 --- a/pandora_console/extensions/net_tools.php +++ b/pandora_console/extensions/net_tools.php @@ -1,26 +1,60 @@ ".__('The agent hasn\'t got IP').'
'; - return; - } - - echo " - "; - - echo '
'; - echo "
"; - echo ""; - echo ''; - echo ''; - echo "'; - echo '
'; - echo __('Operation'); - ui_print_help_tip( - __('You can set the command path in the menu Administration -> Extensions -> Config Network Tools') - ); - echo ''; - echo "'; - echo ''; - echo __('IP address'); - echo ''; - echo "'; - echo '"; - echo __('SNMP Community').' '; - echo ""; - echo ''; - echo ""; - echo '
'; - echo '
'; - - $operation = get_parameter('operation', 0); - $community = get_parameter('community', 'public'); - $ip = get_parameter('select_ips'); - if (!validate_address($ip)) { - ui_print_error_message(__('The ip or dns name entered cannot be resolved')); + ui_print_error_message(__('The ip or dns name entered cannot be resolved')); } else { switch ($operation) { case 1: @@ -175,7 +147,7 @@ function main_net_tools() } else { echo '

'.__('Traceroute to ').$ip.'

'; echo '
';
-                    echo system("$traceroute $ip");
+                    echo system($traceroute.' '.$ip);
                     echo '
'; } break; @@ -187,7 +159,7 @@ function main_net_tools() } else { echo '

'.__('Ping to %s', $ip).'

'; echo '
';
-                    echo system("$ping -c 5 $ip");
+                    echo system($ping.' -c 5 '.$ip);
                     echo '
'; } break; @@ -199,7 +171,7 @@ function main_net_tools() } else { echo '

'.__('Basic TCP Scan on ').$ip.'

'; echo '
';
-                    echo system("$nmap -F $ip");
+                    echo system($nmap.' -F '.$ip);
                     echo '
'; } break; @@ -212,7 +184,7 @@ function main_net_tools() ui_print_error_message(__('Dig executable does not exist.')); } else { echo '
';
-                    echo system("dig $ip");
+                    echo system('dig '.$ip);
                     echo '
'; } @@ -221,51 +193,227 @@ function main_net_tools() ui_print_error_message(__('Whois executable does not exist.')); } else { echo '
';
-                    echo system("whois $ip");
+                    echo system('whois '.$ip);
                     echo '
'; } break; case 3: + $snmp_obj = [ + 'ip_target' => $ip, + 'snmp_version' => $snmp_version, + 'snmp_community' => $community, + 'format' => '-Oqn', + ]; + + $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; + $result = get_h_snmpwalk($snmp_obj); echo '

'.__('SNMP information for ').$ip.'

'; - - $snmpget = whereis_the_command('snmpget'); - if (empty($snmpget)) { - ui_print_error_message(__('SNMPget executable does not exist.')); + echo '

'.__('Uptime').'

'; + echo '
';
+                if (empty($result)) {
+                    ui_print_error_message(__('Target unreachable.'));
+                    break;
                 } else {
-                    echo '

'.__('Uptime').'

'; - echo '
';
-                    echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
-                    echo '
'; - echo '

'.__('Device info').'

'; - echo '
';
-
-                    echo system("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
-                    echo '
'; - - echo '

Interface Information

'; - echo ''; - echo '
'.__('Interface'); - echo ''.__('Status'); - - $int_max = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 "); - - for ($ax = 0; $ax < $int_max; $ax++) { - $interface = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax "); - $estado = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax "); - echo "
$interface$estado"; - } - - echo '
'; + echo array_pop($result); } + + echo '
'; + echo '

'.__('Device info').'

'; + echo '
';
+                $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0';
+                $result = get_h_snmpwalk($snmp_obj);
+                if (empty($result)) {
+                    ui_print_error_message(__('Target unreachable.'));
+                    break;
+                } else {
+                    echo array_pop($result);
+                }
+
+                echo '
'; + + echo '

Interface Information

'; + + $table = new StdClass(); + $table->class = 'databox'; + $table->head = []; + $table->head[] = __('Interface'); + $table->head[] = __('Status'); + + $i = 0; + + $base_oid = '.1.3.6.1.2.1.2.2.1'; + $idx_oids = '.1'; + $names_oids = '.2'; + $status_oids = '.8'; + + $snmp_obj['base_oid'] = $base_oid.$idx_oids; + $idx = get_h_snmpwalk($snmp_obj); + + $snmp_obj['base_oid'] = $base_oid.$names_oids; + $names = get_h_snmpwalk($snmp_obj); + + $snmp_obj['base_oid'] = $base_oid.$status_oids; + $statuses = get_h_snmpwalk($snmp_obj); + + foreach ($idx as $k => $v) { + $index = str_replace($base_oid.$idx_oids, '', $k); + $name = $names[$base_oid.$names_oids.$index]; + + $status = $statuses[$base_oid.$status_oids.$index]; + + $table->data[$i][0] = $name; + $table->data[$i++][1] = $status; + } + + html_print_table($table); + break; + + default: + // Ignore. break; } } +} + + +/** + * Main function. + * + * @return void + */ +function main_net_tools() +{ + $operation = get_parameter('operation', 0); + $community = get_parameter('community', 'public'); + $ip = get_parameter('select_ips'); + $snmp_version = get_parameter('select_version'); + + // Show form. + $id_agente = get_parameter('id_agente', 0); + $principal_ip = db_get_sql( + sprintf( + 'SELECT direccion FROM tagente WHERE id_agente = %d', + $id_agente + ) + ); + + $list_address = db_get_all_rows_sql( + sprintf( + 'SELECT id_a FROM taddress_agent WHERE id_agent = %d', + $id_agente + ) + ); + foreach ($list_address as $address) { + $ids[] = join(',', $address); + } + + $ips = db_get_all_rows_sql( + sprintf( + 'SELECT ip FROM taddress WHERE id_a IN (%s)', + join($ids) + ) + ); + + if ($ips == '') { + echo "
".__('The agent hasn\'t got IP').'
'; + return; + } + + // Javascript. + ?> + + '; + echo "
"; + echo ""; + echo ''; + echo ''; + echo "'; + echo '
'; + echo __('Operation'); + ui_print_help_tip( + __('You can set the command path in the menu Administration -> Extensions -> Config Network Tools') + ); + echo ''; + + html_print_select( + [ + 1 => __('Traceroute'), + 2 => __('Ping host & Latency'), + 3 => __('SNMP Interface status'), + 4 => __('Basic TCP Port Scan'), + 5 => __('DiG/Whois Lookup'), + ], + 'operation', + $operation, + 'mostrarColumns(this.value)', + __('Please select') + ); + + echo ''; + echo __('IP address'); + echo ''; + + $ips_for_select = array_reduce( + $ips, + function ($carry, $item) { + $carry[$item['ip']] = $item['ip']; + return $carry; + } + ); + + html_print_select( + $ips_for_select, + 'select_ips', + $principal_ip + ); + echo '"; + echo __('SNMP Version'); + html_print_select( + [ + '1' => 'v1', + '2c' => 'v2c', + ], + 'select_version', + $snmp_version + ); + echo ''; + echo __('SNMP Community').' '; + html_print_input_text('community', $community); + echo ''; + echo ""; + echo '
'; + echo '
'; + + if ($operation) { + // Execute form. + net_tools_execute($operation, $ip, $community, $snmp_version); + } + echo '
'; } +/** + * Add option. + * + * @return void + */ function godmode_net_tools() { global $config; diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index 09d66abf0c..e487d49ee5 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -29,7 +29,14 @@ function pandora_realtime_graphs() $hide_header = get_parameter('hide_header', 0); if (!$hide_header) { - ui_print_page_header(__('Realtime graphs'), 'images/extensions.png', false, '', false, $onheader); + ui_print_page_header( + __('Realtime graphs'), + 'images/extensions.png', + false, + 'real_time_view', + false, + $onheader + ); } $chart[time()]['graph'] = '0'; @@ -166,7 +173,7 @@ function pandora_realtime_graphs() $table->colspan[2]['snmp_oid'] = 2; $data['snmp_ver'] = __('Version').'  '.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true); - $data['snmp_ver'] .= '  '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true); + $data['snmp_ver'] .= '  '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true); $table->colspan[2]['snmp_ver'] = 2; $table->data[] = $data; diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.css b/pandora_console/extensions/realtime_graphs/realtime_graphs.css index ab6c94e238..2219c6152a 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.css +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.css @@ -11,5 +11,5 @@ #graph_container { width: 800px; - margin: 20px auto !important; + margin: 20px auto; } diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js index 7140d245d4..b5d6c1eaa8 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js @@ -10,7 +10,9 @@ var plot; var plotOptions = { - legend: { container: $("#chartLegend") }, + legend: { + container: $("#chartLegend") + }, xaxis: { tickFormatter: function(timestamp, axis) { var date = new Date(timestamp * 1000); @@ -131,47 +133,6 @@ resetDataPooling(); } - // Set the form OID to the value selected in the SNMP browser - function setOID() { - if ($("#snmp_browser_version").val() == "3") { - $("#text-snmp_oid").val($("#table1-0-1").text()); - } else { - $("#text-snmp_oid").val($("#snmp_selected_oid").text()); - } - - // Close the SNMP browser - $(".ui-dialog-titlebar-close").trigger("click"); - } - - // Show the SNMP browser window - function snmpBrowserWindow() { - // Keep elements in the form and the SNMP browser synced - $("#text-target_ip").val($("#text-ip_target").val()); - $("#text-community").val($("#text-snmp_community").val()); - $("#snmp_browser_version").val($("#snmp_version").val()); - $("#snmp3_browser_auth_user").val($("#snmp3_auth_user").val()); - $("#snmp3_browser_security_level").val($("#snmp3_security_level").val()); - $("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val()); - $("#snmp3_browser_auth_pass").val($("#snmp3_auth_pass").val()); - $("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val()); - $("#snmp3_browser_privacy_pass").val($("#snmp3_privacy_pass").val()); - - $("#snmp_browser_container") - .show() - .dialog({ - title: "", - resizable: true, - draggable: true, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 920, - height: 500 - }); - } - function shortNumber(number) { if (Math.round(number) != number) return number; number = Number.parseInt(number); @@ -187,6 +148,7 @@ return number + " " + shorts[pos]; } + function roundToTwo(num) { return +(Math.round(num + "e+2") + "e-2"); } diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index 92d106d153..c43e2a97f2 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -998,20 +998,23 @@ function process_upload_xml($xml) { $hook_enterprise = enterprise_include('extensions/resource_registration/functions.php'); - // Extract component + // Extract component. process_upload_xml_component($xml); $group_filter = get_parameter('group'); - // Extract visual map + // Extract visual map. process_upload_xml_visualmap($xml, $group_filter); - // Extract policies + // Extract policies. if ($hook_enterprise === true) { - process_upload_xml_policy($xml, $group_filter); + $centralized_management = !is_central_policies_on_node(); + if ($centralized_management) { + process_upload_xml_policy($xml, $group_filter); + } } - // Extract reports + // Extract reports. process_upload_xml_report($xml, $group_filter); } @@ -1038,6 +1041,11 @@ function resource_registration_extension_main() return; } + $centralized_management = !is_central_policies_on_node(); + if (!$centralized_management) { + ui_print_warning_message(__('This node is configured with centralized mode. Go to metaconsole to create a policy.')); + } + echo '
'; echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'

'.__("You can get more resurces in our Public Resource Library"); echo '
'; diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 562d757a20..e26b0dab1e 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -66,10 +66,10 @@ function users_extension_main_god($god=true) $rows = []; echo "
".__('No other users connected').'
'; } else { - $table->cellpadding = 4; - $table->cellspacing = 4; + $table->cellpadding = 0; + $table->cellspacing = 0; $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->size = []; $table->data = []; $table->head = []; diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt deleted file mode 100644 index 7ddcdae14e..0000000000 --- a/pandora_console/extras/delete_files/delete_files.txt +++ /dev/null @@ -1,3 +0,0 @@ -/godmode/servers/recorn_script.php -/godmode/servers/manage_recontask_form.php -/godmode/servers/manage_recontask.php \ No newline at end of file diff --git a/pandora_console/extras/mr/26.sql b/pandora_console/extras/mr/26.sql index f9c904a0a3..591edd6499 100644 --- a/pandora_console/extras/mr/26.sql +++ b/pandora_console/extras/mr/26.sql @@ -1,8 +1,24 @@ START TRANSACTION; --- ---------------------------------------------------------------------- --- Add column in table `tagent_custom_fields` --- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tnetwork_matrix` ( + `id` int(10) unsigned NOT NULL auto_increment, + `source` varchar(60) default '', + `destination` varchar(60) default '', + `utimestamp` bigint(20) default 0, + `bytes` int(18) unsigned default 0, + `pkts` int(18) unsigned default 0, + PRIMARY KEY (`id`), + UNIQUE (`source`, `destination`, `utimestamp`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8 ; + +ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; + +UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; + +UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport"); + ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; +ALTER TABLE `trecon_task` ADD COLUMN `summary` text; + COMMIT; diff --git a/pandora_console/extras/mr/27.sql b/pandora_console/extras/mr/27.sql new file mode 100644 index 0000000000..697be21a93 --- /dev/null +++ b/pandora_console/extras/mr/27.sql @@ -0,0 +1,54 @@ +START TRANSACTION; + +ALTER TABLE `tnetflow_filter` DROP COLUMN `output`; + +ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; +ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; + +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'; + +UPDATE tuser_task SET parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; + +ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; + +ALTER TABLE `treport_content_template` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; + +ALTER TABLE `trecon_script` ADD COLUMN `type` int NOT NULL default 0; +ALTER TABLE `trecon_task` ADD COLUMN `type` int NOT NULL default 0; + +UPDATE `trecon_script` SET `type` = 1 WHERE `name`="Discovery.Application.VMware"; +UPDATE `trecon_script` SET `type` = 2 WHERE `name`="Discovery.Cloud"; +UPDATE `trecon_script` SET `type` = 3 WHERE `name` LIKE "IPAM%Recon"; +UPDATE `trecon_script` SET `type` = 4 WHERE `name` LIKE "IPMI%Recon"; + +UPDATE `trecon_task` SET `type`=3 WHERE `description`="Discovery.Application.VMware"; +UPDATE `trecon_task` SET `type`=2 WHERE `description`="Discovery.Cloud"; +UPDATE `trecon_task` SET `type`=7 WHERE `description`="Discovery.Cloud.RDS"; + +COMMIT; diff --git a/pandora_console/extras/mr/28.sql b/pandora_console/extras/mr/28.sql new file mode 100644 index 0000000000..bab07bead8 --- /dev/null +++ b/pandora_console/extras/mr/28.sql @@ -0,0 +1,45 @@ +START TRANSACTION; + +ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; + +ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; + +ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text; + +ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); + +DELETE FROM `tevent_response` WHERE `name` LIKE 'Create Integria IMS incident from event'; +INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW()); + + +INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official communication"), "admin", 1, 0); +UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System status' OR `description` = 'Official communication'; +UPDATE `tnotification_source` SET `icon`="icono_logo_pandora.png" WHERE `description` = 'Official communication'; + +-- --------------------------------------------------------------------- +-- Table `tvisual_console_items_cache` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tvisual_console_elements_cache` ( + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `vc_id` INTEGER UNSIGNED NOT NULL, + `vc_item_id` INTEGER UNSIGNED NOT NULL, + `user_id` VARCHAR(60) DEFAULT NULL, + `data` TEXT NOT NULL, + `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire', + PRIMARY KEY(`id`), + FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`) + ON DELETE CASCADE, + FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`) + ON DELETE CASCADE, + FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`) + ON DELETE CASCADE ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0; + +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) DEFAULT '1'; + +COMMIT; diff --git a/pandora_console/extras/mr/29.sql b/pandora_console/extras/mr/29.sql new file mode 100644 index 0000000000..2bc8b9a8c9 --- /dev/null +++ b/pandora_console/extras/mr/29.sql @@ -0,0 +1,28 @@ +START TRANSACTION; + +ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`); + +DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x'; + +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', + `username` text, + `password` text, + `extra_1` text, + `extra_2` text, + PRIMARY KEY (`identifier`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +INSERT INTO `tcredential_store` (`identifier`, `id_group`, `product`, `username`, `password`) VALUES ("imported_aws_account", 0, "AWS", (SELECT `value` FROM `tconfig` WHERE `token` = "aws_access_key_id" LIMIT 1), (SELECT `value` FROM `tconfig` WHERE `token` = "aws_secret_access_key" LIMIT 1)); +DELETE FROM `tcredential_store` WHERE `username` IS NULL AND `password` IS NULL; + +UPDATE `tagente` ta INNER JOIN `tagente` taa on ta.`id_parent` = taa.`id_agente` AND taa.`nombre` IN ("us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1") SET ta.nombre = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), ta.`nombre`)); + +UPDATE `tagente` SET `nombre` = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), `nombre`)) WHERE `nombre` IN ("Aws", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1"); + +UPDATE `trecon_task` SET `auth_strings` = "imported_aws_account" WHERE `type` IN (2,6,7); + +COMMIT; diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index d6cd017087..f3b11177d1 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -122,7 +122,7 @@ function execution_time() 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 a more extensive information of this data consult the Execution Time graph"; + return "Normal Status   The execution time is correct. For more information about this data, check the Execution Time graph"; } } @@ -140,7 +140,8 @@ function get_status_logs($path) { $status_server_log = ''; $size_server_log = number_format(get_logs_size($path)); - if ($size_server_log <= 1048576) { + $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"; @@ -157,9 +158,9 @@ function percentage_modules_per_agent() $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 percent"; + $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 percent. You can have performance problems"; + $status_average_modules = "Warning Status  The average of modules per agent is more than 40. You can have performance problems"; } return $status_average_modules; @@ -173,9 +174,9 @@ function license_capacity() $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   The license capacity is more than 90 percent"; + $status_license_capacity = "Warning Status   License capacity exceeds 90 percent"; } else { - $status_license_capacity = "Normal Status   The license capacity is less than 90 percent"; + $status_license_capacity = "Normal Status   License capacity is less than 90 percent"; } return $status_license_capacity; @@ -202,9 +203,9 @@ function interval_average_of_network_modules() $average_time = ((int) $total_module_interval_time / $total_network_modules); if ($average_time < 180) { - $status_average_modules = "Warning Status   The system has a lot of load and a very fine configuration is required"; + $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 has an acceptable charge"; + $status_average_modules = "Normal Status   The system is not overloaded (average time $average_time) "; } if ($average_time == 0) { @@ -221,9 +222,9 @@ $attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLO function files_attachment_folder($total_files) { if ($total_files <= 700) { - $status_total_files = "Normal Status   The attachment folder has less than 700 files."; + $status_total_files = "Normal Status   The attached folder contains less than 700 files."; } else { - $status_total_files = "Warning Status   The attachment folder has more than 700 files."; + $status_total_files = "Warning Status   The attached folder contains more than 700 files."; } return $status_total_files; @@ -236,9 +237,9 @@ $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 has an acceptable amount of data."; + $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 has too much data. A historical database is recommended."; + $tagente_datos_size = "Warning Status   The tagente_datos table contains too much data. A historical database is recommended."; } return $tagente_datos_size; @@ -274,6 +275,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { } $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'; @@ -294,16 +296,16 @@ $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 = 0; +$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   The fragmentation tables is higher than recommended. You should defragment them."; + $status_tables_frag = "Warning Status   Table fragmentation is higher than recommended. They should be defragmented."; } else { - $status_tables_frag = "Normal Status   The fragmentation tables is correct."; + $status_tables_frag = "Normal Status   Table fragmentation is correct."; } return $status_tables_frag; @@ -319,9 +321,9 @@ 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 gives information about Pandora FMS database. -This program only can be executed from console, and need a parameter, the -full path to Pandora FMS 'config.php' file. + 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 @@ -344,15 +346,21 @@ full path to Pandora FMS 'config.php' file. include '../include/config.php'; } - // Not from console, this is a web session - if ((!isset($config['id_user'])) or (!check_acl($config['id_user'], 0, 'PM'))) { + // 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, '', true); + // Header. + ui_print_page_header( + __('Pandora FMS Diagnostic tool'), + '', + false, + 'diagnostic_tool_tab', + true + ); echo ""; echo "'; @@ -677,7 +685,7 @@ render_info_data( $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 "'; + 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 '); @@ -704,12 +712,14 @@ render_info_data( 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), 'Status fragmentation tables'); + 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'); @@ -731,14 +741,14 @@ render_info_data( echo "'; - render_row($attachment_total_files, 'Total files in the attachment folder'); + 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 the tagente_datos table'); - render_row(status_tagente_datos($tagente_datos_size), 'Status of the tagente_datos table'); - render_row(execution_time(), 'Degradation of the execution time when executing a count'); + 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 "'; @@ -781,6 +791,6 @@ render_info_data( echo "
"; echo ''.__( - '(*) Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\' very important to -keep up-to-date database to get the best performance and results in Pandora' + '(*) 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' ).'


'; 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 e7cedb62f5..4bad7b3652 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 @@ -58,6 +58,7 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` ( ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; +ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; -- ----------------------------------------------------- -- Table `tpolicy_modules` @@ -136,6 +137,7 @@ 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'; -- --------------------------------------------------------------------- -- Table `tpolicies` @@ -759,11 +761,41 @@ 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'; ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0'; ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0'; +ALTER TABLE `treport_content_template` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; -- ----------------------------------------------------- -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) @@ -975,10 +1007,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( `agent_version` varchar(100) default '', `ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00', `disabled` tinyint(2) NOT NULL default '0', + `remote` tinyint(1) NOT NULL default '0', `id_parent` int(10) unsigned default '0', `custom_id` varchar(255) default '', `server_name` varchar(100) default '', `cascade_protection` tinyint(2) NOT NULL default '0', + `cascade_protection_module` int(10) unsigned default '0', `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' , `icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' , `update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' , @@ -993,19 +1027,21 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( `fired_count` bigint(20) NOT NULL default '0', `update_module_count` tinyint(1) NOT NULL default '0', `update_alert_count` tinyint(1) NOT NULL default '0', + `update_secondary_groups` tinyint(1) NOT NULL default '0', + `transactional_agent` tinyint(1) NOT NULL default '0', + `alias` varchar(600) BINARY NOT NULL default '', + `alias_as_name` tinyint(2) NOT NULL default '0', + `safe_mode_module` int(10) unsigned NOT NULL default '0', + `cps` int NOT NULL default 0, PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`(255)), KEY `direccion` (`direccion`), + KEY `id_tagente_idx` (`id_tagente`), KEY `disabled` (`disabled`), KEY `id_grupo` (`id_grupo`), FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0'; -ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT ''; - -- --------------------------------------------------------------------- -- Table `ttransaction` -- --------------------------------------------------------------------- @@ -1150,6 +1186,9 @@ ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0 ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0; ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0; ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0; +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'; -- --------------------------------------------------------------------- -- Table `talert_actions` @@ -1180,6 +1219,7 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT " UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket'; UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using: _field1_ as destination email address, and _field2_ as subject for message. _field3_ as text of message. _field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1; ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0; +ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; @@ -1199,13 +1239,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', 26); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 29); 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', '733'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '736'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); -- --------------------------------------------------------------------- @@ -1252,6 +1292,11 @@ alter table tusuario add autorefresh_white_list text not null default ''; ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30'; ALTER TABLE `tusuario` DROP COLUMN `flash_chart`; ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0'; +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); + + -- --------------------------------------------------------------------- -- Table `tagente_modulo` @@ -1260,6 +1305,10 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; 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'; -- --------------------------------------------------------------------- -- Table `tagente_datos` @@ -1279,6 +1328,7 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0'; 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'; -- --------------------------------------------------------------------- -- Table `tagente` @@ -1329,6 +1379,7 @@ ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0; ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0; ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0; +ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1355,6 +1406,7 @@ ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default ' -- Table `tnetflow_filter` -- --------------------------------------------------------------------- ALTER TABLE tnetflow_filter ADD COLUMN `router_ip` TEXT NOT NULL DEFAULT ""; +UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport"); -- --------------------------------------------------------------------- -- Table `treport_custom_sql` @@ -1369,13 +1421,27 @@ UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_n -- ---------------------------------------------------------------------- -- Table `treport_content` -- --------------------------------------------------------------------- - ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL; +ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0'; +UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; +ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; +ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1'; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` @@ -1410,6 +1476,7 @@ ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0'; 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; -- --------------------------------------------------------------------- -- Table `twidget` AND Table `twidget_dashboard` @@ -1912,6 +1979,47 @@ CREATE TABLE `tgis_map_layer_groups` ( CONSTRAINT `tgis_map_layer_groups_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tnetwork_matrix` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tnetwork_matrix` ( + `id` int(10) unsigned NOT NULL auto_increment, + `source` varchar(60) default '', + `destination` varchar(60) default '', + `utimestamp` bigint(20) default 0, + `bytes` int(18) unsigned default 0, + `pkts` int(18) unsigned default 0, + PRIMARY KEY (`id`), + UNIQUE (`source`, `destination`, `utimestamp`) +) ENGINE = InnoDB DEFAULT CHARSET=utf8 ; + +-- --------------------------------------------------------------------- +-- Table `user_task` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tuser_task` ( + `id` int(20) unsigned NOT NULL auto_increment, + `function_name` varchar(80) NOT NULL default '', + `parameters` text NOT NULL default '', + `name` varchar(60) NOT NULL default '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `user_task_scheduled` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tuser_task_scheduled` ( + `id` int(20) unsigned NOT NULL auto_increment, + `id_usuario` varchar(60) NOT NULL default '0', + `id_user_task` int(20) unsigned NOT NULL default '0', + `args` TEXT NOT NULL, + `scheduled` enum('no','hourly','daily','weekly','monthly','yearly','custom') default 'no', + `last_run` int(20) unsigned default '0', + `custom_data` int(10) NULL default '0', + `flag_delete` tinyint(1) UNSIGNED NOT NULL default 0, + `id_grupo` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- ----------------------------------------------------- -- Table `tnotification_source` -- ----------------------------------------------------- @@ -1934,7 +2042,7 @@ INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, ` ("Message", "icono_info_mr.png", 86400, 1, 1, 0), ("Pending task", "icono_info_mr.png", 86400, 1, 1, 0), ("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0), - ("Official communication", "icono_info_mr.png", 86400, 1, 1, 0), + ("Official communication", "icono_logo_pandora.png", 86400, 1, 1, 0), ("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0); -- ----------------------------------------------------- @@ -2031,6 +2139,9 @@ INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fi INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0); INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message"; INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != ''; +INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official communication"), "admin", 1, 0); +UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System status' OR `description` = 'Official communication'; + -- ---------------------------------------------------------------------- -- Add custom internal recon scripts -- ---------------------------------------------------------------------- @@ -2040,3 +2151,61 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di -- Add column in table `tagent_custom_fields` -- ---------------------------------------------------------------------- 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`; + + +-- ---------------------------------------------------------------------- +-- Update table `tuser_task` +-- ---------------------------------------------------------------------- +UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; + +-- ---------------------------------------------------------------------- +-- ADD message in table 'tnews' +-- ---------------------------------------------------------------------- + +INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW()); + +-- ---------------------------------------------------------------------- +-- Alter table `talert_templates` +-- ---------------------------------------------------------------------- + + ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); + +-- --------------------------------------------------------------------- +-- Table `tvisual_console_items_cache` +-- --------------------------------------------------------------------- +CREATE TABLE `tvisual_console_elements_cache` ( + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `vc_id` INTEGER UNSIGNED NOT NULL, + `vc_item_id` INTEGER UNSIGNED NOT NULL, + `user_id` VARCHAR(60) DEFAULT NULL, + `data` TEXT NOT NULL, + `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire', + PRIMARY KEY(`id`), + FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`) + ON DELETE CASCADE, + FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`) + ON DELETE CASCADE, + FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`) + ON DELETE CASCADE + ON UPDATE CASCADE +) engine=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tcredential_store` +-- --------------------------------------------------------------------- +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', + `username` text, + `password` text, + `extra_1` text, + `extra_2` text, + PRIMARY KEY (`identifier`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/general/firts_task/collections.php b/pandora_console/general/firts_task/collections.php index 269de3ba12..8e27ce6ee3 100755 --- a/pandora_console/general/firts_task/collections.php +++ b/pandora_console/general/firts_task/collections.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); __('Collections')]); ?>
-

+

true, 'message' => __('There are no custom __('Custom Fields')]); ?>

-

+

true, 'message' => __('There are no custom __('Custom Graphs')]); ?>

-

+

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

-

+

__('Incidents')]); ?>

-

+

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

-

+

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

-

+

__('Planned Downtime')]); ?>

-

+

__('Discovery server')]); ?>

-

+

+

diff --git a/pandora_console/general/firts_task/service_list.php b/pandora_console/general/firts_task/service_list.php index f3971ca786..424bc60400 100755 --- a/pandora_console/general/firts_task/service_list.php +++ b/pandora_console/general/firts_task/service_list.php @@ -25,7 +25,7 @@ ui_require_css_file('firts_task'); __('Services')]); ?>
-

+

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

-

+

__('Tags')]); ?>

-

+

__('Transactions')]); ?>

-

+


'; +echo ''.__('Page generated on %s', date('Y-m-d H:i:s')).''; + -echo ' '; -echo ''.__('Page generated at').' '.date($config['date_format']); -echo '
® '.get_copyright_notice().''; if (isset($config['debug'])) { $cache_info = []; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 7addef057f..a093596b2b 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -18,10 +18,14 @@ require_once 'include/functions_notifications.php'; // Global errors/warnings checking. config_check(); -?> -

-
+if ($config['menu_type'] == 'classic') { + echo '
'; +} else { + echo '
'; +} +?> +
'; - // Search + // Search. $acl_head_search = true; if ($config['acl_enterprise'] == 1 && !users_is_admin()) { $acl_head_search = db_get_sql( @@ -94,7 +98,7 @@ require_once 'include/functions_notifications.php'; } if ($acl_head_search) { - // Search bar + // Search bar. $search_bar = '
'; if (!isset($config['search_keywords'])) { $search_bar .= ''; @@ -116,15 +120,13 @@ require_once 'include/functions_notifications.php'; } $search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" - onkeyup="javascript: fieldKeyWordEmpty = false;" - style="margin-top:5px;" class="search_input" />'; + onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; $search_bar .= ""; $search_bar .= ''; - $header_searchbar = ''; + $header_searchbar = ''; } @@ -141,14 +143,74 @@ require_once 'include/functions_notifications.php'; $_GET['sec2'] = ''; } + if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) { + // home screen chosen by the user + $home_page = ''; + if (isset($config['id_user'])) { + $user_info = users_get_user_by_id($config['id_user']); + $home_page = io_safe_output($user_info['section']); + $home_url = $user_info['data_section']; + } + + if ($home_page != '') { + switch ($home_page) { + case 'Event list': + $_GET['sec2'] = 'operation/events/events'; + break; + + case 'Group view': + $_GET['sec2'] = 'operation/agentes/group_view'; + break; + + case 'Alert detail': + $_GET['sec2'] = 'operation/agentes/alerts_status'; + break; + + case 'Tactical view': + $_GET['sec2'] = 'operation/agentes/tactical'; + break; + + case 'Default': + $_GET['sec2'] = 'general/logon_ok'; + break; + + case 'Dashboard': + $_GET['sec2'] = 'enterprise/dashboard/main_dashboard'; + break; + + case 'Visual console': + $_GET['sec2'] = 'operation/visual_console/render_view'; + break; + + case 'Other': + $home_url = io_safe_output($home_url); + $url_array = parse_url($home_url); + parse_str($url_array['query'], $res); + foreach ($res as $key => $param) { + $_GET[$key] = $param; + } + break; + } + } + } + if (!isset($_GET['refr'])) { $_GET['refr'] = null; } - $select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'"); - $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + $select = db_process_sql( + "SELECT autorefresh_white_list,time_autorefresh + FROM tusuario + WHERE id_user = '".$config['id_user']."'" + ); - if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { + $autorefresh_list = json_decode( + $select[0]['autorefresh_white_list'] + ); + + if ($autorefresh_list !== null + && array_search($_GET['sec2'], $autorefresh_list) !== false + ) { $do_refresh = true; if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') { if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) { @@ -157,23 +219,65 @@ require_once 'include/functions_notifications.php'; } if ($do_refresh) { - $autorefresh_img = html_print_image('images/header_refresh_gray.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]); + $autorefresh_img = html_print_image( + 'images/header_refresh_gray.png', + true, + [ + 'class' => 'bot', + 'alt' => 'lightning', + 'title' => __('Configure autorefresh'), + ] + ); - if ($_GET['refr']) { - $autorefresh_txt .= ' ('.date('i:s', $config['refr']).')'; + if ((isset($select[0]['time_autorefresh']) === true) + && $select[0]['time_autorefresh'] !== 0 + && $config['refr'] === null + ) { + $config['refr'] = $select[0]['time_autorefresh']; + $autorefresh_txt .= ' ('; + $autorefresh_txt .= date( + 'i:s', + $config['refr'] + ); + $autorefresh_txt .= ')'; + } else if ($_GET['refr']) { + $autorefresh_txt .= ' ('; + $autorefresh_txt .= date('i:s', $config['refr']); + $autorefresh_txt .= ')'; } $ignored_params['refr'] = ''; $values = get_refresh_time_array(); + $autorefresh_additional = ''; unset($values); + if ($home_page != '') { + $autorefresh_link_open_img = ''; + } else { + $autorefresh_link_open_img = ''; + } - $autorefresh_link_open_img = ''; - - if ($_GET['refr']) { - $autorefresh_link_open_txt = ''; + if ($_GET['refr'] + || ((isset($select[0]['time_autorefresh']) === true) + && $select[0]['time_autorefresh'] !== 0) + ) { + if ($home_page != '') { + $autorefresh_link_open_txt = ''; + } else { + $autorefresh_link_open_txt = ''; + } } else { $autorefresh_link_open_txt = ''; } @@ -192,7 +296,15 @@ require_once 'include/functions_notifications.php'; $display_counter = 'display:none'; } } else { - $autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]); + $autorefresh_img = html_print_image( + 'images/header_refresh_disabled_gray.png', + true, + [ + 'class' => 'bot autorefresh_disabled', + 'alt' => 'lightning', + 'title' => __('Disabled autorefresh'), + ] + ); $ignored_params['refr'] = false; @@ -203,56 +315,80 @@ require_once 'include/functions_notifications.php'; $display_counter = 'display:none'; } - $header_autorefresh = '
'.$autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close.'
'; - $header_autorefresh_counter = '
'.$autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional.'
'; + $header_autorefresh = '
'; + $header_autorefresh .= $autorefresh_link_open_img; + $header_autorefresh .= $autorefresh_img; + $header_autorefresh .= $autorefresh_link_close; + $header_autorefresh .= '
'; + + $header_autorefresh_counter = '
'; + $header_autorefresh_counter .= $autorefresh_link_open_txt; + $header_autorefresh_counter .= $autorefresh_txt; + $header_autorefresh_counter .= $autorefresh_link_close; + $header_autorefresh_counter .= $autorefresh_additional; + $header_autorefresh_counter .= '
'; - // Qr. - if ($config['show_qr_code_header'] == 0) { - $show_qr_code_header = 'display: none;'; + // Support. + if (defined('PANDORA_ENTERPRISE')) { + $header_support_link = 'https://support.artica.es/'; } else { - $show_qr_code_header = 'display: inline;'; + $header_support_link = 'https://pandorafms.com/forums/'; } - $header_qr = '
'; + $header_support = ''; + + // Documentation. + $header_docu = ''; + - echo "'; - ?> - - __('Edit my user'), 'class' => 'bot', 'alt' => 'user']); + $header_user = html_print_image( + 'images/header_user_admin_green.png', + true, + [ + 'title' => __('Edit my user'), + 'class' => 'bot', + 'alt' => 'user', + ] + ); } else { - $header_user = html_print_image('images/header_user_green.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']); + $header_user = html_print_image( + 'images/header_user_green.png', + true, + [ + 'title' => __('Edit my user'), + 'class' => 'bot', + 'alt' => 'user', + ] + ); } $header_user = ''; // Logout. $header_logout = ''; - echo '
'.$header_autorefresh, $header_autorefresh_counter, $header_qr, $header_chat.'
-
'.$header_searchbar, $header_discovery, $servers_list.'
-
'.$header_user, $header_logout.'
'; + 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.'
'; ?>
@@ -490,7 +626,12 @@ require_once 'include/functions_notifications.php'; ); - $("a.autorefresh_txt").toggle (); - $("#combo_refr").toggle (); - href = $("a.autorefresh").attr ("href"); - - var refresh = ''; - $(document).attr ("location", href + refresh); - - - if (fixed_header) { $('div#head').addClass('fixed_header'); - $('div#page') - .css('padding-top', $('div#head').innerHeight() + 'px') - .css('position', 'relative'); + $('div#main').css('padding-top', $('div#head').innerHeight() + 'px'); } check_new_chats_icon('icon_new_messages_chat'); @@ -547,14 +669,14 @@ require_once 'include/functions_notifications.php'; blinkpubli(); $("#header_autorefresh").css('padding-right', '5px'); - var refr_time = ; + var refr_time = ; var t = new Date(); - t.setTime (t.getTime () + - parseInt()); - $("#refrcounter").countdown ({until: t, + t.setTime (t.getTime () + parseInt()); + $("#refrcounter").countdown ({ + until: t, layout: '%M%nn%M:%S%nn%S', labels: ['', '', '', '', '', '', ''], onExpiry: function () { diff --git a/pandora_console/general/login_identification_wizard.php b/pandora_console/general/login_identification_wizard.php deleted file mode 100644 index 7bdb370b54..0000000000 --- a/pandora_console/general/login_identification_wizard.php +++ /dev/null @@ -1,455 +0,0 @@ - true, - 'message' => '', - ]; - - if ($register_pandora) { - // Pandora register update - $um_message = update_manager_register_instance(); - $ui_feedback['message'] .= $um_message['message'].'

'; - if ($um_message['success']) { - config_update_value('instance_registered', 1); - $ui_feedback['status'] = true && $ui_feedback['status']; - } else { - $ui_feedback['status'] = false; - } - } else if (!$forced) { - config_update_value('identification_reminder_timestamp', $future_8_days); - } - - if ($newsletter) { - // Pandora newsletter update - $email = get_parameter('email', ''); - $um_message = update_manager_insert_newsletter($email); - $ui_feedback['message'] .= $um_message['message']; - if ($um_message['success']) { - db_process_sql_update('tusuario', ['middlename' => 1], ['id_user' => $config['id_user']]); - $ui_feedback['status'] = true && $ui_feedback['status']; - } else { - $ui_feedback['status'] = false; - } - } else if (!$forced) { - db_process_sql_update('tusuario', ['lastname' => $future_8_days], ['id_user' => $config['id_user']]); - } - - // Form answer JSON - $ui_feedback['status'] = $ui_feedback['status'] ? 1 : 0; - echo io_json_mb_encode($ui_feedback); - } - - if (!$not_return) { - return; - } -} - -// Check if user is admin -if (!license_free()) { - return; -} - -if (!users_is_admin($config['id_user'])) { - return; -} - -// Get data to display properly the wizard -$wizard_data = []; - -$wizard_data['newsletter_subscribed'] = db_get_value('middlename', 'tusuario', 'id_user', $config['id_user']); -// force_* = 1 -> force show -// force_* = 0 -> force hide -// force_* = -1 -> show or hide depends reminder and timestamp -$wizard_data['force_newsletter'] = get_parameter('force_newsletter', -1); -$wizard_data['newsletter_reminder'] = db_get_value('firstname', 'tusuario', 'id_user', $config['id_user']); -$wizard_data['newsletter_reminder_timestamp'] = db_get_value('lastname', 'tusuario', 'id_user', $config['id_user']); - - -$wizard_data['instance_registered'] = $config['instance_registered']; -$wizard_data['force_register'] = get_parameter('force_register', -1); -$wizard_data['identification_reminder'] = $config['identification_reminder']; -$wizard_data['identification_reminder_timestamp'] = $config['identification_reminder_timestamp']; - -$display_newsletter = display_newsletter($wizard_data); -$display_register = display_register($wizard_data); -$display_forced = ($wizard_data['force_newsletter'] != -1) || ($wizard_data['force_register'] != -1); - -// Return if it is fully completed -if ((!$display_register) && (!$display_newsletter)) { - return false; -} - -$return_button = get_parameter('return_button', 0) == 1; - -$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']); -// Avoid to show default email -if ($email == 'admin@example.com') { - $email = ''; -} - -// Prints accept register license -echo '
'; - echo '
'; - echo html_print_image('images/pandora_circle_big.png', true); - echo '
'; - echo '
'; - echo __('Stay up to date with the %s community', get_product_name()).'.'; - echo '
'; - - echo '
'; - echo '

'.__('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on the database owned by Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', get_product_name(), get_product_name(), get_product_name()).'

'; - echo '

'.__('In the same fashion, when subscribed to the newsletter you accept that your email will pass on to a database property of Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the newsletter subscription options.', get_product_name()).'

'; - echo '
'; - - echo '
'; - echo '
'; - html_print_submit_button(__('Finish'), 'finish_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"'); - echo '
'; - $display_status_return = $return_button ? 'block' : 'none'; - echo '
'; - html_print_submit_button(__('Return'), 'return_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"'); - echo '
'; - echo '
'; - html_print_checkbox('register', 1, false, false, false, 'cursor: \'pointer\''); - echo ' '.__('Join the %s community!', get_product_name()).'!
'; - html_print_checkbox('newsletter', 1, false, false, false, 'cursor: \'pointer\''); - echo ' '.__('Subscribe to our newsletter').''; - echo '
'; - echo '
'; - echo ' '; - html_print_input_text_extended('email-newsletter', $email, 'text-email-newsletter', '', 30, 255, false, '', ['style' => 'display:none; width: 200px;']); -echo ' '; - echo ' *'.__('Required').' '; - echo '
'; - echo '
'; - echo '
'; -echo '
'; - -// Print yes or not dialog -echo '
'; - echo '
'; - echo __('Do you want to continue without any registration').'?'; - echo '
'; - echo '
'; - html_print_submit_button(__('No'), 'no_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel" style="width:100px;"'); - echo '
'; - echo '
'; - html_print_submit_button(__('Yes'), 'yes_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"'); - echo '
'; -echo '
'; - -// Print feedback user dialog -echo '
'; - echo '
'; - echo html_print_image('images/success_circle_big.png', true); - echo '
'; - echo '
'; -echo '
'; -?> - - - - - diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index ea73318e2a..4fbdf93140 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -19,8 +19,8 @@ if (isset($config['homedir'])) { ui_require_css_file('login'); -require_once $homedir.'include/functions_ui.php'; -require_once $homedir.'include/functions.php'; +require_once __DIR__.'/../include/functions_ui.php'; +require_once __DIR__.'/../include/functions.php'; require_once __DIR__.'/../include/functions_html.php'; @@ -186,7 +186,7 @@ switch ($login_screen) { echo '
'; echo ''; echo ''; echo ''; } break; @@ -245,7 +245,7 @@ switch ($login_screen) { html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true); echo '
'; echo ''; break; @@ -305,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { echo ''; @@ -319,7 +319,7 @@ echo '
'; echo '
'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'
'; echo ''; -if (!isset($process_error_message) && isset($mail)) { +if (empty($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; @@ -336,7 +336,7 @@ if (!isset($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; -} else if (isset($process_error_message)) { +} else if (isset($process_error_message) && !empty($process_error_message)) { echo '
'; echo '
'; echo '
'; @@ -518,6 +518,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig' ui_require_css_file('dialog'); ui_require_css_file('jquery-ui.min', 'include/styles/js/'); ui_require_jquery_file('jquery-ui.min'); +ui_require_jquery_file('jquery-ui_custom'); ?> $email], - ['id_user' => $config['id_user']] - ); - } - - // Update the alert action Mail to XXX/Administrator if it is set to default - $mail_check = 'yourmail@domain.es'; - $mail_alert = alerts_get_alert_action_field1(1); - if ($mail_check === $mail_alert && $email !== false) { - alerts_update_alert_action( - 1, - [ - 'field1' => $email, - 'field1_recovery' => $email, - ] - ); - } - - config_update_value('initial_wizard', 1); - } - - // Change the language if is change in checkbox - if ($change_language !== 0) { - config_update_value('language', $change_language); - } - - if ($cancel_wizard !== 0) { - config_update_value('initial_wizard', 1); - } - - return; -} - -$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']); -// Avoid to show default email -if ($email == 'admin@example.com') { - $email = ''; -} - -// Prints first step pandora registration -echo ''; - - ?> - - diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 21c9713a48..a02f6c11ac 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -1,26 +1,39 @@ -
".__('Pandora status info').'
".__('MySQL Performance metrics').'
".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).'
".__(' Pandora FMS logs dates').'
".__(' Status of the attachment folder').'
".__(' Information from the tagente_datos table').'
".__(' Pandora FMS server threads').'
- - - - - - - -
- - - class = 'databox'; - $table->cellpadding = 4; - $table->cellspacing = 4; - $table->head = []; - $table->data = []; - $table->headstyle[0] = 'text-align:center;'; - $table->width = '100%'; - $table->head[0] = ''.__('%s Overview', get_product_name()).''; - $table->head_colspan[0] = 4; - // Indicators - $tdata = []; - $stats = reporting_get_stats_indicators($data, 120, 10, false); - $status = ''; - foreach ($stats as $stat) { - $status .= ''; - } +ui_require_css_file('logon'); - $status .= '
'.$stat['title'].''.''.$stat['graph'].'
'; - $table->data[0][0] = $status; - $table->rowclass[] = ''; +echo '
'; - $table->data[] = $tdata; +// +// Overview Table. +// +$table = new stdClass(); +$table->class = 'no-class'; +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->head = []; +$table->data = []; +$table->headstyle[0] = 'text-align:center;'; +$table->width = '100%'; +$table->head_colspan[0] = 4; - // Alerts - $tdata = []; - $tdata[0] = reporting_get_stats_alerts($data); - $table->rowclass[] = ''; - $table->data[] = $tdata; +// Indicators. +$tdata = []; +$stats = reporting_get_stats_indicators($data, 120, 10, false); +$status = ''; +foreach ($stats as $stat) { + $status .= ''; +} - // Modules by status - $tdata = []; - $tdata[0] = reporting_get_stats_modules_status($data, 180, 100); - $table->rowclass[] = ''; - $table->data[] = $tdata; +$status .= '
'.$stat['title'].''.$stat['graph'].'
'; +$table->data[0][0] = $status; +$table->rowclass[] = ''; - // Total agents and modules - $tdata = []; - $tdata[0] = reporting_get_stats_agents_monitors($data); - $table->rowclass[] = ''; - $table->data[] = $tdata; +$table->data[] = $tdata; - // Users - if (users_is_admin()) { - $tdata = []; - $tdata[0] = reporting_get_stats_users($data); - $table->rowclass[] = ''; - $table->data[] = $tdata; - } +// Alerts. +$tdata = []; +$tdata[0] = reporting_get_stats_alerts($data); +$table->rowclass[] = ''; +$table->data[] = $tdata; - html_print_table($table); - unset($table); - ?> - - -
- - - rowclass[] = ''; +$table->data[] = $tdata; + +// Total agents and modules. +$tdata = []; +$tdata[0] = reporting_get_stats_agents_monitors($data); +$table->rowclass[] = ''; +$table->data[] = $tdata; + +// Users. +if (users_is_admin()) { + $tdata = []; + $tdata[0] = reporting_get_stats_users($data); + $table->rowclass[] = ''; + $table->data[] = $tdata; +} + +ui_toggle( + html_print_table($table, true), + __('%s Overview', get_product_name()), + '', + 'overview', + false +); +unset($table); + +echo '
+$activity .= html_print_table($table, true); +unset($table); + +ui_toggle( + $activity, + __('Latest activity'), + '', + 'activity', + false, + false, + '', + 'white-box-content padded' +); +// END OF LAST ACTIVIYY. +// Close right panel. +echo '
'; + +// Close welcome panel. +echo '
'; diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index cb5126b621..ca6c0fd473 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -20,40 +20,16 @@ if (! isset($config['id_user'])) { '; +if ($config['menu_type'] == 'classic') { + echo '