diff --git a/extras/bin/gotty b/extras/bin/gotty
new file mode 100755
index 0000000000..1a1de33cf6
Binary files /dev/null and b/extras/bin/gotty differ
diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf
index 4fff860931..f3657d3a7a 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.739, AIX version
+# Version 7.0NG.740, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf
index f33b304a7c..95fd1090ad 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.739, FreeBSD Version
+# Version 7.0NG.740, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf
index 1d627fc222..04122feb30 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.739, HP-UX Version
+# Version 7.0NG.740, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf
index 9501fa5222..b083e7f3aa 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.739, GNU/Linux
+# Version 7.0NG.740, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf
index bdd4bcf425..4bb88c5b4e 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.739, GNU/Linux
+# Version 7.0NG.740, 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 f80f403dd8..a90b7227ca 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.739, Solaris Version
+# Version 7.0NG.740, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf
index 86bfede9d7..d750898b70 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.739
+# Version 7.0NG.740
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software
diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf
index aa65eb24d9..6a663d6331 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.739, AIX version
+# Version 7.0NG.740, AIX version
# General Parameters
# ==================
diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf
index 7c225fea1c..99e4c62462 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.739
+# Version 7.0NG.740
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena
diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf
index 06bd17ed45..7a9d2c4347 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.739, HPUX Version
+# Version 7.0NG.740, HPUX Version
# General Parameters
# ==================
diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf
index 54b0e06dbf..a55d96a952 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.739
+# Version 7.0NG.740
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf
index f5205f4d16..a24a24d16e 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.739
+# Version 7.0NG.740
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf
index 7d6a12d62b..74d515cb4e 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.739
+# Version 7.0NG.740
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net
diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf
index cbae89b0b5..dc915ef18e 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.739, Solaris version
+# Version 7.0NG.740, Solaris version
# General Parameters
# ==================
diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf
index 7f2791b05f..de7e97911b 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.739, AIX version
+# Version 7.0NG.740, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 9c47b6ec9a..ce165fde19 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.739-191028
+Version: 7.0NG.740-191029
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 ace99c417d..a4a8dce448 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.739-191028"
+pandora_version="7.0NG.740-191029"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf
index 7f403ae687..34dd1bf4fc 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.739, GNU/Linux
+# Version 7.0NG.740, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf
index 2871669f88..e4ad74ffe7 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.739, FreeBSD Version
+# Version 7.0NG.740, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf
index 1fcbc17977..e55445fe13 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.739, HP-UX Version
+# Version 7.0NG.740, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf
index 938565241d..54ace6a811 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.739, GNU/Linux
+# Version 7.0NG.740, 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 f9a2b10b93..94e32e8056 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.739, GNU/Linux
+# Version 7.0NG.740, 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 2f108c2011..71e7d14192 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.739, NetBSD Version
+# Version 7.0NG.740, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf
index 47f17aae0f..cc89dee501 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.739, Solaris Version
+# Version 7.0NG.740, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index a011385d9d..4bbac522b1 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
-use constant AGENT_VERSION => '7.0NG.739';
-use constant AGENT_BUILD => '191028';
+use constant AGENT_VERSION => '7.0NG.740';
+use constant AGENT_BUILD => '191029';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index ded364b98a..79f2310c11 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.739
-%define release 191028
+%define version 7.0NG.740
+%define release 191029
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 f503af722d..392fa174ce 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.739
-%define release 191028
+%define version 7.0NG.740
+%define release 191029
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 e1ef018c0e..cc4b78b51c 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.739"
-PI_BUILD="191028"
+PI_VERSION="7.0NG.740"
+PI_BUILD="191029"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf
index d6bf2f9005..79660e5b5d 100644
--- a/pandora_agents/win32/bin/pandora_agent.conf
+++ b/pandora_agents/win32/bin/pandora_agent.conf
@@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
-# Version 7.0NG.739
+# Version 7.0NG.740
# 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 fd4c5af3e4..730edbe5de 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.739}
+{Pandora FMS Windows Agent v7.0NG.740}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{191028}
+{191029}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 2687ff4b4f..823b486b0e 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.739(Build 191028)")
+#define PANDORA_VERSION ("7.0NG.740(Build 191029)")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index fe4067fa72..d714543482 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.739(Build 191028))"
+ VALUE "ProductVersion", "(7.0NG.740(Build 191029))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index a2bc785644..cab514f37e 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.739-191028
+Version: 7.0NG.740-191029
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 d995e7f837..64140d02ad 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.739-191028"
+pandora_version="7.0NG.740-191029"
package_pear=0
package_pandora=1
diff --git a/pandora_console/composer.json b/pandora_console/composer.json
index 208e2d3d14..4138dc77c2 100644
--- a/pandora_console/composer.json
+++ b/pandora_console/composer.json
@@ -1,5 +1,5 @@
{
- "name": "Pandora FMS",
+ "name": "pandorafms/console",
"description": "Pandora Flexible Monitoring System ",
"authors": [
{
@@ -14,7 +14,9 @@
"autoload": {
"psr-4": {
"Models\\": "include/rest-api/models",
- "Enterprise\\Models\\": "enterprise/include/rest-api/models"
+ "Enterprise\\Models\\": "enterprise/include/rest-api/models",
+ "PandoraFMS\\": "include/lib",
+ "PandoraFMS\\Enterprise\\": "enterprise/include/lib"
}
},
"autoload-dev": {
diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php
new file mode 100644
index 0000000000..8c87577abc
--- /dev/null
+++ b/pandora_console/extensions/quick_shell.php
@@ -0,0 +1,503 @@
+printForm(
+ [
+ 'form' => [
+ 'method' => 'POST',
+ 'action' => '#',
+ ],
+ 'inputs' => [
+ [
+ 'class' => 'w100p',
+ 'arguments' => [
+ 'name' => 'submit',
+ 'label' => __('Retry'),
+ 'type' => 'submit',
+ 'attributes' => 'class="sub next"',
+ 'return' => true,
+ ],
+ ],
+ ],
+ ]
+ );
+
+ return;
+ }
+
+ $wiz->printForm(
+ [
+ 'form' => [
+ 'action' => '#',
+ 'class' => 'wizard',
+ 'method' => 'post',
+ ],
+ 'inputs' => [
+ [
+ 'label' => __('Username'),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'username',
+ ],
+ ],
+ [
+ 'label' => __('Port'),
+ 'arguments' => [
+ 'type' => 'text',
+ 'id' => 'port',
+ 'name' => 'port',
+ 'value' => 22,
+ ],
+ ],
+ [
+ 'label' => __('Method'),
+ 'arguments' => [
+ 'type' => 'select',
+ 'name' => 'method',
+ 'fields' => [
+ 'ssh' => __('SSH'),
+ 'telnet' => __('Telnet'),
+ ],
+ 'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);",
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'type' => 'submit',
+ 'label' => __('Connect'),
+ 'attributes' => 'class="sub next"',
+ ],
+ ],
+ ],
+ ],
+ false,
+ true
+ );
+
+ return;
+ }
+
+ // Initialize Gotty Client.
+ $host = $config['gotty_host'];
+ if ($method == 'ssh') {
+ // SSH.
+ $port = $config['gotty_ssh_port'];
+ $command_arguments = "var args = '?arg=".$username.'@'.$address;
+ $command_arguments .= '&arg=-p '.$method_port."';";
+ } else if ($method == 'telnet') {
+ // Telnet.
+ $port = $config['gotty_telnet_port'];
+ $command_arguments = "var args = '?arg=-l ".$username;
+ $command_arguments .= '&arg='.$address;
+ $command_arguments .= '&arg='.$method_port."';";
+ } else {
+ ui_print_error_message(__('Please use SSH or Telnet.'));
+ return;
+ }
+
+ // If rediretion is enabled, we will try to connect to http:// or https:// endpoint.
+ $test = get_headers($ws_url);
+ if ($test === false) {
+ if (empty($wiz) === true) {
+ $wiz = new Wizard();
+ }
+
+ ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
+ echo $wiz->printGoBackButton('#');
+ return;
+ }
+
+ // Check credentials.
+ $auth_str = '';
+ $gotty_url = $host.':'.$port;
+ if (empty($config['gotty_user']) === false
+ && empty($config['gotty_pass']) === false
+ ) {
+ $auth_str = $config['gotty_user'].':'.$config['gotty_pass'];
+ $gotty_url = $auth_str.'@'.$host.':'.$port;
+ }
+
+ $r = file_get_contents('http://'.$gotty_url.'/js/hterm.js');
+ if (empty($r) === true) {
+ if (empty($wiz) === true) {
+ $wiz = new Wizard();
+ }
+
+ ui_print_error_message(__('WebService engine is not working properly, please check documentation.'));
+ echo $wiz->printGoBackButton('#');
+ return;
+ }
+
+ // Override gotty client settings.
+ if (empty($auth_str) === true) {
+ $r .= "var gotty_auth_token = '';";
+ } else {
+ $r .= "var gotty_auth_token = '";
+ $r .= $auth_str."';";
+ }
+
+ // Set websocket target and method.
+ $gotty = file_get_contents('http://'.$gotty_url.'/js/gotty.js');
+ $url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
+ if (empty($config['ws_proxy_url']) === true) {
+ $new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
+ $new .= " + window.location.host + ':";
+ $new .= $config['ws_port'].'/'.$method."';";
+ } else {
+ $new = "var url = '";
+ $new .= $config['ws_proxy_url'].'/'.$method."';";
+ }
+
+ // Update url.
+ $gotty = str_replace($url, $new, $gotty);
+
+ // Update websocket arguments.
+ $args = 'var args = window.location.search;';
+ $new = $command_arguments;
+
+ // Update arguments.
+ $gotty = str_replace($args, $new, $gotty);
+
+ ?>
+
+
+
+
+ 0) {
+ $msg = __('%d Updated', $changes);
+ if ($critical > 0) {
+ $msg = __(
+ '%d Updated, please restart WebSocket engine service',
+ $changes
+ );
+ }
+
+ ui_print_success_message($msg);
+ }
+
+ // Form.
+ $wiz = new Wizard();
+
+ $wiz->printForm(
+ [
+ 'form' => [
+ 'action' => '#',
+ 'class' => 'wizard',
+ 'method' => 'post',
+ ],
+ 'inputs' => [
+ [
+ 'label' => __('Gotty path').ui_print_help_tip(
+ __('Leave blank if using an external Gotty service')
+ ),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'gotty',
+ 'value' => $config['gotty'],
+ ],
+ ],
+ [
+ 'label' => __('Gotty host'),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'gotty_host',
+ 'value' => $config['gotty_host'],
+ ],
+ ],
+ [
+ 'label' => __('Gotty ssh port'),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'gotty_ssh_port',
+ 'value' => $config['gotty_ssh_port'],
+ ],
+ ],
+ [
+ 'label' => __('Gotty telnet port'),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'gotty_telnet_port',
+ 'value' => $config['gotty_telnet_port'],
+ ],
+ ],
+ [
+ 'label' => __('Gotty user').ui_print_help_tip(
+ __('Optional, set a user to access gotty service')
+ ),
+ 'arguments' => [
+ 'type' => 'text',
+ 'name' => 'gotty_user',
+ 'value' => $config['gotty_user'],
+ ],
+ ],
+ [
+ 'label' => __('Gotty password').ui_print_help_tip(
+ __('Optional, set a password to access gotty service')
+ ),
+ 'arguments' => [
+ 'type' => 'password',
+ 'name' => 'gotty_pass',
+ 'value' => io_output_password($config['gotty_pass']),
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'type' => 'submit',
+ 'label' => __('Update'),
+ 'attributes' => 'class="sub next"',
+ ],
+ ],
+ ],
+ ],
+ false,
+ true
+ );
+
+}
+
+
+// This extension is usefull only if the agent has associated IP.
+$agent_id = get_parameter('id_agente');
+if (empty($agent_id) === false
+ && get_parameter('sec2', '') == 'operation/agentes/ver_agente'
+) {
+ $address = agents_get_address($agent_id);
+ if (empty($address) === false) {
+ // Extension registration.
+ extensions_add_opemode_tab_agent(
+ // TabId.
+ 'quick_shell',
+ // TabName.
+ __('QuickShell'),
+ // TabIcon.
+ 'images/ehorus/terminal.png',
+ // TabFunction.
+ 'quickShell',
+ // Version.
+ 'N/A',
+ // Acl.
+ 'PM'
+ );
+ }
+}
+
+extensions_add_godmode_menu_option(
+ // Name.
+ __('QuickShell settings'),
+ // Acl.
+ 'PM',
+ // FatherId.
+ 'gextensions',
+ // Icon.
+ 'images/ehorus/terminal.png',
+ // Version.
+ 'N/A',
+ // SubfatherId.
+ null
+);
+
+extensions_add_godmode_function('quickShellSettings');
diff --git a/pandora_console/extras/mr/33.sql b/pandora_console/extras/mr/33.sql
new file mode 100644
index 0000000000..eeca8ed5d7
--- /dev/null
+++ b/pandora_console/extras/mr/33.sql
@@ -0,0 +1,9 @@
+START TRANSACTION;
+
+INSERT INTO `ttipo_modulo` VALUES
+(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
+(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
+(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
+(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
+
+COMMIT;
\ No newline at end of file
diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php
index eb9a199456..b047106679 100644
--- a/pandora_console/extras/pandora_diag.php
+++ b/pandora_console/extras/pandora_diag.php
@@ -1,796 +1,2 @@
-
-
$value) {
- db_process_sql_update(
- 'tupdate_settings',
- [db_escape_key_identifier('value') => $value],
- [db_escape_key_identifier('key') => $key]
- );
- }
-
- ui_print_success_message(__('License updated'));
-}
-
-ui_require_javascript_file_enterprise('load_enterprise');
-enterprise_include_once('include/functions_license.php');
-$license = enterprise_hook('license_get_info');
-
-$rows = db_get_all_rows_in_table('tupdate_settings');
-
-$settings = new StdClass;
-foreach ($rows as $row) {
- $settings->{$row['key']} = $row['value'];
-}
-
-echo '';
-
-
-function render_info($table)
-{
- global $console_mode;
-
- $info = db_get_sql("SELECT COUNT(*) FROM $table");
- render_row($info, "DB Table $table");
-}
-
-
-function render_info_data($query, $label)
-{
- global $console_mode;
-
- $info = db_get_sql($query);
- render_row($info, $label);
-}
-
-
-function render_row($data, $label)
-{
- global $console_mode;
-
- if ($console_mode == 1) {
- echo $label;
- echo '|';
- echo $data;
- echo "\n";
- } else {
- echo '';
- echo "".$label;
- echo ' | ';
- echo "".$data;
- echo ' | ';
- echo '
';
- }
-}
-
-
-function get_value_sum($arr)
-{
- foreach ($arr as $clave) {
- foreach ($clave as $valor) {
- if (is_numeric($valor) === true) {
- $result += $valor;
- }
- }
- }
-
- return $result;
-}
-
-
-function execution_time()
-{
- $times = db_get_all_rows_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = 29 ORDER BY utimestamp DESC LIMIT 2');
- if ($times[0]['datos'] > ($times[1]['datos'] * 1.2)) {
- return "Warning Status   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph";
- } else {
- return "Normal Status   The execution time is correct. For more information about this data, check the Execution Time graph";
- }
-}
-
-
-function get_logs_size($file)
-{
- $file_name = '/var'.$file.'';
- $size_server_log = filesize($file_name);
- return $size_server_log;
-
-}
-
-
-function get_status_logs($path)
-{
- $status_server_log = '';
- $size_server_log = number_format(get_logs_size($path));
- $size_server_log = (0 + str_replace(',', '', $size_server_log));
- if ($size_server_log <= 10485760) {
- $status_server_log = "Normal Status   You have less than 10 MB of logs";
- } else {
- $status_server_log = "Warning Status   You have more than 10 MB of logs";
- }
-
- return $status_server_log;
-}
-
-
-function percentage_modules_per_agent()
-{
- $status_average_modules = '';
- $total_agents = db_get_value_sql('SELECT count(*) FROM tagente');
- $total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
- $average_modules_per_agent = ($total_modules / $total_agents);
- if ($average_modules_per_agent <= 40) {
- $status_average_modules = "Normal Status   The average of modules per agent is less than 40";
- } else {
- $status_average_modules = "Warning Status  The average of modules per agent is more than 40. You can have performance problems";
- }
-
- return $status_average_modules;
-}
-
-
-function license_capacity()
-{
- $license = enterprise_hook('license_get_info');
- $license_limit = $license['limit'];
- $status_license_capacity = '';
- $current_count = db_get_value_sql('SELECT count(*) FROM tagente');
- if ($current_count > ($license_limit * 90 / 100)) {
- $status_license_capacity = "Warning Status   License capacity exceeds 90 percent";
- } else {
- $status_license_capacity = "Normal Status   License capacity is less than 90 percent";
- }
-
- return $status_license_capacity;
-}
-
-
-function status_license_params($license_param)
-{
- $status_license_par = '';
- if ($license_param <= 0) {
- $status_license_par = 'OFF';
- } else {
- $status_license_par = 'ON';
- }
-
- return $status_license_par;
-}
-
-
-function interval_average_of_network_modules()
-{
- $total_network_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18');
- $total_module_interval_time = db_get_value_sql('SELECT SUM(module_interval) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18');
- $average_time = ((int) $total_module_interval_time / $total_network_modules);
-
- if ($average_time < 180) {
- $status_average_modules = "Warning Status   The system is overloaded (average time $average_time) and a very fine configuration is required";
- } else {
- $status_average_modules = "Normal Status   The system is not overloaded (average time $average_time) ";
- }
-
- if ($average_time == 0) {
- $status_average_modules = "Normal Status   The system has no load";
- }
-
- return $status_average_modules;
-}
-
-
-$attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLOB_BRACE));
-
-
-function files_attachment_folder($total_files)
-{
- if ($total_files <= 700) {
- $status_total_files = "Normal Status   The attached folder contains less than 700 files.";
- } else {
- $status_total_files = "Warning Status   The attached folder contains more than 700 files.";
- }
-
- return $status_total_files;
-}
-
-
-$tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos');
-
-
-function status_tagente_datos($tagente_datos_size)
-{
- if ($tagente_datos_size <= 3000000) {
- $tagente_datos_size = "Normal Status   The tagente_datos table contains an acceptable amount of data.";
- } else {
- $tagente_datos_size = "Warning Status   The tagente_datos table contains too much data. A historical database is recommended.";
- }
-
- return $tagente_datos_size;
-}
-
-
-function status_values($val_rec, $val)
-{
- if ($val_rec <= $val) {
- return $val." (Min. Recommended Value ".$val_rec.')';
- } else {
- return $val." (Min. Recommended Value ".$val_rec.") Warning Status";
- }
-}
-
-
-$tables_fragmentation = db_get_sql(
- "SELECT (data_free/(index_length+data_length))
-as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'"
-);
-$db_size = db_get_all_rows_sql(
- 'SELECT table_schema,
-ROUND(SUM(data_length+index_length)/1024/1024,3)
-FROM information_schema.TABLES
-GROUP BY table_schema;'
-);
-
-if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
- $total_server_threads = shell_exec('ps -T aux | grep pandora_server | grep -v grep | wc -l');
- $percentage_threads_ram = shell_exec("ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
- $percentage_threads_cpu = shell_exec("ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
- $innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
-}
-
-$path_server_logs = '/log/pandora/pandora_server.log';
-$path_err_logs = '/log/pandora/pandora_server.error';
-$path_console_logs = '/www/html/pandora_console/pandora_console.log';
-$innodb_log_file_size_min_rec_value = '64M';
-$innodb_log_buffer_size_min_rec_value = '16M';
-$innodb_flush_log_at_trx_commit_min_rec_value = 0;
-$query_cache_limit_min_rec_value = 2;
-$max_allowed_packet_min_rec_value = 32;
-$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
-$sort_buffer_size_min_rec_value = 32;
-$join_buffer_size_min_rec_value = 265;
-$query_cache_type_min_rec_value = 'ON';
-$query_cache_size_min_rec_value = 24;
-$innodb_lock_wait_timeout_max_rec_value = 120;
-$tables_fragmentation_max_rec_value = 10;
-$thread_cache_size_max_rec_value = 8;
-$thread_stack_min_rec_value = 256;
-$max_connections_max_rec_value = 150;
-$key_buffer_size_min_rec_value = 256;
-$read_buffer_size_min_rec_value = 32;
-$read_rnd_buffer_size_min_rec_value = 32;
-$query_cache_min_res_unit_min_rec_value = 2;
-$innodb_file_per_table_min_rec_value = 1;
-
-
-function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation)
-{
- $status_tables_frag = '';
- if ($tables_fragmentation > $tables_fragmentation_max_rec_value) {
- $status_tables_frag = "Warning Status   Table fragmentation is higher than recommended. They should be defragmented.";
- } else {
- $status_tables_frag = "Normal Status   Table fragmentation is correct.";
- }
-
- return $status_tables_frag;
-}
-
-
-$console_mode = 1;
-if (!isset($argc)) {
- $console_mode = 0;
-}
-
-if ($console_mode == 1) {
- echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n";
-
- if ($argc == 1 || in_array($argv[1], ['--help', '-help', '-h', '-?'])) {
- echo "\nThis command line script contains information about Pandora FMS database.
- This program can only be executed from the console, and it needs a parameter, the
- full path to Pandora FMS 'config.php' file.
-
- Usage:
- php pandora_diag.php path_to_pandora_console
-
- Example:
- php pandora_diag.php /var/www/pandora_console
-
-";
- exit;
- }
-
- if (preg_match('/[^a-zA-Z0-9_\/\.]|(\/\/)|(\.\.)/', $argv[1])) {
- echo "Invalid path: $argv[1]. Always use absolute paths.";
- exit;
- }
-
- include $argv[1].'/include/config.php';
-} else {
- if (file_exists('../include/config.php')) {
- include '../include/config.php';
- }
-
- // Not from console, this is a web session.
- if ((!isset($config['id_user'])) || (!check_acl($config['id_user'], 0, 'PM'))) {
- echo "You don't have privileges to use diagnostic tool
";
- echo 'Please login with an administrator account before try to use this tool
';
- exit;
- }
-
- // Header.
- ui_print_page_header(
- __('Pandora FMS Diagnostic tool'),
- '',
- false,
- 'diagnostic_tool_tab',
- true
- );
-
- echo "";
- echo "".__('Pandora status info').' |
';
-}
-
-render_row($build_version, 'Pandora FMS Build');
-render_row($pandora_version, 'Pandora FMS Version');
-render_info_data("SELECT value FROM tconfig where token ='MR'", 'Minor Release');
-render_row($config['homedir'], 'Homedir');
-render_row($config['homeurl'], 'HomeUrl');
-render_info_data(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'enterprise_installed'",
- 'Enterprise installed'
-);
-
- $full_key = db_get_sql(
- "SELECT value
- FROM tupdate_settings
- WHERE `key` = 'customer_key'"
- );
-
- $compressed_key = substr($full_key, 0, 5).'...'.substr($full_key, -5);
-
- render_row($compressed_key, 'Update Key');
-
- render_info_data(
- "SELECT value
- FROM tupdate_settings
- WHERE `key` = 'updating_code_path'",
- 'Updating code path'
- );
-
- render_info_data(
- "SELECT value
- FROM tupdate_settings
- WHERE `key` = 'current_update'",
- 'Current Update #'
- );
-
-
- echo "".__('PHP setup').' |
';
-
-
- render_row(phpversion(), 'PHP Version');
-
- render_row(ini_get('max_execution_time').' seconds', 'PHP Max execution time');
-
- render_row(ini_get('max_input_time').' seconds', 'PHP Max input time');
-
- render_row(ini_get('memory_limit'), 'PHP Memory limit');
-
- render_row(ini_get('session.cookie_lifetime'), 'Session cookie lifetime');
-
- echo "".__('Database size stats').' |
';
-
- render_info_data('SELECT COUNT(*) FROM tagente', 'Total agents');
- render_info_data('SELECT COUNT(*) FROM tagente_modulo', 'Total modules');
- render_info_data('SELECT COUNT(*) FROM tgrupo', 'Total groups');
- render_info_data('SELECT COUNT(*) FROM tagente_datos', 'Total module data records');
- render_info_data('SELECT COUNT(*) FROM tagent_access', 'Total agent access record');
- render_info_data('SELECT COUNT(*) FROM tevento', 'Total events');
-
- if ($config['enterprise_installed']) {
- render_info_data('SELECT COUNT(*) FROM ttrap', 'Total traps');
- }
-
- render_info_data('SELECT COUNT(*) FROM tusuario', 'Total users');
- render_info_data('SELECT COUNT(*) FROM tsesion', 'Total sessions');
-
- echo "".__('Database sanity').' |
';
-
- render_info_data(
- 'SELECT COUNT( DISTINCT tagente.id_agente)
- FROM tagente_estado, tagente, tagente_modulo
- WHERE tagente.disabled = 0
- AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
- AND tagente_modulo.disabled = 0
- AND tagente_estado.id_agente = tagente.id_agente
- AND tagente_estado.estado = 3',
- 'Total unknown agents'
- );
-
- render_info_data(
- 'SELECT COUNT(tagente_estado.estado)
- FROM tagente_estado
- WHERE tagente_estado.estado = 4',
- 'Total not-init modules'
- );
-
-
- $last_run_difference = '';
-
- $diferencia = (time() - date(
- db_get_sql(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'db_maintance'"
- )
- ));
-
- $last_run_difference_months = 0;
- $last_run_difference_weeks = 0;
- $last_run_difference_days = 0;
- $last_run_difference_minutos = 0;
- $last_run_difference_seconds = 0;
-
- while ($diferencia >= 2419200) {
- $diferencia -= 2419200;
- $last_run_difference_months++;
- }
-
- while ($diferencia >= 604800) {
- $diferencia -= 604800;
- $last_run_difference_weeks++;
- }
-
- while ($diferencia >= 86400) {
- $diferencia -= 86400;
- $last_run_difference_days++;
- }
-
- while ($diferencia >= 3600) {
- $diferencia -= 3600;
- $last_run_difference_hours++;
- }
-
- while ($diferencia >= 60) {
- $diferencia -= 60;
- $last_run_difference_minutes++;
- }
-
- $last_run_difference_seconds = $diferencia;
-
- if ($last_run_difference_months > 0) {
- $last_run_difference .= $last_run_difference_months.'month/s ';
- }
-
- if ($last_run_difference_weeks > 0) {
- $last_run_difference .= $last_run_difference_weeks.' week/s ';
- }
-
- if ($last_run_difference_days > 0) {
- $last_run_difference .= $last_run_difference_days.' day/s ';
- }
-
- if ($last_run_difference_hours > 0) {
- $last_run_difference .= $last_run_difference_hours.' hour/s ';
- }
-
- if ($last_run_difference_minutes > 0) {
- $last_run_difference .= $last_run_difference_minutes.' minute/s ';
- }
-
- $last_run_difference .= $last_run_difference_seconds.' second/s ago';
-
- render_row(
- date(
- 'Y/m/d H:i:s',
- db_get_sql(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'db_maintance'"
- )
- ).' ('.$last_run_difference.')'.' *',
- 'PandoraDB Last run'
- );
-
- echo "".__('Database status info').' |
';
-
- switch ($config['dbtype']) {
- case 'mysql':
- render_info_data(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'db_scheme_first_version'",
- 'DB Schema Version (first installed)'
- );
- render_info_data(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'db_scheme_version'",
- 'DB Schema Version (actual)'
- );
- render_info_data(
- "SELECT `value`
- FROM tconfig
- WHERE `token` = 'db_scheme_build'",
- 'DB Schema Build'
- );
-
- render_row(get_value_sum($db_size).'M', 'DB Size');
-
-
- if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
- echo "".__('System info').' |
';
-
- $output = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"';
- $output2 = 'cat /proc/cpuinfo | grep "processor" | wc -l';
-
- render_row(exec($output).' x '.exec($output2), 'CPU');
-
- $output = 'cat /proc/meminfo | grep "MemTotal"';
-
- render_row(exec($output), 'RAM');
- }
- break;
-
- case 'postgresql':
- render_info_data(
- "SELECT \"value\"
- FROM tconfig
- WHERE \"token\" = 'db_scheme_version'",
- 'DB Schema Version'
- );
- render_info_data(
- "SELECT \"value\"
- FROM tconfig
- WHERE \"token\" = 'db_scheme_build'",
- 'DB Schema Build'
- );
- render_info_data(
- "SELECT \"value\"
- FROM tconfig
- WHERE \"token\" = 'enterprise_installed'",
- 'Enterprise installed'
- );
- render_row(
- date(
- 'Y/m/d H:i:s',
- db_get_sql(
- "SELECT \"value\"
- FROM tconfig WHERE \"token\" = 'db_maintance'"
- )
- ),
- 'PandoraDB Last run'
- );
-
- render_info_data(
- "SELECT value
- FROM tupdate_settings
- WHERE \"key\" = 'customer_key';",
- 'Update Key'
- );
- render_info_data(
- "SELECT value
- FROM tupdate_settings
- WHERE \"key\" = 'updating_code_path'",
- 'Updating code path'
- );
- render_info_data(
- "SELECT value
- FROM tupdate_settings
- WHERE \"key\" = 'current_update'",
- 'Current Update #'
- );
- break;
-
- case 'oracle':
- render_info_data(
- "SELECT value
- FROM tconfig
- WHERE token = 'db_scheme_version'",
- 'DB Schema Version'
- );
- render_info_data(
- "SELECT value
- FROM tconfig
- WHERE token = 'db_scheme_build'",
- 'DB Schema Build'
- );
- render_info_data(
- "SELECT value
- FROM tconfig
- WHERE token = 'enterprise_installed'",
- 'Enterprise installed'
- );
- render_row(
- db_get_sql(
- "SELECT value
- FROM tconfig
- WHERE token = 'db_maintance'"
- ),
- 'PandoraDB Last run'
- );
-
- render_info_data(
- 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
- WHERE \"key\" = 'customer_key'",
- 'Update Key'
- );
- render_info_data(
- 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
- WHERE \"key\" = 'updating_code_path'",
- 'Updating code path'
- );
- render_info_data(
- 'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
- WHERE \"key\" = 'current_update'",
- 'Current Update #'
- );
- break;
- }
-
- $innodb_log_file_size = (db_get_value_sql('SELECT @@innodb_log_file_size') / 1048576);
- $innodb_log_buffer_size = (db_get_value_sql('SELECT @@innodb_log_buffer_size') / 1048576);
- $innodb_flush_log_at_trx_commit = db_get_value_sql('SELECT @@innodb_flush_log_at_trx_commit');
- $max_allowed_packet = (db_get_value_sql('SELECT @@max_allowed_packet') / 1048576);
- $innodb_buffer_pool_size = (db_get_value_sql('SELECT @@innodb_buffer_pool_size') / 1024);
- $sort_buffer_size = number_format((db_get_value_sql('SELECT @@sort_buffer_size') / 1024), 2);
- $join_buffer_size = (db_get_value_sql('SELECT @@join_buffer_size') / 1024);
- $query_cache_type = db_get_value_sql('SELECT @@query_cache_type');
- $query_cache_size = (db_get_value_sql('SELECT @@query_cache_size') / 1048576);
- $query_cache_limit = (db_get_value_sql('SELECT @@query_cache_limit') / 1048576);
- $innodb_lock_wait_timeout = db_get_value_sql('SELECT @@innodb_lock_wait_timeout');
- $thread_cache_size = db_get_value_sql('SELECT @@thread_cache_size');
- $thread_stack = (db_get_value_sql('SELECT @@thread_stack') / 1024);
- $max_connections = db_get_value_sql('SELECT @@max_connections');
- $key_buffer_size = (db_get_value_sql('SELECT @@key_buffer_size') / 1024);
- $read_buffer_size = (db_get_value_sql('SELECT @@read_buffer_size') / 1024);
- $read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024);
- $query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024);
- $innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table');
- echo "".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).' |
';
-
- render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size ');
- render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size ');
- render_row(status_values($innodb_flush_log_at_trx_commit_min_rec_value, $innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ', 'InnoDB flush log at trx-commit ');
- render_row(status_values($max_allowed_packet_min_rec_value, $max_allowed_packet), 'Maximun allowed packet ', 'Maximun allowed packet ');
- render_row(status_values($innodb_buffer_pool_size_min_rec_value, $innodb_buffer_pool_size), 'InnoDB buffer pool size ', 'InnoDB buffer pool size ');
- render_row(status_values($sort_buffer_size_min_rec_value, $sort_buffer_size), 'Sort buffer size ', 'Sort buffer size ');
- render_row(status_values($join_buffer_size_min_rec_value, $join_buffer_size), 'Join buffer size ', 'Join buffer size ');
- render_row(status_values($query_cache_type_min_rec_value, $query_cache_type), 'Query cache type ', 'Query cache type ');
- render_row(status_values($query_cache_size_min_rec_value, $query_cache_size), 'Query cache size ', 'Query cache size ');
- render_row(status_values($query_cache_limit_min_rec_value, $query_cache_limit), 'Query cache limit ', 'Query cache limit ');
- render_row(status_values($innodb_lock_wait_timeout_max_rec_value, $innodb_lock_wait_timeout), 'InnoDB lock wait timeout ', 'InnoDB lock wait timeout ');
- render_row(status_values($thread_cache_size_max_rec_value, $thread_cache_size), 'Thread cache size ', 'Thread cache size ');
- render_row(status_values($thread_stack_min_rec_value, $thread_stack), 'Thread stack ', 'Thread stack ');
- render_row(status_values($max_connections_max_rec_value, $max_connections), 'Maximum connections ', 'Maximun connections ');
- render_row(status_values($key_buffer_size_min_rec_value, $key_buffer_size), 'Key buffer size ', 'Key buffer size ');
- render_row(status_values($read_buffer_size_min_rec_value, $read_buffer_size), 'Read buffer size ', 'Read buffer size ');
- render_row(status_values($read_rnd_buffer_size_min_rec_value, $read_rnd_buffer_size), 'Read rnd-buffer size ', 'Read rnd-buffer size ');
- render_row(status_values($query_cache_min_res_unit_min_rec_value, $query_cache_min_res_unit), 'Query cache min-res-unit ', 'Query cache min-res-unit ');
- render_row(status_values($innodb_file_per_table_min_rec_value, $innodb_file_per_table), 'InnoDB file per table ', 'InnoDB file per table ');
- echo "".__('Tables fragmentation in the Pandora FMS database').' |
';
-
-
-
- render_row($tables_fragmentation_max_rec_value.'%', 'Tables fragmentation (maximum recommended value)');
- render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)');
- render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Table fragmentation status');
-
- echo "".__(' Pandora FMS logs dates').' |
';
-
- render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)');
- render_row(get_status_logs($path_server_logs), 'Status server logs');
- render_row(number_format((get_logs_size($path_err_logs) / 1048576), 3).'M', 'Size error logs (current value)');
- render_row(get_status_logs($path_err_logs), 'Status error logs');
- render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)');
- render_row(get_status_logs($path_console_logs), 'Status console logs');
-
- echo "".__(' Pandora FMS Licence Information').' |
';
-
- render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key');
- render_row($license['expiry_date'], $license['expiry_caption']);
- render_row($license['limit'].' agents', 'Platform Limit');
- render_row($license['count'].' agents', 'Current Platform Count');
- render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)');
- render_row($license['count_disabled'].' agents', 'Current Platform Count (disabled: items)');
- render_row($license['license_mode'], 'License Mode');
- render_row(status_license_params($license['nms']), 'Network Management System');
- render_row(status_license_params($license['dhpm']), 'Satellite');
- render_row($license['licensed_to'], 'Licensed to');
- render_row(license_capacity(), 'Status of agents capacity');
- render_row(percentage_modules_per_agent(), 'Status of average modules per agent');
- render_row(interval_average_of_network_modules(), 'Interval average of the network modules');
-
- echo "".__(' Status of the attachment folder').' |
';
-
- render_row($attachment_total_files, 'Total files in the attached folder');
- render_row(files_attachment_folder($attachment_total_files), 'Status of the attachment folder');
-
- echo "".__(' Information from the tagente_datos table').' |
';
-
- render_row($tagente_datos_size, 'Total data in tagente_datos table');
- render_row(status_tagente_datos($tagente_datos_size), 'Tangente_datos table status');
- render_row(execution_time(), 'Execution time degradation when executing a count');
-
- echo "".__(' Pandora FMS server threads').' |
';
-
- render_row($total_server_threads, 'Total server threads');
- render_row($percentage_threads_ram.'%', 'Percentage of threads used by the RAM');
- render_row($percentage_threads_cpu.'%', 'Percentage of threads used by the CPU');
-
- echo "".__(' Graphs modules that represent the self-monitoring system').' |
';
-
- $server_name = db_get_value_sql('SELECT name FROM tserver WHERE master = 1');
- $agent_id = db_get_value_sql("SELECT id_agente FROM tagente WHERE nombre = '$server_name'");
-
- $id_modules = agents_get_modules($agent_id);
-
- $id_modules = [
- modules_get_agentmodule_id('Agents_Unknown', $agent_id),
- modules_get_agentmodule_id('Database Maintenance', $agent_id),
- modules_get_agentmodule_id('FreeDisk_SpoolDir', $agent_id),
- modules_get_agentmodule_id('Free_RAM', $agent_id),
- modules_get_agentmodule_id('Queued_Modules', $agent_id),
- modules_get_agentmodule_id('Status', $agent_id),
- modules_get_agentmodule_id('System_Load_AVG', $agent_id),
- modules_get_agentmodule_id('Execution_time', $agent_id),
- ];
-
- foreach ($id_modules as $id_module) {
- $params = [
- 'agent_module_id' => $id_module['id_agente_modulo'],
- 'period' => SECONDS_1MONTH,
- 'date' => time(),
- 'height' => '150',
- ];
- render_row(grafico_modulo_sparse($params), 'Graph of the '.$id_module['nombre'].' module.');
- }
-
- if ($console_mode == 0) {
- echo '
';
- }
-
- echo "
";
-
- echo ''.__(
- '(*) Please check your Pandora Server setup and make sure that the database maintenance daemon is running. It\' is very important to
- keep the database up-to-date to get the best performance and results in Pandora'
- ).'
';
+// remove file.
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 1cf541d6e5..004611ca91 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
@@ -1654,7 +1654,12 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
-- Table `ttipo_modulo`
-- ---------------------------------------------------------------------
-INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
+INSERT INTO `ttipo_modulo` VALUES
+(25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'),
+(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
+(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
+(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
+(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
-- ---------------------------------------------------------------------
-- Table `tdashboard`
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php
index 99bb38cc21..e060cf96f6 100644
--- a/pandora_console/general/header.php
+++ b/pandora_console/general/header.php
@@ -328,9 +328,27 @@ if ($config['menu_type'] == 'classic') {
$header_autorefresh_counter .= $autorefresh_additional;
$header_autorefresh_counter .= '';
+ // Button for feedback pandora.
+ if (enterprise_installed()) {
+ $header_feedback = '';
+ }
+
// Support.
- if (defined('PANDORA_ENTERPRISE')) {
+ if (enterprise_installed()) {
$header_support_link = 'https://support.artica.es/';
} else {
$header_support_link = 'https://pandorafms.com/forums/';
@@ -388,9 +406,9 @@ if ($config['menu_type'] == 'classic') {
echo '
- ';
+ ';
?>
-
+
@@ -610,8 +628,46 @@ if ($config['menu_type'] == 'classic') {
});
var fixed_header = ;
-
+
var new_chat = ;
+
+ /**
+ * Loads modal from AJAX to add feedback.
+ */
+ function show_feedback() {
+
+ var btn_ok_text = '';
+ var btn_cancel_text = '';
+ var title = '';
+ var url = '';
+
+ load_modal({
+ target: $('#modal-feedback-form'),
+ form: 'modal_form_feedback',
+ url: '',
+ modal: {
+ title: title,
+ ok: btn_ok_text,
+ cancel: btn_cancel_text,
+ },
+ onshow: {
+ page: url,
+ method: 'formFeedback',
+ },
+ onsubmit: {
+ page: url,
+ method: 'createdScheduleFeedbackTask',
+ dataType: 'json',
+ },
+ ajax_callback: generalShowMsg,
+ idMsgCallback: 'msg-header',
+ });
+ }
+
$(document).ready (function () {
// Check new notifications on a periodic way
@@ -661,7 +717,15 @@ if ($config['menu_type'] == 'classic') {
$("#ui_close_dialog_titlebar").click(function () {
$("#agent_access").css("display","");
});
-
+
+ // Feedback.
+ $("#feedback-header").click(function () {
+ // Clean DOM.
+ $("#feedback-header").empty();
+ // Function charge Modal.
+ show_feedback();
+ });
+
function blinkpubli(){
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
}
diff --git a/pandora_console/general/help_feedback.php b/pandora_console/general/help_feedback.php
new file mode 100644
index 0000000000..1f702d6d36
--- /dev/null
+++ b/pandora_console/general/help_feedback.php
@@ -0,0 +1,77 @@
+ '[HelpFeedBack]'.$e->getMessage() ]);
+ exit;
+ } else {
+ echo '[HelpFeedBack]'.$e->getMessage();
+ }
+
+ // Stop this execution, but continue 'globally'.
+ return;
+}
+
+// Ajax controller.
+if (is_ajax()) {
+ $method = get_parameter('method', '');
+
+ if (method_exists($helpfeedback, $method) === true) {
+ if ($helpfeedback->ajaxMethod($method) === true) {
+ $helpfeedback->{$method}();
+ } else {
+ $helpfeedback->error('Unavailable method.');
+ }
+ } else {
+ $helpfeedback->error('Method not found. ['.$method.']');
+ }
+
+
+ // Stop any execution.
+ exit;
+} else {
+ // Run.
+ $helpfeedback->run();
+}
diff --git a/pandora_console/general/subselect_data_module.php b/pandora_console/general/subselect_data_module.php
index 416897ea15..fca56c692c 100644
--- a/pandora_console/general/subselect_data_module.php
+++ b/pandora_console/general/subselect_data_module.php
@@ -13,7 +13,8 @@ switch ($_GET['module']) {
$sql = sprintf(
'SELECT id_tipo, descripcion
FROM ttipo_modulo
- WHERE categoria between 3 and 5 '
+ WHERE categoria between 3 and 5
+ OR categoria = 10 '
);
break;
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 55116f940a..664b173748 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -1330,7 +1330,7 @@ if ($update_module || $create_module) {
// Change double quotes by single.
$snmp_oid = preg_replace('/"/', ''', $snmp_oid);
- if (empty($snmp_oid)) {
+ if (empty($snmp_oid) === true) {
// The user did not set any OID manually but did a SNMP walk.
$snmp_oid = (string) get_parameter('select_snmp_oid');
}
@@ -1339,18 +1339,30 @@ if ($update_module || $create_module) {
// New support for snmp v3.
$tcp_send = (string) get_parameter('snmp_version');
$plugin_user = (string) get_parameter('snmp3_auth_user');
- $plugin_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
+ $plugin_pass = io_input_password(
+ (string) get_parameter('snmp3_auth_pass')
+ );
$plugin_parameter = (string) get_parameter('snmp3_auth_method');
$custom_string_1 = (string) get_parameter('snmp3_privacy_method');
- $custom_string_2 = io_input_password((string) get_parameter('snmp3_privacy_pass'));
+ $custom_string_2 = io_input_password(
+ (string) get_parameter('snmp3_privacy_pass')
+ );
$custom_string_3 = (string) get_parameter('snmp3_security_level');
+ } else if ($id_module_type >= 34 && $id_module_type <= 37) {
+ $tcp_send = (string) get_parameter('command_text');
+ $custom_string_1 = (string) get_parameter(
+ 'command_credential_identifier'
+ );
+ $custom_string_2 = (string) get_parameter('command_os');
} else {
$plugin_user = (string) get_parameter('plugin_user');
if (get_parameter('id_module_component_type') == 7) {
$plugin_pass = (int) get_parameter('plugin_pass');
} else {
- $plugin_pass = io_input_password((string) get_parameter('plugin_pass'));
+ $plugin_pass = io_input_password(
+ (string) get_parameter('plugin_pass')
+ );
}
$plugin_parameter = (string) get_parameter('plugin_parameter');
diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php
index 13c313892a..874fe3a9d1 100644
--- a/pandora_console/godmode/agentes/module_manager_editor.php
+++ b/pandora_console/godmode/agentes/module_manager_editor.php
@@ -1,16 +1,32 @@
= 15
+ && $component['type'] <= 18
+ ) {
+ // New support for snmp v3.
+ $component['snmp_version'] = $component['tcp_send'];
+ $component['snmp3_auth_user'] = io_safe_output(
+ $component['plugin_user']
+ );
+ // Must use io_output_password.
+ $component['snmp3_auth_pass'] = io_safe_output(
+ $component['plugin_pass']
+ );
+ $component['snmp3_auth_method'] = io_safe_output(
+ $component['plugin_parameter']
+ );
+ $component['snmp3_privacy_method'] = io_safe_output(
+ $component['custom_string_1']
+ );
+ $component['snmp3_privacy_pass'] = io_safe_output(
+ $component['custom_string_2']
+ );
+ $component['snmp3_security_level'] = io_safe_output(
+ $component['custom_string_3']
+ );
+ } else if ($component['type'] >= 34
+ && $component['type'] <= 37
+ ) {
+ $component['command_text'] = io_safe_output(
+ $component['tcp_send']
+ );
+ $component['command_credential_identifier'] = io_safe_output(
+ $component['custom_string_1']
+ );
+ $component['command_os'] = io_safe_output(
+ $component['custom_string_2']
+ );
+ }
$component['str_warning'] = io_safe_output($component['str_warning']);
$component['str_critical'] = io_safe_output($component['str_critical']);
@@ -83,33 +146,29 @@ if (is_ajax()) {
$component = db_get_row('tlocal_component', 'id', $id_component);
foreach ($component as $index => $element) {
- $component[$index] = html_entity_decode($element, ENT_QUOTES, 'UTF-8');
+ $component[$index] = html_entity_decode(
+ $element,
+ ENT_QUOTES,
+ 'UTF-8'
+ );
}
- $typeName = local_components_parse_module_extract_value('module_type', $component['data']);
+ $typeName = local_components_parse_module_extract_value(
+ 'module_type',
+ $component['data']
+ );
- switch ($config['dbtype']) {
- case 'mysql':
- $component['type'] = db_get_value_sql(
- '
- SELECT id_tipo
- FROM ttipo_modulo
- WHERE nombre LIKE "'.$typeName.'"'
- );
- break;
+ $component['type'] = db_get_value_sql(
+ '
+ SELECT id_tipo
+ FROM ttipo_modulo
+ WHERE nombre LIKE "'.$typeName.'"'
+ );
- case 'postgresql':
- case 'oracle':
- $component['type'] = db_get_value_sql(
- '
- SELECT id_tipo
- FROM ttipo_modulo
- WHERE nombre LIKE \''.$typeName.'\''
- );
- break;
- }
-
- $component['throw_unknown_events'] = !local_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
+ $component['throw_unknown_events'] = !local_components_is_disable_type_event(
+ $id_component,
+ EVENTS_GOING_UNKNOWN
+ );
echo io_json_mb_encode($component);
return;
@@ -136,7 +195,9 @@ if (is_ajax()) {
$snmp3_auth_method = get_parameter('snmp3_auth_method');
$snmp3_auth_pass = io_safe_output(get_parameter('snmp3_auth_pass'));
$snmp3_privacy_method = get_parameter('snmp3_privacy_method');
- $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
+ $snmp3_privacy_pass = io_safe_output(
+ get_parameter('snmp3_privacy_pass')
+ );
$snmp_port = get_parameter('snmp_port');
$snmpwalk = get_snmpwalk(
@@ -177,7 +238,7 @@ require_once 'include/functions_exportserver.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php';
-// Reading a module
+// Reading a module.
if ($id_agent_module) {
$module = modules_get_agentmodule($id_agent_module);
$moduletype = $module['id_modulo'];
@@ -202,19 +263,25 @@ if ($id_agent_module) {
$snmp_community = $module['snmp_community'];
$snmp_oid = $module['snmp_oid'];
- // New support for snmp v3
+ // New support for snmp v3.
$snmp_version = $module['tcp_send'];
$snmp3_auth_user = $module['plugin_user'];
$snmp3_auth_pass = io_output_password($module['plugin_pass']);
- // Auth method could be MD5 or SHA
+ // Auth method could be MD5 or SHA.
$snmp3_auth_method = $module['plugin_parameter'];
- // Privacy method could be DES or AES
+ // Privacy method could be DES or AES.
$snmp3_privacy_method = $module['custom_string_1'];
$snmp3_privacy_pass = io_output_password($module['custom_string_2']);
- // Security level Could be noAuthNoPriv | authNoPriv | authPriv
+ // For Remote cmd fields are reused:
+ // tcp_send, custom_string_1, custom_string_2.
+ $command_text = $module['tcp_send'];
+ $command_credential_identifier = $module['custom_string_1'];
+ $command_os = $module['custom_string_2'];
+
+ // Security level Could be noAuthNoPriv | authNoPriv | authPriv.
$snmp3_security_level = $module['custom_string_3'];
$ip_target = $module['ip_target'];
@@ -265,39 +332,39 @@ if ($id_agent_module) {
$id_category = $module['id_category'];
$cron_interval = explode(' ', $module['cron_interval']);
- if (isset($cron_interval[4])) {
+ if (isset($cron_interval[4]) === true) {
$minute_from = $cron_interval[0];
$minute = explode('-', $minute_from);
$minute_from = $minute[0];
- if (isset($minute[1])) {
+ if (isset($minute[1]) === true) {
$minute_to = $minute[1];
}
$hour_from = $cron_interval[1];
$h = explode('-', $hour_from);
$hour_from = $h[0];
- if (isset($h[1])) {
+ if (isset($h[1]) === true) {
$hour_to = $h[1];
}
$mday_from = $cron_interval[2];
$md = explode('-', $mday_from);
$mday_from = $md[0];
- if (isset($md[1])) {
+ if (isset($md[1]) === true) {
$mday_to = $md[1];
}
$month_from = $cron_interval[3];
$m = explode('-', $month_from);
$month_from = $m[0];
- if (isset($m[1])) {
+ if (isset($m[1]) === true) {
$month_to = $m[1];
}
$wday_from = $cron_interval[4];
$wd = explode('-', $wday_from);
$wday_from = $wd[0];
- if (isset($wd[1])) {
+ if (isset($wd[1]) === true) {
$wday_to = $wd[1];
}
} else {
@@ -315,14 +382,17 @@ if ($id_agent_module) {
}
$module_macros = null;
- if (isset($module['module_macros'])) {
- $module_macros = json_decode(base64_decode($module['module_macros']), true);
+ if (isset($module['module_macros']) === true) {
+ $module_macros = json_decode(
+ base64_decode($module['module_macros']),
+ true
+ );
}
} else {
- if (!isset($moduletype)) {
+ if (isset($moduletype) === false) {
$moduletype = (string) get_parameter('moduletype');
- // Clean up specific network modules fields
+ // Clean up specific network modules fields.
$name = '';
$description = '';
$id_module_group = 1;
@@ -374,7 +444,7 @@ if ($id_agent_module) {
$str_critical = '';
$ff_event = 0;
- // New support for snmp v3
+ // New support for snmp v3.
$snmp_version = 1;
$snmp3_auth_user = '';
$snmp3_auth_pass = '';
@@ -383,6 +453,11 @@ if ($id_agent_module) {
$snmp3_privacy_pass = '';
$snmp3_security_level = '';
+ // For Remote CMD.
+ $command_text = '';
+ $command_credential_identifier = '';
+ $command_os = '';
+
$critical_instructions = '';
$warning_instructions = '';
$unknown_instructions = '';
@@ -418,7 +493,9 @@ if ($id_agent_module) {
}
}
-$is_function_policies = enterprise_include_once('include/functions_policies.php');
+$is_function_policies = enterprise_include_once(
+ 'include/functions_policies.php'
+);
if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
$relink_policy = get_parameter('relink_policy', 0);
@@ -428,19 +505,32 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
$policy_info = policies_info_module_policy($id_agent_module);
$policy_id = $policy_info['id_policy'];
- if ($relink_policy && policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING) {
- ui_print_error_message(__('This policy is applying and cannot be modified'));
+ if ($relink_policy
+ && policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING
+ ) {
+ ui_print_error_message(
+ __('This policy is applying and cannot be modified')
+ );
} else {
$result = policies_relink_module($id_agent_module);
- ui_print_result_message($result, __('Module will be linked in the next application'));
+ ui_print_result_message(
+ $result,
+ __('Module will be linked in the next application')
+ );
- db_pandora_audit('Agent management', 'Re-link module '.$id_agent_module);
+ db_pandora_audit(
+ 'Agent management',
+ 'Re-link module '.$id_agent_module
+ );
}
}
if ($unlink_policy) {
$result = policies_unlink_module($id_agent_module);
- ui_print_result_message($result, __('Module will be unlinked in the next application'));
+ ui_print_result_message(
+ $result,
+ __('Module will be unlinked in the next application')
+ );
db_pandora_audit('Agent management', 'Unlink module '.$id_agent_module);
}
@@ -452,7 +542,7 @@ $remote_conf = false;
if ($__code_from !== 'policies') {
// Only check in the module editor.
- // Check ACL tags
+ // Check ACL tags.
$tag_acl = true;
// If edit a existing module.
@@ -479,12 +569,12 @@ switch ($moduletype) {
$remote_conf = false;
if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php');
- $remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$id_agente]);
+ $remote_conf = enterprise_hook(
+ 'config_agents_has_remote_configuration',
+ [$id_agente]
+ );
}
- /*
- Categories is an array containing the allowed module types
- (generic_data, generic_string, etc) from ttipo_modulo (field categoria) */
$categories = [
0,
1,
@@ -503,12 +593,16 @@ switch ($moduletype) {
'config_agents_get_module_from_conf',
[
$id_agente,
- io_safe_output(modules_get_agentmodule_name($id_agent_module)),
+ io_safe_output(
+ modules_get_agentmodule_name($id_agent_module)
+ ),
]
);
}
- enterprise_include('godmode/agentes/module_manager_editor_data.php');
+ enterprise_include(
+ 'godmode/agentes/module_manager_editor_data.php'
+ );
}
break;
@@ -520,6 +614,10 @@ switch ($moduletype) {
4,
5,
];
+ if (enterprise_installed()) {
+ $categories[] = 10;
+ }
+
include 'module_manager_editor_common.php';
include 'module_manager_editor_network.php';
break;
@@ -562,9 +660,12 @@ switch ($moduletype) {
include 'module_manager_editor_wmi.php';
break;
- // WARNING: type 7 is reserved on enterprise
+ // WARNING: type 7 is reserved on enterprise.
default:
- if (enterprise_include('godmode/agentes/module_manager_editor.php') === ENTERPRISE_NOT_HOOK) {
+ if (enterprise_include(
+ 'godmode/agentes/module_manager_editor.php'
+ ) === ENTERPRISE_NOT_HOOK
+ ) {
ui_print_error_message(sprintf(__('Invalid module type')));
return;
}
@@ -580,7 +681,7 @@ if ($config['enterprise_installed'] && $id_agent_module) {
echo '';
-// TODO: Change to the ui_print_error system
+// TODO: Change to the ui_print_error system.
echo '