diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf index 0e4014f5e6..4ec24dd4fc 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.707, AIX version +# Version 7.0NG.708, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf index 207efac3a2..5b84348657 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.707, FreeBSD Version +# Version 7.0NG.708, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf index f0aeb191e4..67368fc92d 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.707, HP-UX Version +# Version 7.0NG.708, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index d9dec84092..67cedc9d0a 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.707, GNU/Linux +# Version 7.0NG.708, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # Optional. UDP Server to receive orders from outside diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf index 29781cd47c..1922741fd4 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.707, GNU/Linux +# Version 7.0NG.708, 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 4a0110cbe4..b9314d2a5a 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.707, Solaris Version +# Version 7.0NG.708, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 515e60a1af..90d17489d0 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.707 +# Version 7.0NG.708 # 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 @@ -11,109 +11,109 @@ # Edit this file to change your parameters or/and add your own modules # Any line with a # character at the first column will be ignored (comment) - -# General Parameters -# ================== - + +# General Parameters +# ================== + # NOTE: The variables $*$ will be substituted in the installation wizard -server_ip $ServerIP$ -server_path $ServerPath$ -temporal $AgentTemp$ -logfile $AgentLog$ - +server_ip $ServerIP$ +server_path $ServerPath$ +temporal $AgentTemp$ +logfile $AgentLog$ + #include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf" #broker_agent name_agent - + # Agent uses your hostname automatically, if you need to change agent name # use directive agent_name (do not use blank spaces, please). # This parameter is CASE SENSITIVE. - -# agent_name My_Custom_Agent_name - -#Parent agent_name -#parent_agent_name caprica - -# address: Enforce to server a ip address to this agent -# You can also try to detect the first IP using "auto", for example -#address auto -# or setting a fixed IP address, like for example: -#address 192.168.36.73 - +# agent_name My_Custom_Agent_name + +#Parent agent_name +#parent_agent_name caprica + +# address: Enforce to server a ip address to this agent +# You can also try to detect the first IP using "auto", for example + +#address auto +# or setting a fixed IP address, like for example: +#address 192.168.36.73 + # Group assigned for this agent (descriptive, p.e: Servers) group $AgentGroup$ - + # This limits operation if temporal dir has not enough free disk. #temporal_min_size 1024 - + # Delay start execution X second before start to minonitoring nothing #startup_delay 30 - + # Interval is defined in seconds interval 300 - + # tranfer_modes: Possible values are local, tentacle (default), ftp and ssh. -transfer_mode tentacle +transfer_mode tentacle server_port 41121 - + # In case of using FTP or tentacle with password. User is always "pandora" #server_pwd pandora - -# Debug mode do not copy XML data files to server. + +# Debug mode renames XML in the temp folder and continues running # debug 1 - + # ODBC connections. Check documentation for more information. # Configuring "ExampleDSN" DSN. Notice that this DSN connection must be configured # under Control panel -> Administrative tools -> ODBC -> DSN # odbc_ExampleDSN_username UserNameForDsn # odbc_ExampleDSN_password Password1234 - + # If set to 1 allows the agent to be configured via the web console # (only works on enterprise version). # remote_config 1 - + # Set XML encoding (ISO-8859-1 by default). #encoding ISO-8859-1 - -# If set to 1 start Drone Agent's Proxy Mode -# proxy_mode 1 - -# Max number of simmultaneus connection for proxy (by default 10) -# proxy_max_connection 10 - -# Proxy timeout (by default 1s) -# proxy_timeout 1 - + +# If set to 1 start Drone Agent's Proxy Mode +# proxy_mode 1 + +# Max number of simmultaneus connection for proxy (by default 10) +# proxy_max_connection 10 + +# Proxy timeout (by default 1s) +# proxy_timeout 1 + # Enable or disable XML buffer. xml_buffer 0 # WMI by default. Set to NT if you don't want to use WMI. win32_monitoring_lib NT - -# Secondary server configuration -# ============================== - -# If secondary_mode is set to on_error, data files are copied to the secondary -# server only if the primary server fails. If set to always, data files are -# always copied to the secondary server. + +# Secondary server configuration +# ============================== + +# If secondary_mode is set to on_error, data files are copied to the secondary +# server only if the primary server fails. If set to always, data files are +# always copied to the secondary server. #secondary_mode on_error #secondary_server_ip localhost -#secondary_server_path /var/spool/pandora/data_in -#secondary_server_port 41121 -#secondary_transfer_mode tentacle -#secondary_server_pwd mypassword -#secondary_server_ssl no -#secondary_server_opts - -# Module Definition +#secondary_server_path /var/spool/pandora/data_in +#secondary_server_port 41121 +#secondary_transfer_mode tentacle +#secondary_server_pwd mypassword +#secondary_server_ssl no +#secondary_server_opts + +# Module Definition # Check online documentation and module library at http://pandorafms.org -# ================= - +# ================= + # CPU Load using WMI module_begin module_name CPU Load -module_type generic_data +module_type generic_data module_wmiquery SELECT LoadPercentage FROM Win32_Processor module_wmicolumn LoadPercentage module_description CPU Load (%) @@ -121,8 +121,8 @@ module_min_warning 80 module_max_warning 90 module_min_critical 91 module_max_critical 100 -module_end - +module_end + # Number processes module_begin module_name Number processes diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf index 1d2be693ad..d624a8d66d 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.707, AIX version +# Version 7.0NG.708, AIX version # General Parameters # ================== @@ -11,7 +11,7 @@ pandora_path /usr/share/pandora_agent temporal /var/spool/pandora/data_out interval 300 checksum 0 -#agent_name adama +# Debug mode renames XML in the temp folder and continues running debug 0 # By default is 22 (for ssh) #server_port 22 diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf index 54dca07566..9edc972282 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.707 +# Version 7.0NG.708 # FreeBSD/IPSO version # Licenced under GPL licence, 2003-2007 Sancho Lerena @@ -13,6 +13,7 @@ pandora_path /opt/pandora_agent temporal /var/spool/pandora/data_out interval 600 agent_name nokia +# Debug mode renames XML in the temp folder and continues running debug 0 checksum 0 harmless_mode 1 diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf index 94f5627291..f77b766dab 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.707, HPUX Version +# Version 7.0NG.708, HPUX Version # General Parameters # ================== @@ -11,6 +11,7 @@ temporal /var/spool/pandora/data_out interval 300 #agent_name satellite_system checksum 1 +# Debug mode renames XML in the temp folder and continues running debug 0 # Module Definition diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 23524d4db2..d37678b502 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.707 +# Version 7.0NG.708 # Licensed under GPL license v2, # (c) 2003-2010 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net @@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index 53edc0a423..da67ed5470 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.707 +# Version 7.0NG.708 # Licensed under GPL license v2, # (c) 2003-2009 Artica Soluciones Tecnologicas # please visit http://pandora.sourceforge.net @@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf index 811e4181df..d8a9d19ee3 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.707 +# Version 7.0NG.708 # Licensed under GPL license v2, # please visit http://pandora.sourceforge.net @@ -14,8 +14,7 @@ logfile /opt/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 30 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf index f66fa06679..1b4a021236 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.707, Solaris version +# Version 7.0NG.708, Solaris version # General Parameters # ================== @@ -11,6 +11,7 @@ temporal /var/spool/pandora/data_out interval 300 #agent_name satellite_system checksum 0 +# Debug mode renames XML in the temp folder and continues running debug 0 # By default is 22 (for ssh) #server_port 22 diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 9b5905996f..dfdc519a04 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.707, AIX version +# Version 7.0NG.708, AIX version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -15,8 +15,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b2baa6978a..34b9a6c8c6 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.707-170718 +Version: 7.0NG.708-170728 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 25f101dcbc..3c966af5cf 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.707-170718" +pandora_version="7.0NG.708-170728" 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/DEBIAN/prerm b/pandora_agents/unix/DEBIAN/prerm index 847c25f593..35682fa3c5 100755 --- a/pandora_agents/unix/DEBIAN/prerm +++ b/pandora_agents/unix/DEBIAN/prerm @@ -14,3 +14,4 @@ if [ -x `command -v systemctl` ]; then else update-rc.d -f pandora_agent_daemon remove fi +exit 0 diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 35fbd8c7f8..81ce878b4e 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.707, GNU/Linux +# Version 7.0NG.708, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # Optional. UDP Server to receive orders from outside diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 4c1e20f0ff..535a637421 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.707, FreeBSD Version +# Version 7.0NG.708, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -18,8 +18,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # Optional. UDP Server to receive orders from outside diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 522ef2f345..962d1a4047 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.707, HP-UX Version +# Version 7.0NG.708, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 8d9893c24a..efaa9ac0bc 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.707, GNU/Linux +# Version 7.0NG.708, 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 d2feeff65c..8a153581e2 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.707, GNU/Linux +# Version 7.0NG.708, 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 ef6a51d6d2..8cb4f47058 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.707, NetBSD Version +# Version 7.0NG.708, NetBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index d642c6d314..290d3614a3 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.707, Solaris Version +# Version 7.0NG.708, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com @@ -17,8 +17,7 @@ logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 -# Debug mode only generate XML, and stop after first execution, -# and does not copy XML to server. +# Debug mode renames XML in the temp folder and continues running debug 0 # By default, agent takes machine name diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f05b8948ab..ab53784cf9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -40,8 +40,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.707'; -use constant AGENT_BUILD => '170718'; +use constant AGENT_VERSION => '7.0NG.708'; +use constant AGENT_BUILD => '170728'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -906,14 +906,13 @@ sub fix_directory ($) { ################################################################################ # Sends a file to the server. ################################################################################ -#sub send_file ($;$) { +#sub send_file ($;$$$) { sub send_file { - my ($file, $secondary) = @_; + my ($file, $secondary, $rc_primary, $flag_always) = @_; my $output; - my $pid = fork(); return 1 unless defined $pid; - + if ($pid == 0) { # execute the transfer program by child process. eval { @@ -942,14 +941,14 @@ sub send_file { }; if ($@) { - log_message ('error', "Error sending file '$file': File transfer command is not responding."); + log_message ('error', "Error sending file '$file' to '" . $Conf{'server_ip'} . ":" . $Conf{'server_port'}. "': File transfer command is not responding."); exit 1; } # Get the errorlevel my $rc = $? >> 8; if ($rc != 0) { - log_message ('error', "Error sending file '$file': $output"); + log_message ('error', "Error sending file '$file' to '" . $Conf{'server_ip'} . ":" . $Conf{'server_port'}. "': $output"); } exit $rc; } @@ -958,39 +957,104 @@ sub send_file { waitpid ($pid, 0); my $rc = $? >> 8; - return $rc unless (defined ($secondary)); + if( ($Conf{'secondary_mode'} eq 'always') && ( !defined($flag_always) ) ){ + # Send the file to the secondary server + return $rc unless ($Conf{'secondary_mode'} eq 'always'); + + if(defined ($secondary)){ + if( ($rc != 0 && ($file =~ /\.data/)) ){ + $rc_primary = 1; + } + swap_servers (); + $rc = send_file ($file, undef, $rc_primary); + swap_servers (); - # Send the file to the secondary server - return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0)); - - swap_servers (); - $rc = send_file ($file); - swap_servers (); - return $rc; + return $rc; + } + else{ + my $rc_secondary = 0; + if( ($rc != 0) && ($file =~ /\.data/)){ + $rc_secondary = 1; + } + + if ( $rc_secondary == 1 && defined($rc_primary) ){ + return 1; + } + + if ( $rc_secondary == 1 ){ + if (! -d "$Conf{'temporal'}/secondary"){ + mkdir "$Conf{'temporal'}/secondary"; + } + eval { + copy("$file", "$Conf{'temporal'}/secondary/"); + }; + if ($@) { + # We shouldn't reach this point... + die ("Cannot write on $Conf{'temporal'}/secondary/"); + } + return 0; + } + + if ( defined($rc_primary) ){ + if (! -d "$Conf{'temporal'}/primary"){ + mkdir "$Conf{'temporal'}/primary"; + } + eval { + copy("$file", "$Conf{'temporal'}/primary/"); + }; + if ($@) { + # We shouldn't reach this point... + die ("Cannot write on $Conf{'temporal'}/primary/"); + } + return 0; + } + + if ( $rc_secondary == 0 && !defined($rc_primary) ){ + return 0; + } + } + } + elsif ( ($Conf{'secondary_mode'} eq 'always') && defined($flag_always) ){ + return $rc; + } + else{ + return $rc unless (defined ($secondary)); + + # Send the file to the secondary server + return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0)); + + swap_servers (); + $rc = send_file ($file); + swap_servers (); + return $rc; + } } ################################################################################ # Send buffered XML files. ################################################################################ -sub send_buffered_xml_files () { - +sub send_buffered_xml_files ($;$) { + my ($temporal_file, $flag_always) = @_; # Read XML files from the temporal directory - opendir(TEMPORAL, $Conf{'temporal'}) or return; - while (my $xml_file = readdir(TEMPORAL)) { - + opendir(TEMPORAL, $temporal_file) or return; + if (defined($flag_always) && ($flag_always == 2)){ + swap_servers (); + } + while (my $xml_file = readdir(TEMPORAL)) { # Skip non data files and symlinks - next if ($xml_file !~ m/^$Conf{'agent_name'}\.[0-9]+\.data$/ || -l "$Conf{'temporal'}/$xml_file"); - - my $rc = send_file ("$Conf{'temporal'}/$xml_file", 1); - + next if ($xml_file !~ m/^$Conf{'agent_name'}\.[0-9]+\.data$/ || -l "$temporal_file/$xml_file"); + my $rc = send_file ("$temporal_file/$xml_file", 1, undef, $flag_always); if ($rc == 0) { if ($Conf{'debug'} eq '1') { - rename "$Conf{'temporal'}/$xml_file", "$Conf{'temporal'}/$xml_file". "sent"; + rename "$temporal_file/$xml_file", "$temporal_file/$xml_file". "sent"; } else { - unlink ("$Conf{'temporal'}/$xml_file"); + unlink ("$temporal_file/$xml_file"); } } } + if (defined($flag_always) && ($flag_always == 2)){ + swap_servers (); + } } ################################################################################ @@ -2769,7 +2833,20 @@ while (1) { # Send buffered XML data files if ($Conf{'xml_buffer'} == 1) { - send_buffered_xml_files (); + if($Conf{'secondary_mode'} eq 'always'){ + $Conf{'__temporal_primary'} = "$Conf{'temporal'}/primary"; + $Conf{'__temporal_secondary'} = "$Conf{'temporal'}/secondary"; + if (-d "$Conf{'__temporal_primary'}"){ + send_buffered_xml_files ($Conf{'__temporal_primary'}, 1); + } + if (-d "$Conf{'__temporal_secondary'}"){ + send_buffered_xml_files ($Conf{'__temporal_secondary'}, 2); + } + send_buffered_xml_files ($Conf{'temporal'}); + } + else{ + send_buffered_xml_files ($Conf{'temporal'}); + } } } diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index dee15b601c..3dba4fdd04 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.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 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 10905ab433..2eeae4c183 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.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 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 7967cc9d11..2aa06d73ec 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.707" -PI_BUILD="170718" +PI_VERSION="7.0NG.708" +PI_BUILD="170728" OS_NAME=`uname -s` FORCE=0 @@ -150,6 +150,13 @@ uninstall () { rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null fi + # Stops the agent on uninstall + if [ -f $PANDORA_BASE/etc/init.d/pandora_agent_daemon ]; then + $PANDORA_BASE/etc/init.d/pandora_agent_daemon stop 12> /dev/null + else + echo "$PANDORA_BASE/etc/init.d/pandora_agent_daemon not found to stop agent" + fi + echo "Removing Pandora FMS Agent..." rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index c2db09fe55..288e42e3a7 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2014 Artica Soluciones Tecnologicas -# Version 7.0NG.707 +# Version 7.0NG.708 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 5f562b103e..7791ee6337 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.707} +{Pandora FMS Windows Agent v7.0NG.708} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170718} +{170728} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e0e4567c8c..bc5b0fbfee 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.707(Build 170718)") +#define PANDORA_VERSION ("7.0NG.708(Build 170728)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3fa1197125..0ed14aaa07 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.707(Build 170718))" + VALUE "ProductVersion", "(7.0NG.708(Build 170728))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 264e95b72e..80dd9486d9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.707-170718 +Version: 7.0NG.708-170728 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 26ce1db52d..d5b24dfee2 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.707-170718" +pandora_version="7.0NG.708-170728" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 2c7a9147b8..cb6fe8cd42 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -528,24 +528,24 @@ function mainAgentsModules() { echo '<a href="javascript:'.$link.'">'; switch ($status) { case AGENT_MODULE_STATUS_NORMAL: - ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false); break; case AGENT_MODULE_STATUS_CRITICAL_BAD: - ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false); break; case AGENT_MODULE_STATUS_WARNING: - ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false); break; case AGENT_MODULE_STATUS_UNKNOWN: - ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false); break; case AGENT_MODULE_STATUS_NORMAL_ALERT: case AGENT_MODULE_STATUS_WARNING_ALERT: case AGENT_MODULE_STATUS_CRITICAL_ALERT: - ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false); break; case 4: - ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px')); + ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false); break; } echo '</a>'; diff --git a/pandora_console/extras/mr/4.sql b/pandora_console/extras/mr/4.sql index 75428b2ea3..f189cbce3c 100644 --- a/pandora_console/extras/mr/4.sql +++ b/pandora_console/extras/mr/4.sql @@ -1,2 +1,17 @@ +START TRANSACTION; + alter table tusuario add autorefresh_white_list text not null default ''; -ALTER TABLE tserver_export MODIFY name varchar(600) BINARY NOT NULL default ''; \ No newline at end of file +ALTER TABLE tserver_export MODIFY name varchar(600) BINARY NOT NULL default ''; + +CREATE TABLE IF NOT EXISTS `tpolicy_groups` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_policy` int(10) unsigned default '0', + `id_group` int(10) unsigned default '0', + `policy_applied` tinyint(1) unsigned default '0', + `pending_delete` tinyint(1) unsigned default '0', + `last_apply_utimestamp` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`), + UNIQUE (`id_policy`, `id_group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 16b67d8e28..cede2c70bd 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 @@ -181,6 +181,20 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` ( UNIQUE (`id_policy`, `id_agent`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tpolicy_groups` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tpolicy_groups` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_policy` int(10) unsigned default '0', + `id_group` int(10) unsigned default '0', + `policy_applied` tinyint(1) unsigned default '0', + `pending_delete` tinyint(1) unsigned default '0', + `last_apply_utimestamp` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`), + UNIQUE (`id_policy`, `id_group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tdashboard` -- --------------------------------------------------------------------- @@ -1337,6 +1351,16 @@ CREATE TABLE IF NOT EXISTS `tcontainer` ( INSERT INTO `tcontainer` SET `name` = 'Default graph container'; +-- ---------------------------------------------------------------------- +-- Table `treset_pass_history` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `treset_pass_history` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `reset_moment` date default NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tcontainer_item` -- --------------------------------------------------------------------- diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index e2e63b6e62..5305588aa7 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -239,6 +239,16 @@ if ($create_agent) { $agent_created_ok = true; + $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$grupo); + + if($tpolicy_group_old){ + foreach ($tpolicy_group_old as $key => $old_group) { + db_process_sql_insert ('tpolicy_agents', + array('id_policy' => $old_group['id_policy'], 'id_agent' => $id_agente)); + } + } + $info = 'Name: ' . $nombre_agente . ' IP: ' . $direccion_agente . ' Group: ' . $grupo . @@ -774,6 +784,10 @@ if ($update_agent) { // if modified some agent paramenter $values['update_module_count'] = 1; // Force an update of the agent cache. } + $group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agente); + $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$group_old); + $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); if ($result === false) { ui_print_error_message( @@ -788,6 +802,38 @@ if ($update_agent) { // if modified some agent paramenter enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo)); } + if($tpolicy_group_old){ + foreach ($tpolicy_group_old as $key => $value) { + $tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agente); + + if($tpolicy_agents_old){ + $result2 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 1), + array ('id_agent' => $id_agente, 'id_policy' => $value['id_policy'])); + } + } + } + + $tpolicy_group = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$grupo); + + if($tpolicy_group){ + foreach ($tpolicy_group as $key => $value) { + $tpolicy_agents= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agente); + + if(!$tpolicy_agents){ + db_process_sql_insert ('tpolicy_agents', + array('id_policy' => $value['id_policy'], 'id_agent' => $id_agente)); + } else { + $result3 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 0), + array ('id_agent' => $id_agente, 'id_policy' => $value['id_policy'])); + } + } + } + $info = 'Group: ' . $grupo . ' Interval: ' . $intervalo . ' Comments: ' . $comentarios . ' Mode: ' . $modo . ' ID OS: ' . $id_os . ' Disabled: ' . $disabled . @@ -954,10 +1000,11 @@ if ($update_module || $create_module) { $macros = io_json_mb_encode($macros); - $conf_array = explode("\n",$configuration_data); + $conf_array = explode("\n", io_safe_output($configuration_data)); + foreach ($conf_array as $line) { if (preg_match("/^module_name\s*(.*)/", $line, $match)) { - $new_configuration_data .= "module_name $name\n"; + $new_configuration_data .= "module_name " . io_safe_output($name) . "\n"; } // We delete from conf all the module macros starting with _field else if(!preg_match("/^module_macro_field.*/", $line, $match)) { @@ -965,14 +1012,28 @@ if ($update_module || $create_module) { } } + $values_macros = array(); + $values_macros['macros'] = base64_encode($macros); + + $macros_for_data = enterprise_hook( + 'config_agents_get_macros_data_conf', array($values_macros)); + + if ($macros_for_data != '') { + $new_configuration_data = str_replace('module_end', $macros_for_data . "module_end", $new_configuration_data); + } + + /* $macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST)); if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') { // Add macros to configuration file $new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data); } - - $configuration_data = $new_configuration_data; + */ + $configuration_data = str_replace('\\', "\", + io_safe_input($new_configuration_data));; + + html_debug($configuration_data, true); } // Services are an enterprise feature, @@ -1182,7 +1243,7 @@ if ($update_module) { 'min_ff_event_critical' => $ff_event_critical, 'each_ff' => $each_ff, 'ff_timeout' => $ff_timeout, - 'unit' => $unit, + 'unit' => io_safe_output($unit), 'macros' => $macros, 'quiet' => $quiet_module, 'critical_instructions' => $critical_instructions, @@ -1342,7 +1403,7 @@ if ($create_module) { 'min_ff_event_critical' => $ff_event_critical, 'each_ff' => $each_ff, 'ff_timeout' => $ff_timeout, - 'unit' => $unit, + 'unit' => io_safe_output($unit), 'macros' => $macros, 'quiet' => $quiet_module, 'critical_instructions' => $critical_instructions, diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4fa9725bf9..712abb5dbb 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -488,6 +488,7 @@ if ($agents !== false) { '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' . '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>'; echo "</th>"; + echo "<th>".__('Type'). "</th>"; echo "<th>".__('Group'). ' ' . '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' . '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>'; @@ -606,6 +607,14 @@ if ($agents !== false) { echo "<td class='$tdcolor' align='left' valign='middle'>"; ui_print_os_icon ($agent["id_os"], false); echo "</td>"; + + // Type agent (Networt, Software or Satellite) + echo "<td class='$tdcolor' align='left' valign='middle'>"; + echo ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'], + $agent['ultimo_contacto'], $agent['remote'], $agent['agent_version']); + echo "</td>"; + + // Group icon and name echo "<td class='$tdcolor' align='left' valign='middle'>" . ui_print_group_icon ($id_grupo, true)."</td>"; // Description diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index facdf18b54..802dc67e6b 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -139,9 +139,51 @@ if ($update_agents) { isset($values['id_grupo'])) { $values['update_module_count'] = 1; // Force an update of the agent cache. } + $group_old = false; + if($values['id_grupo']){ + $group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent); + } + $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agent)); + + if($group_old || $result){ + $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$group_old); + + if($tpolicy_group_old){ + foreach ($tpolicy_group_old as $key => $value) { + $tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agent); + + if($tpolicy_agents_old){ + $result2 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 1), + array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy'])); + } + } + } + + $tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$values['id_grupo']); + + if($tpolicy_group_new){ + foreach ($tpolicy_group_new as $key => $value) { + $tpolicy_agents_new= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agent); + + if(!$tpolicy_agents_new){ + db_process_sql_insert ('tpolicy_agents', + array('id_policy' => $value['id_policy'], 'id_agent' => $id_agent)); + } else { + $result3 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 0), + array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy'])); + } + } + } + } } // Update Custom Fields diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index fed5a6242a..9be93af597 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -41,7 +41,7 @@ if (is_ajax()){ $id_agent = get_parameter('id_agent'); $id_agent_module = get_parameter('id_agent_module'); $time_lapse = get_parameter('time_lapse'); - $only_avg = (int) get_parameter('only_avg'); + $only_avg = (bool) get_parameter('only_avg'); $values = array( 'id_container' => $id_container2, @@ -76,6 +76,7 @@ if (is_ajax()){ $agent_alias = get_parameter('agent_alias',''); $module_name = get_parameter('module_name',''); $tag = get_parameter('tag',0); + $only_avg = (bool) get_parameter('only_avg'); $values = array( 'id_container' => $id_container2, @@ -85,8 +86,8 @@ if (is_ajax()){ 'id_module_group' => $module_group, 'agent' => $agent_alias, 'module' => $module_name, - 'id_tag' => $tag); - + 'id_tag' => $tag, + 'only_average' => $only_avg); $id_item = db_process_sql_insert('tcontainer_item', $values); return; } @@ -433,7 +434,13 @@ if($edit_container){ $tag, '', __('Any'), 0, true, false, false); $table->data[] = $data; $table->rowclass[] = ''; - + + $data = array(); + $data[0] = __('Only average'); + $data[1] = html_print_checkbox('only_avg', 1, false,true); + $table->data[] = $data; + $table->rowclass[] = ''; + $data = array(); $data[0] = ""; $data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>"; @@ -592,6 +599,7 @@ echo html_print_input_hidden('id_agent', 0); var group = $("#container_id_group1").val(); var module_group = $("#combo_modulegroup").val(); var tag = $("#tag").val(); + var only_avg = $("#checkbox-only_avg1").prop("checked"); var id_container = <?php echo $id_container; ?>; jQuery.post ("ajax.php", {"page" : "godmode/reporting/create_container", @@ -603,6 +611,7 @@ echo html_print_input_hidden('id_agent', 0); "module_name" : module_name, "tag" : tag, "id_container" : id_container, + "only_avg" : only_avg, }, function (data, status) { var url = location.href.replace('&update_container=1', ""); diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index beef4167d2..6c4903fbb8 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -94,7 +94,7 @@ echo "</div>"; }, success: function(data) { $("#div_"+hash).remove(); - $("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' style='width: 100%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>"); + $("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' class='graph_conteiner_inside' style='width: 99%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>"); if($('div[class *= graph]').length == 0 && $('div[class *= bullet]').length == 0 && $('div[id *= gauge_]').length == 0){ $("#div_"+hash).remove(); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index b7994e6a1c..ac6d35d4b4 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1124,8 +1124,8 @@ switch ($action) { $values['treport_custom_sql_id'] = get_parameter('id_custom'); if ($values['treport_custom_sql_id'] == 0) { $values['external_source'] = get_parameter('sql'); - $values['historical_db'] = get_parameter('historical_db_check'); } + $values['historical_db'] = get_parameter('historical_db_check'); } else if ($values['type'] == 'url') { $values['external_source'] = get_parameter('url'); @@ -1214,7 +1214,6 @@ switch ($action) { break; } - $resultOperationDB = db_process_sql_update( 'treport_content', $values, @@ -1446,8 +1445,8 @@ switch ($action) { $values['treport_custom_sql_id'] = get_parameter('id_custom'); if ($values['treport_custom_sql_id'] == 0) { $values['external_source'] = get_parameter('sql'); - $values['historical_db'] = get_parameter('historical_db_check'); } + $values['historical_db'] = get_parameter('historical_db_check'); } elseif ($values['type'] == 'url') { $values['external_source'] = get_parameter('url'); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 104ddb9ddb..ee2c23c5de 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -580,8 +580,10 @@ function readFields() { } values['width'] = $("input[name=width]").val(); values['width_data_image'] = $("#data_image_width").val(); - if(values['width_data_image'] != 0 && values['width_data_image'] != undefined){ - values['width'] = values['width_data_image']; + if(selectedItem == 'simple_value' || creationItem == 'simple_value'){ + if(values['width_data_image'] != 0){ + values['width'] = values['width_data_image']; + } } values['height'] = $("input[name=height]").val(); values['parent'] = $("select[name=parent]").val(); @@ -3079,7 +3081,7 @@ function eventsItems(drag) { } if(selectedItem == 'simple_value'){ - + $('#data_image_width').val(event.currentTarget.clientWidth); var found = $('#'+idItem).find("img"); if(found.length > 0){ @@ -3441,6 +3443,7 @@ function click_button_toolbox(id) { $("#period_row." + id).css('display', 'none'); break; case 'label': + $("#data_image_width").val(100); toolbuttonActive = creationItem = 'label'; toggle_item_palette(); break; @@ -3727,4 +3730,4 @@ function showGrid() { eventsItems(); } -} +} \ No newline at end of file diff --git a/pandora_console/images/image_problem_area.png b/pandora_console/images/image_problem_area.png new file mode 100644 index 0000000000..d89324cf81 Binary files /dev/null and b/pandora_console/images/image_problem_area.png differ diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 4b0e4d582a..1b537f8a48 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -162,12 +162,12 @@ if ($get_graphs){ tagente_modulo WHERE id_agente_modulo = ". $value['id_agent_module']); $sql_alias = db_get_all_rows_sql("SELECT alias from tagente WHERE id_agente = ". $sql_modulo[0]['id_agente']); - $table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>"; + $table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>"; $table .= grafico_modulo_sparse( $value['id_agent_module'], $value['time_lapse'], 0, - 800, + 1000, 300, '', '', @@ -225,11 +225,11 @@ if ($get_graphs){ } else { $height = 300; } - $table .= "<div style='width: 800px'><h4>CUSTOM GRAPH ".$graph[0]['name']."</h4><hr></div>"; + $table .= "<div style='width: 90%'><h4>".$graph[0]['name']."</h4><hr></div>"; $table .= graphic_combined_module($modules, $weights, $value['time_lapse'], - 800, + 1000, $height, '', '', @@ -259,8 +259,10 @@ if ($get_graphs){ } break; case 'dynamic_graph': - $alias = " AND alias like '%".io_safe_output($value['agent'])."%'"; - + if($value['agent'] != ''){ + $alias = " AND alias REGEXP '".$value['agent']."'"; + } + if($value['id_group'] === '0'){ $id_group = ""; } else { @@ -281,8 +283,10 @@ if ($get_graphs){ $id_tag = " AND ttag_module.id_tag = ".$value['id_tag']; } - $module_name = " AND nombre like '%".io_safe_output($value['module'])."%'"; - + if($value['module'] != ''){ + $module_name = " AND nombre REGEXP '".$value['module']."'"; + } + $id_agent_module = db_get_all_rows_sql("SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo ". $tag . "WHERE 1=1" . $id_module_group . $module_name . " AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")" @@ -296,13 +300,13 @@ if ($get_graphs){ $sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente WHERE id_agente = ". $sql_modulo2[0]['id_agente']); - $table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>"; + $table .= "<div style='width: 90%'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>"; $table .= grafico_modulo_sparse( $value2['id_agente_modulo'], $value['time_lapse'], 0, - 800, + 1000, 300, '', '', diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4a5b4fbe45..fb9580d3d6 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,8 +22,8 @@ /** * Pandora build version and version */ -$build_version = 'PC170718'; -$pandora_version = 'v7.0NG.707'; +$build_version = 'PC170728'; +$pandora_version = 'v7.0NG.708'; // Do not overwrite default timezone set if defined. $script_tz = @date_default_timezone_get(); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index ccadee5349..55828d1d94 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1195,7 +1195,11 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) { else { $cascadeProtectionModule = 0; } - + + $group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent); + $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$group_old); + $return = db_process_sql_update('tagente', array('alias' => $alias, 'direccion' => $ip, @@ -1216,6 +1220,40 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) { // register ip for this agent in 'taddress' agents_add_address ($id_agent, $ip); } + + if($return){ + if($tpolicy_group_old){ + foreach ($tpolicy_group_old as $key => $value) { + $tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent = " .$id_agent); + + if($tpolicy_agents_old){ + $result2 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 1), + array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy'])); + } + } + } + + $tpolicy_group = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$idGroup); + + if($tpolicy_group){ + foreach ($tpolicy_group as $key => $value) { + $tpolicy_agents= db_get_sql("SELECT * FROM tpolicy_agents + WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agent); + + if(!$tpolicy_agents){ + db_process_sql_insert ('tpolicy_agents', + array('id_policy' => $value['id_policy'], 'id_agent' => $id_agent)); + } else { + $result3 = db_process_sql_update ('tpolicy_agents', + array('pending_delete' => 0), + array ('id_agent' => $id_agent, 'id_policy' => $value['id_policy'])); + } + } + } + } returnData('string', array('type' => 'string', 'data' => (int)((bool)$return))); @@ -1339,7 +1377,19 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) { // register ip for this agent in 'taddress' agents_add_address ($idAgente, $ip); } - + + if($idGroup && !empty($idAgente)){ + $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups + WHERE id_group = ".$idGroup); + + if($tpolicy_group_old){ + foreach ($tpolicy_group_old as $key => $old_group) { + db_process_sql_insert ('tpolicy_agents', + array('id_policy' => $old_group['id_policy'], 'id_agent' => $idAgente)); + } + } + } + returnData('string', array('type' => 'string', 'data' => $idAgente)); } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 6a60622462..0317a34141 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1653,6 +1653,10 @@ function config_process_config () { config_update_value ('command_snapshot', 1); } + if (!isset($config['custom_report_info'])) { + config_update_value ('custom_report_info', 1); + } + // Juanma (06/05/2014) New feature: Custom front page for reports if (!isset($config['custom_report_front'])) { config_update_value ('custom_report_front', 0); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 4ea4f8d87a..f834faf483 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3581,7 +3581,7 @@ function graph_custom_sql_graph ($id, $width, $height, * @param string homeurl * @param bool return or echo the result */ -function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false) { +function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) { global $config; global $graphic_type; @@ -3598,13 +3598,14 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho $data = array (); $legend = array(); $full_legend = array(); + $full_legend_date = array(); $cont = 0; for ($i = 0; $i < $interval; $i++) { $bottom = $datelimit + ($periodtime * $i); if (! $graphic_type) { if ($config['flash_charts']) { - $name = date('H:i', $bottom); + $name = date('H:i:s', $bottom); } else { $name = date('H\h', $bottom); @@ -3618,6 +3619,11 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho if ($cont == 0 or $cont % 2) $legend[$cont] = $name; + if ($from_agent_view) { + $full_date = date('Y/m/d', $bottom); + $full_legend_date[$cont] = $full_date; + } + $full_legend[$cont] = $name; $top = $datelimit + ($periodtime * ($i + 1)); @@ -3646,12 +3652,12 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho } $cont++; } - + $colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN); // Draw slicebar graph if ($config['flash_charts']) { - $out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent); + $out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date); } else { $out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index e7836a358c..3de688c84a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -385,13 +385,28 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $nothing = '', $nothing_value = 0, $return = false, $multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false, - $keys_field = 'id_grupo', $strict_user = false) { + $keys_field = 'id_grupo', $strict_user = false, $delete_groups = false , $include_groups = false) { global $config; $fields = users_get_groups_for_select($id_user, $privilege, $returnAllGroup, true, $id_group, $keys_field); + + if ($delete_groups && is_array($delete_groups)){ + foreach ($delete_groups as $value) { + unset($fields[$value]); + } + } + + if (is_array($include_groups)){ + $field = array(); + foreach ($include_groups as $value) { + $field[$value] = $fields[$value]; + } + $fields = array_intersect($fields, $field); + } + if ($strict_user) { $fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup); } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index ffde723fe7..f64bb7d0ed 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -128,26 +128,6 @@ function reporting_make_reporting_data($report = null, $id_report, $content['period'] = $period; } - if(defined('METACONSOLE')){ - if (is_array($content['id_agent'])) { - $new_array = array(); - foreach ($content['id_agent'] as $key => $value) { - $meta_id = explode("|",$value); - array_push($new_array,$meta_id[1]); - } - $content['id_agent'] = $new_array; - } - else { - $meta_id = explode("|",$content['id_agent']); - if ($meta_id[1] != null) { - $content['id_agent'] = array(); - $content['id_agent'] = $meta_id[1]; - } - } - - - } - $content['style'] = json_decode(io_safe_output($content['style']), true); if(isset($content['style']['name_label'])){ //Add macros name @@ -166,19 +146,17 @@ function reporting_make_reporting_data($report = null, $id_report, continue; } } + + + if(sizeof($content['id_agent']) != 1){ + $content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']); + } + if(sizeof($content['id_agent_module']) != 1){ + $content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']); + } - - if(sizeof($content['id_agent']) != 1){ - $content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']); - } - - if(sizeof($content['id_agent_module']) != 1){ - $content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']); - } - - $content['name'] = reporting_label_macro($items_label, $content['style']['name_label']); - + $content['name'] = reporting_label_macro($items_label, $content['style']['name_label']); if ($metaconsole_on) { //Restore db connection @@ -5811,12 +5789,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', require_once ($config["homedir"] . '/include/functions_graph.php'); - if ($config['metaconsole']) { - $id_meta = metaconsole_get_id_server($content["server_name"]); - - - $server = metaconsole_get_connection_by_id ($id_meta); - metaconsole_connect($server); + if ($type_report == 'automatic_graph') { + // Do none + } + else { + if ($config['metaconsole']) { + $id_meta = metaconsole_get_id_server($content["server_name"]); + + + $server = metaconsole_get_connection_by_id ($id_meta); + metaconsole_connect($server); + } } $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); @@ -5870,7 +5853,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', 'id_agent_module'=>$graph_item['id_agent_module']); } - $label = reporting_label_macro($item, $content['style']['label']); $labels[$graph_item['id_agent_module']] = $label; } } @@ -5889,13 +5871,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', $height = 50; } } - if (defined('METACONSOLE')) { - $modules_new = array(); - foreach ($modules as $mod) { - $modules_new[] = $mod['module']; - } - $modules = $modules_new; - } switch ($type) { case 'dinamic': @@ -10292,6 +10267,7 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w } function reporting_label_macro ($item, $label) { + switch ($item['type']) { case 'event_report_agent': case 'alert_report_agent': @@ -10317,7 +10293,6 @@ function reporting_label_macro ($item, $label) { $label = str_replace("_address_", $agent_name, $label); } break; - case 'automatic_graph': case 'simple_graph': case 'module_histogram_graph': case 'custom_graph': @@ -10337,6 +10312,7 @@ function reporting_label_macro ($item, $label) { case 'TTO': case 'MTBF': case 'MTTR': + case 'automatic_graph': if (preg_match("/_agent_/", $label)) { $agent_name = agents_get_alias($item['id_agent']); $label = str_replace("_agent_", $agent_name, $label); diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 49e651e5ef..690a55d630 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -3780,6 +3780,7 @@ function reporting_get_event_histogram ($events, $text_header_event = false) { ); } } + $table = new stdClass(); if (!$text_header_event) { $table->width = '100%'; @@ -3839,6 +3840,157 @@ function reporting_get_event_histogram ($events, $text_header_event = false) { return $event_graph; } +function reporting_get_event_histogram_meta ($width) { + global $config; + if (!defined("METACONSOLE")) { + include_once ($config['homedir'] .'/include/graphs/functions_gd.php'); + } + else { + include_once ('../../include/graphs/functions_gd.php'); + } + + $period = SECONDS_1HOUR; + + if (!$text_header_event) { + $text_header_event = __('Events info (1hr.)'); + } + + $ttl = 1; + $urlImage = ui_get_full_url(false, true, false, false); + + $data = array (); + + $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph + + $interval = (int) ($period / $resolution); + $date = get_system_time (); + $datelimit = $date - $period; + $periodtime = floor ($period / $interval); + $time = array (); + $data = array (); + $legend = array(); + $full_legend = array(); + $full_legend_date = array(); + + $colors = array( + EVENT_CRIT_MAINTENANCE => COL_MAINTENANCE, + EVENT_CRIT_INFORMATIONAL => COL_INFORMATIONAL, + EVENT_CRIT_NORMAL => COL_NORMAL, + EVENT_CRIT_MINOR => COL_MINOR, + EVENT_CRIT_WARNING => COL_WARNING, + EVENT_CRIT_MAJOR => COL_MAJOR, + EVENT_CRIT_CRITICAL => COL_CRITICAL + ); + + $cont = 0; + for ($i = 0; $i < $interval; $i++) { + $bottom = $datelimit + ($periodtime * $i); + if (! $graphic_type) { + if ($config['flash_charts']) { + $name = date('H:i:s', $bottom); + } + else { + $name = date('H\h', $bottom); + } + } + else { + $name = $bottom; + } + + // Show less values in legend + if ($cont == 0 or $cont % 2) + $legend[$cont] = $name; + + if ($from_agent_view) { + $full_date = date('Y/m/d', $bottom); + $full_legend_date[$cont] = $full_date; + } + + $full_legend[$cont] = $name; + + $top = $datelimit + ($periodtime * ($i + 1)); + $event = db_get_row_filter ('tmetaconsole_event', + array ( + 'utimestamp > '.$bottom, + 'utimestamp < '.$top), + 'criticity, utimestamp'); + + if (!empty($event['utimestamp'])) { + $data[$cont]['utimestamp'] = $periodtime; + switch ($event['criticity']) { + case 0: + $data[$cont]['data'] = EVENT_CRIT_MAINTENANCE; + break; + case 1: + $data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL; + break; + case 2: + $data[$cont]['data'] = EVENT_CRIT_NORMAL; + break; + case 3: + $data[$cont]['data'] = EVENT_CRIT_WARNING; + break; + case 4: + $data[$cont]['data'] = EVENT_CRIT_CRITICAL; + break; + case 5: + $data[$cont]['data'] = EVENT_CRIT_MINOR; + break; + case 6: + $data[$cont]['data'] = EVENT_CRIT_MAJOR; + break; + case 20: + $data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL; + break; + case 34: + $data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL; + break; + default: + $data[$cont]['data'] = 1; + break; + } + } + else { + $data[$cont]['utimestamp'] = $periodtime; + $data[$cont]['data'] = 1; + } + $cont++; + } + + $table = new stdClass(); + + $table->width = '100%'; + + $table->data = array (); + $table->size = array (); + $table->head = array (); + $table->title = '<span>' . $text_header_event . '</span>'; + $table->data[0][0] = "" ; + + if (!empty($data)) { + $slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date); + + $table->data[0][0] = $slicebar; + } + else { + $table->data[0][0] = __('No events'); + } + + if (!$text_header_event) { + $event_graph = '<fieldset class="databox tactical_set"> + <legend>' . + $text_header_event . + '</legend>' . + html_print_table($table, true) . '</fieldset>'; + } + else { + $table->class = 'noclass'; + $event_graph = html_print_table($table, true); + } + + return $event_graph; +} + function reporting_html_planned_downtimes_table ($planned_downtimes) { global $config; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 5aa917b5d4..46a9556e4b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -660,6 +660,28 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, return $output; } +function ui_print_type_agent_icon ( $id_os = false, $remote_contact = false, $contact = false, + $return = false, $remote = 0, $version = ""){ + + if($id_os == 19){ + //Satellite + $options['title'] = __('Satellite'); + $output = html_print_image("images/op_satellite.png", true, $options, false, false, false, true); + } + else if ($remote_contact == $contact && $remote == 0 && $version == ""){ + //Network + $options['title'] = __('Network'); + $output = html_print_image("images/network.png", true, $options, false, false, false, true); + } + else{ + //Software + $options['title'] = __('Software'); + $output = html_print_image("images/data.png", true, $options, false, false, false, true); + } + + return $output; +} + /** * Prints an agent name with the correct link * diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index a97055c8f3..c0c261ea57 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -314,8 +314,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['module_row']['html'] = '<td align="left">' . __('Module') . '</td> <td align="left">' . - html_print_select(array(), 'module', '', '', __('Any'), 0, true) . - '</td>'; + html_print_select(array(), 'module', '', '', __('Any'), 0, true) . '<div id="data_image_container" style="display:none;"><span id="data_image_check_label" style="margin-left:20px;">'.__("Data image").': </span><span id="data_image_check">Off</span><span id="data_image_width_label"> - Width: </span><input style="margin-left:5px;width:40px;" type="number" min="0" id="data_image_width" value="100"></input></div> + </td>'; $event_times = array(86400 => __('24h'), 28800 => __('8h'), diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 7e2950f806..78510da704 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -608,13 +608,16 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, } } -function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent) { +function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) { values = values.split(separator2); labels = labels.split(separator); legend = legend.split(separator); acumulate_data = acumulate_data.split(separator); datacolor = datacolor.split(separator); - + if (full_legend != false) { + full_legend = full_legend.split(separator); + } + // Check possible adapt_keys on classes check_adaptions(graph_id); @@ -719,25 +722,43 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul } }); - $('#'+graph_id).bind('plotclick', function(event, pos, item) { - if (item) { - //from time - var from = legend[item.seriesIndex]; - //to time - var to = legend[item.seriesIndex+1]; - //current date - var dateObj = new Date(); - var month = dateObj.getUTCMonth() + 1; //months from 1-12 - var day = dateObj.getUTCDate(); - var year = dateObj.getUTCFullYear(); - newdate = year + "/" + month + "/" + day; - - if(!to){ - to= '23:59'; - } - window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1'; - } - }); + $('#'+graph_id).bind('plotclick', function(event, pos, item) { + if (item) { + //from time + var from = legend[item.seriesIndex]; + //to time + var to = legend[item.seriesIndex+1]; + //current date + var dateObj = new Date(); + + if (full_legend != "") { + newdate = full_legend[item.seriesIndex]; + newdate2 = full_legend[item.seriesIndex+1]; + } + else { + var month = dateObj.getUTCMonth() + 1; //months from 1-12 + var day = dateObj.getUTCDate(); + var year = dateObj.getUTCFullYear(); + newdate = year + "/" + month + "/" + day; + } + + if(!to){ + to= '23:59'; + } + + if (full_legend != "") { + if (newdate2 == undefined) { + window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&status=-1'; + } + else { + window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate2+'&time_to='+to+'&status=-1'; + } + } + else { + window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1'; + } + } + }); $('#'+graph_id).bind('mouseout',resetInteractivity); } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 22a6de27b0..48b9db9652 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -846,7 +846,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon return $return; } -function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0) { +function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) { global $config; include_javascript_dependencies_flot_graph(); @@ -932,7 +932,6 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ $acumulate += $value; $c++; - //$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>"; if ($value > $max) { $max = $value; } @@ -943,6 +942,12 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ $labels = implode($separator,$labels); $datacolor = implode($separator,$datacolor); $legend = io_safe_output(implode($separator,$legend)); + if (!empty($full_legend_date)) { + $full_legend_date = io_safe_output(implode($separator,$full_legend_date)); + } + else { + $full_legend_date = false; + } $acumulate_data = io_safe_output(implode($separator,$acumulate_data)); // Store data series in javascript format @@ -966,7 +971,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ // Javascript code $return .= "<script type='text/javascript'>"; $return .= "//<![CDATA[\n"; - $return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent)"; + $return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')"; $return .= "\n//]]>"; $return .= "</script>"; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c52af5dbb3..9d7deb64db 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4165,4 +4165,25 @@ div#footer_help{ /*view-agents lastest events for this agent*/ #div_all_events_24h{ padding: 4px; +} + +/*styles graph conteiner*/ +.graph_conteiner_inside > .parent_graph{ + width: 100% !important; +} + +.graph_conteiner_inside > .parent_graph > .menu_graph{ + left: 90% !important; +} + +.graph_conteiner_inside > .parent_graph > .noresizevc{ + width: 90% !important; +} + +.graph_conteiner_inside > div > .nodata_container > .nodata_text { + display: none; +} + +.graph_conteiner_inside > div > .nodata_container{ + background-size: 120px 80px !important; } \ No newline at end of file diff --git a/pandora_console/index.php b/pandora_console/index.php index ff0e86cb8c..5a32eaa670 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -584,6 +584,13 @@ if (! isset ($config['id_user'])) { $res = update_user_password ($id_user, $pass1); if ($res) { $correct_reset_pass_process = __('Password changed successfully'); + + $values = array(); + $values['id_user'] = $id_user; + $reset_pass_moment = new DateTime('now'); + $reset_pass_moment = $reset_pass_moment->format("Y-m-d H:i:s"); + $values['reset_moment'] = $reset_pass_moment; + db_process_sql_insert('treset_pass_history', $values); } else { $process_error_message = __('Failed to change password'); @@ -641,7 +648,7 @@ if (! isset ($config['id_user'])) { if (!$check_user) { $reset = false; - $error = __('User doesn\'t exist in database'); + $error = __('Error in reset password request'); $show_error = true; } else { diff --git a/pandora_console/install.php b/pandora_console/install.php index 524954ec77..172f12af8e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -70,8 +70,8 @@ <body> <div style='height: 10px'> <?php -$version = '7.0NG.707'; -$build = '170718'; +$version = '7.0NG.708'; +$build = '170728'; $banner = "v$version Build $build"; error_reporting(0); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 64a9f65097..c58c72bdd2 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -466,7 +466,10 @@ else { 'unknown_count', 'notinit_count', 'total_count', - 'fired_count'), + 'fired_count', + 'ultimo_contacto_remoto', + 'remote', + 'agent_version'), $access, $order); } @@ -498,11 +501,11 @@ $table->head[1] = __('Description'). ' ' . $table->size[1] = "16%"; -$table->head[9] = __('Remote'). ' ' . +$table->head[10] = __('Remote'). ' ' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=remote&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=remote&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown, "alt" => "down")) . '</a>'; -$table->size[9] = "9%"; +$table->size[10] = "9%"; $table->head[2] = __('OS'). ' ' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=os&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp, "alt" => "up")) . '</a>' . @@ -517,21 +520,24 @@ $table->size[3] = "10%"; $table->head[4] = __('Group'). ' ' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=group&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=group&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown, "alt" => "down")) . '</a>'; -$table->size[4] = "15%"; +$table->size[4] = "8%"; -$table->head[5] = __('Modules'); -$table->size[5] = "10%"; +$table->head[5] = __('Type'); +$table->size[5] = "8%"; -$table->head[6] = __('Status'); -$table->size[6] = "4%"; +$table->head[6] = __('Modules'); +$table->size[6] = "10%"; -$table->head[7] = __('Alerts'); +$table->head[7] = __('Status'); $table->size[7] = "4%"; -$table->head[8] = __('Last contact'). ' ' . +$table->head[8] = __('Alerts'); +$table->size[8] = "4%"; + +$table->head[9] = __('Last contact'). ' ' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=last_contact&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' . '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=' . $refr . '&offset=' . $offset . '&group_id=' . $group_id . '&recursion=' . $recursion . '&search=' . $search . '&status='. $status . '&sort_field=last_contact&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>'; -$table->size[8] = "15%"; +$table->size[9] = "15%"; $table->align = array (); @@ -542,9 +548,9 @@ $table->align[5] = "left"; $table->align[6] = "left"; $table->align[7] = "left"; $table->align[8] = "left"; +$table->align[9] = "left"; $table->style = array(); -//$table->style[0] = 'width: 15%'; $table->data = array (); @@ -584,14 +590,14 @@ foreach ($agents as $agent) { $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); - $data[9] = ""; + $data[10] = ""; if (enterprise_installed()) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) { - $data[9] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))); + $data[10] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))); } } @@ -602,14 +608,18 @@ foreach ($agents as $agent) { $data[4] = ui_print_group_icon ($agent["id_grupo"], true); $agent['not_init_count'] = $agent['notinit_count']; - $data[5] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user); + + $data[5] = ui_print_type_agent_icon ($agent["id_os"], $agent['ultimo_contacto_remoto'], + $agent['ultimo_contacto'], $agent['remote'], + $agent['agent_version']); + + $data[6] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user); + + $data[7] = $status_img; + $data[8] = $alert_img; - $data[6] = $status_img; - - $data[7] = $alert_img; - - $data[8] = agents_get_interval_status ($agent); + $data[9] = agents_get_interval_status ($agent); // This old code was returning "never" on agents without modules, BAD !! // And does not print outdated agents in red. WRONG !!!! diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 9cb2c5d0da..23b5dabed8 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -602,7 +602,7 @@ $data[0][0] .= __('Events (24h)') . '</th></tr>' . '<tr><td style="text-align:center;"><br />' . - graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true) . + graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) . '<br /></td></tr>' . '</table>'; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index b2ba0a338e..a9574b21bf 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -543,8 +543,6 @@ $table_advanced->rowclass[] = ''; $data = array(); $data[0] = __('Date from') . $jump; -//~ $user_users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all()); - $data[0] .= html_print_input_text ('date_from', $date_from, '', 15, 10, true); $data[1] = __('Date to') . $jump; diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index deed8688a4..634fb17ef5 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -246,7 +246,7 @@ switch ($opt) { $row = array(); $row[] = __('Agent'); $row[] = '<a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' - . $agent['id_agente'] . '">'.$agent['nombre'].'</a>'; + . $agent['id_agente'] . '">'.$agent['alias'].'</a>'; $table->data[] = $row; // Position diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index 07e08582ec..36e20bf709 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -242,6 +242,7 @@ if ($config["pure"] != 0) { var new_height = $(document).height(); $("#map").css("height", new_height - 60); + $("svg[id*=OpenLayers]").css("height", new_height - 60); }); </script> diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index fb0338cb20..63320b0ab5 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 # User and Group under which Apache is running %define httpd_name httpd diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec index ddd471b6fe..03a5c23754 100644 --- a/pandora_console/pandora_console.spec +++ b/pandora_console/pandora_console.spec @@ -2,8 +2,8 @@ # Pandora FMS Console # %define name pandorafms_console -%define version 7.0NG.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 %define httpd_name httpd # User and Group under which Apache is running %define httpd_name apache2 diff --git a/pandora_console/pandora_console_install b/pandora_console/pandora_console_install index 5f2746bdd6..39fa2a39de 100644 --- a/pandora_console/pandora_console_install +++ b/pandora_console/pandora_console_install @@ -9,7 +9,7 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.707" +PI_VERSION="7.0NG.708" FORCE=0 DESTDIR="" LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 9733792280..0cb01cf9b5 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1143,6 +1143,16 @@ CREATE TABLE IF NOT EXISTS `tuser_double_auth` ( FOREIGN KEY (`id_user`) REFERENCES tusuario(`id_user`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ---------------------------------------------------------------------- +-- Table `treset_pass_history` +-- ---------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `treset_pass_history` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `reset_moment` datetime not null default 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- ---------------------------------------------------------------------- -- Table `tnews` -- ---------------------------------------------------------------------- @@ -2168,6 +2178,20 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` ( UNIQUE (`id_policy`, `id_agent`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tpolicy_groups` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tpolicy_groups` ( + `id` int(10) unsigned NOT NULL auto_increment, + `id_policy` int(10) unsigned default '0', + `id_group` int(10) unsigned default '0', + `policy_applied` tinyint(1) unsigned default '0', + `pending_delete` tinyint(1) unsigned default '0', + `last_apply_utimestamp` int(10) unsigned NOT NULL default 0, + PRIMARY KEY (`id`), + UNIQUE (`id_policy`, `id_group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- --------------------------------------------------------------------- -- Table `tdashboard` -- --------------------------------------------------------------------- diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index af8acd122e..9645ed17ca 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-server -Version: 7.0NG.707-170718 +Version: 7.0NG.708-170728 Architecture: all Priority: optional Section: admin diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 4042fda1b4..f92422d948 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.707-170718" +pandora_version="7.0NG.708-170728" package_cpan=0 package_pandora=1 diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 4d12de8adb..709b6c7b04 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -607,13 +607,7 @@ sub main() { $server->update(); } - # Update fallen servers - my @servers_db = get_db_rows ($DBH, "SELECT id_server, server_keepalive FROM tserver"); - for (@servers_db) { - my %server_db = %$_; - my $expected_update = strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - $server_db{'server_keepalive'} * 2)); - db_do ($DBH, "UPDATE tserver SET status = 0 WHERE keepalive < ? AND id_server = ?", $expected_update, $server_db{'id_server'}); - } + db_do ($DBH, "UPDATE tserver SET status = 0 WHERE now()-keepalive > 2*server_keepalive"); # Set the master server pandora_set_master(\%Config, $DBH); diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new index 3f5f7d1cd0..6d2e757f1a 100644 --- a/pandora_server/conf/pandora_server.conf.new +++ b/pandora_server/conf/pandora_server.conf.new @@ -1,7 +1,7 @@ ############################################################################# # Pandora FMS Server Parameters # Pandora FMS, the Flexible Monitoring System. -# Version 7.0NG.707 +# Version 7.0NG.708 # Licensed under GPL license v2, # (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 55591df85b..73efa0d513 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -42,8 +42,8 @@ our @EXPORT = qw( ); # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "7.0NG.707"; -my $pandora_build = "170718"; +my $pandora_version = "7.0NG.708"; +my $pandora_build = "170728"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index cb60bae602..0233afe93c 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index b576711740..5e7d97b8b1 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -2,8 +2,8 @@ # Pandora FMS Server # %define name pandorafms_server -%define version 7.0NG.707 -%define release 170718 +%define version 7.0NG.708 +%define release 170728 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index faee7a38db..e8029caecb 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -8,8 +8,8 @@ # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.707" -PI_BUILD="170718" +PI_VERSION="7.0NG.708" +PI_BUILD="170728" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 99ff1e2452..9b1eadf84f 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -33,7 +33,7 @@ use PandoraFMS::Tools; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.707 PS170718"; +my $version = "7.0NG.708 PS170728"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index e5d9202cfb..a9a8c08ba9 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -35,7 +35,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.707 PS170718"; +my $version = "7.0NG.708 PS170728"; # save program name for logging my $progname = basename($0); diff --git a/pandora_server/util/pandora_xml_count.README b/pandora_server/util/pandora_xml_count.README new file mode 100644 index 0000000000..88a2021952 --- /dev/null +++ b/pandora_server/util/pandora_xml_count.README @@ -0,0 +1,17 @@ +Pandora FMS XML count tool +========================== + +This is a small diagnosis tool that counts XML data files in Pandora FMS's spool directory by agent. + +Usage example +------------- + +$ perl ./pandora_xml_count.pl /var/spool/pandora_data_in +Number of .data files Agent name +--------------------- ---------- +1 Agent80 +1 Agent25 +42 Agent22 +... ... +41122 Agent21 + diff --git a/pandora_server/util/pandora_xml_count.pl b/pandora_server/util/pandora_xml_count.pl new file mode 100755 index 0000000000..cd81843c96 --- /dev/null +++ b/pandora_server/util/pandora_xml_count.pl @@ -0,0 +1,55 @@ +#!/usr/bin/perl +################################################################################ +# Pandora XML count tool. +################################################################################ +# Copyright (c) 2017 Artica Soluciones Tecnologicas S.L. +# +# 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 +# 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. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +################################################################################ +use strict; +use warnings; + +# Check command line arguments. +if (!defined($ARGV[0])) { + die("Usage: $0 <path to Pandora FMS's spool directory>\n\n"); +} +my $spool_dir = $ARGV[0]; + +# Open Pandora's spool directory. +opendir(my $dh, $spool_dir) || die("Error opening directory $spool_dir: $!\n\n"); + +# Count files by agent. +my %totals; +while (my $file = readdir($dh)) { + + # Skip . and .. + next if ($file eq '.') or ($file eq '..'); + + # Skip files unknown to the Data Server. + next if ($file !~ /^(.*)[\._]\d+\.data$/); + + # Update the totals. + my $agent = $1; + if (!defined($totals{$agent})) { + $totals{$agent} = 1; + } else { + $totals{$agent} += 1; + } +} +closedir($dh); + +# Print the totals. +print "Number of .data files\t\tAgent name\n"; +print "---------------------\t\t----------\n"; +foreach my $agent (sort { $totals{$a} <=> $totals{$b}} keys(%totals)) { + print "$totals{$agent}\t\t\t\t$agent\n"; +}