resolved conflict merge

This commit is contained in:
marcos 2021-03-30 11:31:29 +02:00
commit 063bbb4433
207 changed files with 4968 additions and 1501 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, AIX version # Version 7.0NG.753, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, FreeBSD Version # Version 7.0NG.753, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, HP-UX Version # Version 7.0NG.753, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, GNU/Linux # Version 7.0NG.753, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, GNU/Linux # Version 7.0NG.753, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, Solaris Version # Version 7.0NG.753, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.752 # Version 7.0NG.753
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.752, AIX version # Version 7.0NG.753, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.752 # Version 7.0NG.753
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.752, HPUX Version # Version 7.0NG.753, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752 # Version 7.0NG.753
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas # (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752 # Version 7.0NG.753
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas # (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752 # Version 7.0NG.753
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.752, Solaris version # Version 7.0NG.753, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, AIX version # Version 7.0NG.753, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.752-210318 Version: 7.0NG.753-210330
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.752-210318" pandora_version="7.0NG.753-210330"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -24,7 +24,7 @@ fi
if [ "$#" -ge 2 ]; then if [ "$#" -ge 2 ]; then
VERSION="$2" VERSION="$2"
else else
VERSION="7.0NG.752" VERSION="7.0NG.753"
fi fi
# Path for the generated DMG file # Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false"> <choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/> <pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.752" onConclusion="none">pandorafms_src.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.753" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications"> <choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/> <pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.752" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.753" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" /> <!-- <installation-check script="check()" />
<script> <script>
<![CDATA[ <![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string> <key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.752</string> <key>CFBundleVersion</key> <string>7.0NG.753</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.752 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.753 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.752</string> <key>CFBundleShortVersionString</key> <string>7.0NG.753</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string> <key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, GNU/Linux # Version 7.0NG.753, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, FreeBSD Version # Version 7.0NG.753, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, HP-UX Version # Version 7.0NG.753, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, GNU/Linux # Version 7.0NG.753, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, GNU/Linux # Version 7.0NG.753, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, NetBSD Version # Version 7.0NG.753, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.752, Solaris Version # Version 7.0NG.753, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas # Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1015,8 +1015,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752'; use constant AGENT_VERSION => '7.0NG.753';
use constant AGENT_BUILD => '210318'; use constant AGENT_BUILD => '210330';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.752 %define version 7.0NG.753
%define release 210318 %define release 210330
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.752 %define version 7.0NG.753
%define release 210318 %define release 210330
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.752" PI_VERSION="7.0NG.753"
PI_BUILD="210318" PI_BUILD="210330"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas # (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.752 # Version 7.0NG.753
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.752} {Pandora FMS Windows Agent v7.0NG.753}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{210318} {210330}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.752(Build 210318)") #define PANDORA_VERSION ("7.0NG.753(Build 210330)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.752(Build 210318))" VALUE "ProductVersion", "(7.0NG.753(Build 210330))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.752-210318 Version: 7.0NG.753-210330
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.752-210318" pandora_version="7.0NG.753-210330"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -64,6 +64,16 @@ if (isset($config['console_log_enabled']) === true
ini_set('error_log', 0); ini_set('error_log', 0);
} }
// Sometimes input is badly retrieved from caller...
if (empty($_REQUEST) === true) {
$data = explode('&', urldecode(file_get_contents('php://input')));
foreach ($data as $d) {
$r = explode('=', $d, 2);
$_POST[$r[0]] = $r[1];
$_GET[$r[0]] = $r[1];
}
}
// Hash login process. // Hash login process.
if (isset($_GET['loginhash']) === true) { if (isset($_GET['loginhash']) === true) {
$loginhash_data = get_parameter('loginhash_data', ''); $loginhash_data = get_parameter('loginhash_data', '');

View File

@ -686,7 +686,7 @@ function mainAgentsModules()
echo '<tr>'; echo '<tr>';
echo "<th width='140px' class='right pdd_r_10px'>".__('Agents').' / '.__('Modules').'</th>'; echo "<th width='140px' class='pdd_r_10px lign_right'>".__('Agents').' / '.__('Modules').'</th>';
if ($hor_offset > 0) { if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block); $new_hor_offset = ($hor_offset - $block);

View File

@ -74,3 +74,7 @@ enterprise/extensions/ipam
enterprise/extensions/disabled/visual_console_manager.php enterprise/extensions/disabled/visual_console_manager.php
enterprise/extensions/visual_console_manager.php enterprise/extensions/visual_console_manager.php
pandora_console/extensions/net_tools.php pandora_console/extensions/net_tools.php
include/lib/WSManager.php
include/lib/WebSocketServer.php
include/lib/WebSocketUser.php
operation/network/network_explorer.php

View File

@ -11,4 +11,10 @@ UPDATE `tinventory_alert` t1 INNER JOIN `tinventory_alert` t2 ON t1.id = t2.id S
ALTER TABLE `tnotification_source` ADD COLUMN `subtype_blacklist` TEXT; ALTER TABLE `tnotification_source` ADD COLUMN `subtype_blacklist` TEXT;
SET @plugin_name = 'Network&#x20;bandwidth&#x20;SNMP';
SET @plugin_description = 'Retrieves&#x20;amount&#x20;of&#x20;digital&#x20;information&#x20;sent&#x20;and&#x20;received&#x20;from&#x20;device&#x20;or&#x20;filtered&#x20;&#x20;interface&#x20;index&#x20;over&#x20;a&#x20;particular&#x20;time&#x20;&#40;agent/module&#x20;interval&#41;.';
SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,300,0,'perl&#x20;/usr/share/pandora_server/util/plugin/pandora_snmp_bandwidth.pl','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"SNMP&#x20;Version&#40;1,2c,3&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Interface&#x20;Index&#x20;&#40;filter&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"securityName\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"context\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"securityLevel\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"authProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"authKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"privProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"privKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"13\":{\"macro\":\"_field13_\",\"desc\":\"UniqId\",\"help\":\"This&#x20;plugin&#x20;needs&#x20;to&#x20;store&#x20;information&#x20;in&#x20;temporary&#x20;directory&#x20;to&#x20;calculate&#x20;bandwidth.&#x20;Set&#x20;here&#x20;an&#x20;unique&#x20;identifier&#x20;with&#x20;no&#x20;spaces&#x20;or&#x20;symbols.\",\"value\":\"\",\"hide\":\"\"},\"14\":{\"macro\":\"_field14_\",\"desc\":\"inUsage\",\"help\":\"Retrieve&#x20;input&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"},\"15\":{\"macro\":\"_field15_\",\"desc\":\"outUsage\",\"help\":\"Retrieve&#x20;output&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"}}','-version&#x20;&#039;_field1_&#039;&#x20;-community&#x20;&#039;_field2_&#039;&#x20;-host&#x20;&#039;_field3_&#039;&#x20;-port&#x20;&#039;_field4_&#039;&#x20;-ifIndex&#x20;&#039;_field5_&#039;&#x20;-securityName&#x20;&#039;_field6_&#039;&#x20;-context&#x20;&#039;_field7_&#039;&#x20;-securityLevel&#x20;&#039;_field8_&#039;&#x20;-authProtocol&#x20;&#039;_field9_&#039;&#x20;-authKey&#x20;&#039;_field10_&#039;&#x20;-privProtocol&#x20;&#039;_field11_&#039;&#x20;-privKey&#x20;&#039;_field12_&#039;&#x20;-uniqid&#x20;&#039;_field13_&#039;&#x20;-inUsage&#x20;&#039;_field14_&#039;&#x20;-outUsage&#x20;&#039;_field15_&#039;');
COMMIT; COMMIT;

View File

@ -2880,6 +2880,12 @@ SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace&#x20;&#40;Optional&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI&#x20;Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields&#x20;list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query&#x20;filter&#x20;&#40;Optional&#41;\",\"help\":\"Use&#x20;single&#x20;quotes&#x20;for&#x20;query&#x20;conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic&#x20;operation&#x20;to&#x20;get&#x20;data.&#x20;Macros&#x20;_fN_&#x20;will&#x20;be&#x20;changed&#x20;by&#x20;fields&#x20;in&#x20;list.&#x20;Example:&#x20;&#40;&#40;_f1_&#x20;-&#x20;_f2_&#41;&#x20;*&#x20;100&#41;&#x20;/&#x20;_f1_\",\"value\":\"\",\"hide\":\"\"}}','-host&#x20;&#039;_field1_&#039;&#x20;-namespace&#x20;&#039;_field2_&#039;&#x20;-user&#x20;&#039;_field3_&#039;&#x20;-pass&#x20;&#039;_field4_&#039;&#x20;-wmiClass&#x20;&#039;_field5_&#039;&#x20;-fieldsList&#x20;&#039;_field6_&#039;&#x20;-queryFilter&#x20;&quot;_field7_&quot;&#x20;-operation&#x20;&#039;_field8_&#039;&#x20;-wmicPath&#x20;/usr/bin/wmic'); INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace&#x20;&#40;Optional&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI&#x20;Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields&#x20;list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query&#x20;filter&#x20;&#40;Optional&#41;\",\"help\":\"Use&#x20;single&#x20;quotes&#x20;for&#x20;query&#x20;conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic&#x20;operation&#x20;to&#x20;get&#x20;data.&#x20;Macros&#x20;_fN_&#x20;will&#x20;be&#x20;changed&#x20;by&#x20;fields&#x20;in&#x20;list.&#x20;Example:&#x20;&#40;&#40;_f1_&#x20;-&#x20;_f2_&#41;&#x20;*&#x20;100&#41;&#x20;/&#x20;_f1_\",\"value\":\"\",\"hide\":\"\"}}','-host&#x20;&#039;_field1_&#039;&#x20;-namespace&#x20;&#039;_field2_&#039;&#x20;-user&#x20;&#039;_field3_&#039;&#x20;-pass&#x20;&#039;_field4_&#039;&#x20;-wmiClass&#x20;&#039;_field5_&#039;&#x20;-fieldsList&#x20;&#039;_field6_&#039;&#x20;-queryFilter&#x20;&quot;_field7_&quot;&#x20;-operation&#x20;&#039;_field8_&#039;&#x20;-wmicPath&#x20;/usr/bin/wmic');
SET @plugin_name = 'Network&#x20;bandwidth&#x20;SNMP';
SET @plugin_description = 'Retrieves&#x20;amount&#x20;of&#x20;digital&#x20;information&#x20;sent&#x20;and&#x20;received&#x20;from&#x20;device&#x20;or&#x20;filtered&#x20;&#x20;interface&#x20;index&#x20;over&#x20;a&#x20;particular&#x20;time&#x20;&#40;agent/module&#x20;interval&#41;.';
SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,300,0,'perl&#x20;/usr/share/pandora_server/util/plugin/pandora_snmp_bandwidth.pl','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"SNMP&#x20;Version&#40;1,2c,3&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Interface&#x20;Index&#x20;&#40;filter&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"securityName\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"context\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"securityLevel\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"authProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"authKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"privProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"privKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"13\":{\"macro\":\"_field13_\",\"desc\":\"UniqId\",\"help\":\"This&#x20;plugin&#x20;needs&#x20;to&#x20;store&#x20;information&#x20;in&#x20;temporary&#x20;directory&#x20;to&#x20;calculate&#x20;bandwidth.&#x20;Set&#x20;here&#x20;an&#x20;unique&#x20;identifier&#x20;with&#x20;no&#x20;spaces&#x20;or&#x20;symbols.\",\"value\":\"\",\"hide\":\"\"},\"14\":{\"macro\":\"_field14_\",\"desc\":\"inUsage\",\"help\":\"Retrieve&#x20;input&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"},\"15\":{\"macro\":\"_field15_\",\"desc\":\"outUsage\",\"help\":\"Retrieve&#x20;output&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"}}','-version&#x20;&#039;_field1_&#039;&#x20;-community&#x20;&#039;_field2_&#039;&#x20;-host&#x20;&#039;_field3_&#039;&#x20;-port&#x20;&#039;_field4_&#039;&#x20;-ifIndex&#x20;&#039;_field5_&#039;&#x20;-securityName&#x20;&#039;_field6_&#039;&#x20;-context&#x20;&#039;_field7_&#039;&#x20;-securityLevel&#x20;&#039;_field8_&#039;&#x20;-authProtocol&#x20;&#039;_field9_&#039;&#x20;-authKey&#x20;&#039;_field10_&#039;&#x20;-privProtocol&#x20;&#039;_field11_&#039;&#x20;-privKey&#x20;&#039;_field12_&#039;&#x20;-uniqid&#x20;&#039;_field13_&#039;&#x20;-inUsage&#x20;&#039;_field14_&#039;&#x20;-outUsage&#x20;&#039;_field15_&#039;');
SET @main_component_group_name = 'Wizard'; SET @main_component_group_name = 'Wizard';
SET @component_id = ''; SET @component_id = '';
SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name; SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name;

View File

@ -902,7 +902,9 @@ if ($config['menu_type'] == 'classic') {
blinkpubli(); blinkpubli();
<?php <?php
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr']
|| (isset($do_refresh) === true && $do_refresh === true)
) {
if ($_GET['sec2'] == 'operation/events/events') { if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true; $autorefresh_draw = true;
} }
@ -966,7 +968,7 @@ if ($config['menu_type'] == 'classic') {
var newValue = btoa(JSON.stringify(values)); var newValue = btoa(JSON.stringify(values));
<?php <?php
// Check if the url has the parameter fb64. // Check if the url has the parameter fb64.
if ($_GET['fb64']) { if (isset($_GET['fb64']) === true) {
$fb64 = $_GET['fb64']; $fb64 = $_GET['fb64'];
?> ?>
var fb64 = '<?php echo $fb64; ?>'; var fb64 = '<?php echo $fb64; ?>';

View File

@ -188,7 +188,12 @@ try {
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
if (!$double_auth_enabled && $config['2FA_all_users'] != '' if (isset($config['2FA_all_users']) === false) {
$config['2FA_all_users'] = null;
}
if (!$double_auth_enabled
&& $config['2FA_all_users'] != ''
&& $config['2Fa_auth'] != '1' && $config['2Fa_auth'] != '1'
&& $config['double_auth_enabled'] && $config['double_auth_enabled']
) { ) {

View File

@ -27,8 +27,6 @@ if (! check_acl($config['id_user'], 0, 'AR')
return; return;
} }
$update = get_parameter('upd_button', ''); $update = get_parameter('upd_button', '');
$default = (int) get_parameter('default', 0); $default = (int) get_parameter('default', 0);
@ -49,7 +47,7 @@ if ($default != 0) {
'value' => $status_monitor_fields, 'value' => $status_monitor_fields,
]; ];
// update 'status_monitor_fields' in tconfig table to keep the value at update. // Update 'status_monitor_fields' in tconfig table to keep the value at update.
$result = db_process_sql_update( $result = db_process_sql_update(
'tconfig', 'tconfig',
$values, $values,
@ -67,7 +65,7 @@ $fields_selected = explode(',', $config['status_monitor_fields']);
$result_selected = []; $result_selected = [];
// show list of fields selected. // Show list of fields selected.
if ($fields_selected[0] != '') { if ($fields_selected[0] != '') {
foreach ($fields_selected as $field_selected) { foreach ($fields_selected as $field_selected) {
switch ($field_selected) { switch ($field_selected) {
@ -239,7 +237,7 @@ $(document).ready (function () {
if(selected_fields_total === current_fields_size){ if(selected_fields_total === current_fields_size){
display_confirm_dialog( display_confirm_dialog(
"<?php echo '<span class="transform_none">'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>", "<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
"<?php echo __('Confirm'); ?>", "<?php echo __('Confirm'); ?>",
"<?php echo __('Cancel'); ?>", "<?php echo __('Cancel'); ?>",
function () { function () {

View File

@ -175,7 +175,7 @@ if (!empty($result)) {
} }
// Form to add new categories or search categories // Form to add new categories or search categories
echo "<div class='w100p right'>"; echo "<div class='w100p right_align'>";
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">'; echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
} else { } else {

View File

@ -201,7 +201,7 @@ if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
echo '<div class="w100p right">'; echo '<div class="w100p right_align">';
} else { } else {
echo '<div class="w100p right">'; echo '<div class="w100p right">';
} }
@ -213,7 +213,7 @@ if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">';
html_print_table($table); html_print_table($table);
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
echo '<div class="w100p right">'; echo '<div class="w100p right_align">';
} else { } else {
echo '<div class="w100p right">'; echo '<div class="w100p right">';
} }

View File

@ -86,7 +86,7 @@ foreach ($event_responses as $response) {
html_print_table($table); html_print_table($table);
echo '<div class="w100p right">'; echo '<div class="w100p right_align">';
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">';
html_print_submit_button( html_print_submit_button(
__('Create response'), __('Create response'),

View File

@ -536,7 +536,7 @@ $table->valign[1] = 'top';
$table->data = []; $table->data = [];
$table->data[0][0] = '<h4>'.__('List of layers').'</h4>'; $table->data[0][0] = '<h4>'.__('List of layers').'</h4>';
$table->data[0][1] = '<divclass="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add"', true).'</div>'; $table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>';
$table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>'; $table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>';
$table->data[1][1] = '<div id="form_layer" class="invisible"> $table->data[1][1] = '<div id="form_layer" class="invisible">
@ -972,15 +972,7 @@ function getAgentRow (layerId, agentId, agentAlias) {
var $deleteCol = $("<td />"); var $deleteCol = $("<td />");
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>"); var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>");
var $removeBtn = $('<a class="delete_row" href="javascript:;"> var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?> </a>');
<?php
echo html_print_image(
'images/cross.png',
true,
['class' => 'invert_filter']
);
?>
</a>');
$removeBtn.click(function (event) { $removeBtn.click(function (event) {
var $layerRow = $("tr#layer_row_" + layerId); var $layerRow = $("tr#layer_row_" + layerId);

View File

@ -279,7 +279,7 @@ if (isset($data)) {
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_table($table); html_print_table($table);
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo "<div class='pdd_l_10px float-right'>"; echo "<div class='pdd_l_10px float-right mrgn_btn_15px'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>'; echo '</div>';
} }

View File

@ -900,7 +900,7 @@ if (isset($data)) {
true, true,
'pagination-bottom' 'pagination-bottom'
); );
echo "<div id='btn_delete_5'>"; echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button( html_print_submit_button(
__('Delete'), __('Delete'),
'delete_btn', 'delete_btn',
@ -918,8 +918,8 @@ if (isset($data)) {
); );
} }
echo '<form method="post" action="'.$url.'" class="float-right">'; echo '<form method="post" action="'.$url.'">';
echo '<div class="right">'; echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1); html_print_input_hidden('new_component', 1);
html_print_select( html_print_select(
[ [

View File

@ -132,7 +132,7 @@ if ($edit_container) {
$id_parent = get_parameter('id_parent', 0); $id_parent = get_parameter('id_parent', 0);
$description = io_safe_input(get_parameter('description', '')); $description = io_safe_input(get_parameter('description', ''));
$id_group = get_parameter('container_id_group', 0); $id_group = get_parameter('container_id_group', 0);
} else { } else if ((bool) $id_container !== false) {
$tcontainer = db_get_row_sql('SELECT * FROM tcontainer WHERE id_container = '.$id_container); $tcontainer = db_get_row_sql('SELECT * FROM tcontainer WHERE id_container = '.$id_container);
$name = $tcontainer['name']; $name = $tcontainer['name'];
$id_parent = $tcontainer['parent']; $id_parent = $tcontainer['parent'];
@ -142,6 +142,7 @@ if ($edit_container) {
} }
if ($add_container) { if ($add_container) {
if ((bool) $name !== false) {
$values = [ $values = [
'name' => $name, 'name' => $name,
'description' => $description, 'description' => $description,
@ -149,6 +150,13 @@ if ($add_container) {
'id_group' => $id_group, 'id_group' => $id_group,
]; ];
$id_container = db_process_sql_insert('tcontainer', $values); $id_container = db_process_sql_insert('tcontainer', $values);
} else {
$error = ui_print_error_message(
__('Container name is missing.'),
'',
true
);
}
} }
if ($update_container) { if ($update_container) {
@ -195,6 +203,9 @@ ui_print_page_header(
if ($add_container) { if ($add_container) {
ui_print_result_message($id_container, __('Container stored successfully'), __('There was a problem storing container')); ui_print_result_message($id_container, __('Container stored successfully'), __('There was a problem storing container'));
if (empty($error) === false) {
echo $error;
}
} }
if ($update_container) { if ($update_container) {
@ -214,6 +225,8 @@ if ($id_container === '1') {
echo "<td class='datos w30p'><input type='text' name='name' size='30' disabled='1'"; echo "<td class='datos w30p'><input type='text' name='name' size='30' disabled='1'";
} else { } else {
echo "<td class='datos w30p'><input type='text' name='name' size='30' "; echo "<td class='datos w30p'><input type='text' name='name' size='30' ";
// Using latest style...
echo ' required ';
} }
if ($edit_container) { if ($edit_container) {
@ -230,21 +243,31 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
echo "<td class='w10p'><b>".__('Group').'</b></td><td>'; echo "<td class='w10p'><b>".__('Group').'</b></td><td>';
echo '<div class="w250px">'; echo '<div class="w250px">';
if ($id_container === '1') { echo html_print_input(
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', true); [
} else { 'type' => 'select_groups',
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', false); 'id_user' => $config['id_user'],
} 'privilege' => 'RW',
'returnAllGroup' => $return_all_groups,
'name' => 'container_id_group',
'selected' => $id_group,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => false,
'required' => true,
'disabled' => ($id_container === '1'),
]
);
echo '</div>'; echo '</div>';
echo '</td></tr>'; echo '</td></tr>';
echo '<tr>'; echo '<tr>';
echo "<td class='datos2'><b>".__('Description').'</b></td>'; echo "<td class='datos2'><b>".__('Description').'</b></td>';
if ($id_container === '1') { if ($id_container === '1') {
echo "<td class='datos2' colspan=3><textarea name='description' class='height_45px' cols=95 rows=2 disabled>"; echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2 disabled>";
} else { } else {
echo "<td class='datos2' colspan=3><textarea name='description' class='height_45px' cols=95 rows=2>"; echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2>";
} }
if ($edit_container) { if ($edit_container) {
@ -400,8 +423,8 @@ if ($edit_container) {
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= '</tr>'; $single_table .= '</tr>';
$single_table .= "<tr id='row_type_graphs' class='datos'>"; $single_table .= "<tr id='row_type_graphs' style='' class='datos'>";
$single_table .= "<td class='bolder'>"; $single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Type of graph'); $single_table .= __('Type of graph');
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= '<td>'; $single_table .= '<td>';
@ -409,8 +432,8 @@ if ($edit_container) {
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= '</tr>'; $single_table .= '</tr>';
$single_table .= "<tr id='row_fullscale' class='datos'>"; $single_table .= "<tr id='row_fullscale' style='' class='datos'>";
$single_table .= "<td class='bolder'>"; $single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); $single_table .= __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true);
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= '<td>'; $single_table .= '<td>';
@ -421,8 +444,8 @@ if ($edit_container) {
$single_table .= '<tr>'; $single_table .= '<tr>';
$single_table .= '<td >'; $single_table .= '<td >';
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= "<td class='right'>"; $single_table .= "<td style='float:right;'>";
$single_table .= "<input type=submit name='add_single' class='sub add right' value='".__('Add item')."'>"; $single_table .= "<input style='float:right;' type=submit name='add_single' class='sub add' value='".__('Add item')."'>";
$single_table .= '</td>'; $single_table .= '</td>';
$single_table .= '</tr>'; $single_table .= '</tr>';
$single_table .= '</table>'; $single_table .= '</table>';
@ -475,7 +498,7 @@ if ($edit_container) {
$data = []; $data = [];
$data[0] = ''; $data[0] = '';
$data[1] = "<input type=submit name='add_custom' class='sub add right' value='".__('Add item')."'>"; $data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
@ -570,7 +593,7 @@ if ($edit_container) {
$data = []; $data = [];
$data[0] = ''; $data[0] = '';
$data[1] = "<input type=submit name='add_dynamic' class='sub add right' value='".__('Add item')."'>"; $data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
@ -582,11 +605,13 @@ if ($edit_container) {
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
if ((bool) $id_container !== false) {
$total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container); $total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container);
$result_item = db_get_all_rows_sql('SELECT * FROM tcontainer_item WHERE id_container = '.$id_container.' LIMIT 10 OFFSET '.$offset); $result_item = db_get_all_rows_sql('SELECT * FROM tcontainer_item WHERE id_container = '.$id_container.' LIMIT 10 OFFSET '.$offset);
}
if (!$result_item) { if (!$result_item) {
echo "<div class='nf'>".__('There are no defined item container').'</div>'; echo "<div class='nf'>".__('There are no items in this container.').'</div>';
} else { } else {
ui_pagination($total_item[0]['count(*)'], false, $offset, 10); ui_pagination($total_item[0]['count(*)'], false, $offset, 10);
$table = new stdClass(); $table = new stdClass();
@ -655,7 +680,7 @@ if ($edit_container) {
} }
$data[7] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&delete_item=1&id_item='.$item['id_ci'].'&id='.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\')) $data[7] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&delete_item=1&id_item='.$item['id_ci'].'&id='.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter']).'</a>'; return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -94,7 +94,7 @@ if ($edit_graph) {
} else { } else {
$id_agent = 0; $id_agent = 0;
$id_module = 0; $id_module = 0;
$id_group = 0; $id_group = null;
$period = SECONDS_1DAY; $period = SECONDS_1DAY;
$factor = 1; $factor = 1;
$stacked = 4; $stacked = 4;
@ -142,28 +142,36 @@ if (users_can_manage_group_all('RW') === false
$output .= '<td><b>'.__('Group').'</b></td><td>'; $output .= '<td><b>'.__('Group').'</b></td><td>';
if (check_acl($config['id_user'], 0, 'RW')) { if (check_acl($config['id_user'], 0, 'RW')) {
$output .= html_print_select_groups( $output .= html_print_input(
$config['id_user'], [
'RW', 'type' => 'select_groups',
$return_all_group, 'id_user' => $config['id_user'],
'graph_id_group', 'privilege' => 'RW',
$id_group, 'returnAllGroup' => $return_all_group,
'', 'name' => 'graph_id_group',
'', 'selected' => $id_group,
'', 'script' => '',
true 'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
); );
} else if (check_acl($config['id_user'], 0, 'RM')) { } else if (check_acl($config['id_user'], 0, 'RM')) {
$output .= html_print_select_groups( $output .= html_print_input(
$config['id_user'], [
'RM', 'type' => 'select_groups',
$return_all_group, 'id_user' => $config['id_user'],
'graph_id_group', 'privilege' => 'RM',
$id_group, 'returnAllGroup' => $return_all_group,
'', 'name' => 'graph_id_group',
'', 'selected' => $id_group,
'', 'script' => '',
true 'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
); );
} }

View File

@ -515,9 +515,9 @@ if (!$maps && !is_metaconsole()) {
if ($maps) { if ($maps) {
if (!is_metaconsole()) { if (!is_metaconsole()) {
echo '<div class="action-buttons w100p right">'; echo '<div class="action-buttons w100p right_align">';
} else { } else {
echo '<div class="w100p right">'; echo '<div class="w100p right right_align mrgn_btn_20px">';
} }
} }

View File

@ -770,12 +770,6 @@ switch ($action) {
// Max values. // Max values.
break; break;
case 'nt_top_n':
$period = $item['period'];
$description = $item['description'];
$top_n_value = $item['top_n_value'];
break;
case 'permissions_report': case 'permissions_report':
$description = $item['description']; $description = $item['description'];
$es = json_decode($item['external_source'], true); $es = json_decode($item['external_source'], true);
@ -818,7 +812,6 @@ switch ($action) {
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'event_report_log': case 'event_report_log':
case 'increment': case 'increment':
case 'nt_top_n':
$label = (isset($style['label'])) ? $style['label'] : ''; $label = (isset($style['label'])) ? $style['label'] : '';
break; break;
@ -3290,7 +3283,7 @@ function print_SLA_list($width, $action, $idItem=null)
echo '</tbody>'; echo '</tbody>';
?> ?>
<tbody id="sla_template"> <tbody id="sla_template">
<tr id="row" class="datos invisible"> <tr id="row" class="datos" style="display: none">
<td class="sla_list_agent_col agent_name"></td> <td class="sla_list_agent_col agent_name"></td>
<td class="sla_list_module_col module_name"></td> <td class="sla_list_module_col module_name"></td>
<?php <?php
@ -3694,7 +3687,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
?> ?>
<tbody id="general_template"> <tbody id="general_template">
<tr id="row" class="datos invisible"> <tr id="row" class="datos" style="display: none">
<td class="agent_name"></td> <td class="agent_name"></td>
<td class="module_name"></td> <td class="module_name"></td>
<?php <?php
@ -5908,12 +5901,6 @@ function chooseType() {
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
case 'nt_top_n':
$("#row_description").show();
$("#row_period").show();
$("#row_quantity").show();
break;
case 'permissions_report': case 'permissions_report':
$("#row_description").show(); $("#row_description").show();
$("#row_users").show(); $("#row_users").show();

View File

@ -664,7 +664,7 @@ if (defined('METACONSOLE')) {
if (check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RM')) {
html_print_input_hidden('ids_items_to_delete', ''); html_print_input_hidden('ids_items_to_delete', '');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right mrgn_btn_15px"');
} }
echo '</div>'; echo '</div>';

View File

@ -121,16 +121,20 @@ if (users_can_manage_group_all('RW') === true) {
} }
$table->data['group'][1] = '<div class="w290px inline">'; $table->data['group'][1] = '<div class="w290px inline">';
$table->data['group'][1] .= html_print_select_groups( $table->data['group'][1] .= html_print_input(
$config['id_user'], [
'AR', 'type' => 'select_groups',
$return_all_group, 'id_user' => $config['id_user'],
'id_group', 'privilege' => 'AR',
$idGroupReport, 'returnAllGroup' => $return_all_group,
'', 'name' => 'id_group',
'', 'selected' => $idGroupReport,
'', 'script' => '',
true 'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
); );
$table->data['group'][1] .= '</div>'; $table->data['group'][1] .= '</div>';

View File

@ -1211,7 +1211,7 @@ switch ($action) {
switch ($activeTab) { switch ($activeTab) {
case 'main': case 'main':
$reportName = ''; $reportName = '';
$idGroupReport = 0; $idGroupReport = null;
// All groups. // All groups.
$description = ''; $description = '';
$resultOperationDB = null; $resultOperationDB = null;
@ -1718,14 +1718,6 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'nt_top_n':
$values['period'] = get_parameter('period');
$values['top_n_value'] = get_parameter(
'quantity'
);
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter( $values['top_n'] = get_parameter(
@ -2093,7 +2085,6 @@ switch ($action) {
case 'projection_graph': case 'projection_graph':
case 'prediction_date': case 'prediction_date':
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {
@ -2379,14 +2370,6 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'nt_top_n':
$values['top_n_value'] = get_parameter(
'quantity'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter( $values['top_n'] = get_parameter(
@ -2727,7 +2710,6 @@ switch ($action) {
case 'projection_graph': case 'projection_graph':
case 'prediction_date': case 'prediction_date':
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') { if ($label != '') {
$style['label'] = $label; $style['label'] = $label;
} else { } else {

View File

@ -122,10 +122,10 @@ if ($action == 'new') {
src="">'; src="">';
} else { } else {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$table->data[0][2] = '<img id="imagen2" $table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="../../images/console/background/'.$background.'">'; src="../../images/console/background/'.$background.'">';
} else { } else {
$table->data[0][2] = '<img id="imagen2" $table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="images/console/background/'.$background.'">'; src="images/console/background/'.$background.'">';
} }
@ -141,16 +141,20 @@ if (users_can_manage_group_all('RW') === true) {
$return_all_group = true; $return_all_group = true;
} }
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_input(
$config['id_user'], [
'RW', 'type' => 'select_groups',
$return_all_group, 'id_user' => $config['id_user'],
'id_group', 'privilege' => 'RW',
$idGroup, 'returnAllGroup' => $return_all_group,
'', 'name' => 'id_group',
'', 'selected' => $idGroup,
'', 'script' => '',
true 'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
).'</div>'; ).'</div>';
$backgrounds_list = list_files( $backgrounds_list = list_files(
$config['homedir'].'/images/console/background/', $config['homedir'].'/images/console/background/',

View File

@ -20,10 +20,13 @@ require_once $config['homedir'].'/include/functions_visual_map.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
enterprise_include_once('include/functions_visual_map.php'); enterprise_include_once('include/functions_visual_map.php');
// Retrieve the visual console id // Retrieve the visual console id.
set_unless_defined($idVisualConsole, 0); set_unless_defined($idVisualConsole, 0);
// Set default // Set default.
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole); $idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
if (empty($idVisualConsole) === true) {
$idVisualConsole = get_parameter('id_visualmap', 0);
}
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
$action_name_parameter = 'action'; $action_name_parameter = 'action';
@ -792,10 +795,10 @@ if ($config['legacy_vc']) {
$buttons['view'] = [ $buttons['view'] = [
'active' => false, 'active' => false,
'text' => '<a href="'.$url_view.'">'.html_print_image('images/operation.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'</a>', 'text' => '<a href="'.$url_view.'">'.html_print_image('images/eye.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'</a>',
]; ];
if ($action == 'new' || $idVisualConsole === false) { if ($idVisualConsole === false) {
$buttons = ['data' => $buttons['data']]; $buttons = ['data' => $buttons['data']];
// Show only the data tab // Show only the data tab
// If it is a fail try, reset the values // If it is a fail try, reset the values
@ -822,7 +825,7 @@ if ($statusProcessInDB !== null) {
echo $statusProcessInDB['message']; echo $statusProcessInDB['message'];
} }
// The source code for PAINT THE PAGE // The source code for PAINT THE PAGE.
switch ($activeTab) { switch ($activeTab) {
case 'wizard': case 'wizard':
include_once $config['homedir'].'/godmode/reporting/visual_console_builder.wizard.php'; include_once $config['homedir'].'/godmode/reporting/visual_console_builder.wizard.php';

View File

@ -16,7 +16,7 @@ global $config;
check_login(); check_login();
// Visual console required. // Visual console required.
if (empty($visualConsole)) { if (empty($visualConsole) === true) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access report builder' 'Trying to access report builder'

View File

@ -97,6 +97,13 @@ if (isset($_GET['server'])) {
echo '<div class="action-buttons w100p">'; echo '<div class="action-buttons w100p">';
echo '<input type="submit" class="sub upd" value="'.__('Update').'">'; echo '<input type="submit" class="sub upd" value="'.__('Update').'">';
echo '</div>'; echo '</div>';
echo '</form>';
if ($row['server_type'] == 13) {
echo '<div style="margin-top: 20px;">';
ui_toggle($content, __('Credential boxes'), '', 'toggle_credential', false);
echo '</div>';
}
} else if (isset($_GET['server_remote'])) { } else if (isset($_GET['server_remote'])) {
// Headers. // Headers.
$id_server = get_parameter_get('server_remote'); $id_server = get_parameter_get('server_remote');
@ -224,11 +231,148 @@ if (isset($_GET['server'])) {
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
var id_server = <?php echo $id_server; ?>;
var server_type = <?php echo $row['server_type']; ?>;
$("#check_exec_server img").on("click", function () { $("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif"); $("#check_exec_server img").attr("src", "images/spinner.gif");
check_process("<?php echo $id_server; ?>"); check_process(id_server);
}); });
if (server_type == 13) {
load_credential_boxes();
}
function load_credential_boxes () {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['load_credential_boxes'] = 1;
parameters['id_server'] = id_server;
parameters['server_name'] = "<?php echo $row['name']; ?>";
jQuery.get(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html(data);
$("#submit-add").click(function (e) {
add_credential_boxes();
});
$("[id^=delete-]").click(function (e) {
delete_credential_boxes(e.currentTarget.id);
});
$("[id^=update-]").click(function (e) {
load_update_credential_boxes(e.currentTarget.id);
});
},
"html"
);
}
function add_credential_boxes () {
$(".white-box-content").html('');
var parameters2 = {};
parameters2['page'] = 'enterprise/include/ajax/servers.ajax';
parameters2['add_credential_boxes'] = 1;
jQuery.get(
"ajax.php",
parameters2,
function (data2) {
$(".white-box-content").html(data2);
// Insert credential
$("#submit-add").click(function (e) {
save_credential_boxes();
})
},
"html"
);
}
function save_credential_boxes () {
var parameters3 = {};
parameters3['page'] = 'enterprise/include/ajax/servers.ajax';
parameters3['save_credential_boxes'] = 1;
parameters3['subnet'] = $("#text-subnet").val();
parameters3['name'] = $("#text-name").val();
parameters3['pass'] = $("#password-pass").val();
parameters3['server_name'] = "<?php echo $row['name']; ?>";
jQuery.post(
"ajax.php",
parameters3,
function (data3) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
function delete_credential_boxes (datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['delete_credential_boxes'] = 1;
parameters['server_name'] = "<?php echo $row['name']; ?>";
parameters['datas'] = datas;
jQuery.post(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
function load_update_credential_boxes (datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['load_update_credential_boxes'] = 1;
parameters['datas'] = datas;
jQuery.get(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html(data);
$("#submit-update").click(function (e) {
update_credential_boxes(datas);
});
},
"html"
);
}
function update_credential_boxes(datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['update_credential_boxes'] = 1;
parameters['subnet'] = $("#text-subnet").val();
parameters['name'] = $("#text-name").val();
parameters['pass'] = $("#password-pass").val();
parameters['server_name'] = "<?php echo $row['name']; ?>";
parameters['old_datas'] = datas;
jQuery.post(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
}); });
function check_process (id_server) { function check_process (id_server) {

View File

@ -105,7 +105,7 @@ if (is_metaconsole()) {
$table->data = []; $table->data = [];
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>'; $table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'class="height_50px w450px"', true); $table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="width: 450px" class="height_50px w450px"', true);
$table->data[1][0] = '<strong>'.__($license['expiry_caption']).'</strong>'; $table->data[1][0] = '<strong>'.__($license['expiry_caption']).'</strong>';
$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true); $table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true);

View File

@ -29,7 +29,10 @@
// Load global vars. // Load global vars.
global $config; global $config;
require_once 'include/config.php'; require_once $config['homedir'].'/include/config.php';
require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Core\Config;
check_login(); check_login();
@ -388,44 +391,11 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$config_history = false; $config_history['days_purge'] = Config::get('days_purge', 180, true);
if ($config['history_db_connection']) { $config_history['days_compact'] = Config::get('days_compact', 120, true);
$history_connect = mysql_db_process_sql( $config_history['step_compact'] = Config::get('step_compact', 1, true);
'DESCRIBE tconfig', $config_history['event_purge'] = Config::get('event_purge', 180, true);
'affected_rows', $config_history['string_purge'] = Config::get('string_purge', 180, true);
$config['history_db_connection'],
false
);
if ($history_connect !== false) {
$config_history_array = mysql_db_process_sql(
'SELECT * FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if (isset($config_history_array) && is_array($config_history_array)) {
foreach ($config_history_array as $key => $value) {
$config_history[$value['token']] = $value['value'];
$config_history = true;
}
}
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the historical database')
);
}
}
if ($config_history === false) {
$config_history = [];
$config_history['days_purge'] = 180;
$config_history['days_compact'] = 120;
$config_history['step_compact'] = 1;
$config_history['event_purge'] = 180;
$config_history['string_purge'] = 180;
}
$table_historical = new StdClass(); $table_historical = new StdClass();
$table_historical->width = '100%'; $table_historical->width = '100%';

View File

@ -337,6 +337,18 @@ if (isset($config['error_config_update_config'])) {
ui_print_success_message(__('Correct update the setup options')); ui_print_success_message(__('Correct update the setup options'));
} }
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
}
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
}
}
unset($config['error_config_update_config']); unset($config['error_config_update_config']);
} }

View File

@ -242,14 +242,6 @@ $table->data[$i++][1] = html_print_checkbox_switch_extended(
true true
); );
$table->data[$i][0] = __('Enable Network Traffic Analyzer');
$table->data[$i++][1] = html_print_switch(
[
'name' => 'activate_nta',
'value' => $config['activate_nta'],
]
);
$zone_name = [ $zone_name = [
'Africa' => __('Africa'), 'Africa' => __('Africa'),

View File

@ -77,6 +77,7 @@ is not working on the metaconsole and there is no time to fix it -->
var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n"; var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n";
var updating = "<?php echo __('Updating'); ?>\n"; var updating = "<?php echo __('Updating'); ?>\n";
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n"; var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied.'); ?>\n"; var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied.'); ?>\n";
var mr_available = "<?php echo __('Minor release available'); ?>\n"; var mr_available = "<?php echo __('Minor release available'); ?>\n";
var package_available = "<?php echo __('New package available'); ?>\n"; var package_available = "<?php echo __('New package available'); ?>\n";

View File

@ -515,19 +515,21 @@ class DiscoveryTaskList extends HTML
} }
// Task name. // Task name.
$table->headstyle[1] .= 'min-width: 150px; width: 300px;'; $table->headstyle[1] .= 'min-width: 170px; width: 300px;';
// Server Name.
$table->headstyle[2] .= 'min-width: 130px; width: 400px;';
// Name. // Name.
$table->headstyle[4] .= 'min-width: 100px; width: 400px;'; $table->headstyle[4] .= 'min-width: 100px; width: 350px;';
// Status. // Status.
$table->headstyle[5] .= 'min-width: 50px; width: 100px;'; $table->headstyle[5] .= 'min-width: 70px; width: 190px;';
// Task type. // Task type.
$table->headstyle[6] .= 'min-width: 200px; width: 200px;'; $table->headstyle[6] .= 'min-width: 190px; width: 200px;';
// Progress. // Progress.
$table->headstyle[7] .= 'min-width: 50px; width: 150px;'; $table->headstyle[7] .= 'min-width: 60px; width: 150px;';
// Updated at. // Updated at.
$table->headstyle[8] .= 'min-width: 50px; width: 150px;'; $table->headstyle[8] .= 'min-width: 50px; width: 150px;';
// Operations. // Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 150px;'; $table->headstyle[9] .= 'min-width: 150px; width: 250px;';
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
$table->head[0] = __('Force'); $table->head[0] = __('Force');
@ -761,6 +763,16 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.Agent.Deployment'); $data[6] .= __('Discovery.Agent.Deployment');
break; break;
case DISCOVERY_APP_MICROSOFT_SQL_SERVER:
// Discovery Applications Oracle.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications Microsoft SQL Server')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.Microsoft SQL Server');
break;
case DISCOVERY_HOSTDEVICES: case DISCOVERY_HOSTDEVICES:
default: default:
if ($task['id_recon_script'] == 0) { if ($task['id_recon_script'] == 0) {
@ -840,7 +852,7 @@ class DiscoveryTaskList extends HTML
$data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">'; $data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/eye.png', 'images/operation.png',
true, true,
[ [
'title' => __('View summary'), 'title' => __('View summary'),
@ -1042,6 +1054,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_APP_MYSQL: case DISCOVERY_APP_MYSQL:
return 'wiz=app&mode=mysql&page=0'; return 'wiz=app&mode=mysql&page=0';
case DISCOVERY_APP_MICROSOFT_SQL_SERVER:
return 'wiz=app&mode=MicrosoftSQLServer&page=0';
case DISCOVERY_APP_ORACLE: case DISCOVERY_APP_ORACLE:
return 'wiz=app&mode=oracle&page=0'; return 'wiz=app&mode=oracle&page=0';

View File

@ -809,7 +809,7 @@ class HostDevices extends Wizard
'name' => 'interval_manual_defined', 'name' => 'interval_manual_defined',
'return' => true, 'return' => true,
], ],
'extra' => '<div id="interval_manual_container"><div class="time_selection_container">'.ui_print_help_tip( 'extra' => '<div id="interval_manual_container"><div class="time_selection_container mrgn_top_20px">'.ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'), __('The minimum recomended interval for Recon Task is 5 minutes'),
true true
).html_print_extended_select_for_time( ).html_print_extended_select_for_time(

View File

@ -1115,16 +1115,16 @@ if ($dialogue_event_response) {
); );
echo '</div><br>'; echo '</div><br>';
echo "<div id='response_loading_command_".$out_iterator."' class='invisible'>"; echo "<div id='response_loading_command_".$out_iterator."' style='display: none'>";
echo html_print_image( echo html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true true
); );
echo '</div>'; echo '</div><br>';
echo "<br><div id='response_out_".$out_iterator."' class='invisible'></div>"; echo "<br><div id='response_out_".$out_iterator."'><br><br></div><br>";
if ($end) { if ($end) {
echo "<br><div id='re_exec_command_".$out_iterator."' class='invisible'>"; echo "<br><div id='re_exec_command_".$out_iterator."' style='display: none'><br>";
html_print_button( html_print_button(
__('Execute again'), __('Execute again'),
'btn_str', 'btn_str',
@ -1132,7 +1132,7 @@ if ($dialogue_event_response) {
'execute_event_response(false);', 'execute_event_response(false);',
"class='sub next'" "class='sub next'"
); );
echo "<span id='execute_again_loading' class='invisible'>"; echo "<span id='execute_again_loading' style='display: none'>";
echo html_print_image( echo html_print_image(
'images/spinner.gif', 'images/spinner.gif',
true true
@ -1146,10 +1146,10 @@ if ($dialogue_event_response) {
echo $prompt."Executing command: $command"; echo $prompt."Executing command: $command";
echo '</div><br>'; echo '</div><br>';
echo "<div id='response_loading_command' class='invisible'>".html_print_image('images/spinner.gif', true).'</div>'; echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
echo "<br><div id='response_out' class='left'></div>"; echo "<br><br><br><div id='response_out' class='left'></div>";
echo "<br><div id='re_exec_command' class='invisible'>"; echo "<br><div id='re_exec_command' style='display:none'><br><br>";
html_print_button(__('Execute again'), 'btn_str', false, "perform_response({'target':'".$command."','event_id':".$event_id.",'server_id':".$server_id.'}, '.$response_id.');', "class='sub next'"); html_print_button(__('Execute again'), 'btn_str', false, "perform_response({'target':'".$command."','event_id':".$event_id.",'server_id':".$server_id.'}, '.$response_id.');', "class='sub next'");
echo '</div>'; echo '</div>';

View File

@ -88,6 +88,11 @@ if (is_ajax()) {
$file_dest = $config['homedir']."/extras/mr/updated/$number.sql"; $file_dest = $config['homedir']."/extras/mr/updated/$number.sql";
copy($file, $file_dest); copy($file, $file_dest);
// After successfully update, schedule history
// database upgrade.
enterprise_include_once('include/functions_config.php');
enterprise_hook('history_db_install');
} }
} else { } else {
$error_file = fopen($config['homedir'].'/extras/mr/error.txt', 'w'); $error_file = fopen($config['homedir'].'/extras/mr/error.txt', 'w');

View File

@ -937,8 +937,8 @@ class AgentWizard extends HTML
$ipsResult = []; $ipsResult = [];
// In this case we need the full information provided by snmpwalk. // In this case we need the full information provided by snmpwalk.
$ipsResult = $this->snmpwalkValues($snmpIpDiscover, false, true); $ipsResult = $this->snmpWalkValues($snmpIpDiscover, false, true);
$indexes = $this->snmpwalkValues($snmpIpIndexes, false, true); $indexes = $this->snmpWalkValues($snmpIpIndexes, false, true);
$unicastIpReferences = []; $unicastIpReferences = [];
foreach ($indexes as $k => $v) { foreach ($indexes as $k => $v) {
@ -960,11 +960,11 @@ class AgentWizard extends HTML
// Set the name of interface. // Set the name of interface.
$interfaces[$indexKey]['name'] = $name; $interfaces[$indexKey]['name'] = $name;
// Get the description. // Get the description.
$interfaces[$indexKey]['descr'] = $this->snmpgetValue( $interfaces[$indexKey]['descr'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.2.'.$indexKey '.1.3.6.1.2.1.2.2.1.2.'.$indexKey
); );
// Get the MAC address. // Get the MAC address.
$interfaces[$indexKey]['mac'] = $this->snmpgetValue( $interfaces[$indexKey]['mac'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.6.'.$indexKey '.1.3.6.1.2.1.2.2.1.6.'.$indexKey
); );
// Get unicast IP address. // Get unicast IP address.
@ -972,6 +972,16 @@ class AgentWizard extends HTML
if (isset($unicastIpReferences[$indexKey]) === true) { if (isset($unicastIpReferences[$indexKey]) === true) {
$interfaces[$indexKey]['ip'] = ''; $interfaces[$indexKey]['ip'] = '';
} }
// Get interface alias.
$interfaces[$indexKey]['alias'] = $this->snmpGetValue(
'.1.3.6.1.2.1.31.1.1.1.18.'.$indexKey
);
// Get interface speed.
$interfaces[$indexKey]['speed'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.5.'.$indexKey
);
} }
// Save the interfaces found for process later. // Save the interfaces found for process later.
@ -1035,7 +1045,7 @@ class AgentWizard extends HTML
if ($this->wizardSection === 'snmp_interfaces_explorer') { if ($this->wizardSection === 'snmp_interfaces_explorer') {
// Check if thereis x64 counters. // Check if thereis x64 counters.
$snmp_tmp = '.1.3.6.1.2.1.31.1.1.1.6'; $snmp_tmp = '.1.3.6.1.2.1.31.1.1.1.6';
$check_x64 = $this->snmpwalkValues( $check_x64 = $this->snmpWalkValues(
$snmp_tmp, $snmp_tmp,
false, false,
true true
@ -1051,7 +1061,7 @@ class AgentWizard extends HTML
// Explore interface names. // Explore interface names.
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1'; $oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
$receivedOid = $this->snmpwalkValues( $receivedOid = $this->snmpWalkValues(
$oidExplore, $oidExplore,
false, false,
true true
@ -1062,7 +1072,7 @@ class AgentWizard extends HTML
} }
// Doc Interfaces de red. // Doc Interfaces de red.
$receivedOid = $this->snmpwalkValues( $receivedOid = $this->snmpWalkValues(
$oidExplore, $oidExplore,
false, false,
false false
@ -1073,7 +1083,7 @@ class AgentWizard extends HTML
$oidExplore = '1.3.6.1.2.1.2.2.1.2'; $oidExplore = '1.3.6.1.2.1.2.2.1.2';
// Doc Interfaces de red. // Doc Interfaces de red.
$receivedOid = $this->snmpwalkValues( $receivedOid = $this->snmpWalkValues(
$oidExplore, $oidExplore,
false, false,
true true
@ -1339,7 +1349,6 @@ class AgentWizard extends HTML
$content .= html_print_table($table, true); $content .= html_print_table($table, true);
echo $content; echo $content;
return;
} }
@ -1431,6 +1440,18 @@ class AgentWizard extends HTML
$result[$value]['description'] = $data['module-default_description-'.$key]; $result[$value]['description'] = $data['module-default_description-'.$key];
} else if (empty(preg_match('/module-value/', $k)) === false) { } else if (empty(preg_match('/module-value/', $k)) === false) {
$result[$value]['value'] = $data['module-value-'.$key]; $result[$value]['value'] = $data['module-value-'.$key];
} else if (empty(preg_match('/module-macros/', $k)) === false) {
$result[$value]['macros'] = $data['module-macros-'.$key];
continue;
} else if (empty(preg_match('/module-id_plugin/', $k)) === false) {
$result[$value]['id_plugin'] = $data['module-id_plugin-'.$key];
continue;
} else if (empty(preg_match('/module-id_modulo/', $k)) === false) {
$result[$value]['id_modulo'] = $data['module-id_modulo-'.$key];
continue;
} else if (empty(preg_match('/module-unit/', $k)) === false) {
$result[$value]['unit'] = $data['module-unit-'.$key];
continue;
} }
preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches); preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches);
@ -1891,6 +1912,7 @@ class AgentWizard extends HTML
{ {
$modules = []; $modules = [];
$errorflag = false; $errorflag = false;
foreach ($modulesCandidates as $candidate) { foreach ($modulesCandidates as $candidate) {
$tmp = Module::search( $tmp = Module::search(
[ [
@ -2062,6 +2084,8 @@ class AgentWizard extends HTML
} else { } else {
$tmp->ip_target($this->targetIp); $tmp->ip_target($this->targetIp);
$tmp->id_modulo(MODULE_PLUGIN); $tmp->id_modulo(MODULE_PLUGIN);
if (empty($candidate['macros']) === true) {
$fieldsPlugin = db_get_value_sql( $fieldsPlugin = db_get_value_sql(
sprintf( sprintf(
'SELECT macros FROM tplugin WHERE id=%d', 'SELECT macros FROM tplugin WHERE id=%d',
@ -2091,6 +2115,11 @@ class AgentWizard extends HTML
$tmp->id_plugin($infoMacros['server_plugin']); $tmp->id_plugin($infoMacros['server_plugin']);
$tmp->macros(json_encode($fieldsPlugin)); $tmp->macros(json_encode($fieldsPlugin));
} else {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
}
} }
} }
} else if ($this->protocol === 'wmi') { } else if ($this->protocol === 'wmi') {
@ -2403,7 +2432,18 @@ class AgentWizard extends HTML
} }
// Get current value. // Get current value.
$currentValue = $this->snmpgetValue($moduleData['value']); if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
// It unit of measure have data, attach to current value. // It unit of measure have data, attach to current value.
if (empty($moduleData['module_unit']) === false) { if (empty($moduleData['module_unit']) === false) {
@ -2413,6 +2453,7 @@ class AgentWizard extends HTML
// Stablish the data for show. // Stablish the data for show.
$generalInterfaceModulesUpdated[] = [ $generalInterfaceModulesUpdated[] = [
'component_id' => $component_id_number++, 'component_id' => $component_id_number++,
'execution_type' => $moduleData['execution_type'],
'name' => $moduleData['module_name'], 'name' => $moduleData['module_name'],
'type' => $moduleData['module_type'], 'type' => $moduleData['module_type'],
'description' => $moduleData['module_info'], 'description' => $moduleData['module_info'],
@ -2425,6 +2466,9 @@ class AgentWizard extends HTML
'module_enabled' => $moduleData['default_enabled'], 'module_enabled' => $moduleData['default_enabled'],
'name_oid' => $moduleData['value'], 'name_oid' => $moduleData['value'],
'value' => $moduleData['value'], 'value' => $moduleData['value'],
'id_plugin' => $moduleData['id_plugin'],
'macros' => $moduleData['macros'],
'id_modulo' => $moduleData['id_modulo'],
]; ];
} }
@ -2556,7 +2600,20 @@ class AgentWizard extends HTML
} }
// Get current value. // Get current value.
$currentValue = $this->snmpgetValue($moduleData['value']); $currentValue = '';
if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
// Format current value with thousands and decimals. // Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) { if (is_numeric($currentValue) === true) {
@ -2572,6 +2629,7 @@ class AgentWizard extends HTML
// Stablish the data for show. // Stablish the data for show.
$interfaceModulesUpdated[] = [ $interfaceModulesUpdated[] = [
'component_id' => $component_id_number++, 'component_id' => $component_id_number++,
'execution_type' => $moduleData['execution_type'],
'name' => $moduleData['module_name'], 'name' => $moduleData['module_name'],
'type' => $moduleData['module_type'], 'type' => $moduleData['module_type'],
'description' => $moduleData['module_description'], 'description' => $moduleData['module_description'],
@ -2585,6 +2643,10 @@ class AgentWizard extends HTML
'current_value' => $currentValue, 'current_value' => $currentValue,
'name_oid' => $moduleData['value'], 'name_oid' => $moduleData['value'],
'value' => $moduleData['value'], 'value' => $moduleData['value'],
'id_plugin' => $moduleData['id_plugin'],
'macros' => $moduleData['macros'],
'id_modulo' => $moduleData['id_modulo'],
'unit' => ($moduleData['unit'] ?? $moduleData['module_unit']),
]; ];
} }
@ -2927,7 +2989,7 @@ class AgentWizard extends HTML
// Common for FIXED Scan types. // Common for FIXED Scan types.
// If _nameOID_ macro exists, stablish the name getted. // If _nameOID_ macro exists, stablish the name getted.
if (empty($module['name_oid']) === false) { if (empty($module['name_oid']) === false) {
$nameValue = $this->snmpgetValue($module['name_oid']); $nameValue = $this->snmpGetValue($module['name_oid']);
$moduleBlocks[$k]['name'] = str_replace( $moduleBlocks[$k]['name'] = str_replace(
'_nameOID_', '_nameOID_',
$nameValue, $nameValue,
@ -2941,7 +3003,7 @@ class AgentWizard extends HTML
$module['value'] = 0; $module['value'] = 0;
} }
$value = $this->snmpgetValue($module['value']); $value = $this->snmpGetValue($module['value']);
// If the value is missing, we must not show this module. // If the value is missing, we must not show this module.
if (empty($value) === true) { if (empty($value) === true) {
unset($moduleBlocks[$k]); unset($moduleBlocks[$k]);
@ -2963,7 +3025,7 @@ class AgentWizard extends HTML
// OIDs and get his values. // OIDs and get his values.
foreach ($macros as $key => $oid) { foreach ($macros as $key => $oid) {
if (preg_match('/extra_field_/', $key) !== 0) { if (preg_match('/extra_field_/', $key) !== 0) {
$value = (float) $this->snmpgetValue($oid); $value = (float) $this->snmpGetValue($oid);
// If the value not exists, // If the value not exists,
// we must not create a module. // we must not create a module.
@ -2999,20 +3061,20 @@ class AgentWizard extends HTML
} else { } else {
if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) { if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) {
// Get the values of snmpwalk. // Get the values of snmpwalk.
$snmpwalkNames = $this->snmpwalkValues($module['name_oid']); $snmpwalkNames = $this->snmpWalkValues($module['name_oid']);
$snmpwalkValues = $this->snmpwalkValues($module['value']); $snmpWalkValues = $this->snmpWalkValues($module['value']);
$snmpwalkCombined = []; $snmpwalkCombined = [];
foreach ($snmpwalkNames as $index => $name) { foreach ($snmpwalkNames as $index => $name) {
if (isset($name) !== true if (isset($name) !== true
|| isset($snmpwalkValues[$index]) !== true || isset($snmpWalkValues[$index]) !== true
) { ) {
continue; continue;
} }
$snmpwalkCombined[$index] = [ $snmpwalkCombined[$index] = [
'name' => $name, 'name' => $name,
'value' => $snmpwalkValues[$index], 'value' => $snmpWalkValues[$index],
]; ];
} }
@ -3062,7 +3124,7 @@ class AgentWizard extends HTML
$snmpwalkNamesTmp = []; $snmpwalkNamesTmp = [];
// Is needed the index and the values of snmpwalk. // Is needed the index and the values of snmpwalk.
$snmpwalkNamesTmp = $this->snmpwalkValues( $snmpwalkNamesTmp = $this->snmpWalkValues(
$module['name_oid'], $module['name_oid'],
true true
); );
@ -3082,7 +3144,7 @@ class AgentWizard extends HTML
foreach ($oids as $oidName => $oid) { foreach ($oids as $oidName => $oid) {
$currentOid = $oid.'.'.$tmpSecond[0]; $currentOid = $oid.'.'.$tmpSecond[0];
$macros['macros'][$oidName] = $currentOid; $macros['macros'][$oidName] = $currentOid;
$currentOidValue = $this->snmpgetValue($currentOid); $currentOidValue = $this->snmpGetValue($currentOid);
// If for any reason the value comes empty, add 1. // If for any reason the value comes empty, add 1.
if ($currentOidValue == '') { if ($currentOidValue == '') {
$currentOidValue = 1; $currentOidValue = 1;
@ -3240,6 +3302,58 @@ class AgentWizard extends HTML
} }
/**
* Returns associated PEN code of this device.
*
* @return integer|null PEN oid or null if not found.
*/
private function getPEN()
{
$oid = '.1.3.6.1.2.1.1.2.0';
$output = $this->snmpWalkValues($oid, false, true, true);
static $pen;
if (isset($pen) === true) {
return $pen;
}
if (is_array($output) === true
&& isset($output[$oid]) === true
) {
// Output should be an array with only 1 element.
$pen = (int) explode('.', $output[$oid])[7];
}
if ($pen === 0) {
return null;
}
return $pen;
}
/**
* Returns the index oid matching selected expected value.
*
* @param string $oidTree Tree to search in.
* @param string $expectedValue Expected value.
*
* @return string|false Index where expected value is stored or false if not
* found.
*/
private function snmpGetValueInverse($oidTree, $expectedValue)
{
$oidTree = $this->snmpWalkValues($oidTree);
if (is_array($oidTree) === false) {
return false;
}
return array_search($expectedValue, $oidTree);
}
/** /**
* Perform a snmpget for get a value from provided oid. * Perform a snmpget for get a value from provided oid.
* *
@ -3248,13 +3362,13 @@ class AgentWizard extends HTML
* *
* @return mixed String when response, null if error. * @return mixed String when response, null if error.
*/ */
private function snmpgetValue(string $oid, ?bool $full_output=false) private function snmpGetValue(string $oid, ?bool $full_output=false)
{ {
if ($oid[0] !== '.') { if ($oid[0] !== '.') {
$oid = '.'.$oid; $oid = '.'.$oid;
} }
$output = $this->snmpwalkValues($oid, false, true, true); $output = $this->snmpWalkValues($oid, false, true, true);
if (is_array($output) === true) { if (is_array($output) === true) {
foreach ($output as $k => $v) { foreach ($output as $k => $v) {
@ -3287,7 +3401,7 @@ class AgentWizard extends HTML
* *
* @return array * @return array
*/ */
private function snmpwalkValues( private function snmpWalkValues(
string $oid, string $oid,
bool $full_output=false, bool $full_output=false,
bool $pure=false, bool $pure=false,
@ -4122,7 +4236,7 @@ class AgentWizard extends HTML
// Unit module. // Unit module.
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
'module-unit-'.$uniqueId, 'module-unit-'.$uniqueId,
$module['unit'], ($module['unit'] ?? $module['module_unit']),
true, true,
$md5IdBlock, $md5IdBlock,
'form="form-create-modules"' 'form="form-create-modules"'
@ -4137,6 +4251,7 @@ class AgentWizard extends HTML
'form="form-create-modules"' 'form="form-create-modules"'
); );
if (empty($module['macros']) === false) {
// Macro module. // Macro module.
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
'module-macros-'.$uniqueId, 'module-macros-'.$uniqueId,
@ -4145,6 +4260,40 @@ class AgentWizard extends HTML
$md5IdBlock, $md5IdBlock,
'form="form-create-modules"' 'form="form-create-modules"'
); );
}
if (empty($module['execution_type']) === false) {
// Id plugin.
$data[6] .= html_print_input_hidden(
'module-execution_type-'.$uniqueId,
$module['execution_type'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
if (empty($module['id_modulo']) === false) {
// Id module.
$data[6] .= html_print_input_hidden(
'module-id_modulo-'.$uniqueId,
$module['id_modulo'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
if (empty($module['id_plugin']) === false) {
// Id plugin.
$data[6] .= html_print_input_hidden(
'module-id_plugin-'.$uniqueId,
$module['id_plugin'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
// Macro module. // Macro module.
$data[6] .= html_print_input_hidden( $data[6] .= html_print_input_hidden(
@ -4286,7 +4435,7 @@ class AgentWizard extends HTML
{ {
$moduleDescription = ''; $moduleDescription = '';
$name = ''; $name = '';
$value = '1'; $value = '_generic_';
// Unpack the array with data. // Unpack the array with data.
if (empty($data) === false) { if (empty($data) === false) {
if (empty($data['mac']) === false) { if (empty($data['mac']) === false) {
@ -4301,6 +4450,12 @@ class AgentWizard extends HTML
$moduleDescription .= ''; $moduleDescription .= '';
} }
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_'; $name = $data['name'].'_';
$value = $data['index']; $value = $data['index'];
} }
@ -4313,11 +4468,16 @@ class AgentWizard extends HTML
// IfOperStatus. // IfOperStatus.
$adminStatusValue = 1; $adminStatusValue = 1;
$speed = 0;
if (empty($data) === false) { if (empty($data) === false) {
$adminStatusValue = $this->snmpgetValue( $adminStatusValue = $this->snmpGetValue(
'1.3.6.1.2.1.2.2.1.7.'.$value '1.3.6.1.2.1.2.2.1.7.'.$value
); );
$speed = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.5.'.$value
);
preg_match('/\((\d+?)\)/', $adminStatusValue, $match); preg_match('/\((\d+?)\)/', $adminStatusValue, $match);
$adminStatusValue = (int) $match[1]; $adminStatusValue = (int) $match[1];
} }
@ -4325,7 +4485,7 @@ class AgentWizard extends HTML
// IfOperStatus. // IfOperStatus.
$operStatusValue = 1; $operStatusValue = 1;
if (empty($data) === false) { if (empty($data) === false) {
$operStatusValue = $this->snmpgetValue( $operStatusValue = $this->snmpGetValue(
'1.3.6.1.2.1.2.2.1.8.'.$value '1.3.6.1.2.1.2.2.1.8.'.$value
); );
@ -4402,9 +4562,11 @@ class AgentWizard extends HTML
'ifOutNUcastPkts / ifHCOutNUcastPkts', 'ifOutNUcastPkts / ifHCOutNUcastPkts',
]; ];
if ($name == '') { if ($name === '') {
foreach ($definition_temp as $module => $module_def) { foreach ($definition_temp as $module => $module_def) {
$definition_temp[$module]['module_name'] = array_shift($general_module_names); $definition_temp[$module]['module_name'] = array_shift(
$general_module_names
);
} }
} }
@ -4412,6 +4574,248 @@ class AgentWizard extends HTML
$definition = array_merge($definition, $definition_temp); $definition = array_merge($definition, $definition_temp);
} }
// LocIfInCRC.
$moduleName = $name.'locIfInCRC';
$definition['locIfInCRC'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_REMOTE_SNMP_INC,
'module_description' => sprintf(
'(%s%s)',
$moduleDescription,
$moduleName
),
'module_info' => 'Number of input packets which had cyclic redundancy checksum errors.',
'execution_type' => 'network',
'value' => '1.3.6.1.4.1.9.2.2.1.1.12.'.$value,
'module_unit' => 'packets/s',
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Manufacturer specific modules.
$pen = $this->getPEN();
switch ($pen) {
case 9:
// CISCO.
$valueTranslated = $this->snmpGetValueInverse(
'.1.3.6.1.4.1.9.5.1.4.1.1.11.1',
$value
);
if ($valueTranslated === false && $value !== '_generic_') {
$duplexMismatchOID = null;
} else {
$duplexMismatchOID = '.1.3.6.1.4.1.9.5.1.4.1.1.10.1';
$duplexMismatchOID .= $valueTranslated;
$minc = 2.5;
$maxc = 3.5;
}
break;
// TODO: Add here extra manufacturers.
default:
// Unknown.
$duplexMismatchOID = null;
break;
}
if (isset($duplexMismatchOID) === true) {
// Duplex mismatch.
$moduleName = $name.'DuplexMismatch';
$definition['DuplexMismatch'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_REMOTE_SNMP,
'module_description' => sprintf(
'(%s%s)',
$moduleDescription,
$moduleName
),
'module_info' => 'Indicates whether the port is operating in half-duplex, full-duplex, disagree or auto negotiation mode. If the port could not agree with the far end on port duplex, the port will be in disagree(3) mode.',
'execution_type' => 'network',
'value' => $duplexMismatchOID,
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => $minc,
'max_critical' => $maxc,
'inv_critical' => false,
],
];
}
// Bandwidth plugin.
static $plugin;
if ($plugin === null) {
$plugin = \db_get_row_filter(
'tplugin',
[ 'name' => 'Network&#x20;bandwidth&#x20;SNMP' ]
);
}
if ($plugin !== false) {
// Network Bandwidth is installed.
$plugin_id = $plugin['id'];
$macros = json_decode($plugin['macros'], 1);
if (json_last_error() === JSON_ERROR_NONE) {
// SNMP Version.
$macros[1]['value'] = $this->version;
// Community.
$macros[2]['value'] = $this->community;
// Host.
$macros[3]['value'] = $this->targetIp;
// Port.
$macros[4]['value'] = $this->targetPort;
// Interface index filter.
$macros[5]['value'] = $value;
// SecurityName.
$macros[6]['value'] = $this->authUserV3;
// SecurityContext.
$macros[7]['value'] = $this->community;
// SecurityLevel.
$macros[8]['value'] = $this->securityLevelV3;
// AuthProtocol.
$macros[9]['value'] = $this->authMethodV3;
// AuthKey.
$macros[10]['value'] = $this->authPassV3;
// PrivProtocol.
$macros[11]['value'] = $this->privacyMethodV3;
// PrivKey.
$macros[12]['value'] = $this->privacyPassV3;
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 0;
// Get output usage.
$macros[15]['value'] = 0;
$moduleName = $name.'Bandwidth';
$definition['Bandwidth'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Amount of digital information sent and received from this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '85',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 1;
// Get output usage.
$macros[15]['value'] = 0;
$moduleName = $name.'inUsage';
$definition['inUsage'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Bandwidth usage received into this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 0;
// Get output usage.
$macros[15]['value'] = 1;
$moduleName = $name.'outUsage';
$definition['outUsage'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Bandwidth usage sent from this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
}
}
// Continue with common x86 and x84 modules. // Continue with common x86 and x84 modules.
// IfAdminStatus. // IfAdminStatus.
$moduleName = $name.'ifAdminStatus'; $moduleName = $name.'ifAdminStatus';
@ -4569,6 +4973,12 @@ class AgentWizard extends HTML
$moduleDescription .= ''; $moduleDescription .= '';
} }
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_'; $name = $data['name'].'_';
$value = $data['index']; $value = $data['index'];
} }
@ -4758,6 +5168,12 @@ class AgentWizard extends HTML
$moduleDescription .= ''; $moduleDescription .= '';
} }
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_'; $name = $data['name'].'_';
$value = $data['index']; $value = $data['index'];
} }

View File

@ -548,10 +548,7 @@ class AgentsAlerts extends HTML
if (empty($templates_raw)) { if (empty($templates_raw)) {
$templates_raw = []; $templates_raw = [];
} }
} };
// Is needed sort templates for show in the row.
sort($templates);
$alerts = []; $alerts = [];
$ntemplates = 0; $ntemplates = 0;
@ -600,14 +597,17 @@ class AgentsAlerts extends HTML
} }
$templates[$temp['id']] = $temp['name']; $templates[$temp['id']] = $temp['name'];
}
}
if (empty($temp['name']) === false) { foreach ($templates as $id => $name) {
if (empty($name) === false) {
$outputLine = html_print_div( $outputLine = html_print_div(
[ [
'id' => 'line_header_'.$temp['id'], 'id' => 'line_header_'.$id,
'class' => 'rotate_text_module position_text_module', 'class' => 'rotate_text_module position_text_module',
'style' => '', 'style' => '',
'content' => '<div title="'.io_safe_output($temp['name']).'">'.ui_print_truncate_text(io_safe_output($temp['name']), 20).'</div>', 'content' => '<div title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>',
], ],
true true
); );
@ -615,7 +615,6 @@ class AgentsAlerts extends HTML
echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine); echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine);
} }
} }
}
if (($this->horOffset + $block) < $ntemplates) { if (($this->horOffset + $block) < $ntemplates) {
$new_hor_offset = ($this->horOffset + $block); $new_hor_offset = ($this->horOffset + $block);
@ -651,7 +650,7 @@ class AgentsAlerts extends HTML
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>'; echo '<tr>';
// Name of the agent. // Name of the agent.
echo '<td class="bolder right">'.$alias['alias'].'</td>'; echo '<td class="bolder" style="text-align: right" >'.$alias['alias'].'</td>';
// Alerts of the agent. // Alerts of the agent.
foreach ($templates as $tid => $tname) { foreach ($templates as $tid => $tname) {
$anyfired = 0; $anyfired = 0;

View File

@ -148,7 +148,8 @@ class ConsoleSupervisor
*/ */
public function runBasic() public function runBasic()
{ {
global $config; // Ensure functions are installed and up to date.
enterprise_hook('cron_extension_install_functions');
/* /*
* PHP configuration warnings: * PHP configuration warnings:
@ -665,7 +666,6 @@ class ConsoleSupervisor
case 'NOTIF.PANDORADB.HISTORICAL': case 'NOTIF.PANDORADB.HISTORICAL':
case 'NOTIF.HISTORYDB.MR': case 'NOTIF.HISTORYDB.MR':
case 'NOTIF.EXT.ELASTICSEARCH': case 'NOTIF.EXT.ELASTICSEARCH':
case 'NOTIF.EXT.LOGSTASH':
case 'NOTIF.METACONSOLE.DB_CONNECTION': case 'NOTIF.METACONSOLE.DB_CONNECTION':
case 'NOTIF.DOWNTIME': case 'NOTIF.DOWNTIME':
case 'NOTIF.UPDATEMANAGER.REGISTRATION': case 'NOTIF.UPDATEMANAGER.REGISTRATION':
@ -1803,7 +1803,6 @@ class ConsoleSupervisor
{ {
global $config; global $config;
// Cannot check logstash, configuration is only available from server.
// Cannot check selenium, configuration is only available from server. // Cannot check selenium, configuration is only available from server.
if (isset($config['log_collector']) if (isset($config['log_collector'])
&& $config['log_collector'] == 1 && $config['log_collector'] == 1

View File

@ -1075,7 +1075,7 @@ class CredentialStore extends Wizard
item.options = '<a href="javascript:" onclick="show_form(\''; item.options = '<a href="javascript:" onclick="show_form(\'';
item.options += id; item.options += id;
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>'; item.options += '\')" ><?php echo html_print_image('images/operation.png', true, ['title' => __('Show')]); ?></a>';
item.options += '<a href="javascript:" onclick="delete_key(\''; item.options += '<a href="javascript:" onclick="delete_key(\'';
item.options += id; item.options += id;

View File

@ -648,7 +648,7 @@ class CustomNetScan extends Wizard
); );
$form['inputs'][] = [ $form['inputs'][] = [
'label' => __('Explanation').'<span id="spinner_recon_script" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>', 'label' => __('Explanation').'<span id="spinner_recon_script" style="display: none">'.html_print_image('images/spinner.gif', true).'</span>',
'arguments' => [ 'arguments' => [
'type' => 'textarea', 'type' => 'textarea',
'rows' => 4, 'rows' => 4,
@ -656,7 +656,8 @@ class CustomNetScan extends Wizard
'name' => 'explanation', 'name' => 'explanation',
'value' => $explanation, 'value' => $explanation,
'return' => true, 'return' => true,
'class' => 'discovery_textarea_input w388px', 'class' => 'w388px discovery_textarea_input',
'style' => 'width: 388px',
], ],
]; ];

View File

@ -787,8 +787,40 @@ class HTML
} }
if (isset($data['form']) === true) { if (isset($data['form']) === true) {
$output_head .= '<form name="'.$form['name'].'" id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head .= '<form ';
$output_head .= '" '.$form['extra'].'>'; if (isset($form['name']) === true) {
$output_head .= 'name="'.$form['name'].'" ';
}
if (isset($form['id']) === true) {
$output_head .= 'id="'.$form['id'].'" ';
}
if (isset($form['class']) === true) {
$output_head .= 'class="discovery '.$form['class'].'" ';
}
if (isset($form['onsubmit']) === true) {
$output_head .= 'onsubmit="'.$form['onsubmit'].'" ';
}
if (isset($form['enctype']) === true) {
$output_head .= 'enctype="'.$form['enctype'].'" ';
}
if (isset($form['action']) === true) {
$output_head .= 'action="'.$form['action'].'" ';
}
if (isset($form['method']) === true) {
$output_head .= 'method="'.$form['method'].'" ';
}
if (isset($form['extra']) === true) {
$output_head .= $form['extra'];
}
$output_head .= '>';
} }
if ($return === false) { if ($return === false) {

View File

@ -236,6 +236,7 @@ class HelpFeedBack extends Wizard
*/ */
public function sendMailMethod() public function sendMailMethod()
{ {
global $config;
$suggestion = get_parameter('type', 'false'); $suggestion = get_parameter('type', 'false');
$feedback_text = get_parameter('feedback_text', null); $feedback_text = get_parameter('feedback_text', null);
$feedback_mail = get_parameter('feedback_email', null); $feedback_mail = get_parameter('feedback_email', null);

View File

@ -47,8 +47,8 @@ class ManageNetScanScripts extends Wizard
* @var array * @var array
*/ */
public $pageLabels = [ public $pageLabels = [
'List net scan scripts', 'List NetScan scripts',
'Operation net scan cripts', 'Operation NetScan scripts',
]; ];
@ -605,7 +605,7 @@ class ManageNetScanScripts extends Wizard
$datam = []; $datam = [];
$datam[0] = __('Description'); $datam[0] = __('Description');
$datam[0] .= "<span class='normal'> ( "; $datam[0] .= "<span class='normal_weight'> ( ";
$datam[0] .= $macro_name; $datam[0] .= $macro_name;
$datam[0] .= ' )</span>'; $datam[0] .= ' )</span>';
$datam[0] .= html_print_input_hidden( $datam[0] .= html_print_input_hidden(
@ -634,7 +634,7 @@ class ManageNetScanScripts extends Wizard
} }
$datam[2] = __('Default value'); $datam[2] = __('Default value');
$datam[2] .= "<span class='normal'> ( "; $datam[2] .= "<span class='normal_weight'> ( ";
$datam[2] .= $macro_name; $datam[2] .= $macro_name;
$datam[2] .= ' ) </span>'; $datam[2] .= ' ) </span>';
$datam[3] = html_print_input_text_extended( $datam[3] = html_print_input_text_extended(
@ -688,7 +688,7 @@ class ManageNetScanScripts extends Wizard
$datam = []; $datam = [];
$datam[0] = __('Help'); $datam[0] = __('Help');
$datam[0] .= "<span class='normal'> ( "; $datam[0] .= "<span class='normal_weight'> ( ";
$datam[0] .= $macro_name; $datam[0] .= $macro_name;
$datam[0] .= ' )</span><br><br><br>'; $datam[0] .= ' )</span><br><br><br>';

View File

@ -3062,7 +3062,7 @@ class NetworkMap
$table->data['template_row']['node_target'] = ''; $table->data['template_row']['node_target'] = '';
$table->data['template_row']['edit'] = ''; $table->data['template_row']['edit'] = '';
$table->data['template_row']['edit'] .= '<span class="edit_icon_correct invisible">'.html_print_image('images/dot_green.png', true).'</span><span class="edit_icon_fail invisible" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress invisible">'.html_print_image('images/spinner.gif', true).'</span><span class="edit_icon"><a class="edit_icon_link" title="'.__('Update').'" href="#">'.html_print_image('images/config.png', true).'</a></span>'; $table->data['template_row']['edit'] .= '<span class="edit_icon_correct" style="display: none">'.html_print_image('images/dot_green.png', true).'</span><span class="edit_icon_fail" style="display: none" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress" style="display: none">'.html_print_image('images/spinner.gif', true).'</span><span class="edit_icon"><a class="edit_icon_link" title="'.__('Update').'" href="#">'.html_print_image('images/config.png', true).'</a></span>';
$table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.png', true).'</a>'; $table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.png', true).'</a>';

View File

@ -104,7 +104,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Tactical View'), 'name' => __('Tactical View'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/op_monitoring.menu_gray.png' 'images/menu/op_monitoring.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=view&sec2=operation/agentes/tactical' 'index.php?sec=view&sec2=operation/agentes/tactical'
@ -122,7 +122,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Agent Management'), 'name' => __('Agent Management'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_resources.menu_gray.png' 'images/menu/gm_resources.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente' 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'
@ -140,7 +140,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('General Setup'), 'name' => __('General Setup'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_setup.menu_gray.png' 'images/menu/gm_setup.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=general&sec2=godmode/setup/setup&section=general' 'index.php?sec=general&sec2=godmode/setup/setup&section=general'
@ -156,7 +156,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Manage Policies'), 'name' => __('Manage Policies'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_configuration.menu_gray.png' 'images/menu/gm_configuration.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies' 'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies'
@ -170,7 +170,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('List Alerts'), 'name' => __('List Alerts'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_alerts.menu_gray.png' 'images/menu/gm_alerts.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=galertas&sec2=godmode/alerts/alert_list' 'index.php?sec=galertas&sec2=godmode/alerts/alert_list'
@ -194,7 +194,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('View Events'), 'name' => __('View Events'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/op_events.menu_gray.png' 'images/menu/op_events.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=eventos&sec2=operation/events/events' 'index.php?sec=eventos&sec2=operation/events/events'
@ -218,7 +218,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Dashboard'), 'name' => __('Dashboard'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/op_reporting.menu_gray.png' 'images/menu/op_reporting.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=reporting&sec2=operation/dashboard/dashboard' 'index.php?sec=reporting&sec2=operation/dashboard/dashboard'
@ -232,7 +232,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Visual Console'), 'name' => __('Visual Console'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/op_network.menu_gray.png' 'images/menu/op_network.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=network&sec2=godmode/reporting/map_builder' 'index.php?sec=network&sec2=godmode/reporting/map_builder'
@ -246,7 +246,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Manage Servers'), 'name' => __('Manage Servers'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_servers.menu_gray.png' 'images/menu/gm_servers.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/modificar_server' 'index.php?sec=gservers&sec2=godmode/servers/modificar_server'
@ -260,7 +260,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Edit User'), 'name' => __('Edit User'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_users.menu_gray.png' 'images/menu/gm_users.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=workspace&sec2=operation/users/user_edit' 'index.php?sec=workspace&sec2=operation/users/user_edit'
@ -270,7 +270,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Tree View'), 'name' => __('Tree View'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/op_monitoring.menu_gray.png' 'images/menu/op_monitoring.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=view&sec2=operation/tree' 'index.php?sec=view&sec2=operation/tree'
@ -280,7 +280,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Network Component'), 'name' => __('Network Component'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_configuration.menu_gray.png' 'images/menu/gm_configuration.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components' 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components'
@ -294,7 +294,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Task List'), 'name' => __('Task List'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_discovery.menu.png' 'images/menu/gm_discovery.menu.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist' 'index.php?sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist'
@ -338,7 +338,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Update Manager'), 'name' => __('Update Manager'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/um_messages.menu_gray.png' 'images/menu/um_messages.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup' 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup'
@ -352,7 +352,7 @@ class OrderInterpreter extends Wizard
[ [
'name' => __('Manage Agent Groups'), 'name' => __('Manage Agent Groups'),
'icon' => ui_get_full_url( 'icon' => ui_get_full_url(
'images/gm_users.menu_gray.png' 'images/menu/gm_users.menu_gray.png'
), ),
'url' => ui_get_full_url( 'url' => ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=groups' 'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=groups'

View File

@ -20,8 +20,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC210318'; $build_version = 'PC210330';
$pandora_version = 'v7.0NG.752'; $pandora_version = 'v7.0NG.753';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();
@ -52,6 +52,10 @@ if ((int) $develop_bypass === 1) {
} }
ini_set('display_errors', 1); ini_set('display_errors', 1);
} else {
// Leave user decide error_level, but limit errors to be displayed only in
// logs.
ini_set('display_errors', 0);
} }
// Check if mysqli is available // Check if mysqli is available
@ -93,7 +97,7 @@ require_once $ownDir.'functions.php';
// We need a timezone BEFORE calling config_process_config. // We need a timezone BEFORE calling config_process_config.
// If not we will get ugly warnings. Set Europe/Madrid by default // If not we will get ugly warnings. Set Europe/Madrid by default
// Later will be replaced by the good one. // Later will be replaced by the good one.
if (!is_dir($_SERVER['DOCUMENT_ROOT'].$config['homeurl']) || !is_dir($_SERVER['DOCUMENT_ROOT'].$config['homeurl_static'])) { if (!is_dir($config['homedir'])) {
$url = explode('/', $_SERVER['REQUEST_URI']); $url = explode('/', $_SERVER['REQUEST_URI']);
$flag_url = 0; $flag_url = 0;
foreach ($url as $key => $value) { foreach ($url as $key => $value) {

View File

@ -1496,6 +1496,7 @@ function db_run_sql_file($location)
// Undo results // Undo results
} }
$config['db_run_sql_file_error'] = $mysqli->error;
return false; return false;
} }
} }

View File

@ -149,7 +149,7 @@ function agents_locate_agent(string $field)
* *
* @param string $alias Agent alias. * @param string $alias Agent alias.
* *
* @return integer Id from the agent. * @return array|boolean Agents ids or false if error.
*/ */
function agents_get_agent_id_by_alias($alias) function agents_get_agent_id_by_alias($alias)
{ {

View File

@ -1864,10 +1864,14 @@ function api_get_custom_field_id($t1, $t2, $other, $returnType)
* @param $thrast2 Don't use. * @param $thrast2 Don't use.
* @param $thrash3 Don't use. * @param $thrash3 Don't use.
*/ */
function api_set_delete_agent($id, $thrash1, $other, $thrash3) function api_set_delete_agent($id, $thrash1, $other, $returnType)
{ {
global $config; global $config;
if (empty($returnType)) {
$returnType = 'string';
}
$agent_by_alias = false; $agent_by_alias = false;
if ($other['data'][0] === '1') { if ($other['data'][0] === '1') {
@ -1910,7 +1914,7 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
} else { } else {
// Delete only if the centralised mode is disabled. // Delete only if the centralised mode is disabled.
$headers = getallheaders(); $headers = getallheaders();
if (isset($headers['idk']) === false || is_management_allowed($headers['idk']) === false) { if (isset($headers['idk']) === false && is_management_allowed($headers['idk']) === false) {
returnError('centralized'); returnError('centralized');
exit; exit;
} }
@ -1934,19 +1938,27 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
} }
} }
} else { } else {
$idAgent = agents_get_agent_id($id, true); $idAgent = agents_get_agent_id($id, false);
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) { if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
return; return;
} }
$result = agents_delete_agent($idAgent, true); $result = agents_delete_agent($idAgent, false);
} }
} }
if (!$result) { if ($result === false) {
returnError('The agent could not be deleted'); if ($returnType !== 'string') {
return false;
}
returnError('The agent could not be deleted', $returnType);
} else { } else {
returnData('string', ['type' => 'string', 'data' => __('The agent was successfully deleted')]); if ($returnType !== 'string') {
return true;
}
returnData($returnType, ['type' => 'string', 'data' => __('The agent was successfully deleted')]);
} }
} }
@ -6980,114 +6992,6 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
} }
/**
* Add data module to policy. And return id from new module.
*
* @param string $id Id of the target policy.
* @param $thrash1 Don't use.
* @param array $other it's array, $other as param is <module_name>;<id_module_type>;<description>;
* <id_module_group>;<min>;<max>;<post_process>;<module_interval>;<min_warning>;<max_warning>;<str_warning>;
* <min_critical>;<max_critical>;<str_critical>;<history_data>;<configuration_data>;
* <disabled_types_event>;<module_macros>;<ff_threshold>;<each_ff>;<ff_threshold_normal>;
* <ff_threshold_warning>;<ff_threshold_critical>;<ff_timeout> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* example:
*
* api.php?op=set&op2=add_data_module_policy&id=1&other=data_module_policy_example_name~2~data%20module%20created%20by%20Api~2~0~0~50.00~10~20~180~~21~35~~1~module_begin%0dmodule_name%20pandora_process%0dmodule_type%20generic_data%0dmodule_exec%20ps%20aux%20|%20grep%20pandora%20|%20wc%20-l%0dmodule_end&other_mode=url_encode_separator_~
*
* @param $thrash3 Don't use
*/
function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3)
{
if (defined('METACONSOLE')) {
return;
}
if ($id == '') {
returnError('The data module could not be added to policy. Id_policy cannot be left blank.');
return;
}
if (enterprise_hook('policies_check_user_policy', [$id]) === false) {
returnError('forbidden', 'string');
return;
}
if ($other['data'][0] == '') {
returnError('The data module could not be added to policy. Module_name cannot be left blank.');
return;
}
// Check if the module is already in the policy
$name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']);
if ($name_module_policy === ENTERPRISE_NOT_HOOK) {
returnError('The data module could not be added to policy.');
return;
}
$disabled_types_event = [];
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][16];
$disabled_types_event = json_encode($disabled_types_event);
$values = [];
$values['id_tipo_modulo'] = $other['data'][1];
$values['description'] = $other['data'][2];
$values['id_module_group'] = $other['data'][3];
$values['min'] = $other['data'][4];
$values['max'] = $other['data'][5];
$values['post_process'] = $other['data'][6];
$values['module_interval'] = $other['data'][7];
$values['min_warning'] = $other['data'][8];
$values['max_warning'] = $other['data'][9];
$values['str_warning'] = $other['data'][10];
$values['min_critical'] = $other['data'][11];
$values['max_critical'] = $other['data'][12];
$values['str_critical'] = $other['data'][13];
$values['history_data'] = $other['data'][14];
$values['configuration_data'] = $other['data'][15];
$values['disabled_types_event'] = $disabled_types_event;
$values['module_macros'] = $other['data'][17];
$values['min_ff_event'] = $other['data'][18];
$values['each_ff'] = $other['data'][19];
$values['min_ff_event_normal'] = $other['data'][20];
$values['min_ff_event_warning'] = $other['data'][21];
$values['min_ff_event_critical'] = $other['data'][22];
$values['ff_timeout'] = $other['data'][23];
$values['ff_type'] = $other['data'][24];
if ($name_module_policy !== false) {
if ($name_module_policy[0]['name'] == $other['data'][0]) {
returnError(
'The data module could not be added to policy. The module is already in the policy.'
);
return;
}
}
$success = enterprise_hook(
'policies_create_module',
[
$other['data'][0],
$id,
1,
$values,
false,
]
);
if ($success) {
// returnData('string', array('type' => 'string', 'data' => __('Data module added to policy. Is necessary to apply the policy in order to changes take effect.')));
returnData('string', ['type' => 'string', 'data' => $success]);
} else {
returnError('The data module could not be added to policy.');
}
}
/** /**
* Update data module in policy. And return id from new module. * Update data module in policy. And return id from new module.
* *

View File

@ -26,7 +26,12 @@
* ============================================================================ * ============================================================================
*/ */
// Config functions. // Config functions.
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/functions.php';
enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer;
use PandoraFMS\Core\Config;
/** /**
@ -147,6 +152,8 @@ function config_update_config()
} }
$error_update = []; $error_update = [];
$errors = [];
$warnings = [];
$sec2 = get_parameter('sec2'); $sec2 = get_parameter('sec2');
@ -225,10 +232,6 @@ function config_update_config()
$error_update[] = __('Enable Netflow'); $error_update[] = __('Enable Netflow');
} }
if (!config_update_value('activate_nta', (bool) get_parameter_switch('activate_nta'))) {
$error_update[] = __('Enable Network Traffic Analyzer');
}
$timezone = (string) get_parameter('timezone'); $timezone = (string) get_parameter('timezone');
if ($timezone != '') { if ($timezone != '') {
if (!config_update_value('timezone', $timezone)) { if (!config_update_value('timezone', $timezone)) {
@ -1456,14 +1459,18 @@ function config_update_config()
break; break;
case 'hist_db': case 'hist_db':
if (!config_update_value('history_db_enabled', get_parameter('history_db_enabled'))) { if ($config['dbname'] == get_parameter('history_db_name')
$error_update[] = __('Enable history database'); && $config['dbport'] == get_parameter('history_db_port')
} && $config['dbhost'] == io_input_password(get_parameter('history_db_host'))
) {
if (!config_update_value('history_event_enabled', get_parameter('history_event_enabled'))) { // Same definition for active and historical database!
$error_update[] = __('Enable history event'); // This is a critical error.
} $config['error_config_update_config']['correct'] = false;
$config['error_config_update_config']['message'] = __(
'Active and historical database cannot be the same.'
);
return;
} else {
if (!config_update_value('history_db_host', get_parameter('history_db_host'))) { if (!config_update_value('history_db_host', get_parameter('history_db_host'))) {
$error_update[] = __('Host'); $error_update[] = __('Host');
} }
@ -1475,6 +1482,15 @@ function config_update_config()
if (!config_update_value('history_db_name', get_parameter('history_db_name'))) { if (!config_update_value('history_db_name', get_parameter('history_db_name'))) {
$error_update[] = __('Database name'); $error_update[] = __('Database name');
} }
}
if (!config_update_value('history_db_enabled', get_parameter('history_db_enabled'))) {
$error_update[] = __('Enable history database');
}
if (!config_update_value('history_event_enabled', get_parameter('history_event_enabled'))) {
$error_update[] = __('Enable history event');
}
if (!config_update_value('history_db_user', get_parameter('history_db_user'))) { if (!config_update_value('history_db_user', get_parameter('history_db_user'))) {
$error_update[] = __('Database user'); $error_update[] = __('Database user');
@ -1515,6 +1531,68 @@ function config_update_config()
) { ) {
$error_update[] = __('Delay'); $error_update[] = __('Delay');
} }
if ((bool) $config['history_db_enabled'] === true) {
$dbm = new DBMaintainer(
[
'host' => $config['history_db_host'],
'port' => $config['history_db_port'],
'name' => $config['history_db_name'],
'user' => $config['history_db_user'],
'pass' => $config['history_db_pass'],
]
);
// Performs several checks and installs if needed.
if ($dbm->checkDatabaseDefinition() === true
&& $dbm->isInstalled() === false
) {
// Target is ready but several tasks are pending.
$dbm->process();
} else if ($dbm->check() !== true) {
$errors[] = $dbm->getLastError();
}
}
// Historical configuration tokens (stored in historical db).
if (Config::set(
'days_purge',
get_parameter('history_dbh_purge'),
true
) !== true
) {
$error_update[] = __('Historical database purge');
}
if (Config::set(
'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0),
true
) !== true
) {
$error_update[] = __('Historical database partitions');
}
if (Config::set(
'event_purge',
get_parameter('history_dbh_events_purge'),
true
) !== true
) {
$error_update[] = __('Historical database events purge');
}
if (Config::set(
'string_purge',
get_parameter('history_dbh_string_purge'),
true
) !== true
) {
$error_update[] = __('Historical database string purge');
}
// Disable history db in history db.
Config::set('history_db_enabled', 0, true);
break; break;
case 'ehorus': case 'ehorus':
@ -1689,6 +1767,14 @@ function config_update_config()
$config['error_config_update_config']['correct'] = true; $config['error_config_update_config']['correct'] = true;
} }
if (count($errors) > 0) {
$config['error_config_update_config']['errors'] = $errors;
}
if (count($warnings) > 0) {
$config['error_config_update_config']['warnings'] = $warnings;
}
enterprise_include_once('include/functions_policies.php'); enterprise_include_once('include/functions_policies.php');
$enterprise = enterprise_include_once('include/functions_skins.php'); $enterprise = enterprise_include_once('include/functions_skins.php');
if ($enterprise !== ENTERPRISE_NOT_HOOK) { if ($enterprise !== ENTERPRISE_NOT_HOOK) {
@ -2369,10 +2455,6 @@ function config_process_config()
config_update_value('activate_netflow', 0); config_update_value('activate_netflow', 0);
} }
if (!isset($config['activate_nta'])) {
config_update_value('activate_nta', 0);
}
if (!isset($config['netflow_path'])) { if (!isset($config['netflow_path'])) {
if ($is_windows) { if ($is_windows) {
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow'; $default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';
@ -3229,7 +3311,7 @@ function get_um_url()
*/ */
function config_return_in_bytes($val) function config_return_in_bytes($val)
{ {
$val = trim($val); $val = (int) trim($val);
$last = strtolower($val[(strlen($val) - 1)]); $last = strtolower($val[(strlen($val) - 1)]);
switch ($last) { switch ($last) {
// The 'G' modifier is available since PHP 5.1.0. // The 'G' modifier is available since PHP 5.1.0.

View File

@ -113,7 +113,7 @@ function custom_graphs_create(
* @param $returnAllGroup Wheter to return graphs of group All or not. * @param $returnAllGroup Wheter to return graphs of group All or not.
* @param $privileges Privileges to check in user group * @param $privileges Privileges to check in user group
* *
* @return Custom graphs of a an user. Empty array if none. * @return array graphs of a an user. Empty array if none.
*/ */
function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=true, $privileges='RR') function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=true, $privileges='RR')
{ {

View File

@ -675,6 +675,33 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* *
* @param array $fields Fields to retrieve. * @param array $fields Fields to retrieve.
* @param array $filter Filters to be applied. * @param array $filter Filters to be applied.
* Available filters:
* [
* 'date_from'
* 'time_from'
* 'date_to'
* 'time_to'
* 'event_view_hr'
* 'id_agent'
* 'event_type'
* 'severity'
* 'id_group_filter'
* 'status'
* 'agent_alias'
* 'search'
* 'id_extra'
* 'id_source_event'
* 'user_comment'
* 'source'
* 'id_user_ack'
* 'tag_with'
* 'tag_without'
* 'filter_only_alert'
* 'module_search'
* 'group_rep'
* 'server_id'
* ].
*
* @param integer $offset Offset (pagination). * @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination). * @param integer $limit Limit (pagination).
* @param string $order Sort order. * @param string $order Sort order.
@ -683,6 +710,8 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* @param boolean $return_sql Return SQL (true) or execute it (false). * @param boolean $return_sql Return SQL (true) or execute it (false).
* @param string $having Having filter. * @param string $having Having filter.
* @param boolean $validatedEvents If true, evaluate validated events. * @param boolean $validatedEvents If true, evaluate validated events.
* @param boolean $recursiveGroups If true, filtered groups and their children
* will be search.
* *
* @return array Events. * @return array Events.
* @throws Exception On error. * @throws Exception On error.
@ -697,7 +726,8 @@ function events_get_all(
$history=false, $history=false,
$return_sql=false, $return_sql=false,
$having='', $having='',
$validatedEvents=false $validatedEvents=false,
$recursiveGroups=true
) { ) {
global $config; global $config;
@ -873,17 +903,56 @@ function events_get_all(
} }
$groups = $filter['id_group_filter']; $groups = $filter['id_group_filter'];
if (isset($groups) === true && $groups > 0) { if ((bool) $user_is_admin === false
$children = groups_get_children($groups); && isset($groups) === false
) {
// Not being filtered by group but not an admin, limit results.
$groups = array_keys(users_get_groups(false, 'AR'));
}
if (isset($groups) === true
&& (is_array($groups) === true || ($groups > 0))
) {
if ($recursiveGroups === true) {
// Add children groups.
$children = [];
if (is_array($groups) === true) {
foreach ($groups as $g) {
$children = array_merge(
groups_get_children($g),
$children
);
}
} else {
$children = groups_get_children($groups);
}
if (is_array($groups) === true) {
$_groups = $groups;
} else {
$_groups = [ $groups ]; $_groups = [ $groups ];
}
if (empty($children) === false) { if (empty($children) === false) {
foreach ($children as $child) { foreach ($children as $child) {
$_groups[] = (int) $child['id_grupo']; $_groups[] = (int) $child['id_grupo'];
} }
} }
if ((bool) $user_is_admin === false) {
$user_groups = users_get_groups(false, 'AR');
$_groups = array_intersect(
$_groups,
array_keys($user_groups)
);
}
$groups = $_groups; $groups = $_groups;
}
if (is_array($groups) === false) {
$groups = [ $groups ];
}
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))', ' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
@ -1466,6 +1535,8 @@ function events_get_all(
/** /**
* @deprecated Use events_get_all instead.
*
* Get all rows of events from the database, that * Get all rows of events from the database, that
* pass the filter, and can get only some fields. * pass the filter, and can get only some fields.
* *
@ -1502,7 +1573,9 @@ function events_get_all(
*/ */
function events_get_events($filter=false, $fields=false) function events_get_events($filter=false, $fields=false)
{ {
if ($filter['criticity'] == EVENT_CRIT_WARNING_OR_CRITICAL) { if (isset($filter['criticity']) === true
&& (int) $filter['criticity'] === EVENT_CRIT_WARNING_OR_CRITICAL
) {
$filter['criticity'] = [ $filter['criticity'] = [
EVENT_CRIT_WARNING, EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL, EVENT_CRIT_CRITICAL,
@ -4256,7 +4329,7 @@ function events_page_details($event, $server='')
if (!empty($agent)) { if (!empty($agent)) {
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Name').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Name').'</div>';
if (can_user_access_node() && is_metaconsole() && empty($event['server_id']) === true) { if (can_user_access_node() && is_metaconsole() && empty($event['server_id']) === true) {
$data[1] = ui_print_truncate_text( $data[1] = ui_print_truncate_text(
$agent['alias'], $agent['alias'],
@ -4289,12 +4362,12 @@ function events_page_details($event, $server='')
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('IP Address').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('IP Address').'</div>';
$data[1] = empty($agent['direccion']) ? '<i>'.__('N/A').'</i>' : $agent['direccion']; $data[1] = empty($agent['direccion']) ? '<i>'.__('N/A').'</i>' : $agent['direccion'];
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('OS').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('OS').'</div>';
$data[1] = ui_print_os_icon($agent['id_os'], true, true); $data[1] = ui_print_os_icon($agent['id_os'], true, true);
if (!empty($agent['os_version'])) { if (!empty($agent['os_version'])) {
$data[1] .= ' ('.$agent['os_version'].')'; $data[1] .= ' ('.$agent['os_version'].')';
@ -4303,17 +4376,17 @@ function events_page_details($event, $server='')
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Last contact').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Last contact').'</div>';
$data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : ui_print_timestamp($agent['ultimo_contacto'], true); $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : ui_print_timestamp($agent['ultimo_contacto'], true);
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Last remote contact').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Last remote contact').'</div>';
$data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent['ultimo_contacto_remoto']); $data[1] = ($agent['ultimo_contacto_remoto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent['ultimo_contacto_remoto']);
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Custom fields').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Custom fields').'</div>';
$data[1] = html_print_button( $data[1] = html_print_button(
__('View custom fields'), __('View custom fields'),
'custom_button', 'custom_button',
@ -4345,13 +4418,13 @@ function events_page_details($event, $server='')
if (!empty($module)) { if (!empty($module)) {
// Module name. // Module name.
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Name').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Name').'</div>';
$data[1] = $module['nombre']; $data[1] = $module['nombre'];
$table_details->data[] = $data; $table_details->data[] = $data;
// Module group. // Module group.
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Module group').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Module group').'</div>';
$id_module_group = $module['id_module_group']; $id_module_group = $module['id_module_group'];
if ($id_module_group == 0) { if ($id_module_group == 0) {
$data[1] = __('No assigned'); $data[1] = __('No assigned');
@ -4388,7 +4461,7 @@ function events_page_details($event, $server='')
if ($acl_graph) { if ($acl_graph) {
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Graph').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Graph').'</div>';
$module_type = -1; $module_type = -1;
if (isset($module['module_type'])) { if (isset($module['module_type'])) {
@ -4437,7 +4510,7 @@ function events_page_details($event, $server='')
if ($event['id_alert_am'] != 0) { if ($event['id_alert_am'] != 0) {
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Source').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Source').'</div>';
$data[1] = '<a href="'.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert'.$hashstring.'">'; $data[1] = '<a href="'.$serverstring.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event['id_agente'].'&amp;tab=alert'.$hashstring.'">';
$standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']); $standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']);
if (!$standby) { if (!$standby) {
@ -4469,7 +4542,7 @@ function events_page_details($event, $server='')
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];
$data[0] = '<div class="normal-weight mrgn_lft_20px">'.__('Priority').'</div>'; $data[0] = '<div class="normal_weight mrgn_lft_20px">'.__('Priority').'</div>';
$priority_code = db_get_value('priority', 'talert_template_modules', 'id', $event['id_alert_am']); $priority_code = db_get_value('priority', 'talert_template_modules', 'id', $event['id_alert_am']);
$alert_priority = get_priority_name($priority_code); $alert_priority = get_priority_name($priority_code);
@ -7409,3 +7482,40 @@ function events_get_instructions($event)
return $output; return $output;
} }
/**
* Return class name matching criticity received.
*
* @param integer $criticity Event's criticity.
*
* @return string
*/
function events_get_criticity_class($criticity)
{
switch ($criticity) {
case EVENT_CRIT_CRITICAL:
return 'datos_red';
case EVENT_CRIT_MAINTENANCE:
return 'datos_grey';
case EVENT_CRIT_INFORMATIONAL:
return 'datos_blue';
case EVENT_CRIT_MAJOR:
return 'datos_pink';
case EVENT_CRIT_MINOR:
return 'datos_pink';
case EVENT_CRIT_NORMAL:
return 'datos_green';
case EVENT_CRIT_WARNING:
return 'datos_yellow';
default:
return 'datos_blue';
}
}

View File

@ -467,10 +467,9 @@ function html_print_select_groups(
$output = ''; $output = '';
global $config; global $config;
if ($config['style'] === 'pandora') {
$select2_css = 'select2.min'; $select2_css = 'select2.min';
} else {
if ($config['style'] === 'pandora_black') {
$select2_css = 'select2_dark.min'; $select2_css = 'select2_dark.min';
} }
@ -576,6 +575,10 @@ function html_print_select_groups(
$required $required
); );
if ($required !== false) {
$require_message = __('Please select an item from this list.');
}
if (empty($size) === true) { if (empty($size) === true) {
$size = '100%'; $size = '100%';
} }
@ -629,6 +632,25 @@ function html_print_select_groups(
} }
} }
}); });
<?php
if ($required !== false) {
?>
$(this).on('change', function(e) {
e.currentTarget.setCustomValidity('');
})
$(this).on('invalid', function(e) {
if ($(e.currentTarget).val() == null) {
e.currentTarget.setCustomValidity(
'<?php echo $require_message; ?>'
);
}
})
<?php
}
?>
} }
); );
@ -2194,24 +2216,26 @@ function html_print_input_text_extended(
/** /**
* Render an input password element. * Render a section <div> html element.
* *
* The element will have an id like: "password-$name" * @param array $options Parameters:
*
* @param mixed parameters:
* - id: string * - id: string
* - style: string * - style: string
* - class: string
* - title: string
* - hidden: boolean * - hidden: boolean
* - content: string * - content: string.
* @param bool return or echo flag * @param boolean $return Return or echo flag.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_div($options, $return=false) function html_print_div(
{ array $options,
bool $return=false
) {
$output = '<div'; $output = '<div';
// Valid attributes (invalid attributes get skipped) // Valid attributes (invalid attributes get skipped).
$attrs = [ $attrs = [
'id', 'id',
'style', 'style',
@ -2248,13 +2272,14 @@ function html_print_div($options, $return=false)
/** /**
* Render an anchor html element. * Render an anchor <a> html element.
* *
* @param array $options Parameters * @param array $options Parameters
* - id: string * - id: string.
* - style: string * - style: string.
* - title: string * - title: string.
* - href: string. * - href: string.
* - content: string.
* @param boolean $return Return or echo flag. * @param boolean $return Return or echo flag.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.

View File

@ -227,7 +227,7 @@ function io_safe_output_array(&$item, $key=false, $utf8=true)
* @param string|array $value String or array of strings to be cleaned. * @param string|array $value String or array of strings to be cleaned.
* @param boolean $utf8 Flag, set the output encoding in utf8, by default true. * @param boolean $utf8 Flag, set the output encoding in utf8, by default true.
* *
* @return string * @return mixed
*/ */
function io_safe_output($value, $utf8=true) function io_safe_output($value, $utf8=true)
{ {

View File

@ -21,70 +21,6 @@
// Write here requires and definitions. // Write here requires and definitions.
/**
* Get the tnetwok_matrix summatory data.
*
* @param integer $top Number of hosts to show.
* @param boolean $talker Talker (true) or listetener (false).
* @param integer $start Utimestamp of start time.
* @param integer $end Utimestamp of end time.
* @param string $ip_filter Ip to filter.
* @param boolean $order_by_bytes True by top by bytes. False by packets.
* @param array $host_filter Host filter array.
*
* @return array With requested data.
*/
function network_matrix_get_top(
$top,
$talker,
$start,
$end,
$ip_filter='',
$order_by_bytes=true,
$host_filter=[]
) {
$field_to_group = ($talker === true) ? 'source' : 'destination';
$field_to_order = ($order_by_bytes === true) ? 'sum_bytes' : 'sum_pkts';
$filter_sql = '';
if (!empty($ip_filter)) {
$filter_field = ($talker === true) ? 'destination' : 'source';
$filter_sql = sprintf('AND %s="%s"', $filter_field, $ip_filter);
}
$host_filter_sql = '';
if (!empty($host_filter)) {
$host_filter_sql = sprintf(
' AND %s IN ("%s")',
$field_to_group,
implode('","', $host_filter)
);
}
$sql = sprintf(
'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
FROM tnetwork_matrix
WHERE utimestamp > %d AND utimestamp < %d
%s
%s
GROUP BY %s
ORDER BY %s DESC
LIMIT %d',
$field_to_group,
$start,
$end,
$filter_sql,
$host_filter_sql,
$field_to_group,
$field_to_order,
$top
);
$data = db_get_all_rows_sql($sql);
return ($data !== false) ? $data : [];
}
/** /**
* Get the possible actions on networking. * Get the possible actions on networking.
* *
@ -169,84 +105,6 @@ function network_format_bytes($value)
} }
/**
* Build netflow data structure to network map.
*
* @param integer $start Time in timestamp format.
* @param integer $end Time in timestamp format.
* @param integer $top Max data to show.
* @param boolean $talker True to get top tolkers. False for listeners.
*
* @return array With map structure.
*/
function network_build_map_data($start, $end, $top, $talker)
{
$data = network_matrix_get_top($top, $talker, $start, $end);
$hosts = array_map(
function ($elem) {
return $elem['host'];
},
$data
);
$inverse_hosts = array_flip($hosts);
$nodes = array_map(
function ($elem) {
return network_init_node_map($elem);
},
$hosts
);
$relations = [];
$orphan_relations = [];
foreach ($hosts as $host) {
$host_top = network_matrix_get_top(
$top,
!$talker,
$start,
$end,
$host,
true,
$hosts
);
foreach ($host_top as $sd) {
$src_index = $inverse_hosts[$host];
$dst_index = $inverse_hosts[$sd['host']];
if (isset($src_index) === false || isset($dst_index) === false) {
continue;
}
network_init_relation_map(
$relations,
$src_index,
$dst_index,
network_format_bytes($sd['sum_bytes'])
);
}
// Put the orphans on Other node.
if (empty($host_top)) {
$other_id = (end($inverse_hosts) + 1);
// TODOS: Add the data.
network_init_relation_map(
$orphan_relations,
$other_id,
$inverse_hosts[$host]
);
}
}
// Put the Others node and their relations.
if (empty($orphan_relations) === false) {
$nodes[] = network_init_node_map(__('Others'));
$relations = array_merge($relations, $orphan_relations);
}
return network_general_map_configuration($nodes, $relations);
}
/** /**
* Return the array to pass to constructor to NetworkMap. * Return the array to pass to constructor to NetworkMap.
* *

View File

@ -1080,6 +1080,27 @@ function notifications_print_dropdown_element($message_info)
break; break;
} }
$split_subject = explode(' ', io_safe_output($message_info['subject']));
$is_image = false;
$img = '';
foreach ($split_subject as $item) {
if ($is_image) {
if (preg_match('/src/', $item)) {
$img .= $item.' >';
$is_image = false;
}
}
if (preg_match('/img/', $item)) {
$img = '<img ';
$is_image = true;
}
}
if ($img !== '') {
$message_info['subject'] = io_safe_input($img);
}
return sprintf( return sprintf(
"<a "<a
class='notification-item' class='notification-item'

View File

@ -851,14 +851,6 @@ function reporting_make_reporting_data(
); );
break; break;
case 'nt_top_n':
$report['contents'][] = reporting_nt_top_n_report(
$report,
$content,
$pdf
);
break;
default: default:
// Default. // Default.
break; break;
@ -12815,7 +12807,7 @@ function reporting_get_stats_servers()
$tdata[0] = html_print_image('images/database.png', true, ['title' => __('Local modules'), 'class' => 'invert_filter']); $tdata[0] = html_print_image('images/database.png', true, ['title' => __('Local modules'), 'class' => 'invert_filter']);
$tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_local_modules']).'</span>'; $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_local_modules']).'</span>';
$tdata[2] = '<span class="med_data">'.format_numeric($server_performance['local_modules_rate'], 2).'</span>'; $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['local_modules_rate'], 2).'</span>';
$tdata[3] = html_print_image('images/database.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec </span>'; $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec </span>';
$table_srv->rowclass[] = ''; $table_srv->rowclass[] = '';
$table_srv->data[] = $tdata; $table_srv->data[] = $tdata;
@ -13580,43 +13572,6 @@ function reporting_header_table_for_pdf($title='', $description='')
} }
/**
* Build the required data to build network traffic top N report
*
* @param int Period (time window).
* @param array Information about the item of report.
* @param bool Pdf or not
*
* @return array With report presentation info and report data.
*/
function reporting_nt_top_n_report($period, $content, $pdf)
{
$return = [];
$return['type'] = 'nt_top_n';
$return['title'] = $content['name'];
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['description'] = $content['description'];
// Get the data sent and received
$return['data'] = [];
$start_time = ($period['datetime'] - (int) $content['period']);
$return['data']['send'] = network_matrix_get_top(
$content['top_n_value'],
true,
$start_time,
$period['datetime']
);
$return['data']['recv'] = network_matrix_get_top(
$content['top_n_value'],
false,
$start_time,
$period['datetime']
);
return $return;
}
/** /**
* Will display an hourly analysis of the selected period. * Will display an hourly analysis of the selected period.
* *

View File

@ -403,10 +403,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_enterprise_html_SLA_monthly($table, $item, $mini); reporting_enterprise_html_SLA_monthly($table, $item, $mini);
break; break;
case 'nt_top_n':
reporting_html_nt_top_n($table, $item, $mini);
break;
case 'SLA_weekly': case 'SLA_weekly':
reporting_enterprise_html_SLA_weekly($table, $item, $mini); reporting_enterprise_html_SLA_weekly($table, $item, $mini);
break; break;
@ -5018,25 +5014,25 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]); $agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]);
$agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span class='red_color font_12pt bolder'>".format_numeric($data['agent_critical']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span class='red_color font_12pt bolder big_data'>".format_numeric($data['agent_critical']).'</span></b></a>';
$agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]); $agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]);
$agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span class='yellow_color font_12pt bolder'>".format_numeric($data['agent_warning']).'</span></b></a>'; $agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span class='yellow_color font_12pt bolder big_data'>".format_numeric($data['agent_warning']).'</span></b></a>';
$table_agent->data[] = $agent_data; $table_agent->data[] = $agent_data;
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]); $agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]);
$agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span class='green_color font_12pt bolder'>".format_numeric($data['agent_ok']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span class='green_color font_12pt bolder big_data'>".format_numeric($data['agent_ok']).'</span></b></a>';
$agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]); $agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]);
$agent_data[3] = "<a style='color: ".COL_UNKNOWN.";' href='".$links['agents_unknown']."'><b><span class='grey_color font_12pt bolder'>".format_numeric($data['agent_unknown']).'</span></b></a>'; $agent_data[3] = "<a style='color: ".COL_UNKNOWN.";' href='".$links['agents_unknown']."'><b><span class='grey_color font_12pt bolder big_data'>".format_numeric($data['agent_unknown']).'</span></b></a>';
$table_agent->data[] = $agent_data; $table_agent->data[] = $agent_data;
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]); $agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder'>".format_numeric($data['agent_not_init']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
$agent_data[2] = ''; $agent_data[2] = '';
$agent_data[3] = ''; $agent_data[3] = '';
@ -5591,65 +5587,6 @@ function reporting_get_event_histogram_meta($width)
} }
/**
* Print network traffic data into top n tables
* (one for received data and another for sent)
*
* @param stdClass Table class to paint the report
* @param array Associative array with info about
* @param bool Unused
*/
function reporting_html_nt_top_n($table, $item, $mini)
{
// Prepare the table
$table_top = new stdClass();
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->cellpadding = 0;
$table_top->cellspacing = 0;
$table_top->width = '100%';
$table_top->class = 'databox data';
$table_top->head['host'] = __('Agent');
$table_top->head['bytes'] = __('Kilobytes');
$table_top->head['pkts'] = __('Packages');
// Build the table for sent packages
if (empty($item['data']['send'])) {
$table->data['send_title'] = '<h3>'.__('No network traffic sent data').'</h3>';
} else {
foreach ($item['data']['send'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['send_title'] = '<h3>'.__('Network traffic sent').'</h3>';
$table->data['send'] = html_print_table($table_top, true);
}
// Reset the table and build the table for received packages
$table_top->data = [];
if (empty($item['data']['send'])) {
$table->data['recv_title'] = '<h3>'.__('No network traffic received data').'</h3>';
} else {
foreach ($item['data']['recv'] as $s_item) {
$table_top->data[] = [
'host' => $s_item['host'],
'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
];
}
$table->data['recv_title'] = '<h3>'.__('Network traffic received').'</h3>';
$table->data['recv'] = html_print_table($table_top, true);
}
}
function reporting_html_planned_downtimes_table($planned_downtimes) function reporting_html_planned_downtimes_table($planned_downtimes)
{ {
global $config; global $config;

View File

@ -891,13 +891,6 @@ function reports_get_report_types($template=false, $not_editor=false)
]; ];
} }
if (!is_metaconsole()) {
$types['nt_top_n'] = [
'optgroup' => __('Network traffic'),
'name' => __('Network Traffic Top N'),
];
}
if ($template === false) { if ($template === false) {
$types['permissions_report'] = [ $types['permissions_report'] = [
'optgroup' => __('Permissions report'), 'optgroup' => __('Permissions report'),

View File

@ -1202,7 +1202,7 @@ function servers_show_type($id)
case 8: case 8:
$return = html_print_image( $return = html_print_image(
'images/module_wux.png', 'images/module-wux.png',
true, true,
[ [
'title' => get_product_name().' WUX server', 'title' => get_product_name().' WUX server',

View File

@ -604,9 +604,11 @@ function snmp_browser_print_oid(
if ($custom_action != '') { if ($custom_action != '') {
$table->head[0] = '<span id="snmp_custom_action">'.$closer.$custom_action.'</span>'; $table->head[0] = '<span id="snmp_custom_action">'.$closer.$custom_action.'</span>';
} else { } else {
$table->headstyle[0] = 'text-align: left';
$table->head[0] = $closer; $table->head[0] = $closer;
} }
$table->headstyle[1] = 'text-align: left';
$table->head[1] = __('OID Information'); $table->head[1] = __('OID Information');
$output .= html_print_table($table, true); $output .= html_print_table($table, true);
@ -636,7 +638,7 @@ function snmp_browser_print_oid(
__('Create network component'), __('Create network component'),
'create_network_component', 'create_network_component',
false, false,
'class="sub add float-left"', 'class="sub add float-left mrgn_right_20px"',
true true
); );
@ -1065,16 +1067,16 @@ function snmp_browser_print_container(
); );
$output .= '<div id="search_results" class="search_results"></div>'; $output .= '<div id="search_results" class="search_results"></div>';
$output .= '<div id="spinner" class="spinner_none_padding">'.html_print_image('images/spinner.gif', true).'</div>'; $output .= '<div id="spinner" class="spinner_none_padding" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
$output .= '<div id="snmp_browser">'; $output .= '<div id="snmp_browser">';
$output .= '</div>'; $output .= '</div>';
$output .= '<div class="databox mrgn_5px" id="snmp_data"></div>'; $output .= '<div class="databox" id="snmp_data"></div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
if ($show_massive_buttons) { if ($show_massive_buttons) {
$output .= '<div id="snmp_create_buttons" class="invisible">'; $output .= '<div id="snmp_create_buttons" style="display:none">';
$output .= html_print_submit_button( $output .= html_print_submit_button(
__('Create agent modules'), __('Create agent modules'),
'create_modules_agent', 'create_modules_agent',

View File

@ -337,7 +337,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) { if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) {
// Actions table // Actions table
echo '<div class="actions_treeview">'; echo '<div class="actions_treeview" style="text-align: right">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">'; echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">';
html_print_submit_button(__('Go to module edition'), 'upd_button', false, 'class="sub config"'); html_print_submit_button(__('Go to module edition'), 'upd_button', false, 'class="sub config"');
echo '</a>'; echo '</a>';
@ -473,7 +473,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false)
if ($user_access_node && check_acl($config['id_user'], $id_group, 'LW')) { if ($user_access_node && check_acl($config['id_user'], $id_group, 'LW')) {
// Actions table // Actions table
echo '<div class="w100p right mw300px">'; echo '<div class="w100p right mw300px right_align">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'" target="_blank">'; echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'" target="_blank">';
html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search"'); html_print_submit_button(__('Go to alerts edition'), 'upd_button', false, 'class="sub search"');
echo '</a>'; echo '</a>';
@ -694,7 +694,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$agent_table = html_print_table($table, true); $agent_table = html_print_table($table, true);
if ($user_access_node && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) { if ($user_access_node && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
$go_to_agent = '<div class="right">'; $go_to_agent = '<div style="text-align: right">';
if ($agent['id_os'] == CLUSTER_OS_ID) { if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) { if (enterprise_installed()) {

View File

@ -322,8 +322,8 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'"> class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
<tr> <tr>
<td class="icon icon_ui" rowspan="2" >'.html_print_image($icon_image, true, false, false, false, false).'</td> <td class="icon icon_ui" rowspan="2" >'.html_print_image($icon_image, true, false, false, false, false).'</td>
<td class="title" class="pandora_upper pdd_t_10px"><b>'.$text_title.'</b></td> <td class="title pandora_upper pdd_t_10px"><b>'.$text_title.'</b></td>
<td class="icon" class="right pdd_r_3px">'; <td class="icon right pdd_r_3px">';
if (!$no_close_bool) { if (!$no_close_bool) {
// Use the no_meta parameter because this image is only in // Use the no_meta parameter because this image is only in
// the base console. // the base console.
@ -333,7 +333,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
$output .= '</td> $output .= '</td>
</tr> </tr>
<tr> <tr>
<td class="black pdd_t_10px">'.$text_message.'</td> <td class="black pdd_t_10px" style="color: #000">'.$text_message.'</td>
<td></td> <td></td>
</tr> </tr>
</table>'; </table>';
@ -3770,6 +3770,7 @@ function ui_print_event_priority(
* @param string $attributes_switch Switch attributes. * @param string $attributes_switch Switch attributes.
* @param string $toggl_attr Main box extra attributes. * @param string $toggl_attr Main box extra attributes.
* @param boolean|null $switch_on Switch enabled disabled or depending on hidden_Default. * @param boolean|null $switch_on Switch enabled disabled or depending on hidden_Default.
* @param string|null $switch_name Use custom switch input name or generate one.
* *
* @return string HTML. * @return string HTML.
*/ */
@ -3790,7 +3791,8 @@ function ui_toggle(
$switch=false, $switch=false,
$attributes_switch='', $attributes_switch='',
$toggl_attr='', $toggl_attr='',
$switch_on=null $switch_on=null,
$switch_name=null
) { ) {
// Generate unique Id. // Generate unique Id.
$uniqid = uniqid(''); $uniqid = uniqid('');
@ -3826,7 +3828,7 @@ function ui_toggle(
$main_class = ''; $main_class = '';
} }
if (empty($container_class) === true) { if ($container_class == 'white-box-content') {
$container_class = 'white-box-content-clean'; $container_class = 'white-box-content-clean';
} }
} }
@ -3836,11 +3838,15 @@ function ui_toggle(
$output .= '<div class="'.$header_class.'" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">'; $output .= '<div class="'.$header_class.'" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">';
if ($reverseImg === false) { if ($reverseImg === false) {
if ($switch === true) { if ($switch === true) {
if (empty($switch_name) === true) {
$switch_name = 'box_enable_toggle'.$uniqid;
}
$output .= html_print_div( $output .= html_print_div(
[ [
'class' => 'float-left', 'class' => 'float-left',
'content' => html_print_checkbox_switch_extended( 'content' => html_print_checkbox_switch_extended(
'box_enable_toggle'.$uniqid, $switch_name,
1, 1,
($switch_on === null) ? (($hidden_default === true) ? 0 : 1) : $switch_on, ($switch_on === null) ? (($hidden_default === true) ? 0 : 1) : $switch_on,
false, false,
@ -3910,7 +3916,7 @@ function ui_toggle(
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n"; $output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
$output .= ' /* <![CDATA[ */'."\n"; $output .= ' /* <![CDATA[ */'."\n";
$output .= " $(document).ready (function () {\n"; $output .= " $(document).ready (function () {\n";
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').click(function() {\n"; $output .= " $('#checkbox-".$switch_name."').click(function() {\n";
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n"; $output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
@ -3925,13 +3931,13 @@ function ui_toggle(
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n"; $output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').prop('checked', true);\n"; $output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n"; $output .= " }\n";
$output .= " else {\n"; $output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n"; $output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n"; $output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n"; $output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
$output .= " $('#checkbox-box_enable_toggle".$uniqid."').prop('checked', false);\n"; $output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n"; $output .= " }\n";
$output .= " });\n"; $output .= " });\n";
$output .= " });\n"; $output .= " });\n";
@ -3951,23 +3957,24 @@ function ui_toggle(
* Simplified way of ui_toggle ussage. * Simplified way of ui_toggle ussage.
* *
* @param array $data Arguments: * @param array $data Arguments:
* 'content' * - content
* 'name' * - name
* 'title' * - title
* 'id' * - id
* 'hidden_default' * - hidden_default
* 'return' * - return
* 'toggle_class' * - toggle_class
* 'container_class' * - container_class
* 'main_class' * - main_class
* 'img_a' * - img_a
* 'img_b' * - img_b
* 'clean' * - clean
* 'reverseImg' * - reverseImg
* 'switch' * - switch
* 'attributes_switch' * - attributes_switch
* 'toggl_attr' * - toggl_attr
* 'switch_on'. * - switch_on
* - switch_name.
* *
* @return string HTML code with toggle content. * @return string HTML code with toggle content.
*/ */
@ -3990,7 +3997,8 @@ function ui_print_toggle($data)
(isset($data['switch']) === true) ? $data['switch'] : false, (isset($data['switch']) === true) ? $data['switch'] : false,
(isset($data['attributes_switch']) === true) ? $data['attributes_switch'] : '', (isset($data['attributes_switch']) === true) ? $data['attributes_switch'] : '',
(isset($data['toggl_attr']) === true) ? $data['toggl_attr'] : '', (isset($data['toggl_attr']) === true) ? $data['toggl_attr'] : '',
(isset($data['switch_on']) === true) ? $data['switch_on'] : null (isset($data['switch_on']) === true) ? $data['switch_on'] : null,
(isset($data['switch_name']) === true) ? $data['switch_name'] : null
); );
} }
@ -5712,6 +5720,12 @@ function ui_print_module_string_value(
$value = io_safe_input($value); $value = io_safe_input($value);
} }
$is_snapshot = is_snapshot_data($module['datos']);
$is_large_image = is_text_to_black_string($module['datos']);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$row[7] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;';
}
$is_snapshot = is_snapshot_data($value); $is_snapshot = is_snapshot_data($value);
$is_large_image = is_text_to_black_string($value); $is_large_image = is_text_to_black_string($value);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) { if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {

View File

@ -3272,12 +3272,6 @@ function visual_map_get_status_element($layoutData)
} }
} }
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
// Linked to other layout ?? - Only if not module defined // Linked to other layout ?? - Only if not module defined
if (!empty($layoutData['id_layout_linked'])) { if (!empty($layoutData['id_layout_linked'])) {
if (!empty($layoutData['linked_layout_node_id'])) { if (!empty($layoutData['linked_layout_node_id'])) {
@ -3379,6 +3373,11 @@ function visual_map_get_status_element($layoutData)
case PERCENTILE_BUBBLE: case PERCENTILE_BUBBLE:
case CIRCULAR_PROGRESS_BAR: case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR: case CIRCULAR_INTERIOR_PROGRESS_BAR:
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
if (empty($module_value) || $module_value == '') { if (empty($module_value) || $module_value == '') {
return VISUAL_MAP_STATUS_UNKNOWN; return VISUAL_MAP_STATUS_UNKNOWN;
@ -3907,9 +3906,19 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
return VISUAL_MAP_STATUS_UNKNOWN; return VISUAL_MAP_STATUS_UNKNOWN;
} }
$layout_items = db_get_all_rows_filter( $layout_items = db_get_all_rows_sql(
'tlayout_data', sprintf(
['id_layout' => $layout_id] 'SELECT tld.*
FROM tlayout_data tld
LEFT JOIN tagente ta
ON ta.id_agente=tld.id_agent
LEFT JOIN tagente_modulo tam
ON tam.id_agente_modulo = tld.id_agente_modulo
WHERE tld.id_layout = %d
AND (ta.disabled = 0 OR ta.disabled is null)
AND (tam.disabled = 0 OR tam.disabled is null)',
$layout_id
)
); );
if ($layout_items === false) { if ($layout_items === false) {

Some files were not shown because too many files have changed in this diff Show More