Merge branch 'develop' into ent-11807-security-hardening-console-informes
This commit is contained in:
commit
a417b15d6f
|
@ -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.2, 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.2, 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.2, 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.2, 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.2, 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.2, 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.2
|
||||
# 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.2, 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.2
|
||||
# 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.2, 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.2
|
||||
# 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.2
|
||||
# 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.2
|
||||
# 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.2, 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.2, 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.2-230829
|
||||
Version: 7.0NG.773.3-230905
|
||||
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.2-230829"
|
||||
pandora_version="7.0NG.773.3-230905"
|
||||
|
||||
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.2"
|
||||
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.2" 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.2" 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.2</string>
|
||||
<key>CFBundleGetInfoString</key> <string>7.0NG.773.2 Pandora FMS on Aug 2020</string>
|
||||
<key>CFBundleShortVersionString</key> <string>7.0NG.773.2</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.2, 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.2, 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.2, 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.2
|
||||
# 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.2, 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.2, 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.2, 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.2';
|
||||
use constant AGENT_BUILD => '230829';
|
||||
use constant AGENT_VERSION => '7.0NG.773.3';
|
||||
use constant AGENT_BUILD => '230905';
|
||||
|
||||
# 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.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
|
||||
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.2
|
||||
%define release 230725
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
|
||||
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.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
|
||||
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.2"
|
||||
PI_BUILD="230829"
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
PI_BUILD="230905"
|
||||
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.2
|
||||
# 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
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.773.2}
|
||||
{Pandora FMS Windows Agent v7.0NG.773.3}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230829}
|
||||
{230905}
|
||||
|
||||
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.2 Build 230829")
|
||||
#define PANDORA_VERSION ("7.0NG.773.3 Build 230905")
|
||||
|
||||
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.2(Build 230829))"
|
||||
VALUE "ProductVersion", "(7.0NG.773.3(Build 230905))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.773.2-230829
|
||||
Version: 7.0NG.773.3-230905
|
||||
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.2-230829"
|
||||
pandora_version="7.0NG.773.3-230905"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
|
||||
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||
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',
|
||||
|
@ -15,4 +22,8 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
|||
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -549,6 +549,11 @@ class SnmpConsole extends HTML
|
|||
$order = get_datatable_order(true);
|
||||
$filters = get_parameter('filter', []);
|
||||
|
||||
// Build ranges.
|
||||
$now_timestamp = time();
|
||||
$interval_seconds = ($filters['filter_hours_ago'] * 3600);
|
||||
$ago_timestamp = ($now_timestamp - $interval_seconds);
|
||||
|
||||
// Build ranges.
|
||||
$now = new DateTime();
|
||||
$ago = new DateTime();
|
||||
|
@ -688,7 +693,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_from_trap != '') {
|
||||
if ($time_from_trap != '') {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) > UNIX_TIMESTAMP("'.$date_from_trap.' '.$time_from_trap.'"))
|
||||
AND (utimestamp > '.$ago_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
@ -700,7 +705,7 @@ class SnmpConsole extends HTML
|
|||
if ($date_to_trap != '') {
|
||||
if ($time_to_trap) {
|
||||
$whereSubquery .= '
|
||||
AND (UNIX_TIMESTAMP(timestamp) < UNIX_TIMESTAMP("'.$date_to_trap.' '.$time_to_trap.'"))
|
||||
AND (utimestamp < '.$now_timestamp.')
|
||||
';
|
||||
} else {
|
||||
$whereSubquery .= '
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230829';
|
||||
$pandora_version = 'v7.0NG.773.2';
|
||||
$build_version = 'PC230905';
|
||||
$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'
|
||||
|
|
|
@ -125,9 +125,22 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
$umask = io_safe_output((string) get_parameter('umask'));
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
$check_extension = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
if ((strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')) {
|
||||
$check_extension = false;
|
||||
} else {
|
||||
$check_extension = true;
|
||||
}
|
||||
}
|
||||
|
||||
// (strtolower($extension) !== 'mib' && strtolower($extension) !== 'zip')
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $check_extension === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader and
|
||||
// user is not trying to access an external path (avoid
|
||||
|
@ -177,14 +190,31 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
|
|||
|
||||
// Upload zip.
|
||||
if ($upload_zip === true) {
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
if (isset($_FILES['file']) === true
|
||||
&& empty($_FILES['file']['name']) === false
|
||||
) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$filepath = $_FILES['file']['tmp_name'];
|
||||
$real_directory = filemanager_safe_directory($destination_directory);
|
||||
$secure = true;
|
||||
if ($parse_sec2_query[1] === 'operation/snmpconsole/snmp_mib_uploader') {
|
||||
// Security control structure.
|
||||
$zip = new \ZipArchive;
|
||||
if ($zip->open($filepath) === true) {
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$unzip_filename = $zip->getNameIndex($i);
|
||||
$extension = pathinfo($unzip_filename, PATHINFO_EXTENSION);
|
||||
if (strtolower($extension) !== 'mib') {
|
||||
$secure = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($real_directory, $default_real_directory) !== 0) {
|
||||
if (strpos($real_directory, $default_real_directory) !== 0 || $secure === false) {
|
||||
// Perform security check to determine whether received upload
|
||||
// directory is part of the default path for caller uploader
|
||||
// and user is not trying to access an external path (avoid
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -2781,7 +2781,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>
|
||||
|
@ -2824,12 +3054,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 = 'include/javascript/datatablesFunction.js';
|
||||
} else {
|
||||
$file_path = '../../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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -275,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);
|
||||
|
@ -305,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) {
|
||||
|
@ -400,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"),
|
||||
|
@ -728,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;
|
||||
|
|
|
@ -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)));
|
||||
|
||||
|
|
|
@ -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' => [
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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%;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,371 @@
|
|||
div#main {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph > div[id^="tgl_div_"] {
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
width: 228px;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph > div[id^="tgl_div_"] > div.white-box-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
div.box-flat.white_table_graph
|
||||
> div[id^="tgl_div_"]
|
||||
> div.white-box-content
|
||||
> [data-id-agent],
|
||||
div.box-flat.white_table_graph
|
||||
> div[id^="tgl_div_"]
|
||||
> div.white-box-content
|
||||
> [data-id-group] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div#menu_tab ul li,
|
||||
div#menu_tab ul li span {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div#menu_tab ul.mn li.nomn.tab_operation img {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
div#menu_tab ul li:hover,
|
||||
div#menu_tab ul li span:hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
div.main-div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
min-height: calc(100vh - 160px);
|
||||
}
|
||||
|
||||
div.main-div.graph-analytics-public {
|
||||
min-height: calc(100vh - 2px);
|
||||
}
|
||||
|
||||
div.padding-div {
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
div.margin-div {
|
||||
margin: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.filters-div-main {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 500px;
|
||||
min-width: 500px;
|
||||
border-right: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
div.filters-div-main.filters-div-main-collapsed {
|
||||
width: 35px;
|
||||
min-width: 20px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
div.filters-div-main.filters-div-main-collapsed
|
||||
*:not(.filters-div-header):not(.filters-div-header > img) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.droppable-graphs-collapsed {
|
||||
margin-left: -30px;
|
||||
}
|
||||
|
||||
div.filters-div-main > .filters-div-header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
div.filters-div-main > .filters-div-header > img {
|
||||
width: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.filters-div-submain {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
height: calc(100% - 51px);
|
||||
}
|
||||
|
||||
div.filter-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
width: 230px;
|
||||
min-width: 230px;
|
||||
max-width: 230px;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
border-top: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
.filters-left-div {
|
||||
border-right: 1px solid var(--border-dark-color);
|
||||
}
|
||||
|
||||
div.filters-right-div {
|
||||
width: 230px;
|
||||
min-width: 230px;
|
||||
max-width: 230px;
|
||||
}
|
||||
|
||||
.search-graph-analytics {
|
||||
background-image: url(../../images/details.svg);
|
||||
background-position: center right 10px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 17px;
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
div.graphs-div-main {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.handle-graph {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
#droppable-graphs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.interval-div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Draggable */
|
||||
.draggable.ui-draggable-dragging {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.draggable {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.draggable-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-left: -10px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.draggable-container:last-child {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.draggable-module {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.draggable-icon {
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.draggable-module > span {
|
||||
line-height: 10pt;
|
||||
}
|
||||
|
||||
.draggable-module > span.draggable-module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.draggable-module > span.draggable-agent-name {
|
||||
color: #8a96a6;
|
||||
}
|
||||
|
||||
/* Droppable */
|
||||
#droppable-graphs * {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.droppable {
|
||||
width: 100%;
|
||||
/* height: 20px; */
|
||||
margin-bottom: 5px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable-zone {
|
||||
background-color: #0077ff80;
|
||||
border: 2px dashed #0077ff;
|
||||
border-radius: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable-zone > div {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#droppable-graphs .drops-hover {
|
||||
background-color: #82b92e80;
|
||||
border: 2px dashed #82b92e;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone:not(.droppable-new) {
|
||||
height: 70px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone.droppable-new {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.droppable-new
|
||||
> span.drop-here {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone > span.drop-here {
|
||||
font-size: 15pt;
|
||||
font-weight: bold;
|
||||
color: #0077ff;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.droppable-new.ui-droppable-active
|
||||
> span.drop-here {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable.droppable-default-zone.ui-droppable-active {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#droppable-graphs
|
||||
.droppable.droppable-default-zone.ui-droppable-active.drops-hover
|
||||
> span.drop-here {
|
||||
color: #82b92e;
|
||||
}
|
||||
|
||||
#droppable-graphs .droppable .draggable.ui-draggable.ui-draggable-handle {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#droppable-graphs .parent_graph {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
#droppable-graphs .timestamp_graph {
|
||||
top: 15px;
|
||||
}
|
||||
|
||||
#droppable-graphs .menu_graph {
|
||||
left: 85%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div.timestamp-top-fixed {
|
||||
top: 15px !important;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-main {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
max-width: 30px;
|
||||
margin-right: 5px;
|
||||
padding-right: 3px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square > span {
|
||||
text-align: right;
|
||||
color: #fff;
|
||||
line-height: 9pt;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend-square > span.square-unit {
|
||||
width: 30px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend > span {
|
||||
line-height: 12pt;
|
||||
}
|
||||
|
||||
div.graph-analytics-legend > span:first-child {
|
||||
font-weight: normal;
|
||||
font-size: 8pt;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#droppable-graphs td.legendColorBox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#droppable-graphs .remove-graph-analytics {
|
||||
width: 20px;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#droppable-graphs > div:hover .remove-graph-analytics {
|
||||
opacity: 1;
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
--secondary-color: #ffffff;
|
||||
--input-border: #c0ccdc;
|
||||
--border-color: #eee;
|
||||
--border-dark-color: #e1e1e1;
|
||||
--text-color: #333;
|
||||
}
|
||||
|
||||
|
@ -12362,6 +12363,10 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
|
|||
width: 100% !important;
|
||||
}
|
||||
|
||||
.group_view_table > tbody > tr > td {
|
||||
width: 350px !important;
|
||||
}
|
||||
|
||||
.notificaion_menu_container {
|
||||
display: flex;
|
||||
padding-top: 10px;
|
||||
|
|
|
@ -727,6 +727,13 @@ div.module-graph .gauge_d3_class {
|
|||
background: #82b92e;
|
||||
}
|
||||
|
||||
#box-rectangle-selection {
|
||||
position: absolute;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border: 2px solid #002f33;
|
||||
}
|
||||
|
||||
/* Styles for the solid icons */
|
||||
|
||||
.fa {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -130,8 +130,8 @@
|
|||
</div>
|
||||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.773.2';
|
||||
$build = '230829';
|
||||
$version = '7.0NG.773.3';
|
||||
$build = '230905';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
|
|
|
@ -305,4 +305,8 @@ echo '</tr></table>';
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.tactical_table .alert_module_background_state').replaceWith(function(){
|
||||
return $("<div />").addClass($(this).attr('class')).data($(this).data());
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -104,6 +104,11 @@ if (isset($fb64) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
$event_list_widget_filter = get_parameter('event_list_widget_filter', null);
|
||||
if (isset($event_list_widget_filter) === true) {
|
||||
$filter = $event_list_widget_filter;
|
||||
}
|
||||
|
||||
$settings_modal = get_parameter('settings', 0);
|
||||
$parameters_modal = get_parameter('parameters', 0);
|
||||
|
||||
|
@ -2728,6 +2733,7 @@ try {
|
|||
-1,
|
||||
-2,
|
||||
'column-instructions',
|
||||
'user_comment',
|
||||
],
|
||||
'ajax_return_operation' => 'buffers',
|
||||
'ajax_return_operation_function' => 'process_buffers',
|
||||
|
|
|
@ -471,6 +471,12 @@ if ($access_console_node === true) {
|
|||
'godmode/reporting/graph_builder',
|
||||
];
|
||||
|
||||
|
||||
// Graph analytics.
|
||||
$sub['operation/reporting/graph_analytics']['text'] = __('Graph analytics');
|
||||
$sub['operation/reporting/graph_analytics']['id'] = 'Graph_analytics';
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'RR')
|
||||
|| check_acl($config['id_user'], 0, 'RW')
|
||||
|| check_acl($config['id_user'], 0, 'RM')
|
||||
|
|
|
@ -696,7 +696,7 @@ if (empty($draw) === false) {
|
|||
$config['style']
|
||||
);
|
||||
|
||||
$netflowContainerClass = ($chart_type === 'netflow_data' || $chart_type === 'netflow_summary' || $chart_type === 'netflow_top_N') ? '' : 'white_box';
|
||||
$netflowContainerClass = ($chart_type === 'netflow_data' || $chart_type === 'netflow_summary' || $chart_type === 'netflow_top_N') ? '' : 'white_box relative';
|
||||
|
||||
// Draw the netflow chart.
|
||||
html_print_div(
|
||||
|
|
|
@ -0,0 +1,942 @@
|
|||
<?php
|
||||
/**
|
||||
* Graph viewer.
|
||||
*
|
||||
* @category Reporting - Graph analytics
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
use PandoraFMS\User;
|
||||
|
||||
// Requires.
|
||||
ui_require_css_file('graph_analytics');
|
||||
require_once 'include/functions_custom_graphs.php';
|
||||
|
||||
// Ajax.
|
||||
if (is_ajax()) {
|
||||
$search_left = get_parameter('search_left');
|
||||
$search_right = get_parameter('search_right');
|
||||
$get_graphs = get_parameter('get_graphs');
|
||||
$save_filter = get_parameter('save_filter');
|
||||
$load_filter = get_parameter('load_filter');
|
||||
$update_filter = get_parameter('update_filter');
|
||||
$get_new_values = get_parameter('get_new_values');
|
||||
$export_filter = get_parameter('export_filter');
|
||||
|
||||
if (empty($search_left) === false) {
|
||||
$output = [];
|
||||
$search = io_safe_input($search_left);
|
||||
|
||||
// Agents.
|
||||
// Concatenate AW and AD permisions to get all the possible groups where the user can manage.
|
||||
$user_groupsAW = users_get_groups($config['id_user'], 'AW');
|
||||
$user_groupsAD = users_get_groups($config['id_user'], 'AD');
|
||||
|
||||
$user_groups = ($user_groupsAW + $user_groupsAD);
|
||||
$user_groups_to_sql = implode(',', array_keys($user_groups));
|
||||
|
||||
$search_sql = ' AND (nombre LIKE "%%'.$search.'%%" OR alias LIKE "%%'.$search.'%%")';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tagente
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tagente.id_agente = tasg.id_agent
|
||||
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
|
||||
%s
|
||||
GROUP BY tagente.id_agente
|
||||
ORDER BY tagente.nombre',
|
||||
$user_groups_to_sql,
|
||||
$user_groups_to_sql,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
$output['agents'] = db_get_all_rows_sql($sql);
|
||||
|
||||
// Groups.
|
||||
$search_sql = ' AND (nombre LIKE "%%'.$search.'%%" OR description LIKE "%%'.$search.'%%")';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_grupo, nombre, icon, description
|
||||
FROM tgrupo
|
||||
WHERE (id_grupo IN (%s))
|
||||
%s
|
||||
ORDER BY nombre',
|
||||
$user_groups_to_sql,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
$output['groups'] = db_get_all_rows_sql($sql);
|
||||
|
||||
// Modules.
|
||||
$result_agents = [];
|
||||
$sql_result = db_get_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN ('.$user_groups_to_sql.')');
|
||||
|
||||
foreach ($sql_result as $result) {
|
||||
array_push($result_agents, $result['id_agente']);
|
||||
}
|
||||
|
||||
$id_agents = implode(',', $result_agents);
|
||||
$search_sql = ' AND (tam.nombre LIKE "%%'.$search.'%%" OR tam.descripcion LIKE "%%'.$search.'%%")';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT tam.id_agente_modulo, tam.nombre, tam.descripcion, ta.alias
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente ta ON ta.id_agente = tam.id_agente
|
||||
WHERE (tam.id_agente IN (%s))
|
||||
%s
|
||||
ORDER BY tam.nombre',
|
||||
$id_agents,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
$output['modules'] = db_get_all_rows_sql($sql);
|
||||
|
||||
// Return.
|
||||
echo json_encode($output);
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($search_right) === false) {
|
||||
$output = [];
|
||||
$search = io_safe_input(get_parameter('free_search'));
|
||||
$agent = get_parameter('search_agent');
|
||||
$group = get_parameter('search_group');
|
||||
|
||||
$search_sql = ' AND (tam.nombre LIKE "%%'.$search.'%%" OR tam.descripcion LIKE "%%'.$search.'%%")';
|
||||
|
||||
// Agent.
|
||||
if (empty($agent) === false) {
|
||||
$sql = sprintf(
|
||||
'SELECT tam.id_agente_modulo, tam.nombre, tam.descripcion, ta.alias
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente ta ON ta.id_agente = tam.id_agente
|
||||
WHERE (tam.id_agente = %s)
|
||||
%s
|
||||
ORDER BY tam.nombre',
|
||||
$agent,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
$output['modules'] = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
// Group.
|
||||
if (empty($group) === false) {
|
||||
$sql = sprintf(
|
||||
'SELECT tam.id_agente_modulo, tam.nombre, tam.descripcion, ta.alias
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente ta ON ta.id_agente = tam.id_agente
|
||||
WHERE (ta.id_grupo = %s)
|
||||
%s
|
||||
ORDER BY tam.nombre',
|
||||
$group,
|
||||
$search_sql
|
||||
);
|
||||
|
||||
$output['modules'] = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
// Return.
|
||||
echo json_encode($output);
|
||||
return;
|
||||
}
|
||||
|
||||
// Graph.
|
||||
if (empty($get_graphs) === false) {
|
||||
$interval = (int) get_parameter('interval');
|
||||
$modules = $get_graphs;
|
||||
|
||||
$params = [
|
||||
'period' => $interval,
|
||||
'width' => '100%',
|
||||
'graph_width' => '85%',
|
||||
'height' => 100,
|
||||
'date' => time(),
|
||||
'percentil' => null,
|
||||
'fullscale' => 1,
|
||||
'type_graph' => 'line',
|
||||
'timestamp_top_fixed' => 'timestamp-top-fixed',
|
||||
'graph_analytics' => true,
|
||||
'realtime' => true,
|
||||
];
|
||||
|
||||
$params_combined = [
|
||||
'stacked' => 2,
|
||||
'labels' => [],
|
||||
'modules_series' => $modules,
|
||||
'id_graph' => null,
|
||||
'return' => 1,
|
||||
'graph_analytics' => true,
|
||||
];
|
||||
|
||||
$graph_return = graphic_combined_module(
|
||||
$modules,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
$graph_return .= "
|
||||
<script>
|
||||
$('div.parent_graph > .legend_background').each(function (index, element) {
|
||||
$(element).next().html('');
|
||||
$(element).next().append(element);
|
||||
});
|
||||
</script>
|
||||
";
|
||||
|
||||
echo $graph_return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Save filter.
|
||||
if (empty($save_filter) === false) {
|
||||
$graphs = get_parameter('graphs');
|
||||
$interval = (int) get_parameter('interval');
|
||||
|
||||
if (empty($save_filter) === true) {
|
||||
echo __('Empty name');
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($graphs) === true) {
|
||||
echo __('It is not possible to create the filter if you have not made any change');
|
||||
return;
|
||||
}
|
||||
|
||||
$id_filter = db_process_sql_insert(
|
||||
'tgraph_analytics_filter',
|
||||
[
|
||||
'filter_name' => $save_filter,
|
||||
'user_id' => $config['id_user'],
|
||||
'graph_modules' => json_encode($graphs),
|
||||
'interval' => $interval,
|
||||
]
|
||||
);
|
||||
|
||||
if ($id_filter > 0) {
|
||||
echo 'saved';
|
||||
return;
|
||||
} else {
|
||||
echo __('It is not possible to create the filter if you have not made any change');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Update filter.
|
||||
if (empty($update_filter) === false) {
|
||||
$graphs = get_parameter('graphs');
|
||||
$interval = (int) get_parameter('interval');
|
||||
|
||||
if (empty($graphs) === true) {
|
||||
echo __('It is not possible to update the filter if you have not made any change');
|
||||
return;
|
||||
}
|
||||
|
||||
$update_filter = db_process_sql_update(
|
||||
'tgraph_analytics_filter',
|
||||
[
|
||||
'graph_modules' => json_encode($graphs),
|
||||
'interval' => $interval,
|
||||
],
|
||||
['id' => $update_filter]
|
||||
);
|
||||
|
||||
if ($update_filter > 0) {
|
||||
echo 'updated';
|
||||
return;
|
||||
} else {
|
||||
echo __('No updated');
|
||||
return;
|
||||
}
|
||||
|
||||
echo $update_filter;
|
||||
return;
|
||||
}
|
||||
|
||||
// Load filter.
|
||||
if (empty($load_filter) === false) {
|
||||
$data = [];
|
||||
$data['graphs'] = json_decode(db_get_value('graph_modules', 'tgraph_analytics_filter', 'id', $load_filter));
|
||||
$data['interval'] = db_get_value('tgraph_analytics_filter.interval', 'tgraph_analytics_filter', 'id', $load_filter);
|
||||
|
||||
echo json_encode($data);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get new values.
|
||||
if (empty($get_new_values) === false) {
|
||||
$data = [];
|
||||
|
||||
$agent_module_id = $get_new_values;
|
||||
$date_array = get_parameter('date_array');
|
||||
$data_module_graph = get_parameter('data_module_graph');
|
||||
$params = get_parameter('params');
|
||||
$suffix = get_parameter('suffix');
|
||||
|
||||
// Stract data.
|
||||
$array_data_module = grafico_modulo_sparse_data(
|
||||
$agent_module_id,
|
||||
$date_array,
|
||||
$data_module_graph,
|
||||
$params,
|
||||
$suffix
|
||||
);
|
||||
|
||||
echo json_encode($array_data_module);
|
||||
return;
|
||||
}
|
||||
|
||||
// Export graphs.
|
||||
if (empty($export_filter) === false) {
|
||||
$counter = 0;
|
||||
$filter = get_parameter('export_filter');
|
||||
$group = get_parameter('group');
|
||||
|
||||
$filter_name = db_get_value('filter_name', 'tgraph_analytics_filter', 'id', $filter);
|
||||
$graphs = json_decode(db_get_value('graph_modules', 'tgraph_analytics_filter', 'id', $filter));
|
||||
$interval = db_get_value('tgraph_analytics_filter.interval', 'tgraph_analytics_filter', 'id', $filter);
|
||||
|
||||
foreach ($graphs as $graph) {
|
||||
$id_graph = db_process_sql_insert(
|
||||
'tgraph',
|
||||
[
|
||||
'id_user' => $config['id_user'],
|
||||
'id_group' => $group,
|
||||
'name' => $filter_name.' ('.__('Graph').' '.($counter + 1).')',
|
||||
'description' => __('Created from Graph analytics. Filter:').' '.$filter_name.'. '.__('Graph').' '.($counter + 1),
|
||||
'period' => $interval,
|
||||
'stacked' => 2,
|
||||
]
|
||||
);
|
||||
|
||||
if ($id_graph > 0) {
|
||||
$counter++;
|
||||
$field_order = 1;
|
||||
|
||||
foreach ($graph as $module) {
|
||||
$id_graph_source = db_process_sql_insert(
|
||||
'tgraph_source',
|
||||
[
|
||||
'id_graph' => $id_graph,
|
||||
'id_server' => 0,
|
||||
'id_agent_module' => $module,
|
||||
'weight' => 1,
|
||||
'label' => '',
|
||||
'field_order' => $field_order,
|
||||
]
|
||||
);
|
||||
|
||||
$field_order++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $counter;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Save filter modal.
|
||||
echo '<div id="save-filter-select" style="width:350px;" class="invisible">';
|
||||
if (check_acl($config['id_user'], 0, 'RW') === 1 || check_acl($config['id_user'], 0, 'RM') === 1) {
|
||||
echo '<div id="info_box"></div>';
|
||||
$table = new StdClass;
|
||||
$table->id = 'save_filter_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox no_border';
|
||||
|
||||
$table->styleTable = 'font-weight: bold; text-align:left;';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[0] = 'update_save_selector';
|
||||
$data[0] = html_print_div(
|
||||
[
|
||||
'style' => 'display: flex;',
|
||||
'content' => html_print_radio_button(
|
||||
'filter_mode',
|
||||
'new',
|
||||
__('New filter'),
|
||||
true,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$data[1] = html_print_div(
|
||||
[
|
||||
'style' => 'display: flex;',
|
||||
'content' => html_print_radio_button(
|
||||
'filter_mode',
|
||||
'update',
|
||||
__('Update filter'),
|
||||
false,
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[1] = 'save_filter_row1';
|
||||
$data[0] = __('Filter name');
|
||||
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
|
||||
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Save filter'),
|
||||
'save_filter',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini ',
|
||||
'icon' => 'save',
|
||||
'style' => 'margin-left: 175px; width: 125px;',
|
||||
'onclick' => 'save_new_filter();',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[2] = 'save_filter_row2';
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'update_filter_row1';
|
||||
$data[0] = __('Overwrite filter');
|
||||
|
||||
$select_filters_update = graph_analytics_filter_select();
|
||||
|
||||
$data[0] .= html_print_select(
|
||||
$select_filters_update,
|
||||
'overwrite_filter',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->rowclass[] = 'display-grid';
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Update filter'),
|
||||
'update_filter',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini ',
|
||||
'icon' => 'save',
|
||||
'style' => 'margin-left: 155px; width: 145px;',
|
||||
'onclick' => 'save_update_filter();',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
} else {
|
||||
include 'general/noaccess.php';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
// Load filter modal.
|
||||
$filters = graph_analytics_filter_select();
|
||||
|
||||
echo '<div id="load-filter-select" class="load-filter-modal invisible">';
|
||||
|
||||
$table = new StdClass;
|
||||
$table->id = 'load_filter_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox no_border';
|
||||
|
||||
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
|
||||
$filter_id_width = 'w100p';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'update_filter_row1';
|
||||
$data[0] = __('Load filter');
|
||||
$data[0] .= html_print_select(
|
||||
$filters,
|
||||
'filter_id',
|
||||
'',
|
||||
'',
|
||||
__('None'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:'.$filter_id_width.';'
|
||||
);
|
||||
|
||||
$table->rowclass[] = 'display-grid';
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Load filter'),
|
||||
'load_filter',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini w30p',
|
||||
'icon' => 'load',
|
||||
'style' => 'margin-left: 208px; width: 130px;',
|
||||
'onclick' => 'load_filter_values();',
|
||||
],
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('load_filter', 1, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
// Share modal.
|
||||
echo '<div id="share-select" class="load-filter-modal invisible">';
|
||||
|
||||
$table = new StdClass;
|
||||
$table->id = 'share_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox no_border';
|
||||
|
||||
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
|
||||
$filter_id_width = 'w100p';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'share_row1';
|
||||
$data[0] = __('Share');
|
||||
$data[0] .= html_print_select(
|
||||
$filters,
|
||||
'share-id',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:'.$filter_id_width.';'
|
||||
);
|
||||
|
||||
$table->rowclass[] = 'display-grid';
|
||||
$data[1] = html_print_submit_button(
|
||||
__('Share'),
|
||||
'share-modal',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini w30p',
|
||||
'icon' => 'next',
|
||||
'style' => 'margin-left: 208px; width: 130px;',
|
||||
'onclick' => '',
|
||||
],
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('share-hidden', 1, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
// Export graphs.
|
||||
echo '<div id="export-select" class="load-filter-modal invisible">';
|
||||
|
||||
$table = new StdClass;
|
||||
$table->id = 'share_form';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox no_border';
|
||||
|
||||
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
|
||||
$filter_id_width = 'w100p';
|
||||
|
||||
$data = [];
|
||||
$table->rowid[3] = 'export_row1';
|
||||
$data[0] = __('Export filter');
|
||||
$data[0] .= html_print_select(
|
||||
$filters,
|
||||
'export-filter-id',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:'.$filter_id_width.';'
|
||||
);
|
||||
|
||||
$user_groups = users_get_groups($config['user'], 'RW');
|
||||
$data[1] = __('Group');
|
||||
$data[1] .= html_print_select(
|
||||
$user_groups,
|
||||
'export-group-id',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:'.$filter_id_width.';'
|
||||
);
|
||||
|
||||
$table->rowclass[] = 'display-grid';
|
||||
$data[2] = html_print_submit_button(
|
||||
__('Export'),
|
||||
'export-modal',
|
||||
false,
|
||||
[
|
||||
'class' => 'mini w30p',
|
||||
'icon' => 'next',
|
||||
'style' => 'margin-left: 208px; width: 130px;',
|
||||
'onclick' => '',
|
||||
],
|
||||
true
|
||||
);
|
||||
$data[1] .= html_print_input_hidden('export-hidden', 1, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
|
||||
// Header & Actions.
|
||||
$title_tab = __('Start realtime');
|
||||
$tab_start_realtime = [
|
||||
'text' => '<span data-button="start-realtime">'.html_print_image(
|
||||
'images/change-active.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
$title_tab = __('Pause realtime');
|
||||
$tab_pause_realtime = [
|
||||
'text' => '<span data-button="pause-realtime">'.html_print_image(
|
||||
'images/change-pause.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
$title_tab = __('New');
|
||||
$tab_new = [
|
||||
'text' => '<span data-button="new">'.html_print_image(
|
||||
'images/plus-black.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
$title_tab = __('Save');
|
||||
$tab_save = [
|
||||
'text' => '<span data-button="save">'.html_print_image(
|
||||
'images/save_mc.png',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
$title_tab = __('Load');
|
||||
$tab_load = [
|
||||
'text' => '<span data-button="load">'.html_print_image(
|
||||
'images/logs@svg.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
// Hash for auto-auth in public link.
|
||||
$hash = User::generatePublicHash();
|
||||
|
||||
$title_tab = __('Share');
|
||||
$tab_share = [
|
||||
'text' => '<span data-button="share">'.html_print_image(
|
||||
'images/responses.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span><input id="hash_share" type="hidden" value="'.$hash.'">
|
||||
<input id="id_user" type="hidden" value="'.$config['id_user'].'">',
|
||||
];
|
||||
|
||||
$title_tab = __('Export to custom graph');
|
||||
$tab_export = [
|
||||
'text' => '<span data-button="export">'.html_print_image(
|
||||
'images/module-graph.svg',
|
||||
true,
|
||||
[
|
||||
'title' => $title_tab,
|
||||
'class' => 'invert_filter main_menu_icon',
|
||||
]
|
||||
).$title_tab.'</span>',
|
||||
];
|
||||
|
||||
ui_print_standard_header(
|
||||
__('Graph analytics'),
|
||||
'images/menu/reporting.svg',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
[
|
||||
$tab_export,
|
||||
$tab_share,
|
||||
$tab_load,
|
||||
$tab_save,
|
||||
$tab_new,
|
||||
$tab_pause_realtime,
|
||||
$tab_start_realtime,
|
||||
],
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Reporting'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Content.
|
||||
$left_content = '';
|
||||
$right_content = '';
|
||||
|
||||
$left_content .= '
|
||||
<div class="filters-div-header">
|
||||
<div></div>
|
||||
<img src="images/menu/contraer.svg">
|
||||
</div>
|
||||
<div class="filters-div-submain">
|
||||
<div class="filter-div filters-left-div">
|
||||
<input id="search-left" name="search-left" placeholder="Enter keywords to search" type="search" class="search-graph-analytics">
|
||||
<br>
|
||||
'.ui_toggle(
|
||||
'',
|
||||
__('Agents'),
|
||||
'agents-toggle',
|
||||
'agents-toggle',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph',
|
||||
'images/arrow@svg.svg',
|
||||
'images/arrow@svg.svg',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
'static'
|
||||
).ui_toggle(
|
||||
'',
|
||||
__('Groups'),
|
||||
'groups-toggle',
|
||||
'groups-toggle',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph',
|
||||
'images/arrow@svg.svg',
|
||||
'images/arrow@svg.svg',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
'static'
|
||||
).ui_toggle(
|
||||
'',
|
||||
__('Modules'),
|
||||
'modules-toggle',
|
||||
'modules-toggle',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'white-box-content',
|
||||
'box-flat white_table_graph',
|
||||
'images/arrow@svg.svg',
|
||||
'images/arrow@svg.svg',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
'static'
|
||||
).'
|
||||
</div>
|
||||
<div class="filter-div filters-right-div ">
|
||||
<input id="search-right" placeholder="Enter keywords to search" type="search" class="search-graph-analytics">
|
||||
<input id="search-agent" type="hidden" value="">
|
||||
<input id="search-group" type="hidden" value="">
|
||||
<div id="modules-right"></div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$intervals = [];
|
||||
$intervals[SECONDS_1HOUR] = _('Last ').human_time_description_raw(SECONDS_1HOUR, true, 'large');
|
||||
$intervals[SECONDS_6HOURS] = _('Last ').human_time_description_raw(SECONDS_6HOURS, true, 'large');
|
||||
$intervals[SECONDS_12HOURS] = _('Last ').human_time_description_raw(SECONDS_12HOURS, true, 'large');
|
||||
$intervals[SECONDS_1DAY] = _('Last ').human_time_description_raw(SECONDS_1DAY, true, 'large');
|
||||
$intervals[SECONDS_2DAY] = _('Last ').human_time_description_raw(SECONDS_2DAY, true, 'large');
|
||||
$intervals[SECONDS_1WEEK] = _('Last ').human_time_description_raw(SECONDS_1WEEK, true, 'large');
|
||||
|
||||
$right_content .= '<div class="interval-div">'.html_print_select(
|
||||
$intervals,
|
||||
'interval',
|
||||
SECONDS_12HOURS,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
).'</div>';
|
||||
|
||||
$right_content .= '
|
||||
<div id="droppable-graphs">
|
||||
<div class="droppable droppable-default-zone" data-modules="[]"><span class="drop-here">'.__('Drop here').'<span></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$filters_div = html_print_div(
|
||||
[
|
||||
'class' => 'filters-div-main',
|
||||
'content' => $left_content,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$graphs_div = html_print_div(
|
||||
[
|
||||
'class' => 'padding-div graphs-div-main',
|
||||
'content' => $right_content,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'white_box main-div',
|
||||
'content' => $filters_div.$graphs_div,
|
||||
]
|
||||
);
|
||||
|
||||
ui_require_javascript_file('graph_analytics', 'include/javascript/', true);
|
||||
?>
|
||||
|
||||
<script>
|
||||
const dropHere = "<?php echo __('Drop here'); ?>";
|
||||
|
||||
const titleNew = "<?php echo __('New graph'); ?>";
|
||||
const messageNew = "<?php echo __('If you create a new graph, the current settings will be deleted. Please save the graph if you want to keep it.'); ?>";
|
||||
|
||||
const titleSave = "<?php echo __('Saved successfully'); ?>";
|
||||
const messageSave = "<?php echo __('The filter has been saved successfully'); ?>";
|
||||
|
||||
const messageSaveEmpty = "<?php echo __('It is not possible to create the filter if you have not made any change'); ?>";
|
||||
const messageSaveEmptyName = "<?php echo __('Empty name'); ?>";
|
||||
|
||||
const titleError = "<?php echo __('Error'); ?>";
|
||||
|
||||
const titleUpdate = "<?php echo __('Override filter?'); ?>";
|
||||
const messageUpdate = "<?php echo __('Do you want to overwrite the filter?'); ?>";
|
||||
|
||||
const titleUpdateConfirm = "<?php echo __('Updated successfully'); ?>";
|
||||
const messageUpdateConfirm = "<?php echo __('The filter has been updated successfully'); ?>";
|
||||
|
||||
const titleUpdateError = "<?php echo __('Error'); ?>";
|
||||
const messageUpdateError = "<?php echo __('It is not possible to update the filter if you have not made any change'); ?>";
|
||||
|
||||
const titleLoad = "<?php echo __('Overwrite current graph?'); ?>";
|
||||
const messageLoad = "<?php echo __('If you load a filter, it will clear the current graph'); ?>";
|
||||
|
||||
const titleLoadConfirm = "<?php echo __('Error'); ?>";
|
||||
const messageLoadConfirm = "<?php echo __('Error loading filter'); ?>";
|
||||
|
||||
const titleExport = "<?php echo __('Export to custom graph'); ?>";
|
||||
|
||||
const titleExportConfirm = "<?php echo __('Exported successfully'); ?>";
|
||||
const messageExportConfirm = "<?php echo __('graphs have been created in Custom graphs'); ?>";
|
||||
|
||||
const titleRemoveConfirm = "<?php echo __('Delete graph'); ?>";
|
||||
const messageRemoveConfirm = "<?php echo __('Do you want to delete the graph? Remember to save the changes.'); ?>";
|
||||
</script>
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
/**
|
||||
* Graph viewer.
|
||||
*
|
||||
* @category Reporting - Graph analytics
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Requires.
|
||||
require_once '../../include/config.php';
|
||||
require_once $config['homedir'].'/vendor/autoload.php';
|
||||
require_once '../../include/functions_custom_graphs.php';
|
||||
|
||||
use PandoraFMS\User;
|
||||
|
||||
$hash = (string) get_parameter('hash');
|
||||
|
||||
// Check input hash.
|
||||
// DO NOT move it after of get parameter user id.
|
||||
if (User::validatePublicHash($hash) !== true) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_GRAPH_ANALYTICS_PUBLIC,
|
||||
'Trying to access public graph analytics'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$text_subtitle = isset($config['rb_product_name_alt']) ? '' : ' - '.__('the Flexible Monitoring System');
|
||||
echo '
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
|
||||
<title>'.get_product_name().$text_subtitle.'</title>
|
||||
';
|
||||
|
||||
// CSS.
|
||||
ui_require_css_file('common', 'include/styles/', true);
|
||||
ui_require_css_file('pandora', 'include/styles/', true);
|
||||
ui_require_css_file('discovery', 'include/styles/', true);
|
||||
ui_require_css_file('register', 'include/styles/', true);
|
||||
ui_require_css_file('order_interpreter', 'include/styles/', true);
|
||||
ui_require_css_file('graph_analytics', 'include/styles/', true);
|
||||
ui_require_css_file('jquery-ui.min', 'include/styles/js/', true);
|
||||
ui_require_css_file('jquery-ui_custom', 'include/styles/js/', true);
|
||||
ui_require_css_file('introjs', 'include/styles/js/', true);
|
||||
ui_require_css_file('events', 'include/styles/', true);
|
||||
|
||||
// JS.
|
||||
ui_require_javascript_file('jquery.current', 'include/javascript/', true);
|
||||
ui_require_javascript_file('jquery.pandora', 'include/javascript/', true);
|
||||
ui_require_javascript_file('jquery-ui.min', 'include/javascript/', true);
|
||||
ui_require_javascript_file('jquery.countdown', 'include/javascript/', true);
|
||||
ui_require_javascript_file('pandora', 'include/javascript/', true);
|
||||
ui_require_javascript_file('pandora_ui', 'include/javascript/', true);
|
||||
ui_require_javascript_file('pandora_events', 'include/javascript/', true);
|
||||
ui_require_javascript_file('select2.min', 'include/javascript/', true);
|
||||
// ui_require_javascript_file('connection_check', 'include/javascript/', true);
|
||||
ui_require_javascript_file('encode_decode_base64', 'include/javascript/', true);
|
||||
ui_require_javascript_file('qrcode', 'include/javascript/', true);
|
||||
ui_require_javascript_file('intro', 'include/javascript/', true);
|
||||
ui_require_javascript_file('clippy', 'include/javascript/', true);
|
||||
ui_require_javascript_file('underscore-min', 'include/javascript/', true);
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var phpTimezone = "'.date_default_timezone_get().'";
|
||||
var configHomeurl = "'.$config['homeurl'].'";
|
||||
</script>
|
||||
';
|
||||
|
||||
|
||||
|
||||
ui_require_javascript_file('date', 'include/javascript/timezone/src/', true);
|
||||
ui_require_javascript_file('jquery.flot.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.time', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.pie', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.crosshair.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.stack.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.selection.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.resize.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.threshold', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.threshold.multiple', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.symbol.min', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.exportdata.pandora', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('jquery.flot.axislabels', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('pandora.flot', 'include/graphs/flot/', true);
|
||||
ui_require_javascript_file('chart', 'include/graphs/chartjs/', true);
|
||||
ui_require_javascript_file('chartjs-plugin-datalabels.min', 'include/graphs/chartjs/', true);
|
||||
|
||||
|
||||
|
||||
ui_require_javascript_file('graph_analytics', 'include/javascript/', true);
|
||||
|
||||
|
||||
echo '
|
||||
</head>
|
||||
<body>
|
||||
';
|
||||
|
||||
// Content.
|
||||
$right_content = '';
|
||||
|
||||
$right_content .= '
|
||||
<div id="droppable-graphs">
|
||||
<div class="droppable droppable-default-zone" data-modules="[]"><span class="drop-here">'.__('Drop here').'<span></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
$graphs_div = html_print_div(
|
||||
[
|
||||
'class' => 'padding-div graphs-div-main',
|
||||
'content' => $right_content,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'white_box main-div graph-analytics-public',
|
||||
'content' => $graphs_div,
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
const dropHere = "<?php echo __('Drop here'); ?>";
|
||||
|
||||
const titleNew = "<?php echo __('New graph'); ?>";
|
||||
const messageNew = "<?php echo __('If you create a new graph, the current settings will be deleted. Please save the graph if you want to keep it.'); ?>";
|
||||
|
||||
const titleSave = "<?php echo __('Saved successfully'); ?>";
|
||||
const messageSave = "<?php echo __('The filter has been saved successfully'); ?>";
|
||||
|
||||
const messageSaveEmpty = "<?php echo __('Empty graph'); ?>";
|
||||
const messageSaveEmptyName = "<?php echo __('Empty name'); ?>";
|
||||
|
||||
const titleError = "<?php echo __('Error'); ?>";
|
||||
|
||||
const titleUpdate = "<?php echo __('Override filter?'); ?>";
|
||||
const messageUpdate = "<?php echo __('Do you want to overwrite the filter?'); ?>";
|
||||
|
||||
const titleUpdateConfirm = "<?php echo __('Updated successfully'); ?>";
|
||||
const messageUpdateConfirm = "<?php echo __('The filter has been updated successfully'); ?>";
|
||||
|
||||
const titleUpdateError = "<?php echo __('Error'); ?>";
|
||||
const messageUpdateError = "<?php echo __('Empty graph'); ?>";
|
||||
|
||||
const titleLoad = "<?php echo __('Overwrite current graph?'); ?>";
|
||||
const messageLoad = "<?php echo __('If you load a filter, it will clear the current graph'); ?>";
|
||||
|
||||
const titleLoadConfirm = "<?php echo __('Error'); ?>";
|
||||
const messageLoadConfirm = "<?php echo __('Error loading filter'); ?>";
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
const hash = "<?php echo get_parameter('hash'); ?>";
|
||||
const idFilter = atob("<?php echo get_parameter('id'); ?>");
|
||||
const idUser = "<?php echo get_parameter('id_user'); ?>";
|
||||
|
||||
load_filter_values(idFilter, configHomeurl);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -601,7 +601,6 @@ $skin = '';
|
|||
$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';
|
||||
|
||||
|
@ -615,6 +614,10 @@ $skin = '';
|
|||
$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;
|
||||
|
|
|
@ -693,6 +693,14 @@ ui_require_css_file('form');
|
|||
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
||||
var controls = document.getElementById('vc-controls');
|
||||
|
||||
// Rectangle selections.
|
||||
window.selection_rectangle = [0, 0, 0, 0];
|
||||
window.key_multiple_selection = 17; // CTRL key.
|
||||
window.flag_multiple_selection = false;
|
||||
window.mousedown = false;
|
||||
window.starX = 0;
|
||||
window.starY = 0;
|
||||
|
||||
autoHideElement(controls, 1000);
|
||||
var handleUpdate = function (prevProps, newProps) {
|
||||
if (!newProps) return;
|
||||
|
@ -822,6 +830,8 @@ ui_require_css_file('form');
|
|||
}
|
||||
}
|
||||
|
||||
$('body').append('<div id="box-rectangle-selection"></div>');
|
||||
|
||||
<?php
|
||||
if ($edit_capable === true) {
|
||||
?>
|
||||
|
@ -983,6 +993,111 @@ if ($edit_capable === true) {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).keydown(function(e) {
|
||||
const edit = $("input[name=edit-mode]").prop('checked');
|
||||
if (e.keyCode == key_multiple_selection && edit === true) {
|
||||
flag_multiple_selection = true;
|
||||
}
|
||||
});
|
||||
|
||||
$("#visual-console-container").mousedown(function(e) {
|
||||
if (flag_multiple_selection === true &&
|
||||
e.target.classList.contains("visual-console-item") === false
|
||||
) {
|
||||
$('selector').css('cursor', 'crosshair');
|
||||
document.documentElement.style.cursor = 'crosshair';
|
||||
mousedown = true;
|
||||
|
||||
// Star position.
|
||||
var rect = document.getElementById('visual-console-container').getBoundingClientRect();
|
||||
starX = (e.clientX - rect.left) + rect.x;
|
||||
starY = (e.clientY - rect.top) + rect.y;
|
||||
$("#box-rectangle-selection").css("top", starY + 'px');
|
||||
$("#box-rectangle-selection").css("left", starX + 'px');
|
||||
$("#box-rectangle-selection").css("display", '');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).mousemove(function(e) {
|
||||
if (flag_multiple_selection === true && mousedown === true) {
|
||||
var rect = document.getElementById('visual-console-container').getBoundingClientRect();
|
||||
|
||||
var xMouse = (e.clientX - rect.left) + rect.x;
|
||||
var yMouse = (e.clientY - rect.top) + rect.y;
|
||||
|
||||
var x = starX;
|
||||
var width = xMouse - starX;
|
||||
if (width < 0) {
|
||||
x = xMouse;
|
||||
width = starX - xMouse;
|
||||
}
|
||||
|
||||
var y = starY;
|
||||
var height = yMouse - starY;
|
||||
if (height < 0) {
|
||||
y = yMouse;
|
||||
height = starY - yMouse;
|
||||
}
|
||||
|
||||
if (xMouse >= rect.x && yMouse >= rect.y &&
|
||||
xMouse < (rect.x + rect.width) &&
|
||||
yMouse < (rect.y + rect.height)
|
||||
) {
|
||||
$("#box-rectangle-selection").css("top", y + 'px');
|
||||
$("#box-rectangle-selection").css("left", x + 'px');
|
||||
$("#box-rectangle-selection").css("width", width + 'px');
|
||||
$("#box-rectangle-selection").css("height", height + 'px');
|
||||
|
||||
var r2 = new Rectangle();
|
||||
r2.left = x;
|
||||
r2.top = y;
|
||||
r2.right = x + width;
|
||||
r2.bottom = y + height;
|
||||
|
||||
visualConsoleManager.visualConsole.elements.forEach(item => {
|
||||
// Calcular puntos arriba a la izquierda y abajo a la derecha de ambos rectangulos.
|
||||
var r1 = new Rectangle();
|
||||
|
||||
r1.left = item.itemProps.x + rect.x;
|
||||
r1.top = item.itemProps.y + rect.y;
|
||||
r1.right = item.itemProps.x + rect.x + item.itemProps.width;
|
||||
r1.bottom = item.itemProps.y + rect.y + item.itemProps.height;
|
||||
|
||||
if (intersectRect(r1, r2)) {
|
||||
if (item.meta.isSelected === false) {
|
||||
item.selectItem();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#visual-console-container").mouseup(function(e) {
|
||||
if (flag_multiple_selection === true) {
|
||||
document.documentElement.style.cursor = 'default';
|
||||
mousedown = false;
|
||||
}
|
||||
|
||||
$("#box-rectangle-selection").css("width", '0px');
|
||||
$("#box-rectangle-selection").css("height", '0px');
|
||||
$("#box-rectangle-selection").css("display", 'none');
|
||||
});
|
||||
|
||||
$(document).keyup(function(e) {
|
||||
const edit = $("input[name=edit-mode]").prop('checked');
|
||||
if (e.keyCode == key_multiple_selection && edit === true) {
|
||||
flag_multiple_selection = false;
|
||||
|
||||
document.documentElement.style.cursor = 'default';
|
||||
mousedown = false;
|
||||
|
||||
$("#box-rectangle-selection").css("width", '0px');
|
||||
$("#box-rectangle-selection").css("height", '0px');
|
||||
$("#box-rectangle-selection").css("display", 'none');
|
||||
}
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -1034,6 +1149,11 @@ if ($edit_capable === true) {
|
|||
visualConsoleManager.copyItem(item);
|
||||
}
|
||||
});
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
visualConsoleManager.forceUpdateVisualConsole();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
$('.link-create-item').click(function (event){
|
||||
|
@ -1086,6 +1206,22 @@ if ($edit_capable === true) {
|
|||
visualConsoleManager.forceUpdateVisualConsole();
|
||||
}
|
||||
|
||||
function intersectRect(r1, r2) {
|
||||
return !(r2.left > r1.right ||
|
||||
r2.right < r1.left ||
|
||||
r2.top > r1.bottom ||
|
||||
r2.bottom < r1.top);
|
||||
}
|
||||
|
||||
class Rectangle {
|
||||
constructor(val) {
|
||||
this.left = val;
|
||||
this.top = val;
|
||||
this.right = val;
|
||||
this.bottom = val;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process ajax responses and shows a dialog with results.
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.773.2
|
||||
%define release 230829
|
||||
%define version 7.0NG.773.3
|
||||
%define release 230905
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.773.2"
|
||||
PI_VERSION="7.0NG.773.3"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -1257,6 +1257,7 @@ CREATE TABLE IF NOT EXISTS `ttrap` (
|
|||
`text` VARCHAR(255) DEFAULT '',
|
||||
`description` VARCHAR(255) DEFAULT '',
|
||||
`severity` TINYINT UNSIGNED NOT NULL DEFAULT 2,
|
||||
`utimestamp` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id_trap`),
|
||||
INDEX timestamp (`timestamp`),
|
||||
INDEX status (`status`),
|
||||
|
@ -4424,4 +4425,16 @@ CREATE TABLE IF NOT EXISTS `tsca` (
|
|||
`remediation` text DEFAULT NULL,
|
||||
`compliance` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tgraph_analytics_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
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;
|
|
@ -54,6 +54,23 @@ global $config;
|
|||
<?php
|
||||
} else {
|
||||
// Updates.
|
||||
$settings = update_manager_get_config_values();
|
||||
$umc = new \UpdateManager\Client($settings);
|
||||
$updates = $umc->listUpdates();
|
||||
$text_for_next_version = '';
|
||||
$text_for_last_version = '';
|
||||
$back_up_url = 'index.php?sec=gextensions&sec2=enterprise/godmode/manage_backups';
|
||||
if ($updates[0]['lts'] === true) {
|
||||
$text_for_next_version = __('Attention. You are about to install an LTS version. LTS versions are the most stable and are released twice a year. Before installing this LTS version, please make sure you have an <a href='.$back_up_url.'>up-to-date backup</a>.');
|
||||
} else {
|
||||
$text_for_next_version = __('Attention. You are about to install an RRR version. This version may contain new features and changes, so its installation is not recommended if you are looking for maximum system stability. LTS versions are the most stable and are released twice a year. <br/> Before installing this RRR version, please make sure you have an <a href='.$back_up_url.'>up-to-date backup</a>.');
|
||||
}
|
||||
|
||||
if ($updates[array_key_last($updates)]['lts'] === true) {
|
||||
$text_for_last_version = __('Attention. You are about to install an LTS version. LTS versions are the most stable and are released twice a year. Before installing this LTS version, please make sure you have an <a href='.$back_up_url.'>up-to-date backup</a>.');
|
||||
} else {
|
||||
$text_for_last_version = __('Attention. You are about to install an RRR version. This version may contain new features and changes, so its installation is not recommended if you are looking for maximum system stability. LTS versions are the most stable and are released twice a year. <br/> Before installing this RRR version, please make sure you have an <a href='.$back_up_url.'>up-to-date backup</a>.');
|
||||
}
|
||||
?>
|
||||
<div id="um-loading">
|
||||
<p id="loading-msg"></p>
|
||||
|
@ -122,7 +139,8 @@ global $config;
|
|||
blast.setAttribute('disable', true);
|
||||
result.innerHTML = '';
|
||||
umConfirm({
|
||||
message: "<?php echo __('This action will upgrade this console to version '); ?> "+nextUpdateVersion+". <?php echo __('Are you sure?'); ?>",
|
||||
/*message: "<?php echo __('This action will upgrade this console to version '); ?> "+nextUpdateVersion+". <?php echo __('Are you sure?'); ?>",*/
|
||||
message: "<?php echo '<p>'.$text_for_next_version.'</p>'; ?> ",
|
||||
title: "<?php echo __('Update to'); ?> "+nextUpdateVersion,
|
||||
onAccept: function() {
|
||||
updateNext({
|
||||
|
@ -163,7 +181,8 @@ global $config;
|
|||
blast.setAttribute('disable', true);
|
||||
result.innerHTML = '';
|
||||
umConfirm({
|
||||
message: "<?php echo __('This action will upgrade this console to version '); ?> "+lastUpdateVersion+". <?php echo __('Are you sure?'); ?>",
|
||||
/*message: "<?php echo __('This action will upgrade this console to version '); ?> "+lastUpdateVersion+". <?php echo __('Are you sure?'); ?>",*/
|
||||
message: "<?php echo '<p>'.$text_for_last_version.'</p>'; ?> ",
|
||||
title: "<?php echo __('Update to'); ?> "+lastUpdateVersion,
|
||||
onAccept: function() {
|
||||
updateLatest({
|
||||
|
|
|
@ -47,6 +47,18 @@ $output .= '<div class="header-options">';
|
|||
|
||||
if ($manageDashboards !== 0 || $writeDashboards !== 0) {
|
||||
if ((int) $cellData['id_widget'] !== 0) {
|
||||
$output .= '<a id="copy-widget-'.$cellData['id'].'" class="">';
|
||||
$output .= html_print_image(
|
||||
'images/copy.svg',
|
||||
true,
|
||||
[
|
||||
'width' => '16px',
|
||||
'title' => __('Copy widget'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$output .= '</a> ';
|
||||
|
||||
$output .= '<a id="configure-widget-'.$cellData['id'].'" class="">';
|
||||
$output .= html_print_image(
|
||||
'images/configuration@svg.svg',
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue