mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Merge branch 'develop' into 'ent-10348-15022-SNMP-Console-no-muestra-Traps-de-1-hora-de-plazo-con-timezone-de-Usuario-1'
# Conflicts: # pandora_console/extras/mr/66.sql
This commit is contained in:
commit
fa5af7efab
@ -28,7 +28,7 @@ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spe
|
||||
$CODEHOME/pandora_console/pandora_console.redhat.spec \
|
||||
$CODEHOME/pandora_console/pandora_console.rhel7.spec \
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec\
|
||||
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
|
||||
$CODEHOME/pandora_server/pandora_server.redhat.spec \
|
||||
$PANDHOME_ENT/pandora_agents/pandora_agent.spec \
|
||||
$PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, FreeBSD Version
|
||||
# Version 7.0NG.773.3, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, HP-UX Version
|
||||
# Version 7.0NG.773.3, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, Solaris Version
|
||||
# Version 7.0NG.773.3, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# 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
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, HPUX Version
|
||||
# Version 7.0NG.773.3, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2023 Pandora FMS
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.773.1, Solaris version
|
||||
# Version 7.0NG.773.3, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, AIX version
|
||||
# Version 7.0NG.773.3, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.773.1-230822
|
||||
Version: 7.0NG.773.3-230904
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.773.1-230822"
|
||||
pandora_version="7.0NG.773.3-230904"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -31,7 +31,7 @@ fi
|
||||
if [ "$#" -ge 2 ]; then
|
||||
VERSION="$2"
|
||||
else
|
||||
VERSION="7.0NG.773.1"
|
||||
VERSION="7.0NG.773.3"
|
||||
fi
|
||||
|
||||
# Path for the generated DMG file
|
||||
|
@ -19,11 +19,11 @@
|
||||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.1" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.3" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.1" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.3" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||
<!-- <installation-check script="check()" />
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
@ -5,9 +5,9 @@
|
||||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.1</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.1 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.1</string>
|
||||
<key>CFBundleVersion</key> <string>7.0NG.773.3</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.3 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.3</string>
|
||||
|
||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, FreeBSD Version
|
||||
# Version 7.0NG.773.3, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, HP-UX Version
|
||||
# Version 7.0NG.773.3, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2004-2023 Pandora FMS
|
||||
# https://pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, GNU/Linux
|
||||
# Version 7.0NG.773.3, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, NetBSD Version
|
||||
# Version 7.0NG.773.3, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.773.1, Solaris Version
|
||||
# Version 7.0NG.773.3, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2023 Pandora FMS
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1030,8 +1030,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.773.1';
|
||||
use constant AGENT_BUILD => '230822';
|
||||
use constant AGENT_VERSION => '7.0NG.773.3';
|
||||
use constant AGENT_BUILD => '230904';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,8 +3,8 @@
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -4,8 +4,8 @@
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.773
|
||||
%define release 230725
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
Name: %{name}
|
||||
|
@ -3,8 +3,8 @@
|
||||
#
|
||||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.773.1
|
||||
%define release 230822
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230904
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.1"
|
||||
PI_BUILD="230822"
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="230904"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2023 Pandora FMS
|
||||
# Version 7.0NG.773.1
|
||||
# Version 7.0NG.773.3
|
||||
# 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
|
||||
# Foundation; either version 2 of the Licence or any later version
|
||||
@ -522,4 +522,11 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
||||
#module_type generic_data_string
|
||||
#module_exec echo Bordón
|
||||
#module_native_encoding OEM
|
||||
#module_end
|
||||
#module_end
|
||||
|
||||
# Hardening plugin for security compliance analysis.
|
||||
#module_begin
|
||||
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_sca.exe"
|
||||
#module_absoluteinterval 7d
|
||||
#module_end
|
||||
|
||||
|
3
pandora_agents/win32/bin/util/pandora_sca.exe
Executable file
3
pandora_agents/win32/bin/util/pandora_sca.exe
Executable file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d93bd9d56c938063045fa2093198d324746f84df2b74567648f3baebd635657
|
||||
size 5248006
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.773.1}
|
||||
{Pandora FMS Windows Agent v7.0NG.773.3}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{230822}
|
||||
{230904}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.773.1 Build 230822")
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 230904")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Pandora FMS"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.773.1(Build 230822))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 230904))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.773.1-230822
|
||||
Version: 7.0NG.773.3-230904
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.773.1-230822"
|
||||
pandora_version="7.0NG.773.3-230904"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -26,19 +26,20 @@
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
require_once $config['homedir'].'/include/config.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
*/
|
||||
require_once '../include/config.php';
|
||||
require_once '../include/functions_agents.php';
|
||||
require_once '../include/functions_reporting.php';
|
||||
require_once '../include/functions_modules.php';
|
||||
require_once '../include/functions_users.php';
|
||||
|
||||
global $config;
|
||||
if (true) {
|
||||
include_once '../include/config.php';
|
||||
include_once '../include/functions_agents.php';
|
||||
include_once '../include/functions_reporting.php';
|
||||
include_once '../include/functions_modules.php';
|
||||
include_once '../include/functions_users.php';
|
||||
include_once $config['homedir'].'/include/config.php';
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
}
|
||||
|
||||
|
||||
check_login();
|
||||
|
||||
|
@ -204,51 +204,60 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
|
||||
|
||||
if ($upload_result === true) {
|
||||
$filename = $_FILES[$file_input_name]['name'];
|
||||
// Replace conflictive characters
|
||||
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
||||
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
||||
// The filename should not be larger than 200 characters
|
||||
if (mb_strlen($filename, 'UTF-8') > 200) {
|
||||
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
$hash = '';
|
||||
if ($public) {
|
||||
$hash = md5(time().$config['dbpass']);
|
||||
$hash = mb_substr($hash, 0, 8, 'UTF-8');
|
||||
}
|
||||
// Invalid extensions.
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$invalid_extensions = '/^(php|php1|php2|php3|php4|php5|php7|php8|phar|phptml|phps)$/i';
|
||||
|
||||
$values = [
|
||||
'name' => $filename,
|
||||
'description' => $description,
|
||||
'hash' => $hash,
|
||||
];
|
||||
$file_id = db_process_sql_insert('tfiles_repo', $values);
|
||||
if (preg_match($invalid_extensions, $extension) === 0) {
|
||||
// Replace conflictive characters
|
||||
$filename = str_replace([' ', '=', '?', '&'], '_', $filename);
|
||||
$filename = filter_var($filename, FILTER_SANITIZE_URL);
|
||||
// The filename should not be larger than 200 characters
|
||||
if (mb_strlen($filename, 'UTF-8') > 200) {
|
||||
$filename = mb_substr($filename, 0, 200, 'UTF-8');
|
||||
}
|
||||
|
||||
if ($file_id) {
|
||||
$file_tmp = $_FILES[$file_input_name]['tmp_name'];
|
||||
$destination = $files_repo_path.'/'.$file_id.'_'.$filename;
|
||||
$hash = '';
|
||||
if ($public) {
|
||||
$hash = md5(time().$config['dbpass']);
|
||||
$hash = mb_substr($hash, 0, 8, 'UTF-8');
|
||||
}
|
||||
|
||||
if (move_uploaded_file($file_tmp, $destination)) {
|
||||
if (is_array($groups) && !empty($groups)) {
|
||||
db_process_sql_delete('tfiles_repo_group', ['id_file' => $file_id]);
|
||||
foreach ($groups as $group) {
|
||||
$values = [
|
||||
'id_file' => $file_id,
|
||||
'id_group' => $group,
|
||||
];
|
||||
db_process_sql_insert('tfiles_repo_group', $values);
|
||||
$values = [
|
||||
'name' => $filename,
|
||||
'description' => $description,
|
||||
'hash' => $hash,
|
||||
];
|
||||
$file_id = db_process_sql_insert('tfiles_repo', $values);
|
||||
|
||||
if ($file_id) {
|
||||
$file_tmp = $_FILES[$file_input_name]['tmp_name'];
|
||||
$destination = $files_repo_path.'/'.$file_id.'_'.$filename;
|
||||
|
||||
if (move_uploaded_file($file_tmp, $destination)) {
|
||||
if (is_array($groups) && !empty($groups)) {
|
||||
db_process_sql_delete('tfiles_repo_group', ['id_file' => $file_id]);
|
||||
foreach ($groups as $group) {
|
||||
$values = [
|
||||
'id_file' => $file_id,
|
||||
'id_group' => $group,
|
||||
];
|
||||
db_process_sql_insert('tfiles_repo_group', $values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result['status'] = true;
|
||||
$result['status'] = true;
|
||||
} else {
|
||||
db_process_sql_delete('tfiles_repo', ['id' => $file_id]);
|
||||
unlink($file_tmp);
|
||||
$result['message'] = __('The file could not be copied');
|
||||
}
|
||||
} else {
|
||||
db_process_sql_delete('tfiles_repo', ['id' => $file_id]);
|
||||
unlink($file_tmp);
|
||||
$result['message'] = __('The file could not be copied');
|
||||
$result['message'] = __('There was an error creating the file');
|
||||
}
|
||||
} else {
|
||||
$result['message'] = __('There was an error creating the file');
|
||||
$result['message'] = __('File has an invalid extension');
|
||||
}
|
||||
} else {
|
||||
$result['message'] = $upload_result;
|
||||
|
@ -4,6 +4,15 @@ ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
|
||||
`id` INT NOT NULL auto_increment,
|
||||
`filter_name` VARCHAR(45) NULL,
|
||||
`user_id` VARCHAR(255) NULL,
|
||||
`graph_modules` TEXT NULL,
|
||||
`interval` INT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
UPDATE `twelcome_tip`
|
||||
SET title = 'Scheduled downtimes',
|
||||
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'
|
||||
|
@ -241,10 +241,10 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
||||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
// Exception for network maps.
|
||||
if ($_GET['sec2'] === 'operation/agentes/pandora_networkmap') {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
|
@ -216,7 +216,9 @@ if ($create_agent) {
|
||||
$server_name = (string) get_parameter_post('server_name');
|
||||
$id_os = (int) get_parameter_post('id_os');
|
||||
$disabled = (int) get_parameter_post('disabled');
|
||||
$custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
|
||||
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
|
||||
// $custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$cascade_protection = (int) get_parameter_post('cascade_protection', 0);
|
||||
$cascade_protection_module = (int) get_parameter_post('cascade_protection_module', 0);
|
||||
$safe_mode = (int) get_parameter_post('safe_mode', 0);
|
||||
@ -999,7 +1001,9 @@ if ($update_agent) {
|
||||
$disabled = (bool) get_parameter_post('disabled');
|
||||
$server_name = (string) get_parameter_post('server_name', '');
|
||||
$id_parent = (int) get_parameter_post('id_agent_parent');
|
||||
$custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
|
||||
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
|
||||
// $custom_id = (string) get_parameter_post('custom_id', '');
|
||||
$cascade_protection = (int) get_parameter_post('cascade_protection', 0);
|
||||
$cascade_protection_module = (int) get_parameter('cascade_protection_module', 0);
|
||||
$safe_mode_module = (int) get_parameter('safe_mode_module', 0);
|
||||
|
@ -1558,7 +1558,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
||||
$all_modules = true;
|
||||
}
|
||||
|
||||
if ($all_common_modules === true) {
|
||||
if ($all_common_modules === true || $all_modules === true) {
|
||||
$module_names = explode(',', get_parameter('all_common_modules'));
|
||||
}
|
||||
|
||||
@ -1602,7 +1602,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
||||
foreach ($agents as $agent_id) {
|
||||
$agent_id = (int) $agent_id;
|
||||
// Check module belongs to the agent.
|
||||
if ($modules_selection_mode == 'all' && $all_modules === false) {
|
||||
if ($modules_selection_mode == 'all' && ($all_modules === false || $all_modules === true)) {
|
||||
$check = false;
|
||||
foreach ($module_names as $module_name) {
|
||||
$check_module = modules_get_agentmodule_id(
|
||||
@ -1666,7 +1666,7 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
||||
);
|
||||
}
|
||||
|
||||
if ($result !== false && (bool) $all_modules === false) {
|
||||
if ($result !== false && ((bool) $all_modules === false || (bool) $all_modules === true)) {
|
||||
foreach ($module_names as $module_name) {
|
||||
$module = modules_get_agentmodule_id(
|
||||
$module_name,
|
||||
|
@ -89,7 +89,7 @@ if (is_ajax() === true) {
|
||||
[
|
||||
'id' => 'agent_modules_affected_planned_downtime',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'style' => 'width: 99%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/agentes/planned_downtime.list',
|
||||
@ -730,7 +730,7 @@ if ($downtimes === false && $filter_performed === false) {
|
||||
$table->cellstyle = [];
|
||||
|
||||
$table->head = [];
|
||||
$table->head['name'] = __('Name #Ag.');
|
||||
$table->head['name'] = __('Name (Ag.)');
|
||||
$table->head['description'] = __('Description');
|
||||
$table->head['group'] = __('Group');
|
||||
$table->head['type'] = __('Type');
|
||||
|
284
pandora_console/godmode/massive/massive_add_policies_alerts.php
Normal file
284
pandora_console/godmode/massive/massive_add_policies_alerts.php
Normal file
@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '<>0']) as $row) {
|
||||
$alerts[$row['id']] = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.policies_get_module_name($row['id_policy_module']));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$add = (bool) get_parameter_post('add');
|
||||
|
||||
if ($add) {
|
||||
$array_alerts = (array) get_parameter('id_alerts');
|
||||
$array_actions = (array) get_parameter('action');
|
||||
$fires_min = (int) get_parameter('fires_min', 0);
|
||||
$fires_max = (int) get_parameter('fires_max', 0);
|
||||
|
||||
if (empty($array_alerts) === false) {
|
||||
foreach ($array_alerts as $id_alert) {
|
||||
foreach ($array_actions as $action) {
|
||||
$id_policy_alert = db_get_value('id_policy_alert', 'tpolicy_alerts_actions', 'id', $action);
|
||||
$result = policies_add_action_alert($id_alert, $action, $fires_min, $fires_max);
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Add action successfully'), __('Could not be added'), '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
$actions = alerts_get_alert_actions();
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$actions,
|
||||
'action[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
'width:100%'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Number of matching alerts'),
|
||||
'<div>'.html_print_input_text('fires_min', 0, '', false, 10, true, false, false, '', 'w30p').'<span class="margin-lr-10">'.__('to').'</span>'.html_print_input_text('fires_max', 0, '', false, 10, true, false, false, '', 'w30p').'</div>'
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('add', 'add', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var action = $('#action :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(action) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
$array_alerts = policies_get_alerts(
|
||||
$policie,
|
||||
['id_policy_module' => '0']
|
||||
);
|
||||
foreach ($array_alerts as $row) {
|
||||
$alerts[$row['id']] = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.$row['name_extern_module']);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$add = (bool) get_parameter_post('add');
|
||||
|
||||
if ($add) {
|
||||
$array_alerts = (array) get_parameter('id_alerts');
|
||||
$array_actions = (array) get_parameter('action');
|
||||
$fires_min = (int) get_parameter('fires_min', 0);
|
||||
$fires_max = (int) get_parameter('fires_max', 0);
|
||||
|
||||
if (empty($array_alerts) === false) {
|
||||
foreach ($array_alerts as $id_alert) {
|
||||
foreach ($array_actions as $action) {
|
||||
$id_policy_alert = db_get_value('id_policy_alert', 'tpolicy_alerts_actions', 'id', $action);
|
||||
$result = policies_add_action_alert($id_alert, $action, $fires_min, $fires_max);
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Add action successfully'), __('Could not be added'), '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
$actions = alerts_get_alert_actions();
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Action'),
|
||||
html_print_select(
|
||||
$actions,
|
||||
'action[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'w100p',
|
||||
false,
|
||||
'width:100%'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[2][1] = html_print_label_input_block(
|
||||
__('Number of matching alerts'),
|
||||
'<div>'.html_print_input_text('fires_min', 0, '', false, 10, true, false, false, '', 'w30p').'<span class="margin-lr-10">'.__('to').'</span>'.html_print_input_text('fires_max', 0, '', false, 10, true, false, false, '', 'w30p').'</div>'
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('add', 'add', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts_action_external',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_add_policies_alerts_action_external',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var action = $('#action :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(action) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,325 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
$load_actions_alerts = get_parameter('load_actions_alerts', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '<>0']) as $row) {
|
||||
$name = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.policies_get_module_name($row['id_policy_module']));
|
||||
$alerts[$row['id'].'__'.policies_get_name($policie).' - '.$name] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_actions_alerts) {
|
||||
$array_alerts = get_parameter('id_alerts', []);
|
||||
|
||||
$actions = [];
|
||||
foreach ($array_alerts as $alert) {
|
||||
$alert_policie = explode('__', $alert);
|
||||
$alert_id = $alert_policie[0];
|
||||
$alert_name = $alert_policie[1];
|
||||
$array_actions = db_get_all_rows_filter(
|
||||
'tpolicy_alerts_actions',
|
||||
['id_policy_alert' => $alert]
|
||||
);
|
||||
foreach ($array_actions as $row) {
|
||||
$action = db_get_row_filter(
|
||||
'talert_actions',
|
||||
['id' => $row['id_alert_action']]
|
||||
);
|
||||
$actions[$row['id']] = $alert_name.' - '.$action['name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($actions, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter_post('delete');
|
||||
|
||||
if ($delete) {
|
||||
$array_actions = get_parameter('id_actions');
|
||||
foreach ($array_actions as $id_action) {
|
||||
$result = policies_delete_action_alert($id_action);
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Deleted action successfully'), __('Could not be deleted'), '');
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 2;
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Actions'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_actions[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#id_alerts').change(function(){
|
||||
var data = $(this).val();
|
||||
if (data !== 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts',
|
||||
load_actions_alerts: 1,
|
||||
id_alerts: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_actions').html(options);
|
||||
} else {
|
||||
$('#id_actions').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var id_actions = $('#id_actions :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(id_actions) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,325 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access massive alert deletion'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
if (is_ajax() === true) {
|
||||
$load_policies = get_parameter('load_policies', 0);
|
||||
$load_alerts_policies = get_parameter('load_alerts_policies', 0);
|
||||
$load_actions_alerts = get_parameter('load_actions_alerts', 0);
|
||||
|
||||
if ($load_policies) {
|
||||
$id_group = get_parameter('id_group', 0);
|
||||
if ($id_group !== '0') {
|
||||
$filter['force_id_group'] = $id_group;
|
||||
$arr_policies = policies_get_policies($filter);
|
||||
} else {
|
||||
$arr_policies = policies_get_policies();
|
||||
}
|
||||
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
echo json_encode($policies, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_alerts_policies) {
|
||||
$ids_policies = get_parameter('policies', []);
|
||||
|
||||
$alerts = [];
|
||||
foreach ($ids_policies as $policie) {
|
||||
foreach (policies_get_alerts($policie, ['id_policy_module' => '0']) as $row) {
|
||||
$name = io_safe_output(alerts_get_alert_template_name($row['id_alert_template']).' - '.$row['name_extern_module']);
|
||||
$alerts[$row['id'].'__'.policies_get_name($policie).' - '.$name] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($alerts, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($load_actions_alerts) {
|
||||
$array_alerts = get_parameter('id_alerts', []);
|
||||
|
||||
$actions = [];
|
||||
foreach ($array_alerts as $alert) {
|
||||
$alert_policie = explode('__', $alert);
|
||||
$alert_id = $alert_policie[0];
|
||||
$alert_name = $alert_policie[1];
|
||||
$array_actions = db_get_all_rows_filter(
|
||||
'tpolicy_alerts_actions',
|
||||
['id_policy_alert' => $alert]
|
||||
);
|
||||
foreach ($array_actions as $row) {
|
||||
$action = db_get_row_filter(
|
||||
'talert_actions',
|
||||
['id' => $row['id_alert_action']]
|
||||
);
|
||||
$actions[$row['id']] = $alert_name.' - '.$action['name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($actions, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter_post('delete');
|
||||
|
||||
if ($delete) {
|
||||
$array_actions = get_parameter('id_actions');
|
||||
foreach ($array_actions as $id_action) {
|
||||
$result = policies_delete_action_alert($id_action);
|
||||
}
|
||||
|
||||
ui_print_result_message($result, __('Deleted action successfully'), __('Could not be deleted'), '');
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters filter-table-adv';
|
||||
$table->width = '100%';
|
||||
$table->data = [];
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = [];
|
||||
$table->size[0] = '50%';
|
||||
$table->size[1] = '50%';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = html_print_label_input_block(
|
||||
__('Group'),
|
||||
html_print_select_groups(
|
||||
false,
|
||||
'AW',
|
||||
true,
|
||||
'id_group',
|
||||
0,
|
||||
'',
|
||||
'All',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:180px;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[0][1] = html_print_label_input_block(
|
||||
__('Group recursion'),
|
||||
html_print_checkbox('recursion', 1, $recursion, true, false, '', true)
|
||||
);
|
||||
|
||||
$arr_policies = policies_get_policies();
|
||||
$policies = [];
|
||||
foreach ($arr_policies as $row) {
|
||||
$policies[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$table->data[1][0] = html_print_label_input_block(
|
||||
__('Policies'),
|
||||
html_print_select(
|
||||
$policies,
|
||||
'id_policies[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_label_input_block(
|
||||
__('Alerts'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_alerts[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
$table->colspan[2][0] = 2;
|
||||
$table->data[2][0] = html_print_label_input_block(
|
||||
__('Actions'),
|
||||
html_print_select(
|
||||
[],
|
||||
'id_actions[]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:100%;'
|
||||
)
|
||||
);
|
||||
|
||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_alerts">';
|
||||
html_print_table($table);
|
||||
|
||||
attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#id_group').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_policies: 1,
|
||||
id_group: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_policies').html(options);
|
||||
} else {
|
||||
$('#id_policies').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
$('#id_policies').trigger('change');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#id_policies').change(function(){
|
||||
var data = $(this).val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_alerts_policies: 1,
|
||||
policies: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_alerts').html(options);
|
||||
} else {
|
||||
$('#id_alerts').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#id_alerts').change(function(){
|
||||
var data = $(this).val();
|
||||
if (data !== 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: 'godmode/massive/massive_delete_policies_alerts_action_external',
|
||||
load_actions_alerts: 1,
|
||||
id_alerts: data,
|
||||
},
|
||||
success: function(data) {
|
||||
var data = $.parseJSON(data);
|
||||
var options = '';
|
||||
$.each( data, function( id, name ) {
|
||||
options += '<option value="'+id+'">'+name+'</option>';
|
||||
});
|
||||
if (options!== ''){
|
||||
$('#id_actions').html(options);
|
||||
} else {
|
||||
$('#id_actions').html('<option value="0"><?php echo __('None'); ?></option>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$("form").submit(function(e){
|
||||
var id_policies = $('#id_policies :selected').val();
|
||||
var id_alerts = $('#id_alerts :selected').val();
|
||||
var id_actions = $('#id_actions :selected').val();
|
||||
|
||||
if ($.isEmptyObject(id_policies) || $.isEmptyObject(id_alerts) || $.isEmptyObject(id_actions) || id_policies === '0' || id_alerts === '0'){
|
||||
e.preventDefault();
|
||||
alert('<?php echo __('Policies, Alerts and Action must to be selected'); ?>');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
@ -371,7 +371,6 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
||||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard';
|
||||
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
$autorefresh_list_out['operation/events/events'] = 'Events';
|
||||
|
||||
|
@ -64,6 +64,16 @@ $options_alerts = [
|
||||
'standby_alerts' => __('Bulk alert setting standby'),
|
||||
];
|
||||
|
||||
$options_alerts_policies = [
|
||||
'add_policies_alerts' => __('Bulk policies alert action add'),
|
||||
'delete_policies_alerts' => __('Bulk policies alert action delete'),
|
||||
];
|
||||
|
||||
$options_policies_alerts_externals = [
|
||||
'add_policies_alerts_action_external' => __('Bulk policies external alert action add'),
|
||||
'delete_policies_alerts_action_external' => __('Bulk policies external alert action delete'),
|
||||
];
|
||||
|
||||
$options_agents = [
|
||||
'edit_agents' => __('Bulk agent edit'),
|
||||
'delete_agents' => __('Bulk agent delete'),
|
||||
@ -119,6 +129,10 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
|
||||
|
||||
if (in_array($option, array_keys($options_alerts)) === true) {
|
||||
$tab = 'massive_alerts';
|
||||
} else if (in_array($option, array_keys($options_alerts_policies)) === true) {
|
||||
$tab = 'massive_policies_alerts';
|
||||
} else if (in_array($option, array_keys($options_policies_alerts_externals)) === true) {
|
||||
$tab = 'massive_policies_alerts_external';
|
||||
} else if (in_array($option, array_keys($options_agents)) === true) {
|
||||
$tab = 'massive_agents';
|
||||
} else if (in_array($option, array_keys($options_users)) === true) {
|
||||
@ -173,6 +187,14 @@ switch ($tab) {
|
||||
$options = $options_alerts;
|
||||
break;
|
||||
|
||||
case 'massive_policies_alerts':
|
||||
$options = $options_alerts_policies;
|
||||
break;
|
||||
|
||||
case 'massive_policies_alerts_external':
|
||||
$options = $options_policies_alerts_externals;
|
||||
break;
|
||||
|
||||
case 'massive_agents':
|
||||
$options = $options_agents;
|
||||
break;
|
||||
@ -223,6 +245,30 @@ $alertstab = [
|
||||
'active' => $tab == 'massive_alerts',
|
||||
];
|
||||
|
||||
$policiesalertstab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_policies_alerts">'.html_print_image(
|
||||
'images/policies_mc.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Policies alerts'),
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => $tab == 'massive_policies_alerts',
|
||||
];
|
||||
|
||||
$policiesalertsexternaltab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_policies_alerts_external">'.html_print_image(
|
||||
'images/alerts_extern.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Policies external alerts'),
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).'</a>',
|
||||
'active' => $tab == 'massive_policies_alerts_external',
|
||||
];
|
||||
|
||||
$userstab = [
|
||||
'text' => '<a href="'.$url.'&tab=massive_users">'.html_print_image(
|
||||
'images/user.svg',
|
||||
@ -298,6 +344,8 @@ if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
}
|
||||
|
||||
$onheader['massive_alerts'] = $alertstab;
|
||||
$onheader['massive_policies_alerts'] = $policiesalertstab;
|
||||
$onheader['massive_policies_alerts_external'] = $policiesalertsexternaltab;
|
||||
$onheader['policies'] = $policiestab;
|
||||
$onheader['snmp'] = $snmptab;
|
||||
$onheader['satellite'] = $satellitetab;
|
||||
@ -318,6 +366,8 @@ if (is_metaconsole() === false) {
|
||||
$pluginstab,
|
||||
$userstab,
|
||||
$alertstab,
|
||||
$policiesalertstab,
|
||||
$policiesalertsexternaltab,
|
||||
$policiestab,
|
||||
$snmptab,
|
||||
$satellitetab,
|
||||
@ -490,6 +540,22 @@ switch ($option) {
|
||||
include_once $config['homedir'].'/godmode/massive/massive_standby_alerts.php';
|
||||
break;
|
||||
|
||||
case 'add_policies_alerts':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_policies_alerts.php';
|
||||
break;
|
||||
|
||||
case 'delete_policies_alerts':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_delete_policies_alerts.php';
|
||||
break;
|
||||
|
||||
case 'add_policies_alerts_action_external':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_policies_alerts_action_external.php';
|
||||
break;
|
||||
|
||||
case 'delete_policies_alerts_action_external':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_delete_policies_alerts_action_external.php';
|
||||
break;
|
||||
|
||||
case 'add_profiles':
|
||||
include_once $config['homedir'].'/godmode/massive/massive_add_profiles.php';
|
||||
break;
|
||||
|
@ -309,6 +309,8 @@ if ($access_console_node === true) {
|
||||
}
|
||||
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_policies_alerts']['text'] = __('Policies alerts');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_policies_alerts_external']['text'] = __('Policies External alerts');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
@ -190,14 +190,21 @@ $output .= html_print_label_input_block(
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'w100p'
|
||||
'w100p',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
)
|
||||
);
|
||||
$output .= "</td><td class='datos2' width='50%'>";
|
||||
|
@ -1421,10 +1421,21 @@ $class = 'databox filters';
|
||||
html_print_extended_select_for_time(
|
||||
'period',
|
||||
$period,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
@ -1444,10 +1455,21 @@ $class = 'databox filters';
|
||||
html_print_extended_select_for_time(
|
||||
'period_range',
|
||||
$period_range,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period_range\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
@ -1487,10 +1509,21 @@ $class = 'databox filters';
|
||||
html_print_extended_select_for_time(
|
||||
'period1',
|
||||
$period_pg,
|
||||
'',
|
||||
'check_period_warning(this)',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
@ -1506,10 +1539,21 @@ $class = 'databox filters';
|
||||
html_print_extended_select_for_time(
|
||||
'period2',
|
||||
$projection_period,
|
||||
'',
|
||||
'check_period_warning(this)',
|
||||
'',
|
||||
'0',
|
||||
10
|
||||
10,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'period\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
@ -3440,7 +3484,7 @@ $class = 'databox filters';
|
||||
html_print_extended_select_for_time(
|
||||
'lapse',
|
||||
$lapse,
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
__('None'),
|
||||
'0',
|
||||
10,
|
||||
@ -3448,7 +3492,13 @@ $class = 'databox filters';
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
!$lapse_calc
|
||||
!$lapse_calc,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'lapse\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
|
@ -555,6 +555,7 @@ switch ($activeTab) {
|
||||
$type = (int) get_parameter('type', STATIC_GRAPH);
|
||||
$image = get_parameter('image');
|
||||
$range = (int) get_parameter('range', 50);
|
||||
$range_vertical = (int) get_parameter('range_vertical', 50);
|
||||
$width = (int) get_parameter('width', 0);
|
||||
$height = (int) get_parameter('height', 0);
|
||||
$period = (int) get_parameter('period', 0);
|
||||
@ -567,6 +568,9 @@ switch ($activeTab) {
|
||||
$label_type = get_parameter('label_type', 'agent_module');
|
||||
$enable_link = get_parameter('enable_link', 'enable_link');
|
||||
$show_on_top = get_parameter('show_on_top', 0);
|
||||
$pos_x = get_parameter('pos_x', 0);
|
||||
$pos_y = get_parameter('pos_y', 0);
|
||||
$max_elements_row = (int) get_parameter('max_elements_row', 0);
|
||||
|
||||
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
|
||||
$item_per_agent = get_parameter('item_per_agent', 0);
|
||||
@ -611,6 +615,7 @@ switch ($activeTab) {
|
||||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
@ -626,7 +631,10 @@ switch ($activeTab) {
|
||||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
|
||||
$statusProcessInDB = [
|
||||
@ -668,6 +676,7 @@ switch ($activeTab) {
|
||||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
@ -683,7 +692,10 @@ switch ($activeTab) {
|
||||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
} else {
|
||||
$id_modules = [];
|
||||
@ -722,6 +734,7 @@ switch ($activeTab) {
|
||||
$image,
|
||||
$idVisualConsole,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
@ -737,7 +750,10 @@ switch ($activeTab) {
|
||||
$kind_relationship,
|
||||
$item_in_the_map,
|
||||
$fontf,
|
||||
$fonts
|
||||
$fonts,
|
||||
$pos_x,
|
||||
$pos_y,
|
||||
$max_elements_row
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -144,22 +144,28 @@ $table->data['all_0'][0] = html_print_label_input_block(
|
||||
|
||||
|
||||
$table->rowstyle['staticgraph'] = 'display: none;';
|
||||
$table->colspan['staticgraph'][0] = 2;
|
||||
$table->data['staticgraph'][0] = html_print_label_input_block(
|
||||
__('Image'),
|
||||
html_print_select(
|
||||
'<div class="flex">'.html_print_select(
|
||||
$images_list,
|
||||
'image',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
)
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 49%'
|
||||
).'<span id="image_prev" class="mrgn_lft_10px mrgn_top-10px"><img src="'.$config['homeurl'].'/images/console/icons/appliance_ok.png"></span></div>'
|
||||
);
|
||||
|
||||
$table->rowstyle['all_1'] = 'display: none;';
|
||||
$table->data['all_1'][0] = html_print_label_input_block(
|
||||
__('Range between elements (px)'),
|
||||
__('Horizontal range between elements (px)'),
|
||||
html_print_input_text(
|
||||
'range',
|
||||
50,
|
||||
@ -170,6 +176,18 @@ $table->data['all_1'][0] = html_print_label_input_block(
|
||||
)
|
||||
);
|
||||
|
||||
$table->data['all_1'][1] = html_print_label_input_block(
|
||||
__('Vertical range between elements (px)'),
|
||||
html_print_input_text(
|
||||
'range_vertical',
|
||||
50,
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$input_size = __('Width').': ';
|
||||
$input_size .= html_print_input_text('width', 0, '', 5, 5, true);
|
||||
$input_size .= __('Height').': ';
|
||||
@ -425,6 +443,16 @@ if (is_metaconsole() === false) {
|
||||
);
|
||||
}
|
||||
|
||||
$table->data['all_4_01'][0] = html_print_label_input_block(
|
||||
__('Filter agents'),
|
||||
html_print_input_text('filter_agents', '', '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->data['all_4_01'][1] = html_print_label_input_block(
|
||||
__('Filter modules'),
|
||||
html_print_input_text('filter_modules', '', '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->rowstyle['all_4'] = 'display: none;';
|
||||
$table->data['all_4'][0] = html_print_label_input_block(
|
||||
__('Agents').ui_print_help_tip(
|
||||
@ -549,6 +577,16 @@ $table->data['all_8'][1] = html_print_label_input_block(
|
||||
).'</span>'
|
||||
);
|
||||
|
||||
$table->data['all_10'][0] = html_print_label_input_block(
|
||||
__('Max. elements for row'),
|
||||
html_print_input_text('max_elements_row', 0, '', false, 255, true)
|
||||
);
|
||||
|
||||
$table->data['all_10'][1] = html_print_label_input_block(
|
||||
__('Position'),
|
||||
'<div class="flex_center"><span class="mrgn_right_10px">X</span>'.html_print_input_text('pos_x', 0, '', false, 255, true, false, false, '', 'w50p').'<span class="margin-lr-10">Y</span>'.html_print_input_text('pos_y', 0, '', false, 255, true, false, false, '', 'w50p').'</div>'
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
@ -831,6 +869,44 @@ function item_per_agent_change(itemPerAgent) {
|
||||
function metaconsole_init() {
|
||||
$("#groups").change();
|
||||
}
|
||||
|
||||
$('#text-filter_agents').on('keyup',function(){
|
||||
if ($(this).val() !== ''){
|
||||
findInSelect('id_agents',$(this).val());
|
||||
} else {
|
||||
$('#id_agents option').each(function(){
|
||||
$(this).removeClass('invisible');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#text-filter_modules').on('keyup',function(){
|
||||
if ($(this).val() !== ''){
|
||||
findInSelect('module',$(this).val());
|
||||
} else {
|
||||
$('#module option').each(function(){
|
||||
$(this).removeClass('invisible');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function findInSelect(selectid, find){
|
||||
var select = $('#'+selectid+' option');
|
||||
select.each(function(){
|
||||
var regex = new RegExp(find, "gi");
|
||||
if ($(this).html().match(regex) === null) {
|
||||
$(this).addClass('invisible');
|
||||
} else {
|
||||
$(this).removeClass('invisible');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#image').on('change', function(){
|
||||
var img = $(this).val();
|
||||
$('#image_prev').html('<img src="<?php echo $config['homeurl']; ?>/images/console/icons/'+img+'.png">');
|
||||
})
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
select[name='kind_relationship'] option[disabled='disabled'] {
|
||||
|
@ -1628,7 +1628,6 @@ $autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail';
|
||||
$autorefresh_list_out['enterprise/operation/services/services'] = 'Services';
|
||||
$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard';
|
||||
|
||||
$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map';
|
||||
$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console';
|
||||
$autorefresh_list_out['operation/events/events'] = 'Events';
|
||||
|
||||
@ -1643,6 +1642,10 @@ if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || e
|
||||
$aux = [];
|
||||
$count_autorefresh_list = count($autorefresh_list);
|
||||
for ($i = 0; $i < $count_autorefresh_list; $i++) {
|
||||
if ($autorefresh_list[$i] === 'operation/agentes/pandora_networkmap') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]];
|
||||
unset($autorefresh_list_out[$autorefresh_list[$i]]);
|
||||
$autorefresh_list[$i] = $aux;
|
||||
|
10
pandora_console/images/draggable.svg
Normal file
10
pandora_console/images/draggable.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 22 KiB |
BIN
pandora_console/images/widgets/groups_status_map.png
Normal file
BIN
pandora_console/images/widgets/groups_status_map.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
@ -542,13 +542,21 @@ class CustomNetScan extends Wizard
|
||||
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
|
||||
'interval',
|
||||
$this->task['interval_sweep'],
|
||||
'',
|
||||
'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
'check_period_warning_manual(\'interval\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')'
|
||||
).'</span>',
|
||||
];
|
||||
|
||||
|
@ -283,7 +283,8 @@ class ExtensionsDiscovery extends Wizard
|
||||
ui_require_javascript_file('extensions_discovery');
|
||||
$_iniFile = $this->loadIni();
|
||||
if ($_iniFile === false) {
|
||||
include 'general/noaccess.php';
|
||||
// No file .disco.
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No .disco file found') ]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230822';
|
||||
$pandora_version = 'v7.0NG.773.1';
|
||||
$build_version = 'PC230904';
|
||||
$pandora_version = 'v7.0NG.773.3';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -807,6 +807,7 @@ define('AUDIT_LOG_FILE_MANAGER', 'File manager');
|
||||
define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management');
|
||||
define('AUDIT_LOG_ALERT_CORRELATION_MANAGEMENT', 'Alert correlation management');
|
||||
define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management');
|
||||
define('AUDIT_LOG_GRAPH_ANALYTICS_PUBLIC', 'Graph Analytics Public');
|
||||
define('AUDIT_LOG_TAG_MANAGEMENT', 'Tag management');
|
||||
define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
|
||||
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
|
||||
|
@ -270,7 +270,8 @@ function format_for_graph(
|
||||
$dec_point='.',
|
||||
$thousands_sep=',',
|
||||
$divider=1000,
|
||||
$sufix=''
|
||||
$sufix='',
|
||||
$two_lines=false
|
||||
) {
|
||||
// Exception to exclude modules whose unit is already formatted as KB (satellite modules)
|
||||
if (!empty($sufix) && $sufix == 'KB') {
|
||||
@ -297,6 +298,10 @@ function format_for_graph(
|
||||
}
|
||||
|
||||
// This will actually do the rounding and the decimals.
|
||||
if ($two_lines === true) {
|
||||
return remove_right_zeros(format_numeric($number, $decimals)).'<br>'.$shorts[$pos].$sufix;
|
||||
}
|
||||
|
||||
return remove_right_zeros(format_numeric($number, $decimals)).$shorts[$pos].$sufix;
|
||||
}
|
||||
|
||||
@ -4046,25 +4051,49 @@ function series_type_graph_array($data, $show_elements_graph)
|
||||
}
|
||||
} else {
|
||||
$name_legend = '';
|
||||
if (isset($show_elements_graph['fullscale']) === true
|
||||
&& (int) $show_elements_graph['fullscale'] === 1
|
||||
) {
|
||||
$name_legend .= 'Tip: ';
|
||||
} else {
|
||||
$name_legend .= 'Avg: ';
|
||||
}
|
||||
|
||||
if ($value['unit']) {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].': ';
|
||||
if ($show_elements_graph['graph_analytics'] === true) {
|
||||
$name_legend .= '<div class="graph-analytics-legend-main">';
|
||||
$name_legend .= '<div class="graph-analytics-legend-square" style="background-color: '.$color_series[$i]['color'].';">';
|
||||
$name_legend .= '<span class="square-value">';
|
||||
$name_legend .= format_for_graph(
|
||||
end(end($value['data'])),
|
||||
1,
|
||||
$config['decimal_separator'],
|
||||
$config['thousand_separator'],
|
||||
1000,
|
||||
'',
|
||||
true
|
||||
);
|
||||
$name_legend .= '</span>';
|
||||
$name_legend .= '<span class="square-unit" title="'.$value['unit'].'">'.$value['unit'].'</span>';
|
||||
$name_legend .= '</div>';
|
||||
$name_legend .= '<div class="graph-analytics-legend">';
|
||||
$name_legend .= '<span>'.$value['agent_alias'].'</span>';
|
||||
$name_legend .= '<span title="'.$value['module_name'].'">'.$value['module_name'].'</span>';
|
||||
$name_legend .= '</div>';
|
||||
$name_legend .= '</div>';
|
||||
} else {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
if (isset($show_elements_graph['fullscale']) === true
|
||||
&& (int) $show_elements_graph['fullscale'] === 1
|
||||
) {
|
||||
$name_legend .= 'Tip: ';
|
||||
} else {
|
||||
$name_legend .= 'Avg: ';
|
||||
}
|
||||
|
||||
if ($value['unit']) {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $value['unit'].': ';
|
||||
} else {
|
||||
$name_legend .= $value['agent_alias'];
|
||||
$name_legend .= ' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4085,28 +4114,30 @@ function series_type_graph_array($data, $show_elements_graph)
|
||||
$value['max'] = 0;
|
||||
}
|
||||
|
||||
$data_return['legend'][$key] .= '<span class="legend-font-small">'.__('Min').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'.__('Max').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'._('Avg.').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> '.$str;
|
||||
if (isset($show_elements_graph['graph_analytics']) === false) {
|
||||
$data_return['legend'][$key] .= '<span class="legend-font-small">'.__('Min').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['min'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'.__('Max').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['max'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> <span class="legend-font-small">'._('Avg.').' </span><span class="bolder">'.remove_right_zeros(
|
||||
number_format(
|
||||
$value['avg'],
|
||||
$config['graph_precision'],
|
||||
$config['csv_decimal_separator'],
|
||||
$config['csv_decimal_separator'] == ',' ? '.' : ','
|
||||
)
|
||||
).' '.$value['unit'].'</span> '.$str;
|
||||
}
|
||||
|
||||
if ($show_elements_graph['compare'] == 'overlapped'
|
||||
&& $key == 'sum2'
|
||||
|
@ -2760,69 +2760,7 @@ function agents_delete_agent($id_agents, $disableACL=false)
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook('agent_delete_from_cache', [$id_agent]);
|
||||
|
||||
// Delete agent from visual console.
|
||||
db_process_sql_delete(
|
||||
'tlayout_data',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete agent from visual dashboards.
|
||||
db_process_sql(
|
||||
'UPDATE twidget_dashboard
|
||||
SET options = NULL
|
||||
WHERE options LIKE ("%\"agentid\":\"'.$id_agent.'\"%")'
|
||||
);
|
||||
|
||||
// Delete agent from treport.
|
||||
db_process_sql_delete(
|
||||
'treport_content',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete rules from tevent alerts (correlative alerts)
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'agent' => $id_agent,
|
||||
'operator_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'tevent_rule',
|
||||
[
|
||||
'log_agent' => $id_agent,
|
||||
'operator_log_agent' => '==',
|
||||
]
|
||||
);
|
||||
|
||||
// Delete from gis maps history
|
||||
db_process_sql_delete(
|
||||
'tgis_data_history',
|
||||
['tagente_id_agente' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from policies.
|
||||
db_process_sql_delete(
|
||||
'tpolicy_agents',
|
||||
['id_agent' => $id_agent]
|
||||
);
|
||||
|
||||
// Delete from tnetwork maps
|
||||
db_process_sql_delete(
|
||||
'titem',
|
||||
['source_data' => $id_agent]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'trel_item',
|
||||
[
|
||||
'id_parent_source_data' => $id_agent,
|
||||
'id_child_source_data' => $id_agent,
|
||||
],
|
||||
'OR'
|
||||
);
|
||||
|
||||
|
||||
// Delete agent from fav menu.
|
||||
db_process_sql_delete(
|
||||
'tfavmenu_user',
|
||||
|
@ -5540,3 +5540,23 @@ function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWate
|
||||
$options
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function graph_analytics_filter_select()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$result = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'RW') === 1 || check_acl($config['id_user'], 0, 'RM') === 1) {
|
||||
$filters = db_get_all_rows_sql('SELECT id, filter_name FROM tgraph_analytics_filter WHERE user_id = "'.$config['id_user'].'"');
|
||||
|
||||
if ($filters !== false) {
|
||||
foreach ($filters as $filter) {
|
||||
$result[$filter['id']] = $filter['filter_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -2648,14 +2648,16 @@ function groups_get_heat_map_agents(array $id_group, float $width=0, float $heig
|
||||
*
|
||||
* @return string Html
|
||||
*/
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups)
|
||||
function tactical_groups_get_agents_and_monitoring($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'total_agents' => groups_agents_total_counters($id_groups, false)['total'],
|
||||
'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS
|
||||
$urls = [];
|
||||
@ -2703,16 +2705,18 @@ function tactical_groups_get_agents_and_monitoring($id_groups)
|
||||
* @param [type] $id_groups
|
||||
* @return string Html.
|
||||
*/
|
||||
function tactical_groups_get_stats_alerts($id_groups)
|
||||
function tactical_groups_get_stats_alerts($id_groups, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
if ($data === '') {
|
||||
$alerts = groups_monitor_alerts_total_counters($id_groups, false);
|
||||
$data = [
|
||||
'monitor_alerts' => $alerts['total'],
|
||||
'monitor_alerts_fired' => $alerts['fired'],
|
||||
|
||||
];
|
||||
];
|
||||
}
|
||||
|
||||
$urls = [];
|
||||
$urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0];
|
||||
@ -2780,17 +2784,19 @@ function tactical_groups_get_stats_alerts($id_groups)
|
||||
* @param boolean $data_agents
|
||||
* @return void
|
||||
*/
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false)
|
||||
function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false, $data='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
if ($data === '') {
|
||||
$data = [
|
||||
'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false),
|
||||
'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false),
|
||||
];
|
||||
}
|
||||
|
||||
// Link URLS.
|
||||
if ($links === false) {
|
||||
|
@ -2166,7 +2166,8 @@ function html_print_extended_select_for_time(
|
||||
$style_icon='',
|
||||
$no_change=false,
|
||||
$allow_zero=0,
|
||||
$units=null
|
||||
$units=null,
|
||||
$script_input=''
|
||||
) {
|
||||
global $config;
|
||||
$admin = is_user_admin($config['id_user']);
|
||||
@ -2256,7 +2257,7 @@ function html_print_extended_select_for_time(
|
||||
echo '</div>';
|
||||
|
||||
echo '<div id="'.$uniq_name.'_manual" class="w100p inline_flex">';
|
||||
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
|
||||
html_print_input_text($uniq_name.'_text', $selected, '', $size, 255, false, $readonly, false, '', $class, $script_input);
|
||||
|
||||
html_print_input_hidden($name, $selected, false, $uniq_name);
|
||||
html_print_select(
|
||||
@ -5773,7 +5774,11 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['readonly']) === true) ? $data['readonly'] : false),
|
||||
((isset($data['custom_fields']) === true) ? $data['custom_fields'] : false),
|
||||
((isset($data['style_icon']) === true) ? $data['style_icon'] : '')
|
||||
((isset($data['style_icon']) === true) ? $data['style_icon'] : ''),
|
||||
((isset($data['no_change']) === true) ? $data['no_change'] : ''),
|
||||
((isset($data['allow_zero']) === true) ? $data['allow_zero'] : ''),
|
||||
((isset($data['units']) === true) ? $data['units'] : null),
|
||||
((isset($data['script_input']) === true) ? $data['script_input'] : '')
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -950,11 +950,14 @@ if (is_ajax()) {
|
||||
$dialog = '
|
||||
<div id="about-tabs" class="invisible overflow-hidden">
|
||||
<ul>
|
||||
<li><a href="#tab-general-view">'.__('Information').'</a></li>
|
||||
<li><a href="#tab-database">'.__('Database').'</a></li>
|
||||
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
|
||||
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>
|
||||
<li class="ui-tabs-close-button" style="float:right!important;">
|
||||
<li><a href="#tab-general-view">'.__('Information').'</a></li>';
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) {
|
||||
$dialog .= '<li><a href="#tab-database">'.__('Database').'</a></li>
|
||||
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
|
||||
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>';
|
||||
}
|
||||
|
||||
$dialog .= '<li class="ui-tabs-close-button" style="float:right!important;">
|
||||
<img id="about-close" style="cursor: pointer;" src="'.ui_get_full_url('/include/styles/images/dialog-titlebar-close.png', false, false, false).'" alt="'.__('Close').'" title="'.__('Close').'" width="25px">
|
||||
</li>
|
||||
</ul>
|
||||
@ -986,7 +989,7 @@ if (is_ajax()) {
|
||||
$dialog .= '<p><b><a href="https://pandorafms.com/contact/" target="_blank">'.__('Contact Pandora FMS for official support contract.').'</a></b></p>';
|
||||
}
|
||||
|
||||
if (((bool) check_acl($config['id_user'], 0, 'PM') === true) && (is_metaconsole() === false)) {
|
||||
if (((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) && (is_metaconsole() === false)) {
|
||||
$dialogButtons = [];
|
||||
|
||||
$dialogButtons[] = html_print_button(
|
||||
@ -1028,222 +1031,224 @@ if (is_ajax()) {
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' <a href="https://pandorafms.com/" target="_blank">Pandora FMS</a>. All rights reserved</p>
|
||||
</div>
|
||||
<div id="tab-database" class="div-scroll">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database health status').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->unknownAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->notInitAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_health->data->pandoraDbLastRun->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</div>';
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || $config['is_admin']['admin'] === true) {
|
||||
$dialog .= '<div id="tab-database" class="div-scroll">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database health status').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->unknownAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_health->data->notInitAgents->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_health->data->pandoraDbLastRun->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database status info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeFirstVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeBuild->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Database status info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeFirstVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_info->data->dbSchemeBuild->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="about-last-tr">
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p class="about-last-p" style="font-size: 10pt;">'.$db_info->data->dbSize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p>'.$fragmentation_status.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p style="font-size: 10pt;">'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 50%;">
|
||||
<p>'.$fragmentation_status.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-system-info">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('System Info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 30%;">
|
||||
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->cpuInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->osInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->hostnameInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ipInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$system_date->data->date->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$system_date->data->date->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-php-system">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('PHP system').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->phpVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxExecutionTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxInputTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->memoryLimit->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->sessionLifetime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-system-info">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('System Info').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 30%;">
|
||||
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->cpuInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ramInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->osInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->hostnameInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$sys_info->data->ipInfo->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 15%;">
|
||||
<p><span>'.$system_date->data->date->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 85%;">
|
||||
<p style="font-size: 10pt;">'.$system_date->data->date->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tab-php-system">
|
||||
<table class="table-about">
|
||||
<tbody style="text-align: left;">
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<h2><span> - </span>'.__('PHP system').'</h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 50%;">
|
||||
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->phpVersion->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxExecutionTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->maxInputTime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->memoryLimit->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->sessionLifetime->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
';
|
||||
}
|
||||
|
||||
echo $dialog;
|
||||
}
|
||||
|
@ -620,45 +620,33 @@ function planned_downtimes_stop($downtime)
|
||||
|
||||
$count = 0;
|
||||
foreach ($agents as $agent) {
|
||||
if ($agent['all_modules']) {
|
||||
$modules = db_get_all_rows_filter(
|
||||
'tplanned_downtime_modules',
|
||||
[
|
||||
'id_agent' => $agent['id_agent'],
|
||||
'id_downtime' => $id_downtime,
|
||||
]
|
||||
);
|
||||
if (empty($modules)) {
|
||||
$modules = [];
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$result = db_process_sql_update(
|
||||
'tagente',
|
||||
['quiet' => 0],
|
||||
['id_agente' => $agent['id_agent']]
|
||||
'tagente_modulo',
|
||||
[
|
||||
'quiet' => 0,
|
||||
'quiet_by_downtime' => 0,
|
||||
],
|
||||
[
|
||||
'quiet_by_downtime' => 1,
|
||||
'id_agente_modulo' => $module['id_agent_module'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
$modules = db_get_all_rows_filter(
|
||||
'tplanned_downtime_modules',
|
||||
[
|
||||
'id_agent' => $agent['id_agent'],
|
||||
'id_downtime' => $id_downtime,
|
||||
]
|
||||
);
|
||||
if (empty($modules)) {
|
||||
$modules = [];
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$result = db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
[
|
||||
'quiet' => 0,
|
||||
'quiet_by_downtime' => 0,
|
||||
],
|
||||
[
|
||||
'quiet_by_downtime' => 1,
|
||||
'id_agente_modulo' => $module['id_agent_module'],
|
||||
]
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2581,7 +2581,237 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
||||
|
||||
$table->colspan['group_report']['cell'] = 3;
|
||||
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
|
||||
$data = "<table class='info_table' width='100%'>
|
||||
$metaconsole_connected = false;
|
||||
if (is_metaconsole() === true) {
|
||||
$connection = metaconsole_get_connection($item['server_name']);
|
||||
if (metaconsole_connect($connection) == NOERR) {
|
||||
$metaconsole_connected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['subtitle'] === 'All') {
|
||||
$group_id = [];
|
||||
$all_group_id = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo');
|
||||
|
||||
foreach ($all_group_id as $group) {
|
||||
$group_id[] = $group['id_grupo'];
|
||||
}
|
||||
|
||||
$description = __('Data view of all groups');
|
||||
$icon = '';
|
||||
|
||||
$group_events = db_get_all_rows_sql(
|
||||
'SELECT COUNT(te.id_evento) as count_events, ta.alias
|
||||
FROM tevento as te
|
||||
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
|
||||
GROUP BY te.id_agente'
|
||||
);
|
||||
|
||||
$group_os = db_get_all_rows_sql(
|
||||
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
|
||||
FROM tconfig_os as os
|
||||
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
|
||||
);
|
||||
} else {
|
||||
$group_id = db_get_value('id_grupo', 'tgrupo', 'nombre', $item['subtitle']);
|
||||
$description = db_get_value('description', 'tgrupo', 'id_grupo', $group_id);
|
||||
$icon_url = db_get_value('icon', 'tgrupo', 'id_grupo', $group_id);
|
||||
$icon = html_print_image(
|
||||
'images/'.$icon_url,
|
||||
true,
|
||||
[
|
||||
'title' => $item['subtitle'],
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
);
|
||||
|
||||
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
|
||||
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
|
||||
|
||||
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
|
||||
$array_group_id = [];
|
||||
$array_group_id[] = $group_id;
|
||||
foreach ($childrens as $group) {
|
||||
$array_group_id[] = $group['id_grupo'];
|
||||
}
|
||||
|
||||
$group_id = $array_group_id;
|
||||
$explode_group_id = implode(',', $group_id);
|
||||
} else {
|
||||
$explode_group_id = $group_id;
|
||||
}
|
||||
|
||||
$group_events = db_get_all_rows_sql(
|
||||
'SELECT COUNT(te.id_evento) as count_events, ta.alias
|
||||
FROM tevento as te
|
||||
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
|
||||
GROUP BY te.id_agente'
|
||||
);
|
||||
|
||||
$group_os = db_get_all_rows_sql(
|
||||
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
|
||||
FROM tconfig_os as os
|
||||
INNER JOIN tagente as ta ON ta.id_os = os.id_os
|
||||
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
|
||||
);
|
||||
}
|
||||
|
||||
if ($metaconsole_connected === true) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$graph_width = 280;
|
||||
$graph_height = 250;
|
||||
|
||||
$out = '<table width="100%" class="info_table">';
|
||||
$out .= '<tbody>';
|
||||
$out .= '<tr>';
|
||||
|
||||
$out .= '<td>';
|
||||
$out .= '<fieldset class="databox tactical_set" id="group_view_'.$item['subtitle'].'">
|
||||
<legend>'.$item['subtitle'].' '.$icon.'</legend>';
|
||||
|
||||
$out .= '<table class="info_table group_view_table">';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td style="word-wrap:break-word; text-align: left;">
|
||||
<fieldset>
|
||||
<legend>'.__('Group Description').'</legend> '.$description.'</fieldset>
|
||||
</td>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'monitor_alerts' => $item['data']['group_stats']['monitor_alerts'],
|
||||
'monitor_alerts_fired' => $item['data']['group_stats']['monitor_alerts_fired'],
|
||||
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_stats_alerts($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'total_agents' => $item['data']['group_stats']['total_agents'],
|
||||
'monitor_total' => $item['data']['group_stats']['monitor_checks'],
|
||||
];
|
||||
|
||||
$out .= tactical_groups_get_agents_and_monitoring($group_id, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
|
||||
$data = [
|
||||
'monitor_critical' => $item['data']['group_stats']['monitor_critical'],
|
||||
'monitor_warning' => $item['data']['group_stats']['monitor_warning'],
|
||||
'monitor_ok' => $item['data']['group_stats']['monitor_ok'],
|
||||
'monitor_unknown' => $item['data']['group_stats']['monitor_unknown'],
|
||||
'monitor_not_init' => $item['data']['group_stats']['monitor_not_init'],
|
||||
];
|
||||
$out .= groups_get_stats_modules_status($group_id, 250, 150, false, false, $data);
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '<tr>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td><fieldset><legend>'.__('Events per agent').'</legend>';
|
||||
$data = [];
|
||||
$options = [];
|
||||
$labels = [];
|
||||
|
||||
foreach ($group_events as $value) {
|
||||
$data[$value['alias']] = $value['count_events'];
|
||||
$labels[] = io_safe_output($value['alias']);
|
||||
}
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$ttl = 2;
|
||||
} else {
|
||||
$ttl = 0;
|
||||
}
|
||||
|
||||
$options = [
|
||||
'width' => $graph_width,
|
||||
'height' => $graph_height,
|
||||
'legend' => ['display' => false],
|
||||
'labels' => $labels,
|
||||
'ttl' => $ttl,
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'top',
|
||||
'align' => 'center',
|
||||
],
|
||||
];
|
||||
|
||||
$out .= '<div id="events_per_agent_pie" style="height: '.$graph_height.'px">';
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '<img src="data:image/png;base64,';
|
||||
} else {
|
||||
$out .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'px;">';
|
||||
}
|
||||
|
||||
$out .= pie_graph($data, $options);
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '" />';
|
||||
} else {
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td><fieldset><legend>'.__('Distribution by OS').'</legend>';
|
||||
|
||||
$data = [];
|
||||
$options = [];
|
||||
$labels = [];
|
||||
foreach ($group_os as $value) {
|
||||
$data[$value['name_os']] = $value['count_os'];
|
||||
$labels[] = io_safe_output($value['name_os']);
|
||||
}
|
||||
|
||||
$options = [
|
||||
'width' => $graph_width,
|
||||
'height' => $graph_height,
|
||||
'legend' => ['display' => false],
|
||||
'labels' => $labels,
|
||||
'ttl' => $ttl,
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'top',
|
||||
'align' => 'center',
|
||||
],
|
||||
];
|
||||
|
||||
$out .= '<div id="group_os_pie" style="height: '.$graph_height.'px">';
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '<img src="data:image/png;base64,';
|
||||
} else {
|
||||
$out .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'px;">';
|
||||
}
|
||||
|
||||
$out .= pie_graph($data, $options);
|
||||
if ((int) $ttl === 2) {
|
||||
$out .= '" />';
|
||||
} else {
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</table>';
|
||||
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
$out .= '</td>';
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= '</tbody>';
|
||||
$out .= '</table>';
|
||||
|
||||
/*
|
||||
$data = "<table class='info_table' width='100%'>
|
||||
<tbody><tr>
|
||||
<td></td>
|
||||
<td colspan='3' class='cellBold cellCenter'>".__('Total')."</td>
|
||||
@ -2624,12 +2854,12 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
||||
<td class='cellBold cellCenter'>".__('Events (not validated)')."</td>
|
||||
<td colspan='6' class='cellBold cellCenter cellWhite cellBorder1 cellBig'>".$item['data']['count_events'].'</td>
|
||||
</tr></tbody>
|
||||
</table>';
|
||||
</table>';*/
|
||||
|
||||
$table->data['group_report']['cell'] = $data;
|
||||
$table->data['group_report']['cell'] = $out;
|
||||
|
||||
if ($pdf !== 0) {
|
||||
return $data;
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3913,6 +3913,15 @@ function ui_print_datatable(array $parameters)
|
||||
$parameters['toggle_collapsed'] = true;
|
||||
}
|
||||
|
||||
$columns_tmp = [];
|
||||
foreach ($parameters['columns'] as $k_column => $v_column) {
|
||||
if (isset($parameters['columns'][$k_column]['text']) === true) {
|
||||
array_push($columns_tmp, $v_column['text']);
|
||||
} else {
|
||||
array_push($columns_tmp, $v_column);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($parameters['order'])) {
|
||||
$order = 0;
|
||||
$direction = 'asc';
|
||||
@ -3926,7 +3935,7 @@ function ui_print_datatable(array $parameters)
|
||||
} else {
|
||||
$order = array_search(
|
||||
$parameters['order']['field'],
|
||||
$parameters['columns']
|
||||
$columns_tmp
|
||||
);
|
||||
|
||||
if ($order === false) {
|
||||
@ -3943,7 +3952,7 @@ function ui_print_datatable(array $parameters)
|
||||
foreach ($parameters['no_sortable_columns'] as $key => $find) {
|
||||
$found = array_search(
|
||||
$parameters['no_sortable_columns'][$key],
|
||||
$parameters['columns']
|
||||
$columns_tmp
|
||||
);
|
||||
|
||||
if ($found !== false) {
|
||||
@ -4165,11 +4174,7 @@ function ui_print_datatable(array $parameters)
|
||||
$parameters['dataElements'] = json_encode($parameters['data_element']);
|
||||
|
||||
// * START JAVASCRIPT.
|
||||
if (is_metaconsole() === false) {
|
||||
$file_path = ui_get_full_url('include/javascript/datatablesFunction.js');
|
||||
} else {
|
||||
$file_path = ui_get_full_url('../../include/javascript/datatablesFunction.js');
|
||||
}
|
||||
$file_path = $config['homedir'].'/include/javascript/datatablesFunction.js';
|
||||
|
||||
$file_content = file_get_contents($file_path);
|
||||
$json_data = json_encode($parameters);
|
||||
@ -4229,18 +4234,17 @@ function ui_print_datatable(array $parameters)
|
||||
false
|
||||
);
|
||||
$output .= '?v='.$config['current_package'].'"/>';
|
||||
if (is_metaconsole() === true) {
|
||||
// Load meta_tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
ENTERPRISE_DIR.'/include/styles/meta_tables.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '?v='.$config['current_package'].'"/>';
|
||||
}
|
||||
|
||||
// if (is_metaconsole() === true) {
|
||||
// Load meta_tables.css.
|
||||
// $output .= '<link rel="stylesheet" href="';
|
||||
// $output .= ui_get_full_url(
|
||||
// ENTERPRISE_DIR.'/include/styles/meta_tables.css',
|
||||
// false,
|
||||
// false,
|
||||
// false
|
||||
// );
|
||||
// $output .= '?v='.$config['current_package'].'"/>';
|
||||
// }
|
||||
// Load datatables.js.
|
||||
$output .= '<script src="';
|
||||
$output .= ui_get_full_url(
|
||||
@ -4516,7 +4520,8 @@ function ui_toggle(
|
||||
$switch_on=null,
|
||||
$switch_name=null,
|
||||
$disableToggle=false,
|
||||
$id_table=false
|
||||
$id_table=false,
|
||||
$position_tgl_div=false
|
||||
) {
|
||||
// Generate unique Id.
|
||||
$uniqid = uniqid('');
|
||||
@ -4635,6 +4640,11 @@ function ui_toggle(
|
||||
}
|
||||
|
||||
if ($disableToggle === false) {
|
||||
$position_div = 'relative';
|
||||
if ($position_tgl_div !== false) {
|
||||
$position_div = $position_tgl_div;
|
||||
}
|
||||
|
||||
// JQuery Toggle.
|
||||
$output .= '<script type="text/javascript">'."\n";
|
||||
$output .= ' var hide_tgl_ctrl_'.$uniqid.' = '.(int) $hidden_default.";\n";
|
||||
@ -4659,7 +4669,7 @@ function ui_toggle(
|
||||
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
|
||||
$output .= " $('#tgl_div_".$uniqid."').css('position', '".$position_div."');\n";
|
||||
$output .= " $('#image_".$uniqid."').attr('style', 'rotate: ".$rotateA."');\n";
|
||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
|
||||
$output .= $class_table;
|
||||
@ -7088,7 +7098,7 @@ function ui_print_breadcrums($tab_name)
|
||||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
function ui_print_comments($comments, $truncate_limit=255)
|
||||
function ui_print_comments($comment, $truncate_limit=255)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -2554,6 +2554,7 @@ function visual_map_process_wizard_add(
|
||||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width=0,
|
||||
$height=0,
|
||||
$period='',
|
||||
@ -2562,7 +2563,10 @@ function visual_map_process_wizard_add(
|
||||
$max_value=0,
|
||||
$type_percentile='',
|
||||
$value_show='',
|
||||
$type=''
|
||||
$type='',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
if (empty($id_agents)) {
|
||||
print_error_message(__('No agents selected'));
|
||||
@ -2572,14 +2576,9 @@ function visual_map_process_wizard_add(
|
||||
$id_agents = (array) $id_agents;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
$value_height = $height;
|
||||
$value_image = $image;
|
||||
$value_type = $type;
|
||||
@ -2628,7 +2627,14 @@ function visual_map_process_wizard_add(
|
||||
|
||||
db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
}
|
||||
|
||||
$return = ui_print_success_message(__('Agent successfully added to layout'), '', true);
|
||||
@ -2654,6 +2660,7 @@ function visual_map_process_wizard_add_modules(
|
||||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
@ -2669,7 +2676,10 @@ function visual_map_process_wizard_add_modules(
|
||||
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
|
||||
$item_in_the_map=0,
|
||||
$fontf='lato',
|
||||
$fonts='12pt'
|
||||
$fonts='12pt',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
if (empty($width) === true) {
|
||||
$width = 0;
|
||||
@ -2691,15 +2701,9 @@ function visual_map_process_wizard_add_modules(
|
||||
$id_modules = (array) $id_modules;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
foreach ($id_modules as $id_module) {
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
if ($id_server != 0) {
|
||||
$connection = db_get_row_filter(
|
||||
'tmetaconsole_setup',
|
||||
@ -2820,7 +2824,14 @@ function visual_map_process_wizard_add_modules(
|
||||
|
||||
db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
}
|
||||
|
||||
$return = ui_print_success_message(__('Modules successfully added to layout'), '', true);
|
||||
@ -2885,6 +2896,7 @@ function visual_map_process_wizard_add_agents(
|
||||
$image,
|
||||
$id_layout,
|
||||
$range,
|
||||
$range_vertical,
|
||||
$width,
|
||||
$height,
|
||||
$period,
|
||||
@ -2900,7 +2912,10 @@ function visual_map_process_wizard_add_agents(
|
||||
$kind_relationship=VISUAL_MAP_WIZARD_PARENTS_NONE,
|
||||
$item_in_the_map=0,
|
||||
$fontf='lato',
|
||||
$fonts='12pt'
|
||||
$fonts='12pt',
|
||||
$pos_x=10,
|
||||
$pos_y=10,
|
||||
$max_elements_row=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
@ -2925,9 +2940,8 @@ function visual_map_process_wizard_add_agents(
|
||||
$id_agents = (array) $id_agents;
|
||||
|
||||
$error = false;
|
||||
$pos_y = 10;
|
||||
$pos_x = 10;
|
||||
|
||||
$elements_row = 1;
|
||||
$initial_x = $pos_x;
|
||||
$relationship = true;
|
||||
$relationships_agents = [];
|
||||
// Check if the set a none relationship
|
||||
@ -2945,11 +2959,6 @@ function visual_map_process_wizard_add_agents(
|
||||
$id_agent = $id_a;
|
||||
}
|
||||
|
||||
if ($pos_x > 600) {
|
||||
$pos_x = 10;
|
||||
$pos_y = ($pos_y + $range);
|
||||
}
|
||||
|
||||
$value_height = $height;
|
||||
$value_image = $image;
|
||||
$value_type = $type;
|
||||
@ -3061,6 +3070,15 @@ function visual_map_process_wizard_add_agents(
|
||||
|
||||
$id_item = db_process_sql_insert('tlayout_data', $values);
|
||||
|
||||
if (($max_elements_row === $elements_row) && $max_elements_row !== 0) {
|
||||
$elements_row = 1;
|
||||
$pos_x = $initial_x;
|
||||
$pos_y = ($range_vertical + $pos_y);
|
||||
} else {
|
||||
$pos_x = ($pos_x + $range);
|
||||
$elements_row++;
|
||||
}
|
||||
|
||||
if ($relationship) {
|
||||
switch ($kind_relationship) {
|
||||
case VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP:
|
||||
@ -3093,8 +3111,6 @@ function visual_map_process_wizard_add_agents(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$pos_x = ($pos_x + $range);
|
||||
}
|
||||
|
||||
foreach ($relationships_agents as $relationship_item) {
|
||||
|
@ -46,6 +46,18 @@ $hash = get_parameter('hash');
|
||||
$file_raw = get_parameter('file');
|
||||
|
||||
$file = base64_decode(urldecode($file_raw));
|
||||
$secure_extension = true;
|
||||
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if ($extension === 'php' || $extension === 'js') {
|
||||
$secure_extension = false;
|
||||
}
|
||||
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$dirname = dirname($file);
|
||||
|
||||
$path_traversal = strpos($file, '../');
|
||||
|
||||
// Avoid possible inifite loop with referer.
|
||||
if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN']) === true && $_SERVER['HTTP_REFERER'] === $_SERVER['HTTP_ORIGIN'].$_SERVER['REQUEST_URI'])) {
|
||||
$refererPath = ui_get_full_url('index.php');
|
||||
@ -53,12 +65,13 @@ if (isset($_SERVER['HTTP_ORIGIN']) === false || (isset($_SERVER['HTTP_ORIGIN'])
|
||||
$refererPath = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier']) || isset($_SERVER['HTTP_REFERER']) === false) {
|
||||
if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$config['server_unique_identifier'])
|
||||
|| isset($_SERVER['HTTP_REFERER']) === false || $path_traversal !== false || $secure_extension === false
|
||||
) {
|
||||
$errorMessage = __('Security error. Please contact the administrator.');
|
||||
} else {
|
||||
$downloadable_file = '';
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
|
||||
// Metaconsole have a route distinct than node.
|
||||
$main_file_manager = (is_metaconsole() === true) ? 'advanced/metasetup' : 'godmode/setup/file_manager';
|
||||
$main_collections = (is_metaconsole() === true) ? 'advanced/collections' : 'enterprise/godmode/agentes/collections';
|
||||
@ -70,7 +83,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
||||
break;
|
||||
|
||||
case 'extensions/files_repo':
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$downloadable_file = $attachment_path.'/files_repo/'.$file;
|
||||
// $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/servers/plugin':
|
||||
@ -81,6 +96,9 @@ if (empty($file) === true || empty($hash) === true || $hash !== md5($file_raw.$c
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
|
||||
break;
|
||||
|
||||
case 'godmode/setup/file_manager':
|
||||
$downloadable_file = ($dirname === 'image') ? $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file : '';
|
||||
|
||||
default:
|
||||
// Wrong action.
|
||||
$downloadable_file = '';
|
||||
|
@ -995,6 +995,9 @@ function pandoraFlotSlicebar(
|
||||
}
|
||||
}
|
||||
|
||||
// Set array for realtime graphs
|
||||
var realtimeGraphs = [];
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function pandoraFlotArea(
|
||||
graph_id,
|
||||
@ -1007,6 +1010,21 @@ function pandoraFlotArea(
|
||||
params,
|
||||
events_array
|
||||
) {
|
||||
// Realtime graphs.
|
||||
if (typeof params.realtime !== "undefined") {
|
||||
realtimeGraphs.push({
|
||||
graph_id,
|
||||
values,
|
||||
legend,
|
||||
series_type,
|
||||
color,
|
||||
date_array,
|
||||
data_module_graph,
|
||||
params,
|
||||
events_array
|
||||
});
|
||||
}
|
||||
|
||||
//diferents vars
|
||||
var unit = params.unit ? params.unit : "";
|
||||
var homeurl = params.homeurl;
|
||||
@ -2462,15 +2480,23 @@ function pandoraFlotArea(
|
||||
if (Object.keys(update_legend).length == 0) {
|
||||
label_aux = legend[series.label];
|
||||
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(
|
||||
label_aux +
|
||||
" value = " +
|
||||
number_format(y, 0, "", short_data, divisor) +
|
||||
" " +
|
||||
unit
|
||||
);
|
||||
if (params.graph_analytics === true) {
|
||||
var numberParams = {};
|
||||
numberParams.twoLines = true;
|
||||
$("#legend_" + graph_id + " .legendLabel .square-value")
|
||||
.eq(i)
|
||||
.html(number_format(y, 0, "", 1, divisor, numberParams));
|
||||
} else {
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(
|
||||
label_aux +
|
||||
" value = " +
|
||||
number_format(y, 0, "", short_data, divisor) +
|
||||
" " +
|
||||
unit
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$.each(update_legend, function(index, value) {
|
||||
if (typeof value[x - 1] !== "undefined") {
|
||||
@ -2844,12 +2870,16 @@ function pandoraFlotArea(
|
||||
// Add bottom margin in the legend
|
||||
// Estimated height of 24 (works fine with this data in all browsers)
|
||||
$("#legend_" + graph_id).css("margin-bottom", "10px");
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
.parent()
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
|
||||
if (typeof params.realtime === "undefined" || params.realtime === false) {
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
.parent()
|
||||
.css("height")
|
||||
.split("px")[0]
|
||||
);
|
||||
}
|
||||
|
||||
adjust_menu(graph_id, plot, parent_height, width, show_legend);
|
||||
}
|
||||
}
|
||||
@ -2987,7 +3017,14 @@ function check_adaptions(graph_id) {
|
||||
});
|
||||
}
|
||||
|
||||
function number_format(number, force_integer, unit, short_data, divisor) {
|
||||
function number_format(
|
||||
number,
|
||||
force_integer,
|
||||
unit,
|
||||
short_data,
|
||||
divisor,
|
||||
params
|
||||
) {
|
||||
divisor = typeof divisor !== "undefined" ? divisor : 1000;
|
||||
var decimals = 2;
|
||||
|
||||
@ -3029,6 +3066,11 @@ function number_format(number, force_integer, unit, short_data, divisor) {
|
||||
number = 0;
|
||||
}
|
||||
|
||||
if (typeof params !== "undefined") {
|
||||
if (typeof params.twoLines !== "undefined" && params.twoLines === true);
|
||||
return number + "<br>" + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ function d3_relationship_graph($elements, $matrix, $width=700, $return=false, $h
|
||||
}
|
||||
|
||||
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
||||
function d3_tree_map_graph($data, $width=700, $height=700, $return=false, $id_container='tree_map', $child_links=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -91,7 +91,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
||||
$data = json_encode($data);
|
||||
}
|
||||
|
||||
$output = "<div id=\"tree_map\" style='overflow: hidden;'></div>";
|
||||
$output = '<div id="'.$id_container."\" style='overflow: hidden;'></div>";
|
||||
$output .= include_javascript_d3(true);
|
||||
$output .= '<style type="text/css">
|
||||
.cell>rect {
|
||||
@ -139,8 +139,18 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
|
||||
}
|
||||
</style>';
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
treeMap('#tree_map', $data, '$width', '$height');
|
||||
treeMap('#$id_container', $data, '$width', '$height', $child_links);
|
||||
</script>";
|
||||
if ($child_links === true) {
|
||||
$output .= html_print_input_image(
|
||||
'resize_parent',
|
||||
'/images/normal_screen.png',
|
||||
1,
|
||||
'background-color: white !important; padding: 4px !important;',
|
||||
true,
|
||||
['class' => 'resize_button invisible']
|
||||
);
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
echo $output;
|
||||
|
@ -39,7 +39,7 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false
|
||||
$output .= '
|
||||
<script type="text/javascript">
|
||||
var phpTimezone = "'.date_default_timezone_get().'";
|
||||
var configHomeurl = "'.$config['homeurl'].'";
|
||||
var configHomeurl = "'.((is_metaconsole() === false) ? $config['homeurl'] : '../../').'";
|
||||
</script>';
|
||||
|
||||
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
|
||||
@ -262,8 +262,14 @@ function flot_area_graph(
|
||||
(empty($params['line_width']) === true) ? $config['custom_graph_width'] : $params['line_width'],
|
||||
true
|
||||
);
|
||||
|
||||
$timestamp_top_fixed = '';
|
||||
if (isset($params['timestamp_top_fixed']) === true && empty($params['timestamp_top_fixed']) === false) {
|
||||
$timestamp_top_fixed = $params['timestamp_top_fixed'];
|
||||
}
|
||||
|
||||
$return .= "<div id='timestamp_$graph_id'
|
||||
class='timestamp_graph'
|
||||
class='timestamp_graph ".$timestamp_top_fixed." '
|
||||
style='font-size:".$params['font_size']."pt;
|
||||
display:none; position:absolute;
|
||||
background:#fff; border: solid 1px #aaa;
|
||||
@ -275,8 +281,20 @@ function flot_area_graph(
|
||||
$return .= 'noresizevc ';
|
||||
}
|
||||
|
||||
if (strpos($params['width'], '%') === false) {
|
||||
$width = 'width: '.$params['width'].'px;';
|
||||
} else {
|
||||
$width = 'width: '.$params['width'].';';
|
||||
}
|
||||
|
||||
if (strpos($params['graph_width'], '%') === false) {
|
||||
$width = 'width: '.$params['graph_width'].'px;';
|
||||
} else {
|
||||
$width = 'width: '.$params['graph_width'].';';
|
||||
}
|
||||
|
||||
$return .= 'graph'.$params['adapt_key']."'
|
||||
style=' width: ".$params['width'].'px;
|
||||
style='".$width.';
|
||||
height: '.$params['height']."px;'></div>";
|
||||
|
||||
$legend_top = 10;
|
||||
|
@ -402,18 +402,24 @@ function chordDiagram(recipient, elements, matrix, width, height) {
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
function treeMap(recipient, data, width, height) {
|
||||
function treeMap(recipient, data, width, height, childLinks = false) {
|
||||
//var isIE = BrowserDetect.browser == 'Explorer';
|
||||
var isIE = true;
|
||||
var chartWidth = width;
|
||||
var chartHeight = height;
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
$("#tooltip").css(
|
||||
const uniqueId = generateUniqueId();
|
||||
if (document.getElementById("hidden-selected_style_theme") !== null) {
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
} else {
|
||||
var consoleStyle = "";
|
||||
}
|
||||
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"color",
|
||||
consoleStyle === "pandora_black" ? "rgb(240, 240, 240)" : "rgb(0, 0, 0)"
|
||||
);
|
||||
$("#tooltip").css(
|
||||
$("#tooltip_" + uniqueId).css(
|
||||
"background-color",
|
||||
consoleStyle === "pandora_black" ? "rgb(0, 0, 0)" : "rgb(240, 240, 240)"
|
||||
);
|
||||
@ -431,6 +437,9 @@ function treeMap(recipient, data, width, height) {
|
||||
var transitionDuration = 500;
|
||||
var root;
|
||||
var node;
|
||||
var resize_button = $(recipient)
|
||||
.parent()
|
||||
.find(".resize_button");
|
||||
|
||||
var treemap = d3.layout
|
||||
.treemap()
|
||||
@ -468,6 +477,7 @@ function treeMap(recipient, data, width, height) {
|
||||
.attr("class", "cell parent")
|
||||
.on("click", function(d) {
|
||||
zoom(d);
|
||||
resize_button.show();
|
||||
})
|
||||
.append("svg")
|
||||
.attr("class", "clip")
|
||||
@ -476,6 +486,9 @@ function treeMap(recipient, data, width, height) {
|
||||
})
|
||||
.attr("height", headerHeight);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("rect")
|
||||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
@ -483,6 +496,9 @@ function treeMap(recipient, data, width, height) {
|
||||
.attr("height", headerHeight)
|
||||
.style("fill", headerColor);
|
||||
parentEnterTransition
|
||||
.filter(function(d) {
|
||||
if (d.name) return d;
|
||||
})
|
||||
.append("text")
|
||||
.attr("class", "label")
|
||||
.attr("fill", "white")
|
||||
@ -490,6 +506,7 @@ function treeMap(recipient, data, width, height) {
|
||||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
})
|
||||
.attr("style", "transition: all 0.5s ease-out;")
|
||||
.attr("height", headerHeight)
|
||||
.text(function(d) {
|
||||
return d.name;
|
||||
@ -521,6 +538,10 @@ function treeMap(recipient, data, width, height) {
|
||||
// remove transition
|
||||
parentCells.exit().remove();
|
||||
|
||||
$(resize_button).on("click", function() {
|
||||
zoom(root);
|
||||
$(this).hide();
|
||||
});
|
||||
// create children cells
|
||||
var childrenCells = chart
|
||||
.selectAll("g.cell.child")
|
||||
@ -534,19 +555,27 @@ function treeMap(recipient, data, width, height) {
|
||||
.append("g")
|
||||
.attr("class", "cell child")
|
||||
.on("click", function(d) {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
if (childLinks) {
|
||||
if (node === d.parent) {
|
||||
window.location.href = d.link;
|
||||
} else {
|
||||
resize_button.show();
|
||||
zoom(d.parent);
|
||||
}
|
||||
} else {
|
||||
zoom(node === d.parent ? root : d.parent);
|
||||
}
|
||||
})
|
||||
.on("mouseover", over_user)
|
||||
.on("mouseout", out_user)
|
||||
.on("mousemove", move_tooltip)
|
||||
.append("svg")
|
||||
.attr("class", "clip");
|
||||
|
||||
$(recipient).on("mouseover", over_user);
|
||||
$(recipient).on("mouseout", out_user);
|
||||
$(recipient).on("mousemove", move_tooltip);
|
||||
childEnterTransition
|
||||
.append("rect")
|
||||
.classed("background", true)
|
||||
.style("fill", function(d) {
|
||||
return color(d.name);
|
||||
return d.color ? d.color : color(d.name);
|
||||
});
|
||||
|
||||
childEnterTransition
|
||||
@ -608,6 +637,30 @@ function treeMap(recipient, data, width, height) {
|
||||
|
||||
zoom(node);
|
||||
|
||||
function calculateSizeText() {
|
||||
$(recipient + " .parent .clip .label").each((key, node) => {
|
||||
const textElement = node;
|
||||
const containerWidth = parseFloat(
|
||||
$(textElement)
|
||||
.parent()
|
||||
.attr("width")
|
||||
);
|
||||
const originalFontSize = 12;
|
||||
|
||||
textElement.style.fontSize = "16px";
|
||||
const computedTextLength = textElement.getComputedTextLength();
|
||||
const textWidth = computedTextLength + 8;
|
||||
textElement.style.fontSize = originalFontSize + "px";
|
||||
|
||||
const scaleFactor = containerWidth / textWidth;
|
||||
let scaledFontSize = parseFloat(originalFontSize) * scaleFactor;
|
||||
|
||||
scaledFontSize = scaledFontSize > 12 ? 12 : scaledFontSize;
|
||||
|
||||
textElement.style.fontSize = scaledFontSize + "px";
|
||||
});
|
||||
}
|
||||
|
||||
function size(d) {
|
||||
return d.size;
|
||||
}
|
||||
@ -728,6 +781,9 @@ function treeMap(recipient, data, width, height) {
|
||||
if (d3.event) {
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
setTimeout(() => {
|
||||
calculateSizeText();
|
||||
}, transitionDuration);
|
||||
}
|
||||
|
||||
function position() {
|
||||
@ -746,11 +802,10 @@ function treeMap(recipient, data, width, height) {
|
||||
}
|
||||
|
||||
function move_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
$("#tooltip").css("left", x + "px");
|
||||
$("#tooltip").css("top", y + "px");
|
||||
x = d.offsetX + 40;
|
||||
y = d.offsetY + 40;
|
||||
$("#tooltip_" + uniqueId).css("left", x + "px");
|
||||
$("#tooltip_" + uniqueId).css("top", y + "px");
|
||||
}
|
||||
|
||||
function over_user(d) {
|
||||
@ -772,17 +827,17 @@ function treeMap(recipient, data, width, height) {
|
||||
}
|
||||
|
||||
function create_tooltip(d, x, y) {
|
||||
if ($("#tooltip").length == 0) {
|
||||
if ($("#tooltip_" + uniqueId).length == 0) {
|
||||
$(recipient).append(
|
||||
$("<div></div>")
|
||||
.attr("id", "tooltip")
|
||||
.html(d.tooltip_content)
|
||||
.attr("id", "tooltip_" + uniqueId)
|
||||
.html(d.target.__data__.tooltip_content)
|
||||
);
|
||||
} else {
|
||||
$("#tooltip").html(d.tooltip_content);
|
||||
$("#tooltip_" + uniqueId).html(d.target.__data__.tooltip_content);
|
||||
}
|
||||
|
||||
$("#tooltip").attr(
|
||||
$("#tooltip_" + uniqueId).attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"color: #111;" +
|
||||
@ -805,14 +860,22 @@ function treeMap(recipient, data, width, height) {
|
||||
}
|
||||
|
||||
function show_tooltip(d) {
|
||||
x = d3.event.pageX + 10;
|
||||
y = d3.event.pageY + 10;
|
||||
|
||||
create_tooltip(d, x, y);
|
||||
x = d.offsetX + 10;
|
||||
y = d.offsetY + 10;
|
||||
if (d.target.__data__) {
|
||||
create_tooltip(d, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
function hide_tooltip() {
|
||||
$("#tooltip").hide();
|
||||
$("#tooltip_" + uniqueId).hide();
|
||||
}
|
||||
|
||||
function generateUniqueId() {
|
||||
const timestamp = new Date().getTime();
|
||||
const randomNum = Math.floor(Math.random() * 10000);
|
||||
const uniqueId = `${timestamp}-${randomNum}`;
|
||||
return uniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
|
713
pandora_console/include/javascript/graph_analytics.js
Normal file
713
pandora_console/include/javascript/graph_analytics.js
Normal file
@ -0,0 +1,713 @@
|
||||
// Droppable options.
|
||||
var droppableOptions = {
|
||||
accept: ".draggable",
|
||||
hoverClass: "drops-hover",
|
||||
activeClass: "droppable-zone",
|
||||
drop: function(event, ui) {
|
||||
// Add new module.
|
||||
$(this)
|
||||
.data("modules")
|
||||
.push(ui.draggable.data("id-module"));
|
||||
|
||||
// Create elements.
|
||||
createDroppableZones(droppableOptions, getModulesByGraphs());
|
||||
}
|
||||
};
|
||||
|
||||
// Doc ready.
|
||||
$(document).ready(function() {
|
||||
// Hide toggles.
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
|
||||
// Set droppable zones.
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
});
|
||||
|
||||
// Interval change.
|
||||
$("#interval").change(function(e) {
|
||||
createDroppableZones(droppableOptions, getModulesByGraphs());
|
||||
});
|
||||
|
||||
// Collapse filters.
|
||||
$("div.filters-div-main > .filters-div-header > img").click(function(e) {
|
||||
if ($(".filters-div-main").hasClass("filters-div-main-collapsed") === true) {
|
||||
$(".filters-div-header > img").attr("src", "images/menu/contraer.svg");
|
||||
$(".filters-div-main").removeClass("filters-div-main-collapsed");
|
||||
$("#droppable-graphs").removeClass("droppable-graphs-collapsed");
|
||||
} else {
|
||||
$(".filters-div-header > img").attr("src", "images/menu/expandir.svg");
|
||||
$(".filters-div-main").addClass("filters-div-main-collapsed");
|
||||
$("#droppable-graphs").addClass("droppable-graphs-collapsed");
|
||||
}
|
||||
});
|
||||
|
||||
// Search left.
|
||||
$("#search-left").keyup(function(e) {
|
||||
if ($(this).val() !== "") {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
search_left: e.target.value
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.agents || data.groups || data.modules) {
|
||||
var agentsToggle = $(
|
||||
"#agents-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
var groupsToggle = $(
|
||||
"#groups-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
var modulesToggle = $(
|
||||
"#modules-toggle > div[id^=tgl_div_] > div.white-box-content"
|
||||
);
|
||||
agentsToggle.empty();
|
||||
groupsToggle.empty();
|
||||
modulesToggle.empty();
|
||||
|
||||
if (data.agents) {
|
||||
$("#agents-toggle").show();
|
||||
data.agents.forEach(agent => {
|
||||
agentsToggle.append(
|
||||
`<div onclick="clickAgent(event.target);" data-id-agent="${agent.id_agente}" title="${agent.alias}">${agent.alias}</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
}
|
||||
|
||||
if (data.groups) {
|
||||
$("#groups-toggle").show();
|
||||
data.groups.forEach(group => {
|
||||
groupsToggle.append(
|
||||
`<div onclick="clickGroup(event.target);" data-id-group="${group.id_grupo}" title="${group.nombre}">${group.nombre}</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#groups-toggle").hide();
|
||||
}
|
||||
|
||||
if (data.modules) {
|
||||
$("#modules-toggle").show();
|
||||
data.modules.forEach(module => {
|
||||
modulesToggle.append(
|
||||
`<div class="draggable draggable-container" data-id-module="${module.id_agente_modulo}" title="${module.nombre}">
|
||||
<img class="draggable-icon" src="images/draggable.svg">
|
||||
<div class="draggable-module">
|
||||
<span class="draggable-module-name">${module.nombre}</span>
|
||||
<span class="draggable-agent-name">${module.alias}</span>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
});
|
||||
} else {
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
|
||||
// Create draggable elements.
|
||||
$(".draggable").draggable({
|
||||
revert: "invalid",
|
||||
stack: ".draggable",
|
||||
helper: "clone"
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#agents-toggle").hide();
|
||||
$("#groups-toggle").hide();
|
||||
$("#modules-toggle").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function clickAgent(e) {
|
||||
$("#search-agent").val($(e).data("id-agent"));
|
||||
$("#search-group").val("");
|
||||
searchRight($("#search-right").val());
|
||||
}
|
||||
|
||||
function clickGroup(e) {
|
||||
$("#search-group").val($(e).data("id-group"));
|
||||
$("#search-agent").val("");
|
||||
searchRight($("#search-right").val());
|
||||
}
|
||||
|
||||
// Search right.
|
||||
$("#search-right").keyup(function(e) {
|
||||
if ($("#search-right") !== "") {
|
||||
searchRight(e.target.value);
|
||||
}
|
||||
});
|
||||
|
||||
function searchRight(freeSearch) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
search_right: true,
|
||||
free_search: freeSearch,
|
||||
search_agent: $("#search-agent").val(),
|
||||
search_group: $("#search-group").val()
|
||||
},
|
||||
success: function(data) {
|
||||
var modulesRight = $("#modules-right");
|
||||
|
||||
if (data.modules) {
|
||||
modulesRight.empty();
|
||||
|
||||
data.modules.forEach(module => {
|
||||
modulesRight.append(
|
||||
`<div class="draggable draggable-container" data-id-module="${module.id_agente_modulo}" title="${module.nombre}">
|
||||
<img class="draggable-icon" src="images/draggable.svg">
|
||||
<div class="draggable-module">
|
||||
<span class="draggable-module-name">${module.nombre}</span>
|
||||
<span class="draggable-agent-name">${module.alias}</span>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
});
|
||||
|
||||
// Create draggable elements.
|
||||
$(".draggable").draggable({
|
||||
revert: "invalid",
|
||||
stack: ".draggable",
|
||||
helper: "clone"
|
||||
});
|
||||
} else {
|
||||
modulesRight.empty();
|
||||
console.error("NO DATA FOUND");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createDroppableZones(
|
||||
droppableOptions,
|
||||
modulesByGraphs,
|
||||
homeurl = "",
|
||||
getInterval = 0
|
||||
) {
|
||||
var url = "ajax.php";
|
||||
var interval = $("#interval").val();
|
||||
|
||||
if (homeurl !== "") {
|
||||
url = homeurl + "/ajax.php";
|
||||
}
|
||||
|
||||
if (getInterval !== 0) {
|
||||
interval = getInterval;
|
||||
}
|
||||
|
||||
// Clear graph area.
|
||||
$("#droppable-graphs").empty();
|
||||
|
||||
// Reset realtime data.
|
||||
realtimeGraphs = [];
|
||||
|
||||
// Graph modules.
|
||||
modulesByGraphs
|
||||
.slice()
|
||||
.reverse()
|
||||
.forEach(graph => {
|
||||
// Max modules by graph.
|
||||
var droppableClass = "";
|
||||
if (graph.length < 2) {
|
||||
droppableClass = "droppable";
|
||||
}
|
||||
|
||||
// Create graph div.
|
||||
var graphDiv = $(
|
||||
`<div class="${droppableClass}" data-modules="[${graph}]"></div>`
|
||||
);
|
||||
$("#droppable-graphs").prepend(graphDiv);
|
||||
|
||||
// Print graphs.
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url,
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
get_graphs: graph,
|
||||
interval
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
graphDiv.append(
|
||||
$(
|
||||
`<div class="draggable ui-draggable ui-draggable-handle">${data}</div>`
|
||||
)
|
||||
);
|
||||
|
||||
// Create remove button.
|
||||
if (
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.hasClass("parent_graph") === true
|
||||
) {
|
||||
graphDiv
|
||||
.children()
|
||||
.children()
|
||||
.children(":first-child")
|
||||
.prepend(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
graphDiv
|
||||
.children()
|
||||
.append(
|
||||
$(
|
||||
'<img src="images/delete.svg" class="remove-graph-analytics" onclick="removeGraph(this);">'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create next droppable zone.
|
||||
graphDiv.after(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone droppable-new" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
// Create first droppable zones and graphs.
|
||||
$("#droppable-graphs").prepend(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone droppable-new" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
|
||||
// Set droppable zones.
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
}
|
||||
|
||||
function getModulesByGraphs() {
|
||||
var modulesByGraphs = [];
|
||||
$("#droppable-graphs > div").each(function(i, v) {
|
||||
var modulesTmp = $(v).data("modules");
|
||||
if (modulesTmp.length > 0) {
|
||||
modulesByGraphs.push(modulesTmp);
|
||||
}
|
||||
});
|
||||
|
||||
return modulesByGraphs;
|
||||
}
|
||||
|
||||
function realtimeGraph() {
|
||||
realtimeGraphsTmp = realtimeGraphs;
|
||||
realtimeGraphs = [];
|
||||
|
||||
realtimeGraphsTmp.forEach(graph => {
|
||||
$.each(graph.series_type, function(i, v) {
|
||||
// Get new values.
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
get_new_values: graph.values[i].agent_module_id,
|
||||
date_array: graph.date_array,
|
||||
data_module_graph: graph.data_module_graph,
|
||||
params: graph.params,
|
||||
suffix: i.slice(-1)
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
// Set new values
|
||||
graph.values[i].data = data[i].data;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// New periods.
|
||||
var period = $("#interval").val();
|
||||
var time = Math.floor(Date.now() / 1000);
|
||||
|
||||
graph.params.date = time;
|
||||
|
||||
var date_array = {
|
||||
period,
|
||||
final_date: time,
|
||||
start_date: time - period
|
||||
};
|
||||
|
||||
pandoraFlotArea(
|
||||
graph.graph_id,
|
||||
graph.values,
|
||||
graph.legend,
|
||||
graph.series_type,
|
||||
graph.color,
|
||||
date_array,
|
||||
graph.data_module_graph,
|
||||
graph.params,
|
||||
graph.events_array
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Action buttons.
|
||||
// Start/Pause Realtime.
|
||||
var realtimeGraphInterval;
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
|
||||
$("[data-button=start-realtime]").click(function(e) {
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
|
||||
realtimeGraphInterval = setInterval(realtimeGraph, 5000);
|
||||
});
|
||||
|
||||
$("[data-button=pause-realtime]").click(function(e) {
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
|
||||
clearInterval(realtimeGraphInterval);
|
||||
});
|
||||
|
||||
// New graph.
|
||||
$("[data-button=new]").click(function(e) {
|
||||
confirmDialog({
|
||||
title: titleNew,
|
||||
message: messageNew,
|
||||
onAccept: function() {
|
||||
$("#droppable-graphs").empty();
|
||||
|
||||
// Create graph div.
|
||||
$("#droppable-graphs").prepend(
|
||||
$(
|
||||
`<div class="droppable droppable-default-zone ui-droppable" data-modules="[]"><span class="drop-here">${dropHere}<span></div>`
|
||||
)
|
||||
);
|
||||
$(".droppable").droppable(droppableOptions);
|
||||
|
||||
// Reset realtime button.
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Save graps modal.
|
||||
$("[data-button=save]").click(function(e) {
|
||||
// Filter save mode selector
|
||||
$("#save_filter_row1").show();
|
||||
$("#save_filter_row2").show();
|
||||
$("#update_filter_row1").hide();
|
||||
$("#radiobtn0002").prop("checked", false);
|
||||
$("#radiobtn0001").prop("checked", true);
|
||||
$("#text-id_name").val("");
|
||||
|
||||
$("[name='filter_mode']").click(function() {
|
||||
if ($(this).val() == "new") {
|
||||
$("#save_filter_row1").show();
|
||||
$("#save_filter_row2").show();
|
||||
$("#submit-save_filter").show();
|
||||
$("#update_filter_row1").hide();
|
||||
} else {
|
||||
$("#save_filter_row1").hide();
|
||||
$("#save_filter_row2").hide();
|
||||
$("#update_filter_row1").show();
|
||||
$("#submit-save_filter").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#save-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: 350
|
||||
});
|
||||
});
|
||||
|
||||
// Save filter button.
|
||||
function save_new_filter() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
save_filter: $("#text-id_name").val(),
|
||||
graphs: getModulesByGraphs(),
|
||||
interval: $("#interval").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data == "saved") {
|
||||
confirmDialog({
|
||||
title: titleSave,
|
||||
message: messageSave,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var message = messageSaveEmpty;
|
||||
if (data === "") {
|
||||
message = messageSaveEmptyName;
|
||||
}
|
||||
confirmDialog({
|
||||
title: titleError,
|
||||
message,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Update filter button.
|
||||
function save_update_filter() {
|
||||
confirmDialog({
|
||||
title: titleUpdate,
|
||||
message: messageUpdate,
|
||||
onAccept: function() {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
update_filter: $("#overwrite_filter").val(),
|
||||
graphs: getModulesByGraphs(),
|
||||
interval: $("#interval").val()
|
||||
},
|
||||
success: function(data) {
|
||||
if (data == "updated") {
|
||||
confirmDialog({
|
||||
title: titleUpdateConfirm,
|
||||
message: messageUpdateConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: titleUpdateError,
|
||||
message: messageUpdateError,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Load graps modal.
|
||||
$("[data-button=load]").click(function(e) {
|
||||
$("#load-filter-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
});
|
||||
|
||||
// Load filter button.
|
||||
function load_filter_values(id = 0, homeurl) {
|
||||
var url = "ajax.php";
|
||||
var filterId = $("#filter_id").val();
|
||||
|
||||
if (id !== 0) {
|
||||
filterId = id;
|
||||
url = homeurl + "/ajax.php";
|
||||
}
|
||||
|
||||
if (id === 0) {
|
||||
confirmDialog({
|
||||
title: titleLoad,
|
||||
message: messageLoad,
|
||||
onAccept: function() {
|
||||
loadFilter(url, filterId, homeurl, id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loadFilter(url, filterId, homeurl, id);
|
||||
}
|
||||
}
|
||||
|
||||
function loadFilter(url, filterId, homeurl, id) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
load_filter: filterId
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
createDroppableZones(
|
||||
droppableOptions,
|
||||
data.graphs,
|
||||
homeurl,
|
||||
data.interval
|
||||
);
|
||||
if (id === 0) {
|
||||
$("#interval")
|
||||
.val(data.interval)
|
||||
.trigger("change");
|
||||
}
|
||||
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
|
||||
// Reset realtime button.
|
||||
if (id === 0) {
|
||||
$("[data-button=pause-realtime]")
|
||||
.parent()
|
||||
.hide();
|
||||
$("[data-button=start-realtime]")
|
||||
.parent()
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
confirmDialog({
|
||||
title: titleLoadConfirm,
|
||||
message: messageLoadConfirm,
|
||||
hideCancelButton: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Share button.
|
||||
$("[data-button=share]").click(function(e) {
|
||||
$("#share-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto"
|
||||
});
|
||||
});
|
||||
|
||||
$("#button-share-modal").click(function(e) {
|
||||
const hash = $("#hash_share").val();
|
||||
const idFilter = btoa($("#share-id").val());
|
||||
const idUser = $("#id_user").val();
|
||||
|
||||
const queryParams = "hash=" + hash + "&id=" + idFilter + "&id_user=" + idUser;
|
||||
|
||||
window.open(
|
||||
configHomeurl +
|
||||
"/operation/reporting/graph_analytics_public.php?" +
|
||||
queryParams
|
||||
);
|
||||
});
|
||||
|
||||
// Export button.
|
||||
$("[data-button=export]").click(function(e) {
|
||||
$("#export-select").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
closeOnEscape: true,
|
||||
width: "auto",
|
||||
title: titleExport
|
||||
});
|
||||
});
|
||||
|
||||
$("#button-export-modal").click(function(e) {
|
||||
const filter = parseInt($("#export-filter-id").val());
|
||||
const group = parseInt($("#export-group-id").val());
|
||||
|
||||
if (filter !== 0) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: "operation/reporting/graph_analytics",
|
||||
export_filter: filter,
|
||||
group
|
||||
},
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
confirmDialog({
|
||||
title: titleExportConfirm,
|
||||
message: data + " " + messageExportConfirm,
|
||||
hideCancelButton: true,
|
||||
onAccept: function() {
|
||||
$(
|
||||
"button.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close"
|
||||
).click();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Remove graph.
|
||||
function removeGraph(e) {
|
||||
confirmDialog({
|
||||
title: titleRemoveConfirm,
|
||||
message: messageRemoveConfirm,
|
||||
onAccept: function() {
|
||||
if (
|
||||
$(e)
|
||||
.parent()
|
||||
.hasClass("menu_graph") === true
|
||||
) {
|
||||
$(e)
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.remove();
|
||||
} else {
|
||||
$(e)
|
||||
.parent()
|
||||
.parent()
|
||||
.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -2487,3 +2487,39 @@ function menuActionButtonResizing() {
|
||||
"width: calc(100% - " + $("#menu_full").width() + "px);"
|
||||
);
|
||||
}
|
||||
|
||||
function check_period_warning(time, title, message) {
|
||||
var period = time.value;
|
||||
var times = 0;
|
||||
if (period >= 2592000 && period < 7776000) {
|
||||
WarningPeriodicityModal(title, message);
|
||||
} else if (period >= 7776000 && period < 15552000) {
|
||||
do {
|
||||
WarningPeriodicityModal(title, message);
|
||||
times = times + 1;
|
||||
} while (times < 2);
|
||||
} else if (period >= 15552000) {
|
||||
do {
|
||||
WarningPeriodicityModal(title, message);
|
||||
times = times + 1;
|
||||
} while (times < 3);
|
||||
}
|
||||
}
|
||||
|
||||
function check_period_warning_manual(input_name, title, message) {
|
||||
var period = {
|
||||
value:
|
||||
$("#text-" + input_name + "_text").val() *
|
||||
$("#" + input_name + "_units option:selected").val()
|
||||
};
|
||||
check_period_warning(period, title, message);
|
||||
}
|
||||
|
||||
function WarningPeriodicityModal(title, message) {
|
||||
confirmDialog({
|
||||
title: title,
|
||||
message: message,
|
||||
strCancelButton: "Ok",
|
||||
hideOkButton: 1
|
||||
});
|
||||
}
|
||||
|
@ -217,8 +217,12 @@ function initialiceLayout(data) {
|
||||
success: function(widgetData) {
|
||||
// Remove spinner.
|
||||
removeSpinner(element);
|
||||
widgetData = widgetData.replace("<script", "<script");
|
||||
widgetData = widgetData.replace("</script", "</script");
|
||||
|
||||
if (widgetData.includes('class="post-widget"')) {
|
||||
widgetData = widgetData.replace("<script", "<script");
|
||||
widgetData = widgetData.replace("</script", "</script");
|
||||
}
|
||||
|
||||
$("#widget-" + id + " .content-widget").append(widgetData);
|
||||
|
||||
$("#button-add-widget-" + id).click(function() {
|
||||
@ -271,6 +275,10 @@ function initialiceLayout(data) {
|
||||
$("#configure-widget-" + id).click(function() {
|
||||
getSizeModalConfiguration(id, widgetId);
|
||||
});
|
||||
|
||||
$("#copy-widget-" + id).click(function() {
|
||||
duplicateWidget(id, widgetId);
|
||||
});
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
@ -301,6 +309,31 @@ function initialiceLayout(data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function duplicateWidget(original_cellId, original_widgetId) {
|
||||
let duplicate_cellId = insertCellLayoutForDuplicate();
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: data.url,
|
||||
data: {
|
||||
page: data.page,
|
||||
method: "duplicateWidget",
|
||||
dashboardId: data.dashboardId,
|
||||
widgetId: original_widgetId,
|
||||
cellId: original_cellId,
|
||||
duplicateCellId: duplicate_cellId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(success) {
|
||||
console.log(success);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveLayout() {
|
||||
var items = $(".grid-stack > .grid-stack-item:visible")
|
||||
.map(function(i, el) {
|
||||
@ -396,6 +429,37 @@ function initialiceLayout(data) {
|
||||
});
|
||||
}
|
||||
|
||||
function insertCellLayoutForDuplicate() {
|
||||
let duplicateCellId = 0;
|
||||
$.ajax({
|
||||
async: false,
|
||||
method: "post",
|
||||
url: data.url,
|
||||
data: {
|
||||
page: data.page,
|
||||
method: "insertCellLayout",
|
||||
dashboardId: data.dashboardId,
|
||||
auth_class: data.auth.class,
|
||||
auth_hash: data.auth.hash,
|
||||
id_user: data.auth.user
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// By default x and y = 0
|
||||
// width and height = 4
|
||||
// position auto = true.
|
||||
if (data.cellId !== 0) {
|
||||
addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true);
|
||||
duplicateCellId = data.cellId;
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
return duplicateCellId;
|
||||
}
|
||||
|
||||
function configurationWidget(cellId, widgetId, size) {
|
||||
load_modal({
|
||||
target: $("#modal-config-widget"),
|
||||
@ -724,6 +788,10 @@ function initialiceLayout(data) {
|
||||
getSizeModalConfiguration(cellId, widgetId);
|
||||
});
|
||||
|
||||
$("#copy-widget-" + cellId).click(function() {
|
||||
duplicateWidget(cellId, widgetId);
|
||||
});
|
||||
|
||||
saveLayout();
|
||||
}
|
||||
});
|
||||
|
@ -160,6 +160,13 @@ class Manager implements PublicLogin
|
||||
*/
|
||||
private $publicLink;
|
||||
|
||||
/**
|
||||
* Duplicate Id Cell.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $duplicateCellId;
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
@ -181,6 +188,7 @@ class Manager implements PublicLogin
|
||||
'formSlides',
|
||||
'callWidgetMethod',
|
||||
'getSizeModalConfiguration',
|
||||
'duplicateWidget',
|
||||
];
|
||||
|
||||
|
||||
@ -283,6 +291,7 @@ class Manager implements PublicLogin
|
||||
$this->widgetId = (int) $extradata['widgetId'];
|
||||
} else {
|
||||
$this->cellId = (int) \get_parameter('cellId', []);
|
||||
$this->duplicateCellId = (int) \get_parameter('duplicateCellId', []);
|
||||
$this->offset = (int) \get_parameter('offset', 0);
|
||||
|
||||
$this->dashboardId = (int) \get_parameter('dashboardId', 0);
|
||||
@ -597,6 +606,42 @@ class Manager implements PublicLogin
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Duplicate widget.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function duplicateWidget():int
|
||||
{
|
||||
$original_widget = [];
|
||||
|
||||
$original_cellId = $this->cellId;
|
||||
foreach ($this->cells as $cells) {
|
||||
if ($cells['id'] == $original_cellId) {
|
||||
$original_widget['id_widget'] = $cells['id_widget'];
|
||||
$original_widget['options'] = $cells['options'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$options = json_decode($original_widget['options'], true);
|
||||
$options['title'] = __('Copy of %s', $options['title']);
|
||||
$options_json = json_encode($options);
|
||||
|
||||
$values = [
|
||||
'options' => $options_json,
|
||||
'id_widget' => $original_widget['id_widget'],
|
||||
];
|
||||
$res = \db_process_sql_update(
|
||||
'twidget_dashboard',
|
||||
$values,
|
||||
['id' => $this->duplicateCellId]
|
||||
);
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy Dashboard and asociate widgets.
|
||||
*
|
||||
|
@ -300,6 +300,10 @@ class Widget
|
||||
$className .= '\GroupsStatusWidget';
|
||||
break;
|
||||
|
||||
case 'groups_status_map':
|
||||
$className .= '\GroupsStatusMapWidget';
|
||||
break;
|
||||
|
||||
case 'maps_made_by_user':
|
||||
$className .= '\MapsMadeByUser';
|
||||
break;
|
||||
|
@ -421,6 +421,8 @@ class BasicChart extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -304,7 +304,8 @@ class BlockHistogram extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -308,6 +308,8 @@ class DataMatrix extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
@ -324,6 +326,8 @@ class DataMatrix extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'slice\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -530,7 +530,7 @@ class EventCardboard extends Widget
|
||||
);
|
||||
}
|
||||
|
||||
$output .= '<table class="w100p h100p table-border-0"><tbody><tr>';
|
||||
$output .= '<table class="w100p h100p table-border-0 event-cardboard-widget"><tbody><tr>';
|
||||
|
||||
$width_td = (100 / count(explode(',', $severity)));
|
||||
|
||||
|
@ -392,6 +392,8 @@ class CustomGraphWidget extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -394,6 +394,8 @@ class EventsListWidget extends Widget
|
||||
-1 => \__('All event'),
|
||||
1 => \__('Only validated'),
|
||||
0 => \__('Only pending'),
|
||||
2 => \__('Only in process'),
|
||||
3 => \__('Only not validated'),
|
||||
];
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
@ -720,14 +722,15 @@ class EventsListWidget extends Widget
|
||||
'style' => 'width: 99%;',
|
||||
'ajax_url' => 'operation/events/events',
|
||||
'ajax_data' => [
|
||||
'get_events' => 1,
|
||||
'table_id' => $table_id,
|
||||
'filter' => $filter,
|
||||
'length' => $this->values['limit'],
|
||||
'groupRecursion' => (bool) $this->values['groupRecursion'],
|
||||
'auth_hash' => $hash,
|
||||
'auth_class' => 'PandoraFMS\Dashboard\Manager',
|
||||
'id_user' => $id_user,
|
||||
'get_events' => 1,
|
||||
'table_id' => $table_id,
|
||||
'filter' => $filter,
|
||||
'event_list_widget_filter' => $filter,
|
||||
'length' => $this->values['limit'],
|
||||
'groupRecursion' => (bool) $this->values['groupRecursion'],
|
||||
'auth_hash' => $hash,
|
||||
'auth_class' => 'PandoraFMS\Dashboard\Manager',
|
||||
'id_user' => $id_user,
|
||||
],
|
||||
'default_pagination' => $this->values['limit'],
|
||||
'pagination_options' => [
|
||||
|
@ -367,6 +367,8 @@ class GraphModuleHistogramWidget extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
|
||||
],
|
||||
];
|
||||
|
@ -0,0 +1,460 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget Group status map Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Group status
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Pandora FMS
|
||||
* Please see https://pandorafms.com/community/ for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
namespace PandoraFMS\Dashboard;
|
||||
|
||||
/**
|
||||
* Group status map Widgets.
|
||||
*/
|
||||
class GroupsStatusMapWidget extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
||||
// Page.
|
||||
$this->page = basename(__FILE__);
|
||||
|
||||
// ClassName.
|
||||
$class = new \ReflectionClass($this);
|
||||
$this->className = $class->getShortName();
|
||||
|
||||
// Title.
|
||||
$this->title = __('Group status map');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'groups_status_map';
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['groups']) === true) {
|
||||
$values['groupId'] = $decoder['groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupRecursion']) === true) {
|
||||
$values['groupRecursion'] = $decoder['groupRecursion'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
$values = $this->values;
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
$values['groupId'] = explode(',', $values['groupId']);
|
||||
// Restrict access to group.
|
||||
$inputs[] = [
|
||||
'label' => __('Groups'),
|
||||
'arguments' => [
|
||||
'type' => 'select_groups',
|
||||
'name' => 'groupId',
|
||||
'returnAllGroup' => true,
|
||||
'privilege' => 'AR',
|
||||
'multiple' => true,
|
||||
'selected' => $values['groupId'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Group recursion'),
|
||||
'arguments' => [
|
||||
'name' => 'groupRecursion',
|
||||
'id' => 'groupRecursion',
|
||||
'type' => 'switch',
|
||||
'value' => $values['groupRecursion'],
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['groupId'] = \get_parameter('groupId', 0);
|
||||
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$size = parent::getSize();
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
$groups_array = (empty($this->values['groupId']) === false) ? explode(',', $this->values['groupId']) : [];
|
||||
|
||||
if ((bool) $this->values['groupRecursion'] === true && in_array('0', $groups_array) === false) {
|
||||
foreach ($groups_array as $key => $group) {
|
||||
$children = groups_get_children($group, false, 'AR', false);
|
||||
foreach ($children as $key => $child) {
|
||||
$groups_array[] = $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
$rows = [];
|
||||
if (isset($servers) === true && is_array($servers) === true
|
||||
) {
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
$result = db_process_sql($sql);
|
||||
if ($result !== false) {
|
||||
foreach ($result as $key => $group) {
|
||||
$not_exist = true;
|
||||
foreach ($rows as $key2 => $row) {
|
||||
if ($group['id_grupo'] === $row['id_grupo']
|
||||
&& $group['estado'] === $row['estado']
|
||||
) {
|
||||
$rows[$key2]['total_modules'] += $group['total_modules'];
|
||||
$not_exist = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($not_exist === true) {
|
||||
$rows[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where = '';
|
||||
if (in_array('0', $groups_array) === false && count($groups_array) > 0) {
|
||||
$where = ' WHERE g.id_grupo IN ('.implode(',', $groups_array).') ';
|
||||
}
|
||||
|
||||
$sql = 'SELECT g.id_grupo, g.nombre, estado, count(*) AS total_modules
|
||||
FROM tagente a
|
||||
LEFT JOIN tgrupo g ON g.id_grupo = a.id_grupo
|
||||
LEFT JOIN tagente_modulo m ON a.id_agente = m.id_agente
|
||||
LEFT JOIN tagente_estado es ON es.id_agente_modulo = m.id_agente_modulo
|
||||
'.$where.'
|
||||
GROUP BY a.id_grupo, estado';
|
||||
|
||||
$rows = db_process_sql($sql);
|
||||
}
|
||||
|
||||
if ($rows === false || (is_array($rows) === true && count($rows) === 0)) {
|
||||
$output = ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No data found.'),
|
||||
]
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
|
||||
$level1 = [
|
||||
'name' => __('Module status map'),
|
||||
'children' => [],
|
||||
];
|
||||
|
||||
$names = [];
|
||||
foreach ($rows as $key => $row) {
|
||||
$color = '';
|
||||
$name_status = '';
|
||||
switch ($row['estado']) {
|
||||
case '1':
|
||||
$color = '#e63c52';
|
||||
$name_status = __('Critical');
|
||||
break;
|
||||
|
||||
case '2':
|
||||
$color = '#FFB900';
|
||||
$name_status = __('Warning');
|
||||
break;
|
||||
|
||||
case '0':
|
||||
$color = '#82b92e';
|
||||
$name_status = __('Normal');
|
||||
break;
|
||||
|
||||
case '3':
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$color = '#4a83f3';
|
||||
$name_status = __('No data');
|
||||
$row['estado'] = 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
$row['estado'] = 6;
|
||||
$color = '#B2B2B2';
|
||||
$name_status = __('Unknown');
|
||||
continue;
|
||||
}
|
||||
|
||||
$level1['children'][$row['id_grupo']][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => $row['estado'],
|
||||
'value' => $row['total_modules'],
|
||||
'color' => $color,
|
||||
'tooltip_content' => $row['total_modules'].__(' Modules(%s)', $name_status),
|
||||
'link' => 'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$row['id_grupo'].'&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status='.$row['estado'].'&sort_field=&sort=none&pure=',
|
||||
];
|
||||
$names[$row['id_grupo']] = $row['nombre'];
|
||||
}
|
||||
|
||||
$level2 = [
|
||||
'children' => [],
|
||||
];
|
||||
foreach ($level1['children'] as $id_grupo => $group) {
|
||||
$level2['children'][] = [
|
||||
'id' => uniqid(),
|
||||
'name' => io_safe_output($names[$id_grupo]),
|
||||
'children' => $group,
|
||||
];
|
||||
}
|
||||
|
||||
$id_container = 'tree_map_'.uniqid();
|
||||
$output = d3_tree_map_graph($level2, $size['width'], $size['height'], true, $id_container, true);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Group status map');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'groups_status_map';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get size Modal Configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSizeModalConfiguration(): array
|
||||
{
|
||||
$size = [
|
||||
'width' => 400,
|
||||
'height' => 330,
|
||||
];
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -205,6 +205,8 @@ class Netflow extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
$chart_types = netflow_get_chart_types();
|
||||
|
@ -352,6 +352,8 @@ class SingleGraphWidget extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -381,6 +381,8 @@ class SLAPercentWidget extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -260,6 +260,8 @@ class TopNWidget extends Widget
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'style_icon' => 'flex-grow: 0',
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -317,6 +317,8 @@ final class BasicChart extends Item
|
||||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -633,6 +633,8 @@ final class ModuleGraph extends Item
|
||||
'value' => $values['period'],
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
'script' => 'check_period_warning(this, \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
'script_input' => 'check_period_warning_manual(\'period\', \''.__('Warning').'\', \''.__('Displaying items with extended historical data can have an impact on system performance. We do not recommend that you use intervals longer than 30 days, especially if you combine several of them in a report, dashboard or visual console.').'\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -937,3 +937,13 @@ div.basic-chart-title span {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input.resize_button {
|
||||
position: absolute;
|
||||
background-color: white !important;
|
||||
padding: 4px !important;
|
||||
border-radius: 20px;
|
||||
width: 28px;
|
||||
bottom: 3%;
|
||||
right: 6%;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user