Merge remote-tracking branch 'origin/develop' into ent-7386-Ocultar-credenciales-de-acceso-a-la-API
This commit is contained in:
commit
6d9149e11b
|
@ -258,6 +258,7 @@ console_dependencies=" \
|
|||
mod_ssl \
|
||||
libzstd \
|
||||
openldap-clients \
|
||||
chromium \
|
||||
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
||||
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
|
||||
|
||||
|
|
|
@ -312,6 +312,7 @@ console_dependencies=" \
|
|||
mod_ssl \
|
||||
libzstd \
|
||||
openldap-clients \
|
||||
chromium \
|
||||
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
|
||||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
|
||||
http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
|
||||
|
|
|
@ -271,6 +271,8 @@ echo -en "${cyan}Installing phantomjs...${reset}"
|
|||
/usr/bin/phantomjs --version &>> "$LOGFILE"
|
||||
check_cmd_status "Error Installing phanromjs"
|
||||
|
||||
# Chromium
|
||||
execute_cmd "apt install -y chromium-browser" "Instaling chromium browser"
|
||||
|
||||
# SDK VMware perl dependencies
|
||||
vmware_dependencies=" \
|
||||
|
|
|
@ -262,13 +262,11 @@ RUN dnf install -y --setopt=tsflags=nodocs \
|
|||
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm
|
||||
|
||||
# Install utils
|
||||
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
|
||||
RUN dnf install -y supervisor chromium crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
|
||||
# SDK VMware perl dependencies
|
||||
RUN dnf install -y http://firefly.artica.es/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm http://firefly.artica.es/centos8/perl-Crypt-SSLeay-0.73_07-1.gf.el8.x86_64.rpm perl-Net-HTTP perl-libwww-perl openssl-devel perl-Crypt-CBC perl-Bytes-Random-Secure perl-Crypt-Random-Seed perl-Math-Random-ISAAC perl-JSON http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm
|
||||
# Instant client Oracle
|
||||
RUN dnf install -y https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm
|
||||
# Install Phantom
|
||||
RUN dnf install -y supervisor crontabs http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
|
||||
|
||||
|
||||
EXPOSE 80 443 41121 162/udp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.767-221220
|
||||
Version: 7.0NG.767-221229
|
||||
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.767-221220"
|
||||
pandora_version="7.0NG.767-221229"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.767';
|
||||
use constant AGENT_BUILD => '221220';
|
||||
use constant AGENT_BUILD => '221229';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.767
|
||||
%define release 221220
|
||||
%define release 221229
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.767
|
||||
%define release 221220
|
||||
%define release 221229
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.767"
|
||||
PI_BUILD="221220"
|
||||
PI_BUILD="221229"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{221220}
|
||||
{221229}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.767 Build 221220")
|
||||
#define PANDORA_VERSION ("7.0NG.767 Build 221229")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.767(Build 221220))"
|
||||
VALUE "ProductVersion", "(7.0NG.767(Build 221229))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.767-221220
|
||||
Version: 7.0NG.767-221229
|
||||
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.767-221220"
|
||||
pandora_version="7.0NG.767-221229"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -9,13 +9,24 @@
|
|||
],
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.2.0"
|
||||
"php": "8.0.0"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"mpdf/mpdf": "^8.0.15",
|
||||
"swiftmailer/swiftmailer": "^6.0",
|
||||
"amphp/parallel-functions": "^1.0"
|
||||
"amphp/parallel-functions": "^1.0",
|
||||
"chrome-php/chrome": "^1.7.1",
|
||||
"artica/phpchartjs": "^1.0"
|
||||
},
|
||||
"repositories": {
|
||||
"phpchartjs": {
|
||||
"type": "path",
|
||||
"url": "../../../phpchartjs",
|
||||
"options": {
|
||||
"symlink": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "643ac0dc8a8e1f129104399054f8dd0c",
|
||||
"content-hash": "be2ad3d9d4df55d7ccb87981e82c4932",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
|
@ -549,6 +549,205 @@
|
|||
],
|
||||
"time": "2021-10-25T18:29:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "artica/phpchartjs",
|
||||
"version": "v1.0.2",
|
||||
"dist": {
|
||||
"type": "path",
|
||||
"url": "../../../phpchartjs",
|
||||
"reference": "4957e7cd699e50cee8e0ba7304e1423aafb2cad2"
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"halfpastfouram/collection": "1.0.0",
|
||||
"laminas/laminas-json": ">3.1.2",
|
||||
"php": ">=7.2",
|
||||
"symfony/var-dumper": "^3.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "*",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"sensiolabs/security-checker": "^5.0",
|
||||
"squizlabs/php_codesniffer": "3.5.3"
|
||||
},
|
||||
"type": "package",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Artica\\PHPChartJS\\": "src/",
|
||||
"Test\\": "test/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"./vendor/bin/phpunit"
|
||||
],
|
||||
"cs-check": [
|
||||
"./vendor/bin/phpcs"
|
||||
],
|
||||
"cs-fix": [
|
||||
"./vendor/bin/phpcbf"
|
||||
]
|
||||
},
|
||||
"license": [
|
||||
"AGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bob Kruithof"
|
||||
},
|
||||
{
|
||||
"name": "Daniel Barbero"
|
||||
}
|
||||
],
|
||||
"description": "PHP library for ChartJS",
|
||||
"homepage": "https://artica.es/",
|
||||
"keywords": [
|
||||
"chartjs",
|
||||
"graph",
|
||||
"php"
|
||||
],
|
||||
"transport-options": {
|
||||
"symlink": false,
|
||||
"relative": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "chrome-php/chrome",
|
||||
"version": "v1.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chrome-php/chrome.git",
|
||||
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chrome-php/chrome/zipball/5783c749b2ee385d1c481b0906f1b8acef0296e4",
|
||||
"reference": "5783c749b2ee385d1c481b0906f1b8acef0296e4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"chrome-php/wrench": "^1.3",
|
||||
"evenement/evenement": "^3.0.1",
|
||||
"monolog/monolog": "^1.27.1 || ^2.8 || ^3.2",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"symfony/filesystem": "^4.4 || ^5.0 || ^6.0",
|
||||
"symfony/polyfill-mbstring": "^1.26",
|
||||
"symfony/process": "^4.4 || ^5.0 || ^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.1",
|
||||
"phpunit/phpunit": "^9.5.23",
|
||||
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"HeadlessChromium\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
},
|
||||
{
|
||||
"name": "Enrico Dias",
|
||||
"email": "enrico@enricodias.com",
|
||||
"homepage": "https://github.com/enricodias"
|
||||
}
|
||||
],
|
||||
"description": "Instrument headless chrome/chromium instances from PHP",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"chrome",
|
||||
"chromium",
|
||||
"crawl",
|
||||
"headless",
|
||||
"pdf",
|
||||
"puppeteer",
|
||||
"screenshot"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/chrome-php/chrome/issues",
|
||||
"source": "https://github.com/chrome-php/chrome/tree/v1.7.1"
|
||||
},
|
||||
"time": "2022-09-04T21:11:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "chrome-php/wrench",
|
||||
"version": "v1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chrome-php/wrench.git",
|
||||
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chrome-php/wrench/zipball/68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
|
||||
"reference": "68b8282d5d0d54a519c3212ee3e4c35bef40b7d9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-sockets": "*",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"symfony/polyfill-php80": "^1.26"
|
||||
},
|
||||
"conflict": {
|
||||
"wrench/wrench": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.1",
|
||||
"phpunit/phpunit": "^9.5.23"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Wrench\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Graham Campbell",
|
||||
"email": "hello@gjcampbell.co.uk",
|
||||
"homepage": "https://github.com/GrahamCampbell"
|
||||
}
|
||||
],
|
||||
"description": "A simple PHP WebSocket implementation",
|
||||
"keywords": [
|
||||
"WebSockets",
|
||||
"hybi",
|
||||
"websocket"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/chrome-php/wrench/issues",
|
||||
"source": "https://github.com/chrome-php/wrench/tree/v1.3.0"
|
||||
},
|
||||
"time": "2022-08-28T11:42:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "1.2.2",
|
||||
|
@ -693,6 +892,265 @@
|
|||
],
|
||||
"time": "2021-10-11T09:18:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "evenement/evenement",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/igorw/evenement.git",
|
||||
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
|
||||
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Evenement": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Igor Wiedler",
|
||||
"email": "igor@wiedler.ch"
|
||||
}
|
||||
],
|
||||
"description": "Événement is a very simple event dispatching library for PHP",
|
||||
"keywords": [
|
||||
"event-dispatcher",
|
||||
"event-emitter"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/igorw/evenement/issues",
|
||||
"source": "https://github.com/igorw/evenement/tree/master"
|
||||
},
|
||||
"time": "2017-07-23T21:35:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "halfpastfouram/collection",
|
||||
"version": "v1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/halfpastfouram/collection.git",
|
||||
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/halfpastfouram/collection/zipball/0862d0b431fef9dc2245518dc06b86ff00dcd102",
|
||||
"reference": "0862d0b431fef9dc2245518dc06b86ff00dcd102",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6.0 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeclimate/php-test-reporter": "dev-master",
|
||||
"phpunit/phpunit": "5.2.*"
|
||||
},
|
||||
"type": "package",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Test\\": "test/",
|
||||
"Halfpastfour\\Collection\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"AGPL 3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bob Kruithof"
|
||||
}
|
||||
],
|
||||
"description": "A flexible PHP Collection complete with custom Iterator.",
|
||||
"homepage": "http://github.com/halfpastfouram/collection",
|
||||
"keywords": [
|
||||
"collection",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/halfpastfouram/collection/issues",
|
||||
"source": "https://github.com/halfpastfouram/collection/tree/master"
|
||||
},
|
||||
"time": "2016-12-18T13:04:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laminas/laminas-json",
|
||||
"version": "3.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laminas/laminas-json.git",
|
||||
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laminas/laminas-json/zipball/7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
|
||||
"reference": "7a8a1d7bf2d05dd6c1fbd7c0868d3848cf2b57ec",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "~8.0.0 || ~8.1.0 || ~8.2.0"
|
||||
},
|
||||
"conflict": {
|
||||
"zendframework/zend-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"laminas/laminas-coding-standard": "~2.4.0",
|
||||
"laminas/laminas-stdlib": "^2.7.7 || ^3.1",
|
||||
"phpunit/phpunit": "^9.5.25"
|
||||
},
|
||||
"suggest": {
|
||||
"laminas/laminas-json-server": "For implementing JSON-RPC servers",
|
||||
"laminas/laminas-xml2json": "For converting XML documents to JSON"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laminas\\Json\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
|
||||
"homepage": "https://laminas.dev",
|
||||
"keywords": [
|
||||
"json",
|
||||
"laminas"
|
||||
],
|
||||
"support": {
|
||||
"chat": "https://laminas.dev/chat",
|
||||
"docs": "https://docs.laminas.dev/laminas-json/",
|
||||
"forum": "https://discourse.laminas.dev",
|
||||
"issues": "https://github.com/laminas/laminas-json/issues",
|
||||
"rss": "https://github.com/laminas/laminas-json/releases.atom",
|
||||
"source": "https://github.com/laminas/laminas-json"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://funding.communitybridge.org/projects/laminas-project",
|
||||
"type": "community_bridge"
|
||||
}
|
||||
],
|
||||
"time": "2022-10-17T04:06:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "2.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50",
|
||||
"reference": "720488632c590286b88b80e62aa3d3d551ad4a50",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2",
|
||||
"psr/log": "^1.0.1 || ^2.0 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"elasticsearch/elasticsearch": "^7 || ^8",
|
||||
"ext-json": "*",
|
||||
"graylog2/gelf-php": "^1.4.2",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"guzzlehttp/psr7": "^2.2",
|
||||
"mongodb/mongodb": "^1.8",
|
||||
"php-amqplib/php-amqplib": "~2.4 || ^3",
|
||||
"phpspec/prophecy": "^1.15",
|
||||
"phpstan/phpstan": "^0.12.91",
|
||||
"phpunit/phpunit": "^8.5.14",
|
||||
"predis/predis": "^1.1 || ^2.0",
|
||||
"rollbar/rollbar": "^1.3 || ^2 || ^3",
|
||||
"ruflin/elastica": "^7",
|
||||
"swiftmailer/swiftmailer": "^5.3|^6.0",
|
||||
"symfony/mailer": "^5.4 || ^6",
|
||||
"symfony/mime": "^5.4 || ^6"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
|
||||
"ext-mbstring": "Allow to work properly with unicode symbols",
|
||||
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
|
||||
"ext-openssl": "Required to send log messages using SSL",
|
||||
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "https://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "https://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Seldaek/monolog/issues",
|
||||
"source": "https://github.com/Seldaek/monolog/tree/2.8.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Seldaek",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-07-24T11:55:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v8.0.15",
|
||||
|
@ -940,30 +1398,30 @@
|
|||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.4",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
|
||||
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
|
||||
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
"php": ">=8.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
"Psr\\Log\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
@ -984,9 +1442,9 @@
|
|||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/log/tree/1.1.4"
|
||||
"source": "https://github.com/php-fig/log/tree/2.0.0"
|
||||
},
|
||||
"time": "2021-05-03T11:20:27+00:00"
|
||||
"time": "2021-07-14T16:41:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
|
@ -1136,6 +1594,152 @@
|
|||
"abandoned": "symfony/mailer",
|
||||
"time": "2021-10-18T15:26:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v5.4.13",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51",
|
||||
"reference": "ac09569844a9109a5966b9438fc29113ce77cf51",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/polyfill-ctype": "~1.8",
|
||||
"symfony/polyfill-mbstring": "~1.8",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides basic utilities for the filesystem",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/filesystem/tree/v5.4.13"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-21T19:53:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.27.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
|
||||
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-iconv",
|
||||
"version": "v1.24.0",
|
||||
|
@ -1392,16 +1996,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.24.0",
|
||||
"version": "v1.27.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
|
||||
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
|
||||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1416,7 +2020,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.23-dev"
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -1424,12 +2028,12 @@
|
|||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
|
@ -1455,7 +2059,7 @@
|
|||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1471,7 +2075,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-11-30T18:21:41+00:00"
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
|
@ -1548,6 +2152,232 @@
|
|||
}
|
||||
],
|
||||
"time": "2021-05-27T09:17:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.27.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
|
||||
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v5.4.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/6e75fe6874cbc7e4773d049616ab450eff537bf1",
|
||||
"reference": "6e75fe6874cbc7e4773d049616ab450eff537bf1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Process\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v5.4.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-27T16:58:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.4.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0719f6cf4633a38b2c1585140998579ce23b4b7d",
|
||||
"reference": "0719f6cf4633a38b2c1585140998579ce23b4b7d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-iconv": "*",
|
||||
"twig/twig": "~1.34|~2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
|
||||
"ext-intl": "To show region name in time zone dump",
|
||||
"ext-symfony_debug": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"Resources/functions/dump.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\VarDumper\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony mechanism for exploring and dumping PHP variables",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v3.4.47"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-24T10:57:07+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
@ -1559,7 +2389,7 @@
|
|||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "7.2.0"
|
||||
"php": "8.0.0"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
@ -1666,6 +1666,14 @@ godmode/um_client/vendor/sebastian/object-enumerator
|
|||
godmode/um_client/vendor/sebastian
|
||||
godmode/um_client/vendor
|
||||
update_manager_client/resources/styles/pandora.css
|
||||
enterprise/views/cluster/edit.php
|
||||
enterprise/views/cluster/list.php
|
||||
enterprise/views/cluster/view.php
|
||||
enterprise/include/lib/Cluster.php
|
||||
enterprise/include/lib/ClusterModule.php
|
||||
enterprise/include/lib/ClusterViewer/ClusterManager.php
|
||||
enterprise/include/lib/ClusterViewer/ClusterWizard.php
|
||||
enterprise/operation/cluster/cluster.php
|
||||
enterprise/meta/general/upload_head_image.php
|
||||
general/first_task/transactional_list.php
|
||||
enterprise/include/ajax/transactional.ajax.php
|
||||
|
@ -1677,3 +1685,5 @@ enterprise/operation/agentes/manage_transmap.php
|
|||
enterprise/operation/agentes/manage_transmap_creation.php
|
||||
enterprise/operation/agentes/manage_transmap_creation_phases_data.php
|
||||
enterprise/operation/agentes/transactional_map.php
|
||||
include/test.js
|
||||
include/web2image.js
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -68,7 +68,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
|
|||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
?>
|
||||
|
||||
<form action='index.php?sec=estado&sec2=enterprise/operation/cluster/cluster&op=new' method="post">
|
||||
<form action='index.php?sec=estado&sec2=operation/cluster/cluster&op=new' method="post">
|
||||
<input type="submit" class="button_task ui_toggle" value="<?php echo __('Create Cluster'); ?>" />
|
||||
</form>
|
||||
|
||||
|
@ -76,4 +76,4 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no cluster
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,6 +59,7 @@ ui_print_warning_message(
|
|||
]
|
||||
);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->data = [];
|
||||
|
|
|
@ -2118,6 +2118,9 @@ if ($delete_module) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Before delete the main module, check and delete the childrens from the original module.
|
||||
module_check_childrens_and_delete($id_borrar_modulo);
|
||||
|
||||
// Also call base function to delete modules.
|
||||
modules_delete_agent_module($id_borrar_modulo);
|
||||
|
||||
|
@ -2473,6 +2476,11 @@ switch ($tab) {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Change description when edit port
|
||||
$( "#text-tcp_port" ).change(function() {
|
||||
$( "#textarea_description" ).text(`Checks port ${$( "#text-tcp_port" ).val()} is opened`);
|
||||
});
|
||||
|
||||
// Set the position and width of the subtab
|
||||
/*
|
||||
|
|
|
@ -732,17 +732,15 @@ if ($agents !== false) {
|
|||
}
|
||||
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2=';
|
||||
$url .= 'operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.ui_print_truncate_text($agent['alias'], 'agent_medium').'</a>';
|
||||
} else {
|
||||
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
||||
|
@ -792,18 +790,16 @@ if ($agents !== false) {
|
|||
echo '</span><div class="left actions clear_left" style=" visibility: hidden">';
|
||||
if ($check_aw) {
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2=';
|
||||
$url .= 'operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.__('Edit').'</a>';
|
||||
echo ' | ';
|
||||
} else {
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||
|
@ -825,17 +821,15 @@ if ($agents !== false) {
|
|||
echo ' | ';
|
||||
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=view&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.__('View').'</a>';
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2=';
|
||||
$url .= 'operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=view&id='.$cluster->id()
|
||||
);
|
||||
echo '<a href="'.$url.'">'.__('View').'</a>';
|
||||
} else {
|
||||
echo '<a href="index.php?sec=estado
|
||||
&sec2=operation/agentes/ver_agente
|
||||
|
|
|
@ -52,13 +52,13 @@ if (!isset($policy_page)) {
|
|||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
|
||||
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
|
||||
echo "<tr><td class='datos bolder w20p'>";
|
||||
echo __('Search').' '.html_print_input_text(
|
||||
echo "<tr><td class='datos bolder w12p'><span class='mrgn_right_7px'>";
|
||||
echo __('Search').'</span>'.html_print_input_text(
|
||||
'search_string',
|
||||
$search_string,
|
||||
'',
|
||||
15,
|
||||
255,
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
html_print_input_hidden('search', 1);
|
||||
|
@ -73,7 +73,6 @@ echo '</td>';
|
|||
echo "<td class='datos w10p'>";
|
||||
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
|
||||
echo '</td>';
|
||||
echo "<td class='datos w10p'></td>";
|
||||
echo '</form>';
|
||||
// Check if there is at least one server of each type available to assign that
|
||||
// kind of modules. If not, do not show server type in combo.
|
||||
|
@ -179,7 +178,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
// Create module/type combo.
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
if (!$policy_page) {
|
||||
echo '<td class="datos w20p bolder">';
|
||||
echo '<td class="datos w15p bolder">';
|
||||
echo __('Show in hierachy mode');
|
||||
if ($checked == 'true') {
|
||||
$checked = true;
|
||||
|
@ -198,8 +197,8 @@ if (($policy_page) || (isset($agent))) {
|
|||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="datos w20p bolder">';
|
||||
echo __('<p>Type</p>');
|
||||
echo '<td class="datos w20p bolder lign_right"><span class="mrgn_right_7px">';
|
||||
echo __('Type').'</span>';
|
||||
html_print_select(
|
||||
$modules,
|
||||
'moduletype',
|
||||
|
@ -216,7 +215,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
);
|
||||
html_print_input_hidden('edit_module', 1);
|
||||
echo '</td>';
|
||||
echo '<td class="datos w10p">';
|
||||
echo '<td class="datos w5p">';
|
||||
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
@ -247,6 +246,8 @@ if ($module_action === 'delete') {
|
|||
$print_result_msg = true;
|
||||
$count_correct_delete_modules = 0;
|
||||
foreach ($id_agent_modules_delete as $id_agent_module_del) {
|
||||
// Before delete the main module, check and delete the childrens from the original module.
|
||||
module_check_childrens_and_delete($id_agent_module_del);
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ if (strstr($page, 'policy_modules') === false) {
|
|||
|
||||
define('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
if (empty($edit_module)) {
|
||||
// Function in module_manager_editor_common.php.
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ if (strstr($page, 'policy_modules') === false) {
|
|||
|
||||
define('ID_NETWORK_COMPONENT_TYPE', 4);
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
if (empty($edit_module)) {
|
||||
// Function in module_manager_editor_common.php
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
|
|
|
@ -82,7 +82,7 @@ if ($plugin_pass == '' && !$id_agent_module) {
|
|||
$plugin_pass = 1;
|
||||
}
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
if (empty($edit_module)) {
|
||||
// Function in module_manager_editor_common.php
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,7 @@ $extra_title = __('WMI server module');
|
|||
|
||||
define('ID_NETWORK_COMPONENT_TYPE', 6);
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
if (empty($edit_module)) {
|
||||
// Function in module_manager_editor_common.php
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
|
|
|
@ -1842,6 +1842,10 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
|
|||
$(document).ready (function () {
|
||||
populate_agents_selector();
|
||||
|
||||
// Add data-pendingdelete attribute to exclude delete_pending modules
|
||||
document.querySelector("#id_agents").dataset.pendingdelete = true
|
||||
document.querySelector("#modules_selection_mode").dataset.pendingdelete = true
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#modules_selection_mode").change(agent_changed_by_multiple_agents);
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ if (strlen(trim($agentName)) > 0) {
|
|||
}
|
||||
|
||||
if ($actionID != -1 && $actionID != '') {
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
|
||||
$where .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.')))';
|
||||
}
|
||||
|
||||
if ($status_alert === 'disabled') {
|
||||
|
|
|
@ -92,6 +92,7 @@ if (is_ajax() === true) {
|
|||
if ($get_group_agents === true) {
|
||||
ob_clean();
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$id_os = (int) get_parameter('id_os', 0);
|
||||
$disabled = (int) get_parameter('disabled', 0);
|
||||
$search = (string) get_parameter('search', '');
|
||||
$recursion = (int) get_parameter('recursion', 0);
|
||||
|
@ -151,6 +152,10 @@ if (is_ajax() === true) {
|
|||
$filter['status'] = $status_agents;
|
||||
}
|
||||
|
||||
if ($id_os !== 0) {
|
||||
$filter['id_os'] = $id_os;
|
||||
}
|
||||
|
||||
$_sql_post = ' 1=1 ';
|
||||
if ($show_void_agents == 0) {
|
||||
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
|
||||
|
@ -782,18 +787,18 @@ if ($tab == 'tree') {
|
|||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters bolder' width='100%'>";
|
||||
$form .= '<tr><td>'.__('Search').' ';
|
||||
$form .= '<tr><td>'.__('Search').' ';
|
||||
$form .= html_print_input_text(
|
||||
'search',
|
||||
$search,
|
||||
'',
|
||||
100,
|
||||
100,
|
||||
30,
|
||||
30,
|
||||
true
|
||||
);
|
||||
$form .= '</td><td>';
|
||||
$form .= '</td><td style="text-align: right">';
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= '<td></tr>';
|
||||
$form .= '</tr>';
|
||||
$form .= '</table>';
|
||||
$form .= '</form>';
|
||||
|
||||
|
|
|
@ -200,14 +200,14 @@ if ($access_console_node === true) {
|
|||
$sub['gmassive']['type'] = 'direct';
|
||||
$sub['gmassive']['subtype'] = 'nolink';
|
||||
$sub2 = [];
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_agents']['text'] = __('Agents operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_modules']['text'] = __('Modules operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_plugins']['text'] = __('Plugins operations');
|
||||
if ((bool) check_acl($config['id_user'], 0, 'UM') === true) {
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
|
||||
}
|
||||
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
$sub2['godmode/massive/massive_operations&tab=massive_alerts']['text'] = __('Alerts operations');
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
|
|
|
@ -2182,6 +2182,8 @@ switch ($action) {
|
|||
'historical_db_check'
|
||||
);
|
||||
$values['top_n_value'] = get_parameter('max_items');
|
||||
|
||||
$values['server_name'] = get_parameter('combo_server');
|
||||
} else if ($values['type'] == 'url') {
|
||||
$values['external_source'] = get_parameter('url');
|
||||
} else if ($values['type'] == 'event_report_group') {
|
||||
|
|
|
@ -684,23 +684,6 @@ $table_other->data[$i++][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
|
||||
$table_other->data[$i++][1] = html_print_input(
|
||||
[
|
||||
'type' => 'select',
|
||||
'name' => 'phantomjs_cache_interval',
|
||||
'return' => true,
|
||||
'fields' => [
|
||||
PHANTOM_CACHE_CLEANUP_ONCE => __('No scheduled'),
|
||||
PHANTOM_CACHE_CLEANUP_WEEKLY => __('Each week'),
|
||||
PHANTOM_CACHE_CLEANUP_DAILY => __('Each day'),
|
||||
],
|
||||
'selected' => ($config['phantomjs_cache_interval'] ?? PHANTOM_CACHE_CLEANUP_ONCE),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Agent Wizard defaults.
|
||||
$defaultAgentWizardOptions = json_decode(io_safe_output($config['agent_wizard_defaults']));
|
||||
$tableSnmpWizard = new stdClass();
|
||||
|
|
|
@ -77,6 +77,7 @@ if (is_ajax()) {
|
|||
true
|
||||
).' ';
|
||||
$table->data['autocreate_remote_users'] = $row;
|
||||
$table->data['csrf_token'] = html_print_csrf_hidden();
|
||||
|
||||
add_enterprise_auth_autocreate_profiles($table, $type_auth);
|
||||
}
|
||||
|
@ -475,6 +476,8 @@ if (!is_metaconsole()) {
|
|||
html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass']));
|
||||
}
|
||||
|
||||
html_print_csrf_hidden();
|
||||
|
||||
html_print_table($table);
|
||||
echo '<div id="table_auth_result"></div>';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
|
|
@ -95,11 +95,11 @@ $table->data[$i++][1] = html_print_input_text(
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[$i][0] = __('Phantomjs bin directory');
|
||||
$table->data[$i][0] = __('Chromium path');
|
||||
$table->data[$i++][1] = html_print_input_text(
|
||||
'phantomjs_bin',
|
||||
'chromium_path',
|
||||
io_safe_output(
|
||||
$config['phantomjs_bin']
|
||||
$config['chromium_path']
|
||||
),
|
||||
'',
|
||||
30,
|
||||
|
|
|
@ -404,6 +404,7 @@ if ($id_profile || $new_profile) {
|
|||
html_print_input_hidden('create_profile', 1);
|
||||
} else {
|
||||
html_print_input_hidden('id', $id_profile);
|
||||
html_print_input_hidden('old_name_profile', $name);
|
||||
html_print_input_hidden('update_profile', 1);
|
||||
html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"');
|
||||
}
|
||||
|
@ -415,15 +416,53 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready (function () {
|
||||
var disable_option = '<?php echo $disable_option; ?>';
|
||||
|
||||
if (disable_option != '') {
|
||||
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
|
||||
if (disable_option != '') {
|
||||
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
|
||||
ids.forEach(id => {
|
||||
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Not enable enter for prevent submits
|
||||
$(window).keydown(function(event){
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#text-name').on('blur',function(){
|
||||
/* Check if the name is already on use for new profiles or check if the
|
||||
name is already on use for update checking if the name is distinct of the original*/
|
||||
if($('#hidden-create_profile').val()==1 || ($('#hidden-update_profile').val()==1 && $('#hidden-old_name_profile').val()!=$('#text-name').val())){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
data: {
|
||||
page: 'include/ajax/profile',
|
||||
search_profile_nanme: true,
|
||||
profile_name: $('#text-name').val().trim(),
|
||||
},
|
||||
success: function (data) {
|
||||
if(data === 'true'){
|
||||
alert( <?php echo "'".__('Profile name already on use, please, change the name before save')."'"; ?> );
|
||||
if($('#hidden-old_name_profile').val()){
|
||||
$('#text-name').val($('#hidden-old_name_profile').val());
|
||||
}else{
|
||||
$('#text-name').val("");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to interpreter order", data)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -654,7 +654,7 @@ if ($get_agent_alerts_datatable === true) {
|
|||
}
|
||||
|
||||
$idGroup = $filter_alert['ag_group'];
|
||||
$tag_filter = $filter_alert['tag_filter'];
|
||||
$tag_filter = $filter_alert['tag'];
|
||||
$action_filter = $filter_alert['action'];
|
||||
|
||||
try {
|
||||
|
@ -884,9 +884,9 @@ if ($get_agent_alerts_datatable === true) {
|
|||
users_get_groups($config['id_user'], $access, false)
|
||||
);
|
||||
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
|
||||
$alerts['alerts_simple'] = get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter, false);
|
||||
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
|
||||
$countAlertsSimple = get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2031,8 +2031,10 @@ if ($total_event_graph) {
|
|||
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
$prueba = grafico_eventos_total('', 280, 150, false, true);
|
||||
echo $prueba;
|
||||
$out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
|
||||
$out .= grafico_eventos_total('', 0, 0, false, true);
|
||||
$out .= '<div>';
|
||||
echo $out;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2041,8 +2043,10 @@ if ($graphic_event_group) {
|
|||
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
$prueba = grafico_eventos_grupo(280, 150, '', false, true);
|
||||
echo $prueba;
|
||||
$out = '<div style="flex: 0 0 300px; width:99%; height:100%;">';
|
||||
$out .= grafico_eventos_grupo(0, 0, '', false, true);
|
||||
$out .= '<div>';
|
||||
echo $out;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
|
||||
// Clean the possible blanks introduced by the included files.
|
||||
ob_clean();
|
||||
|
||||
$search_profile_name = (bool) get_parameter('search_profile_nanme');
|
||||
|
||||
if ($search_profile_name) {
|
||||
$profile_name = (string) get_parameter('profile_name');
|
||||
|
||||
echo json_encode(profile_exist($profile_name));
|
||||
|
||||
return;
|
||||
}
|
|
@ -168,11 +168,16 @@ function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypt
|
|||
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
// Check that row exists, that password is not empty and that password is the same hash.
|
||||
if (($row !== false && $row['password'] !== md5('')
|
||||
&& (string) $row['password'] === md5($pass))
|
||||
|| ($passAlreadyEncrypted === true && (string) $row['password'] === (string) $pass)
|
||||
) {
|
||||
// Perform password check whether it is MD5-hashed (old hashing) or Bcrypt-hashed.
|
||||
if (strlen($row['password']) === 32) {
|
||||
// MD5.
|
||||
$credentials_check = $row !== false && $row['password'] !== md5('') && $row['password'] == md5($pass);
|
||||
} else {
|
||||
// Bcrypt.
|
||||
$credentials_check = password_verify($pass, $row['password']);
|
||||
}
|
||||
|
||||
if ($credentials_check === true) {
|
||||
// Login OK
|
||||
// Nick could be uppercase or lowercase (select in MySQL
|
||||
// is not case sensitive)
|
||||
|
@ -187,6 +192,11 @@ function process_user_login_local($login, $pass, $api=false, $passAlreadyEncrypt
|
|||
return false;
|
||||
}
|
||||
|
||||
// Override password to use Bcrypt encryption.
|
||||
if (strlen($row['password']) === 32) {
|
||||
update_user_password($login, $pass);
|
||||
}
|
||||
|
||||
return $row['id_user'];
|
||||
} else {
|
||||
if (user_can_login($login) === false) {
|
||||
|
@ -612,7 +622,7 @@ function create_user($id_user, $password, $user_info)
|
|||
{
|
||||
$values = $user_info;
|
||||
$values['id_user'] = $id_user;
|
||||
$values['password'] = md5($password);
|
||||
$values['password'] = password_hash($password, PASSWORD_BCRYPT);
|
||||
$values['last_connect'] = 0;
|
||||
$values['registered'] = get_system_time();
|
||||
|
||||
|
@ -703,7 +713,7 @@ function delete_user(string $id_user)
|
|||
|
||||
|
||||
/**
|
||||
* Update the password in MD5 for user pass as id_user with
|
||||
* Update the password using BCRYPT algorithm for specific id_user passing
|
||||
* password in plain text.
|
||||
*
|
||||
* @param string $user User ID.
|
||||
|
@ -722,7 +732,7 @@ function update_user_password(string $user, string $password_new)
|
|||
|
||||
if (isset($config['auth']) === true && $config['auth'] === 'pandora') {
|
||||
$sql = sprintf(
|
||||
"UPDATE tusuario SET password = '".md5($password_new)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'"
|
||||
"UPDATE tusuario SET password = '".password_hash($password_new, PASSWORD_BCRYPT)."', last_pass_change = '".date('Y-m-d H:i:s', get_system_time())."' WHERE id_user = '".$user."'"
|
||||
);
|
||||
|
||||
$connection = mysql_connect_db(
|
||||
|
@ -742,7 +752,7 @@ function update_user_password(string $user, string $password_new)
|
|||
return db_process_sql_update(
|
||||
'tusuario',
|
||||
[
|
||||
'password' => md5($password_new),
|
||||
'password' => password_hash($password_new, PASSWORD_BCRYPT),
|
||||
'last_pass_change' => date('Y/m/d H:i:s', get_system_time()),
|
||||
],
|
||||
['id_user' => $user]
|
||||
|
@ -1006,7 +1016,7 @@ function create_user_and_permisions_ldap(
|
|||
$values['id_user'] = $id_user;
|
||||
|
||||
if ($config['ldap_save_password'] || $config['ad_save_password']) {
|
||||
$values['password'] = md5($password);
|
||||
$values['password'] = password_hash($password, PASSWORD_BCRYPT);
|
||||
}
|
||||
|
||||
$values['last_connect'] = 0;
|
||||
|
@ -1438,9 +1448,9 @@ function change_local_user_pass_ldap($id_user, $password)
|
|||
$local_user_pass = db_get_value_filter('password', 'tusuario', ['id_user' => $id_user]);
|
||||
|
||||
$return = false;
|
||||
if (md5($password) !== $local_user_pass) {
|
||||
if (password_hash($password, PASSWORD_BCRYPT) !== $local_user_pass) {
|
||||
$values_update = [];
|
||||
$values_update['password'] = md5($password);
|
||||
$values_update['password'] = password_hash($password, PASSWORD_BCRYPT);
|
||||
|
||||
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
|
||||
}
|
||||
|
|
|
@ -42,40 +42,23 @@ require_once $config['homedir'].'/include/functions_agents.php';
|
|||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
$data_raw = get_parameter('data');
|
||||
$data_decoded = json_decode(base64_decode($data_raw), true);
|
||||
$data_decoded = json_decode(io_safe_output($data_raw), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
$data = urldecode($data_decoded['data']);
|
||||
$session_id = urldecode($data_decoded['session_id']);
|
||||
$data_combined = urldecode($data_decoded['data_combined']);
|
||||
$data_module_list = urldecode($data_decoded['data_module_list']);
|
||||
$type_graph_pdf = urldecode($data_decoded['type_graph_pdf']);
|
||||
$viewport_width = urldecode($data_decoded['viewport_width']);
|
||||
$data = $data_decoded['data'];
|
||||
$session_id = $data_decoded['session_id'];
|
||||
$type_graph_pdf = $data_decoded['type_graph_pdf'];
|
||||
|
||||
$data_combined = [];
|
||||
if (isset($data_decoded['data_combined']) === true) {
|
||||
$data_combined = $data_decoded['data_combined'];
|
||||
}
|
||||
|
||||
$data_module_list = [];
|
||||
if (isset($data_decoded['data_module_list']) === true) {
|
||||
$data_module_list = $data_decoded['data_module_list'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Echo to stdout a PhantomJS callback call.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function echoPhantomCallback()
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
|
||||
|
@ -99,7 +82,6 @@ if (check_login(false) === false) {
|
|||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<?php echoPhantomCallback(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -108,10 +90,16 @@ if (check_login(false) === false) {
|
|||
}
|
||||
|
||||
// Access granted.
|
||||
$params = json_decode($data, true);
|
||||
$params = $data;
|
||||
if (isset($params['backgroundColor']) === false) {
|
||||
$params['backgroundColor'] = 'inherit';
|
||||
}
|
||||
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = $params['server_id'];
|
||||
$server_id = 0;
|
||||
if (isset($params['server_id']) === true) {
|
||||
$server_id = $params['server_id'];
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
|
@ -124,7 +112,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
|
|||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -133,7 +120,6 @@ if (is_metaconsole() === true && empty($server_id) === false) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
|
@ -146,16 +132,16 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id).' - '.$interface_name; ?>)</title>
|
||||
<title>Pandora FMS Graph</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script>
|
||||
|
@ -170,48 +156,46 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/chartjs/chart.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="graphs/chartjs/chartjs-plugin-datalabels.min.js"></script>
|
||||
</head>
|
||||
<body style='background-color: <?php echo $params['backgroundColor']; ?>;'>
|
||||
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['menu'] = false;
|
||||
|
||||
$params['disable_black'] = true;
|
||||
$params_combined = json_decode($data_combined, true);
|
||||
$module_list = json_decode($data_module_list, true);
|
||||
$params_combined = $data_combined;
|
||||
$module_list = $data_module_list;
|
||||
|
||||
if (isset($params['vconsole']) === false || $params['vconsole'] === false) {
|
||||
if ((int) $viewport_width > 0) {
|
||||
$params['width'] = (int) $viewport_width;
|
||||
$viewport = [
|
||||
'width' => 0,
|
||||
'height' => 0,
|
||||
];
|
||||
|
||||
$style = 'width:100%;';
|
||||
if (isset($params['options']['viewport']) === true) {
|
||||
$viewport = $params['options']['viewport'];
|
||||
if (empty($viewport['width']) === false) {
|
||||
$style .= 'width:'.$viewport['width'].'px;';
|
||||
}
|
||||
|
||||
if ((isset($params['width']) === false
|
||||
|| ($params['width'] <= 0))
|
||||
) {
|
||||
if ((int) $params['width'] <= 0) {
|
||||
$params['width'] = 650;
|
||||
}
|
||||
|
||||
if ((int) $params['landscape'] === 1) {
|
||||
$params['width'] = 850;
|
||||
}
|
||||
|
||||
if ($type_graph_pdf === 'slicebar') {
|
||||
$params['width'] = 100;
|
||||
$params['height'] = 70;
|
||||
}
|
||||
if (empty($viewport['height']) === false) {
|
||||
$style .= 'height:'.$viewport['height'].'px;';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div>';
|
||||
echo '<div id="container-chart-generator-item" style="'.$style.' margin:0px;">';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
$params['pdf'] = true;
|
||||
echo graphic_combined_module(
|
||||
$result = graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
|
||||
echo $result;
|
||||
break;
|
||||
|
||||
case 'sparse':
|
||||
|
@ -219,67 +203,40 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
echo grafico_modulo_sparse($params);
|
||||
break;
|
||||
|
||||
case 'pie_chart':
|
||||
case 'pie_graph':
|
||||
$params['pdf'] = true;
|
||||
echo flot_pie_chart(
|
||||
$params['values'],
|
||||
$params['keys'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$config['font_size'],
|
||||
$params['legend_position'],
|
||||
$params['colors'],
|
||||
$params['hide_labels']
|
||||
$chart = get_build_setup_charts(
|
||||
'PIE',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'vbar':
|
||||
case 'vbar_graph':
|
||||
$params['pdf'] = true;
|
||||
echo flot_vcolumn_chart($params);
|
||||
break;
|
||||
|
||||
case 'hbar':
|
||||
$params['pdf'] = true;
|
||||
echo flot_hcolumn_chart(
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$config['font_size'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color'],
|
||||
$params['val_min'],
|
||||
$params['val_max'],
|
||||
$params['pdf']
|
||||
$chart = get_build_setup_charts(
|
||||
'BAR',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'ring_graph':
|
||||
$params['pdf'] = true;
|
||||
echo flot_custom_pie_chart(
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['colors'],
|
||||
$params['module_name_list'],
|
||||
$params['long_index'],
|
||||
$params['no_data'],
|
||||
false,
|
||||
'',
|
||||
$params['water_mark'],
|
||||
$params['font'],
|
||||
$config['font_size'],
|
||||
$params['unit'],
|
||||
$params['ttl'],
|
||||
$params['homeurl'],
|
||||
$params['background_color'],
|
||||
$params['legend_position'],
|
||||
$params['background_color'],
|
||||
$params['pdf']
|
||||
$params['options']['width'] = 500;
|
||||
$params['options']['height'] = 500;
|
||||
|
||||
$chart = get_build_setup_charts(
|
||||
'DOUGHNUT',
|
||||
$params['options'],
|
||||
$params['chart_data']
|
||||
);
|
||||
|
||||
echo $chart->render(true);
|
||||
break;
|
||||
|
||||
case 'slicebar':
|
||||
|
@ -313,7 +270,6 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
}
|
||||
|
||||
echo '</div>';
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -167,7 +167,7 @@ class ConsoleSupervisor
|
|||
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
|
||||
* NOTIF.PHP.MEMORY_LIMIT
|
||||
* NOTIF.PHP.DISABLE_FUNCTIONS
|
||||
* NOTIF.PHP.PHANTOMJS
|
||||
* NOTIF.PHP.CHROMIUM
|
||||
* NOTIF.PHP.VERSION
|
||||
*/
|
||||
|
||||
|
@ -349,7 +349,7 @@ class ConsoleSupervisor
|
|||
* NOTIF.PHP.UPLOAD_MAX_FILESIZE
|
||||
* NOTIF.PHP.MEMORY_LIMIT
|
||||
* NOTIF.PHP.DISABLE_FUNCTIONS
|
||||
* NOTIF.PHP.PHANTOMJS
|
||||
* NOTIF.PHP.CHROMIUM
|
||||
* NOTIF.PHP.VERSION
|
||||
*/
|
||||
|
||||
|
@ -528,11 +528,7 @@ class ConsoleSupervisor
|
|||
*/
|
||||
public function maintenanceOperations()
|
||||
{
|
||||
/*
|
||||
* Process cache clean if needed.
|
||||
*/
|
||||
|
||||
$this->checkCleanPhantomCache();
|
||||
}
|
||||
|
||||
|
||||
|
@ -688,7 +684,7 @@ class ConsoleSupervisor
|
|||
case 'NOTIF.PHP.UPLOAD_MAX_FILESIZE':
|
||||
case 'NOTIF.PHP.MEMORY_LIMIT':
|
||||
case 'NOTIF.PHP.DISABLE_FUNCTIONS':
|
||||
case 'NOTIF.PHP.PHANTOMJS':
|
||||
case 'NOTIF.PHP.CHROMIUM':
|
||||
case 'NOTIF.PHP.VERSION':
|
||||
case 'NOTIF.HISTORYDB':
|
||||
case 'NOTIF.PANDORADB':
|
||||
|
@ -1431,9 +1427,9 @@ class ConsoleSupervisor
|
|||
$PHPmemory_limit_min = config_return_in_bytes('-1');
|
||||
}
|
||||
|
||||
// PhantomJS status.
|
||||
$phantomjs_dir = io_safe_output($config['phantomjs_bin']);
|
||||
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version');
|
||||
// Chromium status.
|
||||
$chromium_dir = io_safe_output($config['chromium_path']);
|
||||
$result_ejecution = exec($chromium_dir.' --version');
|
||||
|
||||
// PHP version checks.
|
||||
$php_version = phpversion();
|
||||
|
@ -1577,21 +1573,20 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
if (!isset($result_ejecution) || $result_ejecution == '') {
|
||||
$url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration#Phantomjs';
|
||||
if ($config['language'] == 'es') {
|
||||
$url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs';
|
||||
}
|
||||
|
||||
$url = 'https://www.chromium.org/getting-involved/download-chromium/';
|
||||
// if ($config['language'] == 'es') {
|
||||
// $url = 'https://pandorafms.com/manual/es/documentation/02_installation/04_configuration#Phantomjs';
|
||||
// }
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.PHANTOMJS',
|
||||
'title' => __('PhantomJS is not installed'),
|
||||
'message' => __('To be able to create images of the graphs for PDFs, please install the PhantomJS extension. For that, it is necessary to follow these steps:'),
|
||||
'type' => 'NOTIF.PHP.CHROMIUM',
|
||||
'title' => __('chromium is not installed'),
|
||||
'message' => __('To be able to create images of the graphs for PDFs, please install the chromium extension. For that, it is necessary to follow these steps:'),
|
||||
'url' => $url,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS');
|
||||
$this->cleanNotifications('NOTIF.PHP.CHROMIUM');
|
||||
}
|
||||
|
||||
if ($php_version_array[0] < 8) {
|
||||
|
@ -2698,34 +2693,6 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean Phantom cache if needed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkCleanPhantomCache()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['clean_phantomjs_cache']) !== true
|
||||
|| (int) $config['clean_phantomjs_cache'] !== 1
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cache_dir = $config['homedir'].'/attachment/cache';
|
||||
if (is_dir($cache_dir) === true) {
|
||||
Files::rmrf($cache_dir);
|
||||
}
|
||||
|
||||
// Clean process has ended.
|
||||
config_update_value(
|
||||
'clean_phantomjs_cache',
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies the status of synchronization queue and warns if something is
|
||||
* not working as expected.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC221220';
|
||||
$build_version = 'PC221229';
|
||||
$pandora_version = 'v7.0NG.767';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -113,13 +113,6 @@ define('SECONDS_1YEAR', 31536000);
|
|||
define('SECONDS_2YEARS', 63072000);
|
||||
define('SECONDS_3YEARS', 94608000);
|
||||
|
||||
// PhantomJS Cache cleanup intervals.
|
||||
define('PHANTOM_CACHE_CLEANUP_ONCE', 0);
|
||||
define('PHANTOM_CACHE_CLEANUP_WEEKLY', SECONDS_1WEEK);
|
||||
define('PHANTOM_CACHE_CLEANUP_DAILY', SECONDS_1DAY);
|
||||
|
||||
|
||||
|
||||
// Separator constats.
|
||||
define('SEPARATOR_COLUMN', ';');
|
||||
define('SEPARATOR_ROW', chr(10));
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
* @subpackage Generic_Functions
|
||||
*/
|
||||
|
||||
/**
|
||||
use HeadlessChromium\BrowserFactory;
|
||||
use HeadlessChromium\Clip;
|
||||
use HeadlessChromium\Page;
|
||||
|
||||
/*
|
||||
* Include the html and ui functions.
|
||||
*/
|
||||
require_once 'functions_html.php';
|
||||
|
@ -963,6 +967,10 @@ function get_parameter($name, $default='')
|
|||
return get_parameter_get($name, $default);
|
||||
}
|
||||
|
||||
if (isset($_FILES[$name])) {
|
||||
return get_parameter_file($name, $default);
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
@ -1003,6 +1011,24 @@ function get_parameter_post($name, $default='')
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a parameter from a post file request.
|
||||
*
|
||||
* @param string $name key of the parameter in the $_FILES array
|
||||
* @param mixed $default default value if the key wasn't found
|
||||
*
|
||||
* @return mixed Whatever was in that parameter, cleaned however
|
||||
*/
|
||||
function get_parameter_file($name, $default='')
|
||||
{
|
||||
if ((isset($_FILES[$name])) && !empty($_FILES[$name])) {
|
||||
return io_safe_input($_FILES[$name]);
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get header.
|
||||
*
|
||||
|
@ -2100,7 +2126,7 @@ function get_snmpwalk(
|
|||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($server_to_exec != 0) {
|
||||
if (empty($server_to_exec) === false) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
|
@ -4212,8 +4238,7 @@ function generator_chart_to_pdf(
|
|||
$hack_metaconsole = '';
|
||||
}
|
||||
|
||||
$file_js = $config['homedir'].'/include/web2image.js';
|
||||
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
|
||||
$url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php';
|
||||
|
||||
if (!$params['return_img_base_64']) {
|
||||
$img_file = 'img_'.uniqid().'.png';
|
||||
|
@ -4221,64 +4246,88 @@ function generator_chart_to_pdf(
|
|||
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
||||
}
|
||||
|
||||
if ($type_graph_pdf === 'vbar') {
|
||||
$width_img = $params['generals']['pdf']['width'];
|
||||
$height_img = $params['generals']['pdf']['height'];
|
||||
} else if ($type_graph_pdf === 'combined'
|
||||
&& $params_combined['stacked'] == CUSTOM_GRAPH_VBARS
|
||||
) {
|
||||
$width_img = 650;
|
||||
$height_img = ($params['height'] + 50);
|
||||
} else if ($type_graph_pdf === 'hbar' || $type_graph_pdf === 'pie_chart') {
|
||||
$width_img = ($params['width'] ?? 550);
|
||||
$height_img = $params['height'];
|
||||
} else {
|
||||
$width_img = 550;
|
||||
$height_img = $params['height'];
|
||||
|
||||
if ((int) $params['landscape'] === 1) {
|
||||
$height_img = 150;
|
||||
$params['height'] = 150;
|
||||
}
|
||||
}
|
||||
|
||||
$params_encode_json = urlencode(json_encode($params));
|
||||
|
||||
if ($params_combined) {
|
||||
$params_combined = urlencode(json_encode($params_combined));
|
||||
}
|
||||
|
||||
if ($module_list) {
|
||||
$module_list = urlencode(json_encode($module_list));
|
||||
}
|
||||
|
||||
$session_id = session_id();
|
||||
$cache_dir = $config['homedir'].'/attachment/cache';
|
||||
|
||||
$cmd = '"'.io_safe_output($config['phantomjs_bin']);
|
||||
$cmd .= DIRECTORY_SEPARATOR.'phantomjs" ';
|
||||
$cmd .= ' --disk-cache=true --disk-cache-path="'.$cache_dir.'"';
|
||||
$cmd .= ' --max-disk-cache-size=10000 ';
|
||||
$cmd .= ' --ssl-protocol=any --ignore-ssl-errors=true ';
|
||||
$cmd .= '"'.$file_js.'" "'.$url.'" "'.$type_graph_pdf.'"';
|
||||
$cmd .= ' "'.$params_encode_json.'" "'.$params_combined.'"';
|
||||
$cmd .= ' "'.$module_list.'" "'.$img_path.'"';
|
||||
$cmd .= ' "'.$width_img.'" "'.$height_img.'"';
|
||||
$cmd .= ' "'.$session_id.'" "'.$params['return_img_base_64'].'"';
|
||||
|
||||
$result = null;
|
||||
$retcode = null;
|
||||
exec($cmd, $result, $retcode);
|
||||
|
||||
$img_content = join("\n", $result);
|
||||
|
||||
if ($params['return_img_base_64']) {
|
||||
// To be used in alerts.
|
||||
return $img_content;
|
||||
if ($type_graph_pdf === 'combined') {
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
'data_module_list' => $module_list,
|
||||
'data_combined' => $params_combined,
|
||||
];
|
||||
} else {
|
||||
// To be used in PDF files.
|
||||
$config['temp_images'][] = $img_path;
|
||||
return '<img src="'.$img_url.'" />';
|
||||
$data = [
|
||||
'data' => $params,
|
||||
'session_id' => $session_id,
|
||||
'type_graph_pdf' => $type_graph_pdf,
|
||||
];
|
||||
}
|
||||
|
||||
// If not install chromium avoid 500 convert tu images no data to show.
|
||||
$chromium_dir = io_safe_output($config['chromium_path']);
|
||||
$result_ejecution = exec($chromium_dir.' --version');
|
||||
if (empty($result_ejecution) === true) {
|
||||
if ($params['return_img_base_64']) {
|
||||
$params['base64'] = true;
|
||||
}
|
||||
|
||||
return graph_nodata_image($params);
|
||||
}
|
||||
|
||||
try {
|
||||
$browserFactory = new BrowserFactory($chromium_dir);
|
||||
|
||||
// Starts headless chrome.
|
||||
$browser = $browserFactory->createBrowser(['noSandbox' => true]);
|
||||
|
||||
// Creates a new page.
|
||||
$page = $browser->createPage();
|
||||
|
||||
// Navigate to an URL.
|
||||
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
|
||||
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
|
||||
|
||||
// Dynamic.
|
||||
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();
|
||||
if (empty($dynamic_height) === true) {
|
||||
$dynamic_height = 200;
|
||||
}
|
||||
|
||||
if (isset($params['options']['viewport']) === true
|
||||
&& isset($params['options']['viewport']['height']) === true
|
||||
&& empty($params['options']['viewport']['height']) === false
|
||||
) {
|
||||
$dynamic_height = $params['options']['viewport']['height'];
|
||||
}
|
||||
|
||||
$dynamic_width = $page->evaluate('document.getElementById("container-chart-generator-item").clientWidth')->getReturnValue();
|
||||
if (empty($dynamic_width) === true) {
|
||||
$dynamic_width = 794;
|
||||
}
|
||||
|
||||
if (isset($params['options']['viewport']) === true
|
||||
&& isset($params['options']['viewport']['width']) === true
|
||||
&& empty($params['options']['viewport']['width']) === false
|
||||
) {
|
||||
$dynamic_width = $params['options']['viewport']['width'];
|
||||
}
|
||||
|
||||
$clip = new Clip(0, 0, $dynamic_width, $dynamic_height);
|
||||
|
||||
if ($params['return_img_base_64']) {
|
||||
$b64 = $page->screenshot(['clip' => $clip])->getBase64();
|
||||
// To be used in alerts.
|
||||
return $b64;
|
||||
} else {
|
||||
// To be used in PDF files.
|
||||
$b64 = $page->screenshot(['clip' => $clip])->saveToFile($img_path);
|
||||
$config['temp_images'][] = $img_path;
|
||||
return '<img src="'.$img_url.'" />';
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
error_log($th);
|
||||
} finally {
|
||||
$browser->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2101,7 +2101,8 @@ function get_group_alerts(
|
|||
$count=false,
|
||||
$strict_user=false,
|
||||
$tag=false,
|
||||
$action_filter=false
|
||||
$action_filter=false,
|
||||
$alert_action=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -2162,7 +2163,9 @@ function get_group_alerts(
|
|||
// WHEN SELECT ALL TAGS TO FILTER ALERTS
|
||||
if ($action_filter) {
|
||||
$filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))';
|
||||
$filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')';
|
||||
if ($alert_action) {
|
||||
$filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')';
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
|
@ -2252,6 +2255,7 @@ function get_group_alerts(
|
|||
$filter,
|
||||
$orderbyText
|
||||
);
|
||||
|
||||
$alerts = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($alerts === false) {
|
||||
|
|
|
@ -62,7 +62,7 @@ enterprise_include_once('include/functions_cron.php');
|
|||
// Clases.
|
||||
use PandoraFMS\Agent;
|
||||
use PandoraFMS\Module;
|
||||
use PandoraFMS\Enterprise\Cluster;
|
||||
use PandoraFMS\Cluster;
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\Event;
|
||||
use PandoraFMS\SpecialDay;
|
||||
|
@ -10157,6 +10157,8 @@ function api_set_delete_module($id, $id2, $other, $trash1)
|
|||
}
|
||||
|
||||
if (!$simulate) {
|
||||
// Before delete the main module, check and delete the childrens from the original module.
|
||||
module_check_childrens_and_delete($idAgentModule);
|
||||
$return = modules_delete_agent_module($idAgentModule);
|
||||
} else {
|
||||
$return = true;
|
||||
|
@ -10182,6 +10184,8 @@ function api_set_delete_module($id, $id2, $other, $trash1)
|
|||
}
|
||||
|
||||
if (!$simulate) {
|
||||
// Before delete the main module, check and delete the childrens from the original module.
|
||||
module_check_childrens_and_delete($idAgentModule);
|
||||
$return = modules_delete_agent_module($idAgentModule);
|
||||
} else {
|
||||
$return = true;
|
||||
|
|
|
@ -184,8 +184,8 @@ function config_update_config()
|
|||
$error_update[] = __('Remote config directory');
|
||||
}
|
||||
|
||||
if (config_update_value('phantomjs_bin', (string) get_parameter('phantomjs_bin'), true) === false) {
|
||||
$error_update[] = __('phantomjs config directory');
|
||||
if (config_update_value('chromium_path', (string) get_parameter('chromium_path'), true) === false) {
|
||||
$error_update[] = __('Chromium config directory');
|
||||
}
|
||||
|
||||
if (config_update_value('loginhash_pwd', io_input_password((string) get_parameter('loginhash_pwd')), true) === false) {
|
||||
|
@ -523,6 +523,15 @@ function config_update_config()
|
|||
break;
|
||||
|
||||
case 'auth':
|
||||
$validatedCSRF = validate_csrf_code();
|
||||
|
||||
// CSRF Validation.
|
||||
if ($validatedCSRF === false) {
|
||||
include_once 'general/login_page.php';
|
||||
// Finish the execution.
|
||||
exit('</html>');
|
||||
}
|
||||
|
||||
// AUTHENTICATION SETUP.
|
||||
if (config_update_value('auth', get_parameter('auth'), true) === false) {
|
||||
$error_update[] = __('Authentication method');
|
||||
|
@ -926,25 +935,6 @@ function config_update_config()
|
|||
if (config_update_value('agent_wizard_defaults', json_encode($selectedAgentWizardOptions), true) === false) {
|
||||
$error_update[] = __('SNMP Interface Agent Wizard');
|
||||
}
|
||||
|
||||
$pjs = get_parameter('phantomjs_cache_interval');
|
||||
switch ($pjs) {
|
||||
case $config['phantomjs_cache_interval']:
|
||||
default;
|
||||
// No changes.
|
||||
break;
|
||||
|
||||
case PHANTOM_CACHE_CLEANUP_ONCE:
|
||||
case PHANTOM_CACHE_CLEANUP_DAILY:
|
||||
case PHANTOM_CACHE_CLEANUP_WEEKLY:
|
||||
enterprise_hook('phantomjs_cache_interval_schedule', [$pjs]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (config_update_value('phantomjs_cache_interval', get_parameter('phantomjs_cache_interval'), true) === false
|
||||
) {
|
||||
$error_update[] = __('PhantomJS cache interval');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'vis':
|
||||
|
@ -1975,14 +1965,9 @@ function config_process_config()
|
|||
config_update_value('remote_config', $default);
|
||||
}
|
||||
|
||||
if (!isset($config['phantomjs_bin'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\bin';
|
||||
} else {
|
||||
$default = '/usr/bin';
|
||||
}
|
||||
|
||||
config_update_value('phantomjs_bin', $default);
|
||||
if (isset($config['chromium_path']) === false) {
|
||||
$default = '/usr/bin/chromium-browser';
|
||||
config_update_value('chromium_path', $default);
|
||||
}
|
||||
|
||||
if (!isset($config['date_format'])) {
|
||||
|
|
|
@ -2634,27 +2634,6 @@ function events_print_event_table(
|
|||
$events_table = html_print_table($table, true);
|
||||
$out = $events_table;
|
||||
|
||||
if (!$tactical_view) {
|
||||
$out .= '<table width="100%"><tr><td class="w90p align-top pdd_t_0px">';
|
||||
if ($agent_id != 0) {
|
||||
$out .= '</td><td class="w200px align-top">';
|
||||
$out .= '<table cellpadding=0 cellspacing=0 class="databox"><tr><td>';
|
||||
$out .= '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Events -by module-').'</legend>'.graph_event_module(180, 100, $event['id_agente']).'</fieldset>';
|
||||
$out .= '</td></tr></table>';
|
||||
} else {
|
||||
$out .= '</td><td class="w200px align-top">';
|
||||
$out .= '<table cellpadding=0 cellspacing=0 class="databox"><tr><td>';
|
||||
$out .= '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Event graph').'</legend>'.grafico_eventos_total('', 180, 60).'</fieldset>';
|
||||
$out .= '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Event graph by agent').'</legend>'.grafico_eventos_grupo(180, 60).'</fieldset>';
|
||||
$out .= '</td></tr></table>';
|
||||
}
|
||||
|
||||
$out .= '</td></tr></table>';
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
if ($return) {
|
||||
|
@ -5212,7 +5191,7 @@ function events_get_count_events_validated_by_user($data)
|
|||
) {
|
||||
foreach ($fullnames as $value) {
|
||||
if (isset($data_graph_by_user[$value['id_user']]) === true) {
|
||||
$data_graph_by_user[$value['fullname']] = $data_graph_by_user[$value['id_user']];
|
||||
$data_graph_by_user[io_safe_output($value['fullname'])] = $data_graph_by_user[$value['id_user']];
|
||||
unset($data_graph_by_user[$value['id_user']]);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3982,6 +3982,81 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the module data from a children
|
||||
*
|
||||
* @param integer $id_module Id module
|
||||
* @return array Children module data
|
||||
*/
|
||||
function get_children_module($id_module)
|
||||
{
|
||||
$children_module_data = db_get_all_rows_sql(
|
||||
'SELECT *
|
||||
FROM tagente_modulo
|
||||
WHERE parent_module_id = '.$id_module
|
||||
);
|
||||
|
||||
return $children_module_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find and delete the childers modules from the $id_module
|
||||
*
|
||||
* @param mixed $id_module
|
||||
* @return void
|
||||
*/
|
||||
function module_check_childrens_and_delete($id_module)
|
||||
{
|
||||
$children_data = get_children_module($id_module);
|
||||
// Check if exist have a childer
|
||||
if ($children_data) {
|
||||
// If have more than 1 children
|
||||
if (is_array($children_data)) {
|
||||
foreach ($children_data as $children_module_data) {
|
||||
if ($children_module_data['parent_module_id']) {
|
||||
// Search children and delete this module
|
||||
// Before delete, lets check if exist (Just for cases it's already deleted)
|
||||
if (modules_check_agentmodule_exists($children_module_data['parent_module_id'])) {
|
||||
modules_delete_agent_module($children_module_data['parent_module_id']);
|
||||
}
|
||||
|
||||
module_check_childrens_and_delete($children_module_data['id_agente_modulo']);
|
||||
} else {
|
||||
// If haven't children just delete
|
||||
// Before delete, lets check if exist (Just for cases it's already deleted)
|
||||
if (modules_check_agentmodule_exists($children_module_data['id_agente_modulo'])) {
|
||||
modules_delete_agent_module($children_module_data['id_agente_modulo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If just have 1 children
|
||||
if ($children_data['parent_module_id']) {
|
||||
// Before delete, lets check if exist (Just for cases it's already deleted)
|
||||
if (modules_check_agentmodule_exists($children_data['parent_module_id'])) {
|
||||
modules_delete_agent_module($children_data['parent_module_id']);
|
||||
}
|
||||
|
||||
module_check_childrens_and_delete($children_data['id_agente_modulo']);
|
||||
} else {
|
||||
// If haven't children just delete
|
||||
// Before delete, lets check if exist (Just for cases it's already deleted)
|
||||
if (modules_check_agentmodule_exists($children_data['id_agente_modulo'])) {
|
||||
modules_delete_agent_module($children_data['id_agente_modulo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Haven't childrens, so delete
|
||||
// Before delete, lets check if exist (Just for cases it's already deleted)
|
||||
if (modules_check_agentmodule_exists($id_module)) {
|
||||
modules_delete_agent_module($id_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the button with the link to open realtime stats into a new window
|
||||
* Only to native (not satellite discovered) snmp modules.
|
||||
|
|
|
@ -1479,7 +1479,7 @@ function netflow_draw_item(
|
|||
}
|
||||
|
||||
if ($output === 'HTML' || $output === 'PDF') {
|
||||
return graph_nodata_image(300, 110, 'data');
|
||||
return graph_nodata_image(['height' => 110]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3399,7 +3399,10 @@ function get_status_color_networkmap_fictional_point($id_networkmap, $parent='')
|
|||
|
||||
if ($agent['source_data'] == -2) {
|
||||
if (empty($parent) === true) {
|
||||
$option = json_decode($agent, true);
|
||||
if (is_array($agent) === false) {
|
||||
$option = json_decode($agent, true);
|
||||
}
|
||||
|
||||
if ($option['networkmap'] == 0) {
|
||||
$status = 0;
|
||||
} else {
|
||||
|
|
|
@ -134,7 +134,7 @@ function notifications_get_subtypes(?string $source=null)
|
|||
'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
||||
'NOTIF.PHP.MEMORY_LIMIT',
|
||||
'NOTIF.PHP.DISABLE_FUNCTIONS',
|
||||
'NOTIF.PHP.PHANTOMJS',
|
||||
'NOTIF.PHP.CHROMIUM',
|
||||
'NOTIF.PHP.VERSION',
|
||||
'NOTIF.HISTORYDB',
|
||||
'NOTIF.PANDORADB',
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -961,7 +961,7 @@ function reporting_html_top_n($table, $item, $pdf=0)
|
|||
$table->data['top_n']['cell'] = html_print_table($table1, true);
|
||||
}
|
||||
|
||||
if (!empty($item['charts']['pie'])) {
|
||||
if (empty($item['charts']['pie']) === false) {
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= $item['charts']['pie'];
|
||||
} else {
|
||||
|
@ -970,16 +970,15 @@ function reporting_html_top_n($table, $item, $pdf=0)
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($item['charts']['bars'])) {
|
||||
if (empty($item['charts']['bars']) === false) {
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= $item['charts']['bars'];
|
||||
} else {
|
||||
// $table->colspan['char_bars']['cell'] = 3;
|
||||
$table->data['char_pie'][1] = $item['charts']['bars'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($item['resume'])) {
|
||||
if (empty($item['resume']) === false) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
||||
|
@ -5141,7 +5140,17 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height)
|
|||
// Fixed width non interactive charts.
|
||||
$status_chart_width = $graph_width;
|
||||
|
||||
$tdata[0] = '<div style="margin: auto; width: '.$graph_width.'px;"><div id="status_pie" style="margin: auto; width: '.$graph_width.'">'.graph_agent_status(false, $graph_width, $graph_height, true, true).'</div></div>';
|
||||
$tdata[0] = '<div style="margin: auto; width: '.$graph_width.'px;">';
|
||||
$tdata[0] .= '<div id="status_pie" style="margin: auto; width: '.$graph_width.'">';
|
||||
$tdata[0] .= graph_agent_status(
|
||||
false,
|
||||
$graph_width,
|
||||
$graph_height,
|
||||
true,
|
||||
true
|
||||
);
|
||||
$tdata[0] .= '</div>';
|
||||
$tdata[0] .= '</div>';
|
||||
} else {
|
||||
$tdata[2] = html_print_image(
|
||||
'images/image_problem_area_small.png',
|
||||
|
@ -5151,7 +5160,16 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height)
|
|||
}
|
||||
|
||||
if ($data['monitor_alerts'] > 0) {
|
||||
$tdata[2] = '<div style="margin: auto; width: '.$graph_width.'px;">'.graph_alert_status($data['monitor_alerts'], $data['monitor_alerts_fired'], $graph_width, $graph_height, true, true).'</div>';
|
||||
$tdata[2] = '<div style="margin: auto; width: '.$graph_width.'px;">';
|
||||
$tdata[2] .= graph_alert_status(
|
||||
$data['monitor_alerts'],
|
||||
$data['monitor_alerts_fired'],
|
||||
$graph_width,
|
||||
$graph_height,
|
||||
true,
|
||||
true
|
||||
);
|
||||
$tdata[2] .= '</div>';
|
||||
} else {
|
||||
$tdata[2] = html_print_image(
|
||||
'images/image_problem_area_small.png',
|
||||
|
@ -5160,8 +5178,8 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height)
|
|||
);
|
||||
}
|
||||
|
||||
$table_sum->rowclass[] = '';
|
||||
$table_sum->data[] = $tdata;
|
||||
$table_sum->rowclass[] = '';
|
||||
$table_sum->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Summary').'</legend>'.html_print_table($table_sum, true).'</fieldset>';
|
||||
|
|
|
@ -460,7 +460,7 @@ function snmp_browser_get_oid(
|
|||
$snmptranslate_bin = $config['snmptranslate'];
|
||||
}
|
||||
|
||||
if ($server_to_exec != 0 && enterprise_installed()) {
|
||||
if (empty($server_to_exec) === false && enterprise_installed()) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
$command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid);
|
||||
|
||||
|
|
|
@ -690,18 +690,11 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
$go_to_agent = '<div style="text-align: right">';
|
||||
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
$go_to_agent .= '<a target="_blank" href="'.$url.'">';
|
||||
$go_to_agent .= html_print_submit_button(__('Edit cluster'), 'upd_button', false, 'class="sub config"', true);
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
|
||||
$go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
} else {
|
||||
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
|
||||
$go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
|
|
|
@ -1227,7 +1227,7 @@ function visual_map_print_item(
|
|||
|
||||
$module_data = get_bars_module_data(
|
||||
$id_module,
|
||||
($layoutData['type_graph'] !== 'horizontal')
|
||||
$layoutData['type_graph']
|
||||
);
|
||||
$options = [];
|
||||
$options['generals']['rotate'] = true;
|
||||
|
@ -2344,7 +2344,7 @@ function get_if_module_is_image($id_module)
|
|||
}
|
||||
|
||||
|
||||
function get_bars_module_data($id_module, $vBars=false)
|
||||
function get_bars_module_data($id_module, $typeGraph='horizontal')
|
||||
{
|
||||
// This charts is only serialize graphs.
|
||||
// In other string show image no data to show.
|
||||
|
@ -2355,7 +2355,7 @@ function get_bars_module_data($id_module, $vBars=false)
|
|||
);
|
||||
|
||||
$values = false;
|
||||
// avoid showing the image type modules. WUX
|
||||
// Avoid showing the image type modules. WUX.
|
||||
if (strpos($mod_values, 'data:image/png;base64') !== 0) {
|
||||
if (preg_match("/\r\n/", $mod_values)) {
|
||||
$values = explode("\r\n", $mod_values);
|
||||
|
@ -2364,26 +2364,28 @@ function get_bars_module_data($id_module, $vBars=false)
|
|||
}
|
||||
}
|
||||
|
||||
$values_to_return = [];
|
||||
$index = 0;
|
||||
$color_index = 0;
|
||||
$total = 0;
|
||||
|
||||
if (!$values) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($vBars === false) {
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$data[0]] = ['g' => $data[1]];
|
||||
$values_to_return = [];
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
|
||||
if ($data[0] === $val) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[] = [
|
||||
'tick' => $data[0],
|
||||
'data' => $data[1],
|
||||
|
||||
$values_to_return['labels'][] = io_safe_output($data[0]);
|
||||
if ($typeGraph === 'horizontal') {
|
||||
$values_to_return['data'][] = [
|
||||
'y' => io_safe_output($data[0]),
|
||||
'x' => $data[1],
|
||||
];
|
||||
} else {
|
||||
$values_to_return['data'][] = [
|
||||
'x' => io_safe_output($data[0]),
|
||||
'y' => $data[1],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2842,74 +2844,23 @@ function get_donut_module_data($id_module)
|
|||
$no_data_to_show = true;
|
||||
}
|
||||
|
||||
$colors = [];
|
||||
$colors[] = '#aa3333';
|
||||
$colors[] = '#045FB4';
|
||||
$colors[] = '#8181F7';
|
||||
$colors[] = '#F78181';
|
||||
$colors[] = '#D0A9F5';
|
||||
$colors[] = '#BDBDBD';
|
||||
$colors[] = '#6AB277';
|
||||
|
||||
$max_elements = 6;
|
||||
$values_to_return = [];
|
||||
$index = 0;
|
||||
$total = 0;
|
||||
foreach ($values as $val) {
|
||||
if ($index < $max_elements) {
|
||||
$data = explode(',', $val);
|
||||
$data = explode(',', $val);
|
||||
|
||||
if ($no_data_to_show) {
|
||||
$values_to_return[$index]['tag_name'] = $data[0];
|
||||
} else {
|
||||
$values_to_return[$index]['tag_name'] = $data[0].': '.$data[1];
|
||||
}
|
||||
if ($data[0] === $val) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values_to_return[$index]['color'] = $colors[$index];
|
||||
$values_to_return[$index]['value'] = (int) $data[1];
|
||||
$total += (int) $data[1];
|
||||
$index++;
|
||||
if ($no_data_to_show) {
|
||||
$values_to_return['labels'][] = $data[0];
|
||||
} else {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$index]['tag_name'] = __('Others').': '.$data[1];
|
||||
$values_to_return[$index]['color'] = $colors[$index];
|
||||
$values_to_return[$index]['value'] += (int) $data[1];
|
||||
$total += (int) $data[1];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($values_to_return as $ind => $donut_data) {
|
||||
$values_to_return[$ind]['percent'] = (($donut_data['value'] * 100) / $total);
|
||||
}
|
||||
|
||||
// sort array
|
||||
$new_values_to_return = [];
|
||||
while (!empty($values_to_return)) {
|
||||
$first = true;
|
||||
$max_elem = 0;
|
||||
$max_elem_array = [];
|
||||
$index_to_del = 0;
|
||||
foreach ($values_to_return as $i => $val) {
|
||||
if ($first) {
|
||||
$max_elem = $val['value'];
|
||||
$max_elem_array = $val;
|
||||
$index_to_del = $i;
|
||||
$first = false;
|
||||
} else {
|
||||
if ($val['value'] > $max_elem) {
|
||||
$max_elem = $val['value'];
|
||||
$max_elem_array = $val;
|
||||
$index_to_del = $i;
|
||||
}
|
||||
}
|
||||
$values_to_return['labels'][] = $data[0].': '.$data[1];
|
||||
}
|
||||
|
||||
$new_values_to_return[] = $max_elem_array;
|
||||
unset($values_to_return[$index_to_del]);
|
||||
$values_to_return['data'][] = (int) $data[1];
|
||||
}
|
||||
|
||||
$values_to_return = $new_values_to_return;
|
||||
|
||||
return $values_to_return;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -756,71 +756,3 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
|
|||
return $output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print dougnhnut.
|
||||
*
|
||||
* @param array $colors Colors.
|
||||
* @param integer $width Width.
|
||||
* @param integer $height Height.
|
||||
* @param array $data Data.
|
||||
* @param mixed $data_total Data_total.
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
function print_donut_narrow_graph(
|
||||
array $colors,
|
||||
$width,
|
||||
$height,
|
||||
array $data,
|
||||
$data_total
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if (empty($data)) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
}
|
||||
|
||||
$series = count($data);
|
||||
if (($series != count($colors)) || ($series == 0)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$data = json_encode($data);
|
||||
$colors = json_encode($colors);
|
||||
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
// This is for "Style template" in visual styles.
|
||||
switch ($config['style']) {
|
||||
case 'pandora':
|
||||
$textColor = '#000';
|
||||
$strokeColor = '#fff';
|
||||
break;
|
||||
|
||||
case 'pandora_black':
|
||||
$textColor = '#fff';
|
||||
$strokeColor = '#222';
|
||||
break;
|
||||
|
||||
default:
|
||||
$textColor = '#000';
|
||||
$strokeColor = '#fff';
|
||||
break;
|
||||
}
|
||||
|
||||
$textColor = json_encode($textColor);
|
||||
$strokeColor = json_encode($strokeColor);
|
||||
|
||||
$out = "<div id='$graph_id'></div>";
|
||||
$out .= include_javascript_d3(true);
|
||||
$out .= "<script type='text/javascript'>
|
||||
donutNarrowGraph($colors, $width, $height, $data_total, $textColor, $strokeColor)
|
||||
.donutbody(d3.select($graph_id))
|
||||
.data($data)
|
||||
.render();
|
||||
</script>";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,11 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false
|
|||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.exportdata.pandora.js').'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.axislabels.js').'"></script>
|
||||
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/pandora.flot.js').'"></script>';
|
||||
|
||||
// Chartjs.
|
||||
$output .= '<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/chartjs/chart.js').'"></script>';
|
||||
$output .= '<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/chartjs/chartjs-plugin-datalabels.min.js').'"></script>';
|
||||
|
||||
$output .= "
|
||||
<script type='text/javascript'>
|
||||
var precision_graph = ".$config['graph_precision'].";
|
||||
|
|
|
@ -2797,229 +2797,3 @@ function valueToBytes(value) {
|
|||
// This will actually do the rounding and the decimals.
|
||||
return value.toFixed(2) + shorts[pos] + "B";
|
||||
}
|
||||
|
||||
function donutNarrowGraph(
|
||||
colores,
|
||||
width,
|
||||
height,
|
||||
total,
|
||||
textColor,
|
||||
strokeColor
|
||||
) {
|
||||
// Default settings
|
||||
var donutbody = d3.select("body");
|
||||
var data = {};
|
||||
// var showTitle = true;
|
||||
|
||||
if (width == "") {
|
||||
width = 180;
|
||||
}
|
||||
|
||||
if (height == "") {
|
||||
height = 180;
|
||||
}
|
||||
|
||||
var radius = Math.min(width, height) / 2;
|
||||
|
||||
var currentVal;
|
||||
//var color = d3.scale.category20();
|
||||
|
||||
var colores_index = [];
|
||||
var colores_value = [];
|
||||
|
||||
$.each(colores, function(index, value) {
|
||||
colores_index.push(index);
|
||||
colores_value.push(value);
|
||||
});
|
||||
|
||||
var color = d3.scale
|
||||
.ordinal()
|
||||
.domain(colores_index)
|
||||
.range(colores_value);
|
||||
|
||||
var pie = d3.layout
|
||||
.pie()
|
||||
.sort(null)
|
||||
.value(function(d) {
|
||||
return d.value;
|
||||
});
|
||||
|
||||
var svg, g, arc;
|
||||
|
||||
var object = {};
|
||||
|
||||
// Method for render/refresh graph
|
||||
object.render = function() {
|
||||
if (!svg) {
|
||||
// Show normal status by default. This variable must be initialized here, before clearing data.
|
||||
var normal_status = data.Normal;
|
||||
|
||||
// Don't draw 0 or invalid values. console.log(data);
|
||||
var data_map = $.map(data, function(value, index) {
|
||||
if (value == 0 || isNaN(value)) {
|
||||
return index;
|
||||
}
|
||||
});
|
||||
|
||||
$.each(data_map, function(i, val) {
|
||||
delete data[val];
|
||||
});
|
||||
//New data: console.log(data);
|
||||
|
||||
arc = d3.svg
|
||||
.arc()
|
||||
.outerRadius(radius)
|
||||
.innerRadius(radius - radius / 4);
|
||||
|
||||
svg = donutbody
|
||||
.append("svg")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
|
||||
|
||||
g = svg
|
||||
.selectAll(".arc")
|
||||
.data(pie(d3.entries(data)))
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "arc");
|
||||
|
||||
g.append("path")
|
||||
// Attach current value to g so that we can use it for animation
|
||||
.each(function(d) {
|
||||
this._current = d;
|
||||
})
|
||||
.attr("d", arc)
|
||||
.attr("stroke", strokeColor)
|
||||
.style("fill", function(d) {
|
||||
return color(d.data.key);
|
||||
});
|
||||
// This is to show labels on the graph
|
||||
/* g.append("text")
|
||||
.attr("transform", function(d) {
|
||||
return "translate(" + arc.centroid(d) + ")";
|
||||
})
|
||||
.attr("dy", ".35em")
|
||||
.style("text-anchor", "middle");
|
||||
g.select("text").text(function(d) {
|
||||
return d.data.key;
|
||||
});*/
|
||||
|
||||
// Show normal status by default.
|
||||
var percentage_normal;
|
||||
svg
|
||||
.append("text")
|
||||
.datum(data)
|
||||
.attr("x", 0)
|
||||
.attr("y", 0 + radius / 10)
|
||||
.attr("class", "text-tooltip")
|
||||
.style("text-anchor", "middle")
|
||||
.attr("fill", textColor)
|
||||
.style("font-size", function(d) {
|
||||
if (normal_status) {
|
||||
percentage_normal = (normal_status * 100) / total;
|
||||
if (Number.isInteger(percentage_normal)) {
|
||||
percentage_normal = percentage_normal.toFixed(0);
|
||||
return radius / 3 + "px";
|
||||
} else {
|
||||
percentage_normal = percentage_normal.toFixed(1);
|
||||
return radius / 3.5 + "px";
|
||||
}
|
||||
}
|
||||
})
|
||||
.text(function(d) {
|
||||
if (normal_status) {
|
||||
return percentage_normal + "%";
|
||||
} else {
|
||||
return "0%";
|
||||
}
|
||||
});
|
||||
|
||||
g.on("mouseover", function(obj) {
|
||||
//console.log(obj);
|
||||
var percentage;
|
||||
svg
|
||||
.select("text.text-tooltip")
|
||||
// This is to paint the text of the corresponding color.
|
||||
/* .attr("fill", function(d) {
|
||||
return color(obj.data.key);
|
||||
})*/
|
||||
.attr("fill", textColor)
|
||||
.style("font-size", function(d) {
|
||||
percentage = (d[obj.data.key] * 100) / total;
|
||||
if (Number.isInteger(percentage)) {
|
||||
percentage = percentage.toFixed(0);
|
||||
return radius / 3 + "px";
|
||||
} else {
|
||||
percentage = percentage.toFixed(1);
|
||||
return radius / 3.5 + "px";
|
||||
}
|
||||
})
|
||||
.text(percentage + "%");
|
||||
});
|
||||
|
||||
g.on("mouseout", function(obj) {
|
||||
svg.select("text.text-tooltip").text(function(d) {
|
||||
if (normal_status) {
|
||||
return percentage_normal + "%";
|
||||
} else {
|
||||
return "0%";
|
||||
}
|
||||
});
|
||||
// .attr("fill", "#82b92e");
|
||||
});
|
||||
} else {
|
||||
g.data(pie(d3.entries(data)))
|
||||
.exit()
|
||||
.remove();
|
||||
|
||||
g.select("path")
|
||||
.transition()
|
||||
.duration(200)
|
||||
.attrTween("d", function(a) {
|
||||
var i = d3.interpolate(this._current, a);
|
||||
this._current = i(0);
|
||||
return function(t) {
|
||||
return arc(i(t));
|
||||
};
|
||||
});
|
||||
|
||||
g.select("text").attr("transform", function(d) {
|
||||
return "translate(" + arc.centroid(d) + ")";
|
||||
});
|
||||
|
||||
svg.select("text.text-tooltip").datum(data);
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
// Getter and setter methods
|
||||
object.data = function(value) {
|
||||
if (!arguments.length) return data;
|
||||
data = value;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.donutbody = function(value) {
|
||||
if (!arguments.length) return donutbody;
|
||||
donutbody = value;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.width = function(value) {
|
||||
if (!arguments.length) return width;
|
||||
width = value;
|
||||
radius = Math.min(width, height) / 2;
|
||||
return object;
|
||||
};
|
||||
|
||||
object.height = function(value) {
|
||||
if (!arguments.length) return height;
|
||||
height = value;
|
||||
radius = Math.min(width, height) / 2;
|
||||
return object;
|
||||
};
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -1699,7 +1699,6 @@ function selected_node(d, selected_param, hold_other_selections) {
|
|||
);
|
||||
|
||||
d3.event.stopPropagation();
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
|
||||
function clear_selection() {
|
||||
|
@ -4020,8 +4019,10 @@ function draw_elements_graph() {
|
|||
font_size +
|
||||
"px !important; text-align:center; text-anchor:middle; fill:#000000"
|
||||
)
|
||||
.text(function(d) {
|
||||
return ellipsize(get_node_name_ov(d), 30);
|
||||
.html(function(d) {
|
||||
d.text = ellipsize(d.text, 30);
|
||||
|
||||
return get_node_name_ov(d, true, font_size);
|
||||
})
|
||||
.classed("dragable_node fill_fff", true) //own dragable
|
||||
.on("click", selected_node)
|
||||
|
@ -4030,7 +4031,7 @@ function draw_elements_graph() {
|
|||
});
|
||||
|
||||
node_temp.append("title").text(function(d) {
|
||||
return get_node_name_ov(d);
|
||||
return get_node_name_ov(d, false);
|
||||
});
|
||||
|
||||
node.exit().remove();
|
||||
|
@ -4040,9 +4041,19 @@ function is_central_node(data) {
|
|||
return data.type == 0 && data.id_agent == 0;
|
||||
}
|
||||
|
||||
function get_node_name_ov(data) {
|
||||
function get_node_name_ov(data, generate_link, font_size) {
|
||||
font_size = font_size || 20;
|
||||
generate_link = generate_link || false;
|
||||
|
||||
var data_text = data.text;
|
||||
|
||||
if (generate_link === true && data.networkmap_id > 0) {
|
||||
data_text = `<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=
|
||||
${data.networkmap_id}" style="font-size: ${font_size}px;">${data.text}</a>`;
|
||||
}
|
||||
|
||||
// Node central name should be the product name
|
||||
return is_central_node(data) ? $("#hidden-product_name").val() : data.text;
|
||||
return is_central_node(data) ? $("#hidden-product_name").val() : data_text;
|
||||
}
|
||||
|
||||
function choose_group_for_show_agents() {
|
||||
|
|
|
@ -246,7 +246,8 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
|
|||
serialized: serialized,
|
||||
id_server: id_server,
|
||||
status_module: module_status,
|
||||
id_group: id_group
|
||||
id_group: id_group,
|
||||
pendingdelete: event.target.dataset.pendingdelete // Get pendingdelete attribute from target
|
||||
},
|
||||
function(data) {
|
||||
$("#module").empty();
|
||||
|
@ -2231,3 +2232,44 @@ function loadPasswordConfig(id, value) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
var formatterDataLabelPie = function(value, ctx) {
|
||||
let datasets = ctx.chart.data.datasets;
|
||||
if (datasets.indexOf(ctx.dataset) === datasets.length - 1) {
|
||||
let sum = datasets[0].data.reduce((a, b) => parseInt(a) + parseInt(b), 0);
|
||||
let percentage = ((value * 100) / sum).toFixed(1) + "%";
|
||||
return percentage;
|
||||
}
|
||||
};
|
||||
|
||||
var formatterDataHorizontalBar = function(value, ctx) {
|
||||
let datasets = ctx.chart.data.datasets;
|
||||
if (datasets.indexOf(ctx.dataset) === datasets.length - 1) {
|
||||
let sum = datasets[0].data.reduce(
|
||||
(a, b) => {
|
||||
if (a != undefined && b != undefined) {
|
||||
return { x: parseInt(a.x) + parseInt(b.x) };
|
||||
}
|
||||
},
|
||||
{ x: 0 }
|
||||
);
|
||||
let percentage = ((value.x * 100) / sum.x).toFixed(1) + "%";
|
||||
return percentage;
|
||||
}
|
||||
};
|
||||
|
||||
var formatterDataVerticalBar = function(value, ctx) {
|
||||
let datasets = ctx.chart.data.datasets;
|
||||
if (datasets.indexOf(ctx.dataset) === datasets.length - 1) {
|
||||
let sum = datasets[0].data.reduce(
|
||||
(a, b) => {
|
||||
if (a != undefined && b != undefined) {
|
||||
return { y: parseInt(a.y) + parseInt(b.y) };
|
||||
}
|
||||
},
|
||||
{ y: 0 }
|
||||
);
|
||||
let percentage = ((value.y * 100) / sum.y).toFixed(1) + "%";
|
||||
return percentage;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -380,6 +380,7 @@ function configure_modules_form() {
|
|||
$("#text-snmp_oid").val(js_html_entity_decode(data["snmp_oid"]));
|
||||
$("#oid, img#edit_oid").hide();
|
||||
$("#id_module_group").val(data["id_module_group"]);
|
||||
$("#id_module_group").trigger("change");
|
||||
$("#max_timeout").attr("value", data["max_timeout"]);
|
||||
$("#max_retries").attr("value", data["max_retries"]);
|
||||
if (data["id_plugin"] != undefined) {
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,906 @@
|
|||
<?php
|
||||
/**
|
||||
* Cluster entity class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org 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.
|
||||
namespace PandoraFMS;
|
||||
|
||||
use PandoraFMS\Entity;
|
||||
use PandoraFMS\Agent;
|
||||
use PandoraFMS\Module;
|
||||
use PandoraFMS\Group;
|
||||
|
||||
/**
|
||||
* PandoraFMS Cluster entity.
|
||||
*/
|
||||
class Cluster extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* References cluster status Module.
|
||||
*
|
||||
* @var PandoraFMS\Module
|
||||
*/
|
||||
private $clusterStatus;
|
||||
|
||||
/**
|
||||
* Array of PandoraFMS\Agents members of this cluster.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $members = [];
|
||||
|
||||
/**
|
||||
* AA modules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $aaModules = [];
|
||||
|
||||
/**
|
||||
* AP modules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $apModules = [];
|
||||
|
||||
/**
|
||||
* Removed items.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $removedItems = [];
|
||||
|
||||
|
||||
/**
|
||||
* Loads a cluster definition from target agent (rel 1-1).
|
||||
*
|
||||
* @param integer $id_agent Agent id.
|
||||
* @param boolean $load_members Load members or not.
|
||||
*
|
||||
* @return PandoraFMS\Cluster Object.
|
||||
*/
|
||||
public static function loadFromAgentId(
|
||||
int $id_agent,
|
||||
?bool $load_members=true
|
||||
) {
|
||||
if (is_numeric($id_agent) === true
|
||||
&& $id_agent > 0
|
||||
) {
|
||||
$cluster_id = db_get_value(
|
||||
'id',
|
||||
'tcluster',
|
||||
'id_agent',
|
||||
$id_agent
|
||||
);
|
||||
|
||||
return new self($cluster_id, $load_members);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a PandoraFMS\ClusterViewer\Cluster object from a cluster id.
|
||||
*
|
||||
* @param integer $id_cluster Cluster Id.
|
||||
* @param boolean $load_members Load members or not.
|
||||
*
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function __construct(?int $id_cluster=null, ?bool $load_members=true)
|
||||
{
|
||||
if (is_numeric($id_cluster) === true
|
||||
&& $id_cluster > 0
|
||||
) {
|
||||
try {
|
||||
parent::__construct('tcluster', ['id' => $id_cluster]);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception('Cluster id not found.');
|
||||
}
|
||||
|
||||
if ($load_members === true) {
|
||||
// Retrieve members.
|
||||
$data = \db_get_all_rows_filter(
|
||||
'tcluster_agent',
|
||||
['id_cluster' => $id_cluster]
|
||||
);
|
||||
|
||||
if (is_array($data) === true) {
|
||||
foreach ($data as $row) {
|
||||
$this->addMember($row['id_agent']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve items.
|
||||
$data = \db_get_all_rows_filter(
|
||||
'tcluster_item',
|
||||
['id_cluster' => $id_cluster]
|
||||
);
|
||||
|
||||
if (is_array($data) === true) {
|
||||
foreach ($data as $row) {
|
||||
if ($row['item_type'] === 'AA') {
|
||||
$this->aaModules[$row['name']] = new ClusterModule(
|
||||
$row['id']
|
||||
);
|
||||
} else if ($row['item_type'] === 'AP') {
|
||||
$this->apModules[$row['name']] = new ClusterModule(
|
||||
$row['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parent::__construct('tcluster');
|
||||
}
|
||||
|
||||
// Customize certain fields.
|
||||
try {
|
||||
$this->fields['group'] = new Group($this->group());
|
||||
} catch (\Exception $e) {
|
||||
$this->fields['group'] = new Group();
|
||||
}
|
||||
|
||||
if ($this->id_agent() !== null) {
|
||||
try {
|
||||
$this->fields['agent'] = new Agent($this->id_agent(), true);
|
||||
} catch (\Exception $e) {
|
||||
$this->fields['agent'] = new Agent();
|
||||
}
|
||||
} else {
|
||||
$this->fields['agent'] = new Agent();
|
||||
}
|
||||
|
||||
if ($this->id_agent() !== null) {
|
||||
$this->clusterStatus = Module::search(
|
||||
[
|
||||
'nombre' => io_safe_input('Cluster status'),
|
||||
'id_agente' => $this->id_agent(),
|
||||
],
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an array of PandoraFMS\Agents as members of current cluster.
|
||||
*
|
||||
* @return array Of agents.
|
||||
*/
|
||||
public function getMembers()
|
||||
{
|
||||
if (is_array($this->members) === true) {
|
||||
return $this->members;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cleans members from cluster object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cleanMembers()
|
||||
{
|
||||
unset($this->members);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a new agent in the cluster.
|
||||
*
|
||||
* @param integer $id_agent New id_agent to be added.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function addMember(int $id_agent)
|
||||
{
|
||||
if (isset($this->members[$id_agent]) === true) {
|
||||
// Already joining.
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$agent = new Agent($id_agent);
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($agent->id_agente() === null) {
|
||||
throw new \Exception('Invalid agent id.');
|
||||
}
|
||||
|
||||
$this->members[$agent->id_agente()] = $agent;
|
||||
|
||||
return $agent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove an agent from the cluster.
|
||||
*
|
||||
* @param integer $id_agent New id_agent to be removed.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function removeMember(int $id_agent)
|
||||
{
|
||||
if (isset($this->members[$id_agent]) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
unset($this->members[$id_agent]);
|
||||
|
||||
$rs = \db_process_sql_delete(
|
||||
'tcluster_agent',
|
||||
[
|
||||
'id_cluster' => $this->fields['id'],
|
||||
'id_agent' => $id_agent,
|
||||
]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return AA modules associated to current cluster.
|
||||
*
|
||||
* @param integer $type AA or AP (use constants)
|
||||
* MODULE_PREDICTION_CLUSTER_AA
|
||||
* MODULE_PREDICTION_CLUSTER_AP.
|
||||
*
|
||||
* @return array Of items.
|
||||
*/
|
||||
public function getItems(?int $type=null)
|
||||
{
|
||||
$items = [];
|
||||
|
||||
if ($type === MODULE_PREDICTION_CLUSTER_AA) {
|
||||
if (is_array($this->aaModules) === true) {
|
||||
return $this->aaModules;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type === MODULE_PREDICTION_CLUSTER_AP) {
|
||||
if (is_array($this->apModules) === true) {
|
||||
return $this->apModules;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->apModules) === true
|
||||
) {
|
||||
$items = array_merge($items, $this->apModules);
|
||||
}
|
||||
|
||||
if (is_array($this->aaModules) === true
|
||||
) {
|
||||
$items = array_merge($items, $this->aaModules);
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve AA modules.
|
||||
*
|
||||
* @return array Of ClusterItem definition.
|
||||
*/
|
||||
public function getAAModules()
|
||||
{
|
||||
return $this->getItems(MODULE_PREDICTION_CLUSTER_AA);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve AP modules.
|
||||
*
|
||||
* @return array Of ClusterItem definition.
|
||||
*/
|
||||
public function getAPModules()
|
||||
{
|
||||
return $this->getItems(MODULE_PREDICTION_CLUSTER_AP);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves module definition from current members matching name.
|
||||
*
|
||||
* @param string $name Target name to retrieve.
|
||||
*
|
||||
* @return array Module fields.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function getModuleSkel(string $name)
|
||||
{
|
||||
foreach ($this->members as $member) {
|
||||
$module = $member->searchModules(
|
||||
['nombre' => $name]
|
||||
);
|
||||
|
||||
if ($module !== null && empty($module) === false) {
|
||||
if (count($module) > 1) {
|
||||
$msg = __METHOD__.' error: Multiple occurrences of "';
|
||||
$msg .= $name.'", please remove duplicates from agent "';
|
||||
$msg .= $member->alias().'".';
|
||||
throw new \Exception(
|
||||
$msg
|
||||
);
|
||||
}
|
||||
|
||||
// Method searchModules returns multiple occurrences.
|
||||
$module = $module[0];
|
||||
$module = $module->toArray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove specific fields.
|
||||
unset($module['id_agente_modulo']);
|
||||
unset($module['id_agente']);
|
||||
|
||||
return $module;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an item to the cluster.
|
||||
*
|
||||
* @param string $name Target name.
|
||||
* @param integer $type Item type.
|
||||
* @param array $definition Module definition.
|
||||
*
|
||||
* @return ClusterModule Created module.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function addItem(string $name, int $type, array $definition)
|
||||
{
|
||||
$item = new ClusterModule();
|
||||
$item->name($name);
|
||||
$item->id_cluster($this->id());
|
||||
|
||||
// Skel values.
|
||||
$module_skel = $this->getModuleSkel($name);
|
||||
|
||||
// Customize definition.
|
||||
$definition = array_merge($module_skel, $definition);
|
||||
|
||||
// Store in cluster agent.
|
||||
$definition['id_agente'] = $this->id_agent();
|
||||
|
||||
if ($type === MODULE_PREDICTION_CLUSTER_AA) {
|
||||
$item->item_type('AA');
|
||||
} else if ($type === MODULE_PREDICTION_CLUSTER_AP) {
|
||||
$item->item_type('AP');
|
||||
} else {
|
||||
throw new \Exception(__METHOD__.' error: Invalid item type');
|
||||
}
|
||||
|
||||
// Set module definition.
|
||||
$item->setModule($definition);
|
||||
|
||||
// Default values.
|
||||
$item->critical_limit(0);
|
||||
$item->warning_limit(0);
|
||||
$item->is_critical(0);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add AA module to the cluster.
|
||||
*
|
||||
* @param string $name Target name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAAModule(string $name)
|
||||
{
|
||||
if (empty($this->aaModules[$name]) === true) {
|
||||
$main_id = $this->clusterStatus->id_agente_modulo();
|
||||
|
||||
// Register module in agent.
|
||||
// id_modulo = 0,
|
||||
// tcp_port = 1,
|
||||
// prediction_moddule = 6.
|
||||
// Set thresholds while updating.
|
||||
$this->aaModules[$name] = $this->addItem(
|
||||
$name,
|
||||
MODULE_PREDICTION_CLUSTER_AA,
|
||||
[
|
||||
'nombre' => $name,
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 6,
|
||||
'tcp_port' => 1,
|
||||
'id_tipo_modulo' => 1,
|
||||
'custom_integer_1' => $this->id(),
|
||||
'parent_module_id' => $main_id,
|
||||
]
|
||||
);
|
||||
|
||||
\db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Module '.io_safe_output(
|
||||
$name
|
||||
).' added to cluster'.io_safe_output(
|
||||
$this->fields['name']
|
||||
).' as Active-Active module'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add AP module to the cluster.
|
||||
*
|
||||
* @param string $name Target name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addAPModule(string $name)
|
||||
{
|
||||
if (empty($this->apModules[$name]) === true) {
|
||||
$main_id = $this->clusterStatus->id_agente_modulo();
|
||||
|
||||
$type = db_get_value(
|
||||
'id_tipo_modulo',
|
||||
'tagente_modulo',
|
||||
'nombre',
|
||||
$name
|
||||
);
|
||||
|
||||
if (empty($type) === true) {
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
// Register module in agent.
|
||||
// id_modulo = 5,
|
||||
// tcp_port = 1,
|
||||
// prediction_moddule = 7.
|
||||
// Set thresholds while updating.
|
||||
$this->apModules[$name] = $this->addItem(
|
||||
$name,
|
||||
MODULE_PREDICTION_CLUSTER_AP,
|
||||
[
|
||||
'nombre' => $name,
|
||||
'id_modulo' => 5,
|
||||
'prediction_module' => 7,
|
||||
'tcp_port' => 1,
|
||||
'id_tipo_modulo' => $type,
|
||||
'custom_integer_1' => $this->id(),
|
||||
'parent_module_id' => $main_id,
|
||||
]
|
||||
);
|
||||
|
||||
\db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Module '.io_safe_output(
|
||||
$name
|
||||
).' added to cluster'.io_safe_output(
|
||||
$this->fields['name']
|
||||
).' as Active-Passive module'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes AA module from the cluster.
|
||||
*
|
||||
* @param string $name Target name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeAAModule(string $name)
|
||||
{
|
||||
if (empty($this->aaModules[$name]) === false) {
|
||||
// Mark item for db elimination.
|
||||
$this->removedItems[] = [
|
||||
'id' => $this->aaModules[$name]->id(),
|
||||
'item_type' => $this->aaModules[$name]->item_type(),
|
||||
];
|
||||
$this->aaModules[$name]->delete();
|
||||
unset($this->aaModules[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes AP module from the cluster.
|
||||
*
|
||||
* @param string $name Target name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeAPModule(string $name)
|
||||
{
|
||||
if (empty($this->apModules[$name]) === false) {
|
||||
// Mark item for db elimination.
|
||||
$this->removedItems[] = [
|
||||
'id' => $this->apModules[$name]->id(),
|
||||
'item_type' => $this->apModules[$name]->item_type(),
|
||||
];
|
||||
$this->apModules[$name]->delete();
|
||||
unset($this->apModules[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return found cluster definitions.
|
||||
*
|
||||
* @param array $filter Conditions.
|
||||
*
|
||||
* @return mixed Array or false.
|
||||
*/
|
||||
public static function search(array $filter)
|
||||
{
|
||||
return \db_get_all_rows_filter(
|
||||
'tcluster',
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Operates with group.
|
||||
*
|
||||
* @param integer|null $id_group Target group to update. Retrieve group obj
|
||||
* if null.
|
||||
*
|
||||
* @return mixed Void if set, PandoraFMS\Group if argument is null.
|
||||
*/
|
||||
public function group(?int $id_group=null)
|
||||
{
|
||||
if (is_numeric($id_group) === true && $id_group > 0) {
|
||||
$this->fields['group'] = new Group($id_group);
|
||||
} else {
|
||||
return $this->fields['group'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns AA modules as nodes for a map if any, if not, retrieves members.
|
||||
*
|
||||
* @return array Of PandoraFMS\Networkmap nodes.
|
||||
*/
|
||||
public function getNodes()
|
||||
{
|
||||
// Parse agents.
|
||||
$nodes = [];
|
||||
$node_count = 0;
|
||||
$parent = $node_count;
|
||||
$id_node = $node_count++;
|
||||
$status = \agents_get_status_from_counts($this->agent()->toArray());
|
||||
$image = 'images/networkmap/'.os_get_icon($this->agent()->id_os());
|
||||
|
||||
if (empty($this->aaModules) === true) {
|
||||
// No AA modules, use members.
|
||||
$parent = $this->agent()->id_agente();
|
||||
|
||||
// Add node.
|
||||
foreach ($this->members as $agent) {
|
||||
$node = [];
|
||||
|
||||
foreach ($agent->toArray() as $k => $v) {
|
||||
$node[$k] = $v;
|
||||
}
|
||||
|
||||
$node['id_agente'] = $agent->id_agente();
|
||||
$node['id_parent'] = $parent;
|
||||
$node['id_node'] = $node_count;
|
||||
$node['image'] = 'images/networkmap/'.os_get_icon(
|
||||
$agent->id_os()
|
||||
);
|
||||
$node['status'] = \agents_get_status_from_counts(
|
||||
$agent->toArray()
|
||||
);
|
||||
|
||||
$nodes[$node_count++] = $node;
|
||||
}
|
||||
} else {
|
||||
foreach ($this->aaModules as $cl_item) {
|
||||
$cl_module = $cl_item->getModule();
|
||||
|
||||
if ($cl_module === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($this->members as $agent) {
|
||||
$module = $agent->searchModules(
|
||||
['nombre' => $cl_module->nombre()]
|
||||
);
|
||||
|
||||
if (empty($module) === true) {
|
||||
// AA Module not found in member.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Transform multi array to get first occurrence.
|
||||
// Warning. Here must only be 1 result.
|
||||
$module = array_shift($module);
|
||||
|
||||
$node = [];
|
||||
|
||||
$node['type'] = NODE_GENERIC;
|
||||
$node['label'] = $agent->alias().' » ';
|
||||
$node['label'] .= $module->nombre();
|
||||
$node['id_agente'] = $module->id_agente();
|
||||
$node['id_agente_modulo'] = $module->id_agente_modulo();
|
||||
$node['id_parent'] = $parent;
|
||||
$node['id_node'] = $node_count;
|
||||
$node['image'] = 'images/networkmap/'.os_get_icon(
|
||||
$agent->id_os()
|
||||
);
|
||||
$node['status'] = $module->getStatus()->last_known_status();
|
||||
|
||||
$nodes[$node_count++] = $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodes[$parent] = $this->agent()->toArray();
|
||||
$nodes[$parent] = ($nodes[$parent] + [
|
||||
'id_parent' => $parent,
|
||||
'id_node' => $id_node,
|
||||
'status' => $status,
|
||||
'id_agente' => $this->agent()->id_agente(),
|
||||
'image' => $image,
|
||||
]);
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves current group definition to database.
|
||||
*
|
||||
* @return mixed Affected rows of false in case of error.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$values = $this->fields;
|
||||
|
||||
unset($values['agent']);
|
||||
$values['group'] = $this->group()->id_grupo();
|
||||
if (isset($values['id']) === true && $values['id'] > 0) {
|
||||
// Update.
|
||||
$rs = \db_process_sql_update(
|
||||
'tcluster',
|
||||
$values,
|
||||
['id' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
\db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Cluster '.io_safe_output($this->fields['name']).' modified'
|
||||
);
|
||||
} else {
|
||||
// New.
|
||||
$rs = \db_process_sql_insert(
|
||||
'tcluster',
|
||||
$values
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields['id'] = $rs;
|
||||
\db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Cluster '.io_safe_output($this->fields['name']).' created'
|
||||
);
|
||||
}
|
||||
|
||||
$this->saveMembers();
|
||||
$this->saveItems();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates entries in tcluster_agent.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function saveMembers()
|
||||
{
|
||||
$err = __METHOD__.' error: ';
|
||||
|
||||
$values = [];
|
||||
foreach ($this->members as $agent) {
|
||||
$values[$agent->id_agente()] = [
|
||||
'id_cluster' => $this->fields['id'],
|
||||
'id_agent' => $agent->id_agente(),
|
||||
];
|
||||
}
|
||||
|
||||
if (empty($values) === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean previous relationships.
|
||||
$rs = \db_process_sql_delete(
|
||||
'tcluster_agent',
|
||||
[ 'id_cluster' => $this->fields['id'] ]
|
||||
);
|
||||
|
||||
foreach ($values as $set) {
|
||||
// Add current relationships.
|
||||
$rs = \db_process_sql_insert(
|
||||
'tcluster_agent',
|
||||
$set
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
$err.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function saveItems()
|
||||
{
|
||||
$items = $this->getItems();
|
||||
|
||||
foreach ($this->removedItems as $item) {
|
||||
\db_process_sql_delete(
|
||||
'tcluster_item',
|
||||
$item
|
||||
);
|
||||
}
|
||||
|
||||
// Save cluster modules.
|
||||
foreach ($items as $item) {
|
||||
$item->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Force cluster status module to be executed.
|
||||
*
|
||||
* @param boolean $get_informed Throw exception if clusterStatus is null.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function force(?bool $get_informed=true)
|
||||
{
|
||||
if ($this->clusterStatus === null) {
|
||||
if ($get_informed === true) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: Cluster status module does not exist'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->clusterStatus->flag(1);
|
||||
$this->clusterStatus->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete cluster from db.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($this->agent() !== null) {
|
||||
// Delete agent and modules.
|
||||
$this->agent()->delete();
|
||||
}
|
||||
|
||||
// Remove entries from db.
|
||||
// Table tcluster_agent.
|
||||
$rs = \db_process_sql_delete(
|
||||
'tcluster_agent',
|
||||
['id_cluster' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
// Table tcluster_item.
|
||||
$rs = \db_process_sql_delete(
|
||||
'tcluster_item',
|
||||
['id_cluster' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
// Table tcluster.
|
||||
$rs = \db_process_sql_delete(
|
||||
'tcluster',
|
||||
['id' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
\db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Cluster '.io_safe_output($this->fields['name']).' deleted'
|
||||
);
|
||||
|
||||
unset($this->aaModules);
|
||||
unset($this->apModules);
|
||||
unset($this->fields);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
<?php
|
||||
// phpcs:disable Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Cluster module entity class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org 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.
|
||||
namespace PandoraFMS;
|
||||
|
||||
use PandoraFMS\Entity;
|
||||
use PandoraFMS\Module;
|
||||
|
||||
/**
|
||||
* Represents AA and AP modules entity from a cluster.
|
||||
*/
|
||||
class ClusterModule extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* Associated module.
|
||||
*
|
||||
* @var PandoraFMS\Module
|
||||
*/
|
||||
private $module;
|
||||
|
||||
|
||||
/**
|
||||
* Builds a PandoraFMS\ClusterViewer\ClusterModule object from a id.
|
||||
*
|
||||
* @param integer $id ClusterModule Id.
|
||||
*
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function __construct(?int $id=null)
|
||||
{
|
||||
if (is_numeric($id) === true && $id > 0) {
|
||||
try {
|
||||
parent::__construct('tcluster_item', ['id' => $id]);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception('ClusterModule id not found.');
|
||||
}
|
||||
|
||||
// Get module.
|
||||
$this->module = Module::search(
|
||||
[
|
||||
'nombre' => $this->name(),
|
||||
'custom_integer_1' => $this->id_cluster(),
|
||||
],
|
||||
1
|
||||
);
|
||||
} else {
|
||||
parent::__construct('tcluster_item');
|
||||
|
||||
$this->module = new Module();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns current object as array.
|
||||
*
|
||||
* @return array Of fields.
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associates a module to this clusterModule.
|
||||
*
|
||||
* @param array $params Module parameters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setModule(array $params)
|
||||
{
|
||||
$this->module = new Module();
|
||||
foreach ($params as $k => $v) {
|
||||
$this->module->{$k}($v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associates a module to this clusterModule.
|
||||
*
|
||||
* @param PandoraFMS\Module $module Module definition.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setModuleObject(Module $module)
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns current module.
|
||||
*
|
||||
* @return PandoraFMS\Module Object.
|
||||
*/
|
||||
public function getModule()
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves or retrieves value of warning_limit.
|
||||
*
|
||||
* @param float|null $value Warning value.
|
||||
*
|
||||
* @return mixed Value or empty.
|
||||
*/
|
||||
public function warning_limit(?float $value=null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->fields['warning_limit'] = $value;
|
||||
if ($this->module !== null) {
|
||||
$this->module->min_warning($value);
|
||||
}
|
||||
} else {
|
||||
return $this->fields['warning_limit'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves or retrieves value of critical_limit.
|
||||
*
|
||||
* @param float|null $value Critical value.
|
||||
*
|
||||
* @return mixed Value or empty.
|
||||
*/
|
||||
public function critical_limit(?float $value=null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->fields['critical_limit'] = $value;
|
||||
if ($this->module !== null) {
|
||||
$this->module->min_critical($value);
|
||||
}
|
||||
} else {
|
||||
return $this->fields['critical_limit'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save ClusterModule.
|
||||
*
|
||||
* @return boolean True if success, false if error.
|
||||
* @throws \Exception On db error.
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$values = $this->fields;
|
||||
|
||||
if ($this->module === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists($this->module, 'save') === false) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: Cluster module "'.$this->name().'" invalid.'
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($values['id']) === true && $values['id'] > 0) {
|
||||
// Update.
|
||||
$rs = \db_process_sql_update(
|
||||
'tcluster_item',
|
||||
$values,
|
||||
['id' => $this->fields['id']]
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->module === null) {
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: Cluster module "'.$this->name().'" is not defined'
|
||||
);
|
||||
}
|
||||
|
||||
// Update reference.
|
||||
$this->module->custom_integer_2($this->fields['id']);
|
||||
|
||||
// Update module.
|
||||
$this->module->save();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
// New.
|
||||
$rs = \db_process_sql_insert(
|
||||
'tcluster_item',
|
||||
$values
|
||||
);
|
||||
|
||||
if ($rs === false) {
|
||||
global $config;
|
||||
throw new \Exception(
|
||||
__METHOD__.' error: '.$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields['id'] = $rs;
|
||||
|
||||
// Update reference.
|
||||
$this->module->custom_integer_2($this->fields['id']);
|
||||
|
||||
// Update module.
|
||||
$this->module->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Erases this object and its module.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if (method_exists($this->module, 'delete') === true) {
|
||||
$this->module->delete();
|
||||
}
|
||||
|
||||
unset($this->fields);
|
||||
unset($this->module);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,764 @@
|
|||
<?php
|
||||
/**
|
||||
* Cluster view main class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org 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.
|
||||
namespace PandoraFMS\ClusterViewer;
|
||||
|
||||
use PandoraFMS\View;
|
||||
use PandoraFMS\Group;
|
||||
use PandoraFMS\Cluster;
|
||||
|
||||
/**
|
||||
* Class to handle Cluster view operations.
|
||||
*/
|
||||
class ClusterManager
|
||||
{
|
||||
|
||||
/**
|
||||
* Url of controller.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ajaxController;
|
||||
|
||||
/**
|
||||
* Url (main).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Number of clusters defined.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private static $count;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $ajax_page Path to ajax controller.
|
||||
* @param string $url Url.
|
||||
*/
|
||||
public function __construct(
|
||||
string $ajax_page='operation/cluster/cluster',
|
||||
string $url='index.php?sec=estado&sec2=operation/cluster/cluster'
|
||||
) {
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AR')
|
||||
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access cluster viewer'
|
||||
);
|
||||
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => 'noaccess']);
|
||||
} else {
|
||||
include 'general/noaccess.php';
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->ajaxController = $ajax_page;
|
||||
$this->url = $url;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main program starts here.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$operation = get_parameter('op', '');
|
||||
|
||||
switch ($operation) {
|
||||
case 'new':
|
||||
case 'update':
|
||||
$this->showClusterEditor($operation);
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
$this->showCluster();
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$this->deleteCluster();
|
||||
break;
|
||||
|
||||
case 'force':
|
||||
$this->forceCluster();
|
||||
break;
|
||||
|
||||
default:
|
||||
$n_clusters = $this->getCount();
|
||||
|
||||
if ($n_clusters > 0) {
|
||||
$this->showList();
|
||||
} else {
|
||||
$this->showWelcome();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints error message
|
||||
*
|
||||
* @param string $msg Message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error(string $msg)
|
||||
{
|
||||
if (is_ajax()) {
|
||||
echo json_encode(
|
||||
['error' => $msg]
|
||||
);
|
||||
} else {
|
||||
ui_print_error_message($msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads view 'first tasks' for cluster view.
|
||||
* Old style.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showWelcome()
|
||||
{
|
||||
global $config;
|
||||
include_once $config['homedir'].'/general/first_task/cluster_builder.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepares available clusters definition for current users and loads view.
|
||||
*
|
||||
* @param string|null $msg Message (if any).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showList(?string $msg='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Extract data.
|
||||
$n_clusters = $this->getCount();
|
||||
|
||||
if ($n_clusters > 0) {
|
||||
$clusters = $this->getAll();
|
||||
} else {
|
||||
$clusters = [];
|
||||
}
|
||||
|
||||
View::render(
|
||||
'cluster/list',
|
||||
[
|
||||
'message' => $msg,
|
||||
'config' => $config,
|
||||
'model' => $this,
|
||||
'n_clusters' => $n_clusters,
|
||||
'clusters' => $clusters,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show cluster information.
|
||||
*
|
||||
* @param string|null $msg Message (if any).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showCluster(?string $msg=null)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$err = '';
|
||||
$id = get_parameter('id', null);
|
||||
|
||||
try {
|
||||
$cluster = new Cluster($id);
|
||||
} catch (\Exception $e) {
|
||||
$err = ui_print_error_message(
|
||||
__('Cluster not found: '.$e->getMessage()),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($cluster->agent()->id_agente() === null) {
|
||||
// Failed.
|
||||
$err = ui_print_error_message(
|
||||
__('Cluster agent not found: '),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$critical = true;
|
||||
}
|
||||
|
||||
View::render(
|
||||
'cluster/view',
|
||||
[
|
||||
'message' => $msg,
|
||||
'error' => $err,
|
||||
'config' => $config,
|
||||
'model' => $this,
|
||||
'cluster' => $cluster,
|
||||
'critical' => $critical,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a cluster from db.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteCluster()
|
||||
{
|
||||
$msg = '';
|
||||
$id = get_parameter('id', null);
|
||||
|
||||
try {
|
||||
$cluster = new Cluster($id);
|
||||
$cluster->delete();
|
||||
unset($cluster);
|
||||
} catch (\Exception $e) {
|
||||
$msg = ui_print_error_message(
|
||||
__('Error while deleting, reason: %s', $e->getMessage()),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($msg) === true) {
|
||||
$msg = ui_print_success_message(
|
||||
__('Cluster successfully deleted.'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$this->showList($msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Force cluster execution.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forceCluster()
|
||||
{
|
||||
$msg = '';
|
||||
$id = get_parameter('id', null);
|
||||
|
||||
try {
|
||||
$cluster = new Cluster($id);
|
||||
$cluster->force();
|
||||
unset($cluster);
|
||||
} catch (\Exception $e) {
|
||||
$msg = ui_print_error_message(
|
||||
__('Error while forcing, reason: %s', $e->getMessage()),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($msg) === true) {
|
||||
$msg = ui_print_success_message(
|
||||
__('Cluster successfully forced.'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$this->showCluster($msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shows editor for target cluster (or new one).
|
||||
*
|
||||
* @param string $operation Current operation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showClusterEditor(string $operation)
|
||||
{
|
||||
global $config;
|
||||
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to create clusters'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
} else {
|
||||
$wizard = new ClusterWizard(
|
||||
$this->url,
|
||||
$operation
|
||||
);
|
||||
|
||||
$wizard->run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns number of clusters registered.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCount()
|
||||
{
|
||||
if (isset($this->count) !== true) {
|
||||
$this->count = $this->getAll('count');
|
||||
}
|
||||
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all cluster definitons matching given filters.
|
||||
*
|
||||
* @param mixed $fields Fields array or 'count' keyword to retrieve
|
||||
* count, null or default to use default ones.
|
||||
* @param array $filter Filters to be applied.
|
||||
* @param integer $offset Offset (pagination).
|
||||
* @param integer $limit Limit (pagination).
|
||||
* @param string $order Sort order.
|
||||
* @param string $sort_field Sort field.
|
||||
*
|
||||
* @return array With all results or false if error.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public static function getAll(
|
||||
$fields=null,
|
||||
array $filter=[],
|
||||
?int $offset=null,
|
||||
?int $limit=null,
|
||||
?string $order=null,
|
||||
?string $sort_field=null
|
||||
) {
|
||||
$sql_filters = [];
|
||||
$order_by = '';
|
||||
$pagination = '';
|
||||
|
||||
global $config;
|
||||
|
||||
if (is_array($filter) === false) {
|
||||
throw new \Exception('[ClusterManager::getAll] Filter must be an array.');
|
||||
}
|
||||
|
||||
if (empty($filter['id_group']) === false
|
||||
&& (int) $filter['id_group'] !== 0
|
||||
) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND tc.`group` = %d',
|
||||
$filter['id_group']
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($filter['free_search']) === false) {
|
||||
$topic = io_safe_input($filter['free_search']);
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (lower(tc.name) like lower("%%%s%%")
|
||||
OR lower(tc.description) like lower("%%%s%%") ) ',
|
||||
$topic,
|
||||
$topic
|
||||
);
|
||||
}
|
||||
|
||||
$count = false;
|
||||
if (is_array($fields) === false && $fields === 'count') {
|
||||
$fields = ['tc.*'];
|
||||
$count = true;
|
||||
} else if (is_array($fields) === false) {
|
||||
// Default values.
|
||||
$fields = [
|
||||
'tc.*',
|
||||
'(SELECT COUNT(*) FROM `tcluster_agent` WHERE `id_cluster` = tc.`id`) as `nodes`',
|
||||
'tas.known_status',
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($order) === true) {
|
||||
$dir = 'asc';
|
||||
if ($order === 'desc') {
|
||||
$dir = 'desc';
|
||||
};
|
||||
|
||||
if ($sort_field === 'type') {
|
||||
$sort_field = 'cluster_type';
|
||||
}
|
||||
|
||||
if (in_array(
|
||||
$sort_field,
|
||||
[
|
||||
'name',
|
||||
'description',
|
||||
'group',
|
||||
'cluster_type',
|
||||
'nodes',
|
||||
'known_status',
|
||||
]
|
||||
) === true
|
||||
) {
|
||||
$order_by = sprintf(
|
||||
'ORDER BY `%s` %s',
|
||||
$sort_field,
|
||||
$dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($limit) === true && $limit > 0
|
||||
&& isset($offset) === true && $offset >= 0
|
||||
) {
|
||||
$pagination = sprintf(
|
||||
' LIMIT %d OFFSET %d ',
|
||||
$limit,
|
||||
$offset
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tcluster tc
|
||||
LEFT JOIN tagente ta
|
||||
ON tc.id_agent = ta.id_agente
|
||||
LEFT JOIN tagente_modulo tam
|
||||
ON tam.id_agente = tc.id_agent
|
||||
AND tam.nombre = "%s"
|
||||
LEFT JOIN tagente_estado tas
|
||||
ON tam.id_agente_modulo=tas.id_agente_modulo
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
%s',
|
||||
join(',', $fields),
|
||||
io_safe_input('Cluster status'),
|
||||
join(' ', $sql_filters),
|
||||
$order_by,
|
||||
$pagination
|
||||
);
|
||||
|
||||
if ($count === true) {
|
||||
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
|
||||
|
||||
// Counter.. All data.
|
||||
return db_get_value_sql($sql);
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return data for datatables painting.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception On Error.
|
||||
*/
|
||||
public function draw()
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Datatables offset, limit and order.
|
||||
$filter = get_parameter('filter', []);
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order(true);
|
||||
try {
|
||||
ob_start();
|
||||
|
||||
$fields = [
|
||||
'tc.*',
|
||||
'(SELECT COUNT(*) FROM `tcluster_agent` WHERE `id_cluster` = tc.`id`) as `nodes`',
|
||||
'tas.known_status',
|
||||
];
|
||||
|
||||
// Retrieve data.
|
||||
$data = self::getAll(
|
||||
// Fields.
|
||||
$fields,
|
||||
// Filter.
|
||||
$filter,
|
||||
// Offset.
|
||||
$start,
|
||||
// Limit.
|
||||
$length,
|
||||
// Order.
|
||||
$order['direction'],
|
||||
// Sort field.
|
||||
$order['field']
|
||||
);
|
||||
|
||||
// Retrieve counter.
|
||||
$count = self::getAll(
|
||||
'count',
|
||||
$filter
|
||||
);
|
||||
|
||||
if ($data) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
global $config;
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
|
||||
$manage = check_acl(
|
||||
$config['id_user'],
|
||||
$tmp->group,
|
||||
'AW',
|
||||
true
|
||||
);
|
||||
|
||||
$tmp->name = '<b><a href="'.ui_get_full_url(
|
||||
$this->url.'&op=view&id='.$tmp->id
|
||||
).'">'.$tmp->name.'</a></b>';
|
||||
|
||||
if (empty($tmp->group) === true) {
|
||||
$tmp->group = __('Not set');
|
||||
} else {
|
||||
$tmp->group = ui_print_group_icon(
|
||||
$tmp->group,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
// Type.
|
||||
if ($tmp->cluster_type === 'AA') {
|
||||
$tmp->type = __('Active-Active');
|
||||
} else if ($tmp->cluster_type === 'AP') {
|
||||
$tmp->type = __('Active-Passive');
|
||||
} else {
|
||||
$tmp->type = __('Unknown');
|
||||
}
|
||||
|
||||
// Status.
|
||||
$tmp->known_status = ui_print_module_status(
|
||||
$tmp->known_status,
|
||||
true
|
||||
);
|
||||
|
||||
// Options. View.
|
||||
$tmp->options = '<a href="';
|
||||
$tmp->options .= ui_get_full_url(
|
||||
$this->url.'&op=view&id='.$tmp->id
|
||||
);
|
||||
$tmp->options .= '">';
|
||||
$tmp->options .= html_print_image(
|
||||
'images/operation.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('View'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$tmp->options .= '</a>';
|
||||
|
||||
if ($manage) {
|
||||
// Options. Edit.
|
||||
$tmp->options .= '<a href="';
|
||||
$tmp->options .= ui_get_full_url(
|
||||
$this->url.'&op=update&id='.$tmp->id
|
||||
);
|
||||
$tmp->options .= '">';
|
||||
$tmp->options .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$tmp->options .= '</a>';
|
||||
|
||||
// Options. Delete.
|
||||
$tmp->options .= '<a href="';
|
||||
$tmp->options .= ui_get_full_url(
|
||||
$this->url.'&op=delete&id='.$tmp->id
|
||||
);
|
||||
$tmp->options .= '">';
|
||||
$tmp->options .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$tmp->options .= '</a>';
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Datatables format: RecordsTotal && recordsfiltered.
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
// Capture output.
|
||||
$response = ob_get_clean();
|
||||
} catch (\Exception $e) {
|
||||
echo json_encode(['error' => $e->getMessage()]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If not valid, show error with issue.
|
||||
json_decode($response);
|
||||
if (json_last_error() == JSON_ERROR_NONE) {
|
||||
// If valid dump.
|
||||
echo $response;
|
||||
} else {
|
||||
echo json_encode(
|
||||
['error' => $response]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides data for wizard. Ajax method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getAgentsFromGroup()
|
||||
{
|
||||
$side = get_parameter('side', null);
|
||||
$id = get_parameter('id', null);
|
||||
$group_id = get_parameter('group_id', 0);
|
||||
$group_recursion = (bool) get_parameter('group_recursion', 0);
|
||||
|
||||
$groups = [];
|
||||
if ($group_recursion === true) {
|
||||
$groups = groups_get_children_ids($group_id, true);
|
||||
} else {
|
||||
$groups = $group_id;
|
||||
}
|
||||
|
||||
if ($side === 'left') {
|
||||
// Available agents.
|
||||
$agents = agents_get_agents(
|
||||
[ 'id_grupo' => $groups ],
|
||||
[
|
||||
'id_agente',
|
||||
'alias',
|
||||
]
|
||||
);
|
||||
|
||||
$agents = array_reduce(
|
||||
$agents,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_agente']] = io_safe_output($item['alias']);
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else if ($side === 'right') {
|
||||
// Selected agents.
|
||||
$cluster = new Cluster($id);
|
||||
$agents = $cluster->getMembers();
|
||||
$agents = array_reduce(
|
||||
$agents,
|
||||
function ($carry, $item) use ($groups) {
|
||||
if (in_array($item->id_grupo(), $groups) === true) {
|
||||
$carry[$item->id_agente()] = io_safe_output(
|
||||
$item->alias()
|
||||
);
|
||||
}
|
||||
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($agents) === true) {
|
||||
echo '[]';
|
||||
} else {
|
||||
// Dump response.
|
||||
echo json_encode($agents);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a goBack form structure.
|
||||
*
|
||||
* @return array Form structure.
|
||||
*/
|
||||
public function getGoBackForm()
|
||||
{
|
||||
$form['form']['action'] = $this->url;
|
||||
$form['form']['method'] = 'POST';
|
||||
$form['form']['id'] = 'go-back-form';
|
||||
$form['inputs'] = [
|
||||
[
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub cancel"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -695,7 +695,7 @@ class Manager implements PublicLogin
|
|||
|
||||
// Check ACl.
|
||||
if (\is_user_admin($config['id_user']) !== true) {
|
||||
// User no admin see dashboards of him groups and profile 'AR'.
|
||||
// Non-admin user can see dashboards of his groups and 'AR' profile.
|
||||
$group_list = \users_get_groups(
|
||||
$config['id_user'],
|
||||
'RR',
|
||||
|
@ -802,7 +802,7 @@ class Manager implements PublicLogin
|
|||
global $config;
|
||||
|
||||
if (is_user_admin($config['id_user']) !== false) {
|
||||
// User no admin see dashboards of him groups and profile 'AR'.
|
||||
// Non-admin user can see dashboards of his groups and 'AR' profile.
|
||||
$group_list = \users_get_groups(
|
||||
$config['id_user'],
|
||||
'RR',
|
||||
|
@ -818,20 +818,13 @@ class Manager implements PublicLogin
|
|||
$string_groups = io_safe_output($string_groups);
|
||||
|
||||
$sql_dashboard = sprintf(
|
||||
"SELECT COUNT(*)
|
||||
'SELECT COUNT(*)
|
||||
FROM tdashboard
|
||||
WHERE (id_group IN (%s) AND id_user = '') OR
|
||||
id_user = '%s'",
|
||||
$string_groups,
|
||||
$config['id_user']
|
||||
WHERE (id_group IN (%s))',
|
||||
$string_groups
|
||||
);
|
||||
} else {
|
||||
$sql_dashboard = sprintf(
|
||||
"SELECT COUNT(*)
|
||||
FROM tdashboard
|
||||
WHERE id_group = 0 AND id_user = '%s'",
|
||||
$config['id_user']
|
||||
);
|
||||
$sql_dashboard = 'SELECT COUNT(*) FROM tdashboard WHERE id_group = 0';
|
||||
}
|
||||
} else {
|
||||
$sql_dashboard = 'SELECT COUNT(*) FROM tdashboard';
|
||||
|
|
|
@ -206,7 +206,7 @@ class Widget
|
|||
|
||||
$sql_search = '';
|
||||
if (empty($search) === false) {
|
||||
$sql_search = 'AND description LIKE "%'.$search.'%" ';
|
||||
$sql_search = 'AND description LIKE "%'.addslashes($search).'%" ';
|
||||
}
|
||||
|
||||
// User admin view all dashboards.
|
||||
|
|
|
@ -444,7 +444,7 @@ class TopNWidget extends Widget
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$modules = @db_get_all_rows_sql(
|
||||
$modules = db_get_all_rows_sql(
|
||||
$sql,
|
||||
$search_in_history_db
|
||||
);
|
||||
|
@ -462,6 +462,7 @@ class TopNWidget extends Widget
|
|||
}
|
||||
|
||||
$data_hbar = [];
|
||||
$labels = [];
|
||||
$valueMax = 0;
|
||||
$valueMin = 0;
|
||||
$booleanModulesCount = 0;
|
||||
|
@ -476,7 +477,12 @@ class TopNWidget extends Widget
|
|||
foreach ($modules as $module) {
|
||||
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20, false, true, false);
|
||||
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
|
||||
$data_hbar[$item_name]['g'] = $module[$display];
|
||||
$labels[] = io_safe_output($item_name);
|
||||
|
||||
$data_hbar[] = [
|
||||
'x' => $module[$display],
|
||||
'y' => io_safe_output($item_name),
|
||||
];
|
||||
// Calculation of max-min values for show in graph.
|
||||
$calc = (ceil((5 * (float) $module[$display]) / 100) + $module[$display]);
|
||||
// Set of max-min values for graph.
|
||||
|
@ -498,26 +504,24 @@ class TopNWidget extends Widget
|
|||
|
||||
$height = (count($data_hbar) * 25 + 35);
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= hbar_graph(
|
||||
array_reverse($data_hbar),
|
||||
$size['width'],
|
||||
$height,
|
||||
[],
|
||||
[],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$config['homedir'].'/images/logo_vertical_water.png',
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
true,
|
||||
1,
|
||||
$config['homeurl'],
|
||||
'white',
|
||||
'#DFDFDF',
|
||||
$valueMin,
|
||||
$valueMax
|
||||
$options = [
|
||||
'height' => $height,
|
||||
'axis' => 'y',
|
||||
'legend' => ['display' => false],
|
||||
'scales' => [
|
||||
'x' => [
|
||||
'grid' => ['display' => false],
|
||||
],
|
||||
'y' => [
|
||||
'grid' => ['display' => false],
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
|
||||
$output .= vbar_graph(
|
||||
$data_hbar,
|
||||
$options
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
|
|
|
@ -424,6 +424,7 @@ class TopNEventByGroupWidget extends Widget
|
|||
return $output;
|
||||
} else {
|
||||
$data_pie = [];
|
||||
$labels = [];
|
||||
foreach ($result as $row) {
|
||||
if ($row['id_agente'] == 0) {
|
||||
$name = __('System');
|
||||
|
@ -444,7 +445,8 @@ class TopNEventByGroupWidget extends Widget
|
|||
|
||||
$name .= ' ('.$row['count'].')';
|
||||
|
||||
$data_pie[$name] = $row['count'];
|
||||
$labels[] = io_safe_output($name);
|
||||
$data_pie[] = $row['count'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,17 +476,14 @@ class TopNEventByGroupWidget extends Widget
|
|||
|
||||
$output .= pie_graph(
|
||||
$data_pie,
|
||||
$width,
|
||||
$height,
|
||||
__('other'),
|
||||
'',
|
||||
false,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
1,
|
||||
$this->values['legendPosition'],
|
||||
'',
|
||||
false
|
||||
[
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'right',
|
||||
'align' => 'center',
|
||||
],
|
||||
'labels' => $labels,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -427,6 +427,7 @@ class TopNEventByModuleWidget extends Widget
|
|||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
$labels = [];
|
||||
$data_pie = [];
|
||||
foreach ($result as $row) {
|
||||
if ($row['id_agentmodule'] == 0) {
|
||||
|
@ -479,7 +480,8 @@ class TopNEventByModuleWidget extends Widget
|
|||
);
|
||||
}
|
||||
|
||||
$data_pie[$event_name.' [ '.$name.' ] ('.$row['count'].')'] = $row['count'];
|
||||
$labels[] = $event_name.' [ '.$name.' ] ('.$row['count'].')';
|
||||
$data_pie[] = $row['count'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,17 +511,14 @@ class TopNEventByModuleWidget extends Widget
|
|||
|
||||
$output = pie_graph(
|
||||
$data_pie,
|
||||
$width,
|
||||
$height,
|
||||
__('other'),
|
||||
'',
|
||||
false,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
1,
|
||||
$this->values['legendPosition'],
|
||||
'',
|
||||
false
|
||||
[
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'right',
|
||||
'align' => 'center',
|
||||
],
|
||||
'labels' => $labels,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ class WuxWidget extends Widget
|
|||
|
||||
// Must be configured before using.
|
||||
$this->configurationRequired = false;
|
||||
if (empty($this->options) === true) {
|
||||
if (empty($this->values['agentId']) === true) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ final class Container extends Model
|
|||
'OR'
|
||||
);
|
||||
|
||||
if ($rows === false) {
|
||||
if ($row === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -226,85 +226,6 @@ final class BarsGraph extends Item
|
|||
$moduleId = $linkedModule['moduleId'];
|
||||
$metaconsoleId = $linkedModule['metaconsoleId'];
|
||||
|
||||
// Add colors that will use the graphics.
|
||||
$color = [];
|
||||
|
||||
$color[0] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color1'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[1] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color2'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[2] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color3'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[3] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color4'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[4] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color5'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[5] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color6'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[6] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color7'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[7] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color8'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[8] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color9'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[9] = [
|
||||
'border' => '#000000',
|
||||
'color' => $config['graph_color10'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[11] = [
|
||||
'border' => '#000000',
|
||||
'color' => COL_GRAPH9,
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[12] = [
|
||||
'border' => '#000000',
|
||||
'color' => COL_GRAPH10,
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[13] = [
|
||||
'border' => '#000000',
|
||||
'color' => COL_GRAPH11,
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[14] = [
|
||||
'border' => '#000000',
|
||||
'color' => COL_GRAPH12,
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
$color[15] = [
|
||||
'border' => '#000000',
|
||||
'color' => COL_GRAPH13,
|
||||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
|
||||
// Maybe connect to node.
|
||||
$nodeConnected = false;
|
||||
if (\is_metaconsole() === true && $metaconsoleId !== null) {
|
||||
|
@ -320,103 +241,88 @@ final class BarsGraph extends Item
|
|||
}
|
||||
}
|
||||
|
||||
$moduleData = \get_bars_module_data(
|
||||
$moduleId,
|
||||
($typeGraph !== 'horizontal')
|
||||
);
|
||||
if ($moduleData !== false && is_array($moduleData) === true) {
|
||||
array_pop($moduleData);
|
||||
}
|
||||
|
||||
$waterMark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
'url' => \ui_get_full_url(
|
||||
'images/logo_vertical_water.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
];
|
||||
|
||||
if ((int) $data['width'] === 0 || (int) $data['height'] === 0) {
|
||||
$width = 400;
|
||||
$height = 400;
|
||||
} else {
|
||||
$width = (int) $data['width'];
|
||||
$height = (int) $data['height'];
|
||||
}
|
||||
$width = (int) $data['width'];
|
||||
$height = (int) $data['height'];
|
||||
$moduleData = \get_bars_module_data($moduleId, $typeGraph);
|
||||
|
||||
if (empty($moduleData) === true) {
|
||||
$image = ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$rc = file_get_contents($image);
|
||||
if ($rc !== false) {
|
||||
$graph = base64_encode($rc);
|
||||
} else {
|
||||
$graph = graph_nodata_image(
|
||||
// Width.
|
||||
$width,
|
||||
// Height.
|
||||
$height,
|
||||
// Type.
|
||||
'hbar',
|
||||
// Text.
|
||||
'',
|
||||
// Percent.
|
||||
false,
|
||||
// Base64.
|
||||
true
|
||||
);
|
||||
}
|
||||
$graph = graph_nodata_image(['width' => $width, 'height' => $height]);
|
||||
} else {
|
||||
if ($typeGraph === 'horizontal') {
|
||||
$graph = \hbar_graph(
|
||||
$moduleData,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
'images/image_problem_area.png',
|
||||
'',
|
||||
'',
|
||||
$waterMark,
|
||||
$config['fontpath'],
|
||||
$config['fontsize'],
|
||||
'',
|
||||
2,
|
||||
$config['homeurl'],
|
||||
$backGroundColor,
|
||||
$gridColor,
|
||||
null,
|
||||
null,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$options = [];
|
||||
$options['generals']['rotate'] = true;
|
||||
$options['generals']['forceTicks'] = true;
|
||||
$options['generals']['arrayColors'] = $color;
|
||||
$options['grid']['backgroundColor'] = $backGroundColor;
|
||||
$options['y']['color'] = $backGroundColor;
|
||||
$options['x']['color'] = $backGroundColor;
|
||||
array_pop($moduleData['labels']);
|
||||
array_pop($moduleData['data']);
|
||||
|
||||
$waterMark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
'url' => \ui_get_full_url(
|
||||
'images/logo_vertical_water.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
];
|
||||
|
||||
if ((int) $data['width'] === 0 || (int) $data['height'] === 0) {
|
||||
$width = 400;
|
||||
$height = 400;
|
||||
} else {
|
||||
$width = (int) $data['width'];
|
||||
$height = (int) $data['height'];
|
||||
}
|
||||
|
||||
if (empty($moduleData) === true) {
|
||||
$image = ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$rc = file_get_contents($image);
|
||||
if ($rc !== false) {
|
||||
$graph = base64_encode($rc);
|
||||
} else {
|
||||
$graph = graph_nodata_image(['height' => $height]);
|
||||
}
|
||||
} else {
|
||||
$size = $config['font_size'];
|
||||
if ($ratio != 0) {
|
||||
$options['x']['font']['size'] = (($config['font_size'] * $ratio) + 1);
|
||||
$options['x']['font']['color'] = $gridColor;
|
||||
$options['y']['font']['size'] = (($config['font_size'] * $ratio) + 1);
|
||||
$options['y']['font']['color'] = $gridColor;
|
||||
$size = ($config['font_size'] * $ratio);
|
||||
}
|
||||
|
||||
$options['generals']['pdf']['width'] = $width;
|
||||
$options['generals']['pdf']['width'] = $width;
|
||||
$options['generals']['pdf']['height'] = $height;
|
||||
$options['x']['labelWidth'] = $sizeLabelTickWidth;
|
||||
$graph = vbar_graph($moduleData, $options, 2);
|
||||
$options = [
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'waterMark' => $waterMark,
|
||||
'legend' => ['display' => false],
|
||||
'scales' => [
|
||||
'x' => [
|
||||
'grid' => [
|
||||
'display' => true,
|
||||
'color' => $gridColor,
|
||||
],
|
||||
'ticks' => [
|
||||
'fonts' => ['size' => $size],
|
||||
],
|
||||
],
|
||||
'y' => [
|
||||
'grid' => [
|
||||
'display' => true,
|
||||
'color' => $gridColor,
|
||||
],
|
||||
'ticks' => [
|
||||
'fonts' => ['size' => $size],
|
||||
],
|
||||
],
|
||||
],
|
||||
'labels' => $moduleData['labels'],
|
||||
];
|
||||
|
||||
if ($typeGraph === 'horizontal') {
|
||||
$options['axis'] = 'y';
|
||||
}
|
||||
|
||||
$graph = '<div style="background-color:'.$backGroundColor.'">';
|
||||
$graph .= vbar_graph($moduleData['data'], $options);
|
||||
$graph .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,10 +331,7 @@ final class BarsGraph extends Item
|
|||
\metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$imgbase64 = 'data:image/png;base64,';
|
||||
$imgbase64 .= $graph;
|
||||
|
||||
$data['html'] = $imgbase64;
|
||||
$data['html'] = $graph;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ final class DonutGraph extends Item
|
|||
'border_color',
|
||||
]
|
||||
),
|
||||
'#000000'
|
||||
'#ffffff'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,11 @@ final class DonutGraph extends Item
|
|||
// Load side libraries.
|
||||
global $config;
|
||||
include_once $config['homedir'].'/include/functions_visual_map.php';
|
||||
include_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
if (is_metaconsole()) {
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
}
|
||||
|
||||
// Extract needed properties.
|
||||
$legendBackGroundColor = static::extractLegendBackgroundColor($data);
|
||||
// Get the linked agent and module Ids.
|
||||
$linkedModule = static::extractLinkedModule($data);
|
||||
$agentId = $linkedModule['agentId'];
|
||||
|
@ -158,32 +156,27 @@ final class DonutGraph extends Item
|
|||
|
||||
if ($isString === true) {
|
||||
$graphData = \get_donut_module_data($moduleId);
|
||||
if (empty($graphData) || $graphData === null) {
|
||||
$aux = [];
|
||||
$aux[0]['tag_name'] = 'No data to show';
|
||||
$aux[0]['color'] = '#aa3333';
|
||||
$aux[0]['value'] = 1;
|
||||
$aux[0]['percent'] = 100;
|
||||
$graphData = $aux;
|
||||
}
|
||||
|
||||
$data['html'] = \d3_donut_graph(
|
||||
(int) $data['id'],
|
||||
$width,
|
||||
$height,
|
||||
$graphData,
|
||||
$legendBackGroundColor
|
||||
);
|
||||
if (empty($graphData) === true) {
|
||||
$data['html'] = graph_nodata_image(['width' => $width, 'height' => $height]);
|
||||
} else {
|
||||
array_pop($graphData['labels']);
|
||||
array_pop($graphData['data']);
|
||||
|
||||
$options = [
|
||||
'waterMark' => false,
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'position' => 'right',
|
||||
'align' => 'center',
|
||||
],
|
||||
'labels' => $graphData['labels'],
|
||||
];
|
||||
|
||||
$data['html'] = \ring_graph($graphData['data'], $options);
|
||||
}
|
||||
} else {
|
||||
$src = 'images/console/signes/wrong_donut_graph.png';
|
||||
if (\is_metaconsole() === true) {
|
||||
$src = '../../'.$src;
|
||||
}
|
||||
|
||||
$src = ui_get_full_url($src);
|
||||
|
||||
$style = 'width:'.$width.'px; height:'.$height.'px;';
|
||||
$data['html'] = '<img src="'.$src.'" style="'.$style.'">';
|
||||
$data['html'] = graph_nodata_image(['width' => $width, 'height' => $height]);
|
||||
}
|
||||
|
||||
// Restore connection.
|
||||
|
@ -255,12 +248,12 @@ final class DonutGraph extends Item
|
|||
|
||||
// Resume data color.
|
||||
$inputs[] = [
|
||||
'label' => __('Resume data color'),
|
||||
'label' => __('Background color'),
|
||||
'arguments' => [
|
||||
'wrapper' => 'div',
|
||||
'name' => 'legendBackgroundColor',
|
||||
'type' => 'color',
|
||||
'value' => $values['legendBackgroundColor'],
|
||||
'value' => (($values['legendBackgroundColor']) ?? '#ffffff'),
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
|
|
@ -285,8 +285,6 @@ final class ModuleGraph extends Item
|
|||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
}
|
||||
|
||||
$imageOnly = false;
|
||||
|
||||
$backgroundType = static::extractBackgroundType($data);
|
||||
$period = static::extractPeriod($data);
|
||||
$showLegend = static::extractShowLegend($data);
|
||||
|
@ -367,7 +365,7 @@ final class ModuleGraph extends Item
|
|||
'title' => '',
|
||||
'unit_name' => null,
|
||||
'show_alerts' => false,
|
||||
'only_image' => $imageOnly,
|
||||
'only_image' => false,
|
||||
'vconsole' => true,
|
||||
'backgroundColor' => $backgroundType,
|
||||
'show_legend' => $showLegend,
|
||||
|
@ -384,11 +382,7 @@ final class ModuleGraph extends Item
|
|||
'modules_series' => $customGraph['modules_series'],
|
||||
];
|
||||
|
||||
if ($imageOnly !== false) {
|
||||
$imgbase64 = 'data:image/png;base64,';
|
||||
}
|
||||
|
||||
$imgbase64 .= \graphic_combined_module(
|
||||
$chart = \graphic_combined_module(
|
||||
false,
|
||||
$params,
|
||||
$paramsCombined
|
||||
|
@ -417,7 +411,7 @@ final class ModuleGraph extends Item
|
|||
$moduleId
|
||||
),
|
||||
'unit' => \modules_get_unit($moduleId),
|
||||
'only_image' => $imageOnly,
|
||||
'only_image' => false,
|
||||
'menu' => false,
|
||||
'backgroundColor' => $backgroundType,
|
||||
'type_graph' => $graphType,
|
||||
|
@ -429,14 +423,10 @@ final class ModuleGraph extends Item
|
|||
'server_id' => $metaconsoleId,
|
||||
];
|
||||
|
||||
if ($imageOnly !== false) {
|
||||
$imgbase64 = 'data:image/png;base64,';
|
||||
}
|
||||
|
||||
$imgbase64 .= \grafico_modulo_sparse($params);
|
||||
$chart = \grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$data['html'] = $imgbase64;
|
||||
$data['html'] = $chart;
|
||||
// Restore connection.
|
||||
if ($nodeConnected === true) {
|
||||
\metaconsole_restore_db();
|
||||
|
|
|
@ -450,7 +450,8 @@ class View extends \HTML
|
|||
$data['metaconsoleId'] = \get_parameter('metaconsoleId');
|
||||
$data['moduleId'] = \get_parameter('moduleId');
|
||||
$data['legendBackgroundColor'] = \get_parameter(
|
||||
'legendBackgroundColor'
|
||||
'legendBackgroundColor',
|
||||
'#ffffff'
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -9179,3 +9179,16 @@ div#err_msg_centralised {
|
|||
.tag-editor .tag-editor-delete:hover i:before {
|
||||
color: #ccc !important;
|
||||
}
|
||||
|
||||
.snmp-td {
|
||||
padding: 0 !important;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.snmp-div {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
var webPage = require("webpage");
|
||||
var page = webPage.create();
|
||||
var url =
|
||||
"http://nova/pandora_console/operation/agentes/stat_win.php?type=sparse&period=86400&id=136574&label=QXJ0aWNhJiN4MjA7d2ViJiN4MjA7cGFnZSYjeDIwO2V4YW1wbGU%3D&refresh=600&draw_events=0";
|
||||
|
||||
var r = page.addCookie({
|
||||
name: "PHPSESSID" /* required property */,
|
||||
value: "23qu7l1sgb3iq3bkaedr724hp3" /* required property */,
|
||||
path: "/pandora_console",
|
||||
domain: "nova"
|
||||
});
|
||||
|
||||
console.log(r);
|
||||
|
||||
page.viewportSize = { width: 750, height: 350 };
|
||||
page.open(url, function start(status) {
|
||||
page.render("output.jpeg", { format: "jpeg", quality: "100" });
|
||||
phantom.exit();
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,189 +0,0 @@
|
|||
var system = require("system");
|
||||
|
||||
/* global phantom */
|
||||
|
||||
if (system.args.length < 3 || system.args.length > 11) {
|
||||
phantom.exit(1);
|
||||
}
|
||||
|
||||
var url = system.args[1];
|
||||
var type_graph_pdf = system.args[2];
|
||||
var url_params = system.args[3];
|
||||
var url_params_comb = system.args[4];
|
||||
var url_module_list = system.args[5];
|
||||
var output_filename = system.args[6];
|
||||
var viewport_width = system.args[7];
|
||||
var viewport_height = system.args[8];
|
||||
var session_id = system.args[9];
|
||||
var base_64 = system.args[10];
|
||||
var post_data = "";
|
||||
|
||||
if (!viewport_width) {
|
||||
viewport_width = 750;
|
||||
}
|
||||
|
||||
if (!viewport_height) {
|
||||
viewport_height = 350;
|
||||
}
|
||||
|
||||
if (type_graph_pdf == "combined") {
|
||||
post_data = {
|
||||
data: url_params,
|
||||
session_id: session_id,
|
||||
type_graph_pdf: type_graph_pdf,
|
||||
data_module_list: url_module_list,
|
||||
data_combined: url_params_comb
|
||||
};
|
||||
} else {
|
||||
post_data = {
|
||||
data: url_params,
|
||||
session_id: session_id,
|
||||
type_graph_pdf: type_graph_pdf
|
||||
};
|
||||
}
|
||||
|
||||
/* DEBUG
|
||||
page.onAlert = function() {
|
||||
console.log("onAlert");
|
||||
};
|
||||
page.onCallback = function() {
|
||||
console.log("onCallback");
|
||||
};
|
||||
page.onClosing = function() {
|
||||
console.log("onClosing");
|
||||
};
|
||||
page.onConfirm = function() {
|
||||
console.log("onConfirm");
|
||||
};
|
||||
page.onConsoleMessage = function() {
|
||||
console.log("onConsoleMessage");
|
||||
};
|
||||
page.onError = function() {
|
||||
console.log("onError");
|
||||
};
|
||||
page.onFilePicker = function() {
|
||||
console.log("onFilePicker");
|
||||
};
|
||||
page.onInitialized = function() {
|
||||
console.log("onInitialized");
|
||||
};
|
||||
page.onLoadFinished = function() {
|
||||
console.log("onLoadFinished");
|
||||
};
|
||||
page.onLoadStarted = function() {
|
||||
console.log("onLoadStarted");
|
||||
};
|
||||
page.onNavigationRequested = function() {
|
||||
console.log("onNavigationRequested");
|
||||
};
|
||||
page.onPageCreated = function() {
|
||||
console.log("onPageCreated");
|
||||
};
|
||||
page.onPrompt = function() {
|
||||
console.log("onPrompt");
|
||||
};
|
||||
page.onResourceError = function() {
|
||||
console.log("onResourceError");
|
||||
};
|
||||
page.onResourceReceived = function(res) {
|
||||
console.log("onResourceReceived" + ";" + res.url + ";" + res.status);
|
||||
};
|
||||
page.onResourceRequested = function(res) {
|
||||
console.log("onResourceRequested" + ";" + res.url);
|
||||
};
|
||||
page.onResourceTimeout = function() {
|
||||
console.log("onResourceTimeout");
|
||||
};
|
||||
page.onUrlChanged = function(url) {
|
||||
console.log("onUrlChanged" + ";" + url);
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
var page = require("webpage").create();
|
||||
|
||||
page.onResourceError = function(resourceError) {
|
||||
console.log(
|
||||
"Unable to load resource (#" +
|
||||
resourceError.id +
|
||||
"URL:" +
|
||||
resourceError.url +
|
||||
")"
|
||||
);
|
||||
console.log(
|
||||
"Error code: " +
|
||||
resourceError.errorCode +
|
||||
". Description: " +
|
||||
resourceError.errorString
|
||||
);
|
||||
phantom.exit(1);
|
||||
};
|
||||
|
||||
// Not supposed to be prompted messages.
|
||||
page.onPrompt = function() {
|
||||
console.log("Prompt message detected.");
|
||||
phantom.exit(1);
|
||||
};
|
||||
|
||||
page.viewportSize = {
|
||||
width: viewport_width,
|
||||
height: viewport_height
|
||||
};
|
||||
|
||||
page.zoomFactor = 1;
|
||||
|
||||
page.settings.userAgent =
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36";
|
||||
page.settings.resourceTimeout = 120000;
|
||||
page.settings.localToRemoteUrlAccessEnabled = true;
|
||||
|
||||
page.onConsoleMessage = function(msg) {
|
||||
console.log(msg);
|
||||
page.close();
|
||||
phantom.exit();
|
||||
};
|
||||
|
||||
page.onError = function(msg) {
|
||||
console.log(msg);
|
||||
page.close();
|
||||
phantom.exit();
|
||||
};
|
||||
|
||||
page.onCallback = function() {
|
||||
if (!base_64) {
|
||||
page.render(output_filename, { format: "png" });
|
||||
} else {
|
||||
page.settings.loadImages = false;
|
||||
var base64 = page.renderBase64("png");
|
||||
// do not remove this console.output
|
||||
console.log(base64);
|
||||
}
|
||||
phantom.exit();
|
||||
};
|
||||
|
||||
page.open(url, "POST", "data=" + btoa(JSON.stringify(post_data)), function(
|
||||
status
|
||||
) {
|
||||
if (status == "fail") {
|
||||
console.out("Failed to generate chart.");
|
||||
phantom.exit();
|
||||
}
|
||||
});
|
||||
|
||||
phantom.onError = function(msg, trace) {
|
||||
var msgStack = ["PHANTOM ERROR: " + msg];
|
||||
if (trace && trace.length) {
|
||||
msgStack.push("TRACE:");
|
||||
trace.forEach(function(t) {
|
||||
msgStack.push(
|
||||
" -> " +
|
||||
(t.file || t.sourceURL) +
|
||||
": " +
|
||||
t.line +
|
||||
(t.function ? " (in function " + t.function + ")" : "")
|
||||
);
|
||||
});
|
||||
}
|
||||
console.log(msgStack.join("\n"));
|
||||
phantom.exit(1);
|
||||
};
|
|
@ -1393,7 +1393,11 @@ if ($searchPage) {
|
|||
|
||||
case 'External link':
|
||||
$home_url = io_safe_output($home_url);
|
||||
echo '<script type="text/javascript">document.location="'.$home_url.'"</script>';
|
||||
if (strlen($home_url) !== 0) {
|
||||
echo '<script type="text/javascript">document.location="'.$home_url.'"</script>';
|
||||
} else {
|
||||
$_GET['sec2'] = 'general/logon_ok';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -846,17 +846,15 @@ foreach ($agents as $agent) {
|
|||
$data[0] .= '<div class="agentleft_'.$agent['id_agente'].'" style="visibility: hidden; clear: left;">';
|
||||
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=view&id='.$cluster->id()
|
||||
);
|
||||
$data[0] .= '<a href="'.$url.'">'.__('View').'</a>';
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2=';
|
||||
$url .= 'operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=view&id='.$cluster->id()
|
||||
);
|
||||
$data[0] .= '<a href="'.$url.'">'.__('View').'</a>';
|
||||
} else {
|
||||
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'">'.__('View').'</a>';
|
||||
}
|
||||
|
@ -865,17 +863,15 @@ foreach ($agents as $agent) {
|
|||
$data[0] .= ' | ';
|
||||
|
||||
if ($agent['id_os'] == CLUSTER_OS_ID) {
|
||||
if (enterprise_installed()) {
|
||||
$cluster = PandoraFMS\Enterprise\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2='.ENTERPRISE_DIR;
|
||||
$url .= '/operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
$data[0] .= '<a href="'.$url.'">'.__('Edit').'</a>';
|
||||
}
|
||||
$cluster = PandoraFMS\Cluster::loadFromAgentId(
|
||||
$agent['id_agente']
|
||||
);
|
||||
$url = 'index.php?sec=reporting&sec2=';
|
||||
$url .= 'operation/cluster/cluster';
|
||||
$url = ui_get_full_url(
|
||||
$url.'&op=update&id='.$cluster->id()
|
||||
);
|
||||
$data[0] .= '<a href="'.$url.'">'.__('Edit').'</a>';
|
||||
} else {
|
||||
$data[0] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$agent['id_agente'].'">'.__('Edit').'</a>';
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ if ($force_refresh == 1) {
|
|||
db_process_sql('UPDATE tgroup_stat SET utimestamp = 0');
|
||||
}
|
||||
|
||||
$updated_time = '';
|
||||
if ($config['realtimestats'] == 0) {
|
||||
$updated_time = "<a href='index.php?sec=estado&sec2=operation/agentes/tactical&force_refresh=1'>";
|
||||
$updated_time .= __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
|
||||
|
@ -240,13 +241,15 @@ if ($is_admin) {
|
|||
include $config['homedir'].'/godmode/servers/servers.build_table.php';
|
||||
}
|
||||
|
||||
$out = '<table cellpadding=0 cellspacing=0 class="databox pies mrgn_top_15px" width=100%><tr><td>';
|
||||
$out .= '<fieldset class="padding-0 databox tactical_set" id="total_event_graph">
|
||||
<legend>'.__('Event graph').'</legend>'.html_print_image('images/spinner.gif', true, ['id' => 'spinner_total_event_graph']).'</fieldset>';
|
||||
$out .= '</td><td>';
|
||||
$out .= '<fieldset class="padding-0 databox tactical_set" id="graphic_event_group">
|
||||
<legend>'.__('Event graph by agent').'</legend>'.html_print_image('images/spinner.gif', true, ['id' => 'spinner_graphic_event_group']).'</fieldset>';
|
||||
$out .= '</td></tr></table>';
|
||||
$out = '<table cellpadding=0 cellspacing=0 class="databox pies mrgn_top_15px" width=100%><tr><td style="width:50%;">';
|
||||
$out .= '<fieldset class="padding-0 databox tactical_set" id="total_event_graph">';
|
||||
$out .= '<legend>'.__('Event graph').'</legend>';
|
||||
$out .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_total_event_graph']);
|
||||
$out .= '</fieldset>';
|
||||
$out .= '</td><td style="width:50%;">';
|
||||
$out .= '<fieldset class="padding-0 databox tactical_set" id="graphic_event_group">
|
||||
<legend>'.__('Event graph by agent').'</legend>'.html_print_image('images/spinner.gif', true, ['id' => 'spinner_graphic_event_group']).'</fieldset>';
|
||||
$out .= '</td></tr></table>';
|
||||
|
||||
|
||||
ui_toggle(
|
||||
|
|
|
@ -66,6 +66,7 @@ if (is_ajax()) {
|
|||
$agent_alias = get_parameter('alias', '');
|
||||
$agents_inserted = get_parameter('agents_inserted', []);
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$pendingdelete = (bool) get_parameter('pendingdelete');
|
||||
|
||||
$refresh_contact = get_parameter('refresh_contact', 0);
|
||||
|
||||
|
@ -735,6 +736,11 @@ if (is_ajax()) {
|
|||
($sql_tags_join === '') ? 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente' : '',
|
||||
(empty($where_tags)) ? '' : " WHERE 1=1 $where_tags"
|
||||
);
|
||||
if ($pendingdelete == true) {
|
||||
$sql .= sprintf(
|
||||
' AND delete_pending=0'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
|
@ -2063,6 +2069,10 @@ switch ($tab) {
|
|||
// I do not understand, nor do I agree with this operation, but it is what it is.
|
||||
$(document).ready (function () {
|
||||
$('.ehorus_tab').hover(ehorus_tab_show, ehorus_tab_hide);
|
||||
// #9587 Doble find on agent view List modules and list of alerts.
|
||||
$('#button-filter').on('click',function(){
|
||||
search_alerts_status();
|
||||
});
|
||||
});
|
||||
|
||||
function ehorus_tab_show() {
|
||||
|
@ -2074,4 +2084,9 @@ switch ($tab) {
|
|||
$('.subsubmenu').hide("fast");
|
||||
},15000);
|
||||
}
|
||||
|
||||
function search_alerts_status(){
|
||||
$('#text-free_search_alert').val($('#text-status_text_monitor').val());
|
||||
$('#form_alerts_status_datatable_search_bt').trigger('click');
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* Cluster view entrypoint.
|
||||
*
|
||||
* @category View
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org 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;
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use PandoraFMS\ClusterViewer\ClusterManager;
|
||||
|
||||
$ajaxPage = 'operation/cluster/cluster';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$obj = new ClusterManager($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => '[ClusterManager]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[ClusterManager]'.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX controller.
|
||||
if (is_ajax()) {
|
||||
$method = get_parameter('method');
|
||||
|
||||
if (method_exists($obj, $method) === true) {
|
||||
$obj->{$method}();
|
||||
} else {
|
||||
$obj->error('Method not found. [ClusterManager::'.$method.']');
|
||||
}
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$obj->run();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue