fixed conflicts

This commit is contained in:
alejandro.campos@artica.es 2023-01-09 10:49:11 +01:00
commit 5b5694c5f6
791 changed files with 143032 additions and 46860 deletions

View File

@ -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"

View File

@ -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"

View File

@ -18,6 +18,7 @@ WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
@ -271,6 +272,10 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# Chrome
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies
vmware_dependencies=" \

View File

@ -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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.767-221205
Version: 7.0NG.767-230105
Architecture: all
Priority: optional
Section: admin

View File

@ -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-221205"
pandora_version="7.0NG.767-230105"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '221205';
use constant AGENT_BUILD => '230105';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -2403,6 +2403,11 @@ sub check_collections () {
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
$local_collection_md5 = <MD5_FILE>;
close MD5_FILE;
if ( ! defined ($local_collection_md5) ) {
log_message ('Collection', "Size of $ConfDir/collections/$collection_md5_file is 0");
unlink ("$ConfDir/collections/$collection_md5_file");
$local_collection_md5 = "Size 0";
}
} else {
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
next;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.767
%define release 221205
%define release 230105
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.767
%define release 221205
%define release 230105
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.767"
PI_BUILD="221205"
PI_BUILD="230105"
OS_NAME=`uname -s`
FORCE=0

View File

@ -12,32 +12,34 @@
#
###################################################
from sys import argv
from sys import path
from sys import stderr
from sys import exit
from subprocess import Popen
from subprocess import PIPE
from subprocess import DEVNULL
from subprocess import getstatusoutput
import psutil
try:
from sys import argv
from sys import stderr
from sys import exit
from subprocess import Popen
from subprocess import PIPE
from subprocess import DEVNULL
from subprocess import getstatusoutput
import psutil
except ModuleNotFoundError as err:
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
exit(1)
global module_list
module_list = []
version = "1.1"
VERSION = "1.2"
#########################################################################################
# Powershell class
#########################################################################################
class PSCheck:
@staticmethod
@staticmethod
def check_service(servicename, option=False, memcpu=False):
"""Check services with powershell by parsing their DisplayName. Returns a dict\
list with the name of the service and a boolean with its status.\n
list with the name of the service and a boolean with its status.\n
Requires service name (case insensitive)."""
pscall = Popen(["powershell", "Get-Service", "-Name", "'*"+ str(servicename) + "*'",
"|", "Select-Object", "-ExpandProperty", "Name"],
"|", "Select-Object", "-ExpandProperty", "Name"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
result = pscall.communicate()
result = str(result[0]).strip().split("\n")
@ -50,15 +52,15 @@ class PSCheck:
procname = PSCheck.get_serviceprocess(element)
# Get process status
parstatus = PSCheck.getstatus(element)
if memcpu == True and parstatus == 1:
if memcpu and parstatus == 1:
usage = get_memcpu(str(procname), str(element))
output += usage
# Generate module with name and status
parent = service_module(str(element), parstatus)
output += parent
if option == True:
if option:
children = PSCheck.getchildren(element, memcpu)
if type(children) == list and len(children) > 1:
if isinstance(children, list) and len(children) > 1:
for child in children:
output += child
else:
@ -66,7 +68,6 @@ class PSCheck:
else:
next
#if output != '':
if output and element and procname:
return ({"name" : element, "process" : procname, "modules": output})
else:
@ -84,22 +85,22 @@ class PSCheck:
status = PSCheck.getstatus(child)
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
if status:
if memcpu == True:
if memcpu:
kidsusage = get_memcpu(str(child))
for usage in kidsusage:
kids += usage
else:
next
return (kids)
return kids
@staticmethod
def getstatus(servicename):
"""Gets the status of a given Windows service"""
running = Popen(["powershell", "Get-Service", "-Name '" + str(servicename) +
"' |", "Select-Object", "-ExpandProperty", "Status"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
"' |", "Select-Object", "-ExpandProperty", "Status"],
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
status = running.communicate()[0].strip()
return (int(status == "Running"))
return int(status == "Running")
@staticmethod
def get_serviceprocess(servicename):
@ -108,7 +109,7 @@ class PSCheck:
srv_pid = service.pid()
process = psutil.Process(srv_pid)
proc_name = process.name()
return (proc_name)
return proc_name
#########################################################################################
@ -124,13 +125,13 @@ def service_module(name, value, parent=None):
"module_parent" : parent,
}]
#print ("service_module END "+str(now(0,1)))
return (module)
return module
def get_memcpu (process, servicename):
def get_memcpu (process, servicename=None):
"""Creates a module for Memory and CPU for a given process. Returns a list of dictionaries."""
modules = []
if process:
if servicename != None:
if servicename is not None:
parentname = servicename
else:
parentname = process
@ -147,7 +148,7 @@ def get_memcpu (process, servicename):
"unit" : "%",
"module_parent" : "Service "+ parentname + " - Status",
}]
return (modules)
return modules
def proc_percentbyname(procname): ############# 03/03/2020
"""Gets Memory and CPU usage for a given process. Returns a list."""
@ -165,7 +166,7 @@ def proc_percentbyname(procname): ############# 03/03/2020
except psutil.NoSuchProcess:
next
#print ("proc_percentbyname END "+str(now(0,1)))
return ([sum(memory),sum(cpu)])
return [sum(memory),sum(cpu)]
def win_service(servicelist, option=False, memcpu=False):
"""Creates modules for Windows servers."""
@ -173,7 +174,7 @@ def win_service(servicelist, option=False, memcpu=False):
for srvc in servicelist:
if srvc and len(srvc) > 2:
output = PSCheck.check_service(srvc, option, memcpu)
if output != None and output["modules"]:
if output is not None and output["modules"]:
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
module_list.append(srvc)
#winprocess = output["name"]
@ -197,9 +198,9 @@ def lnx_service(services_list, memcpu=False):
if sysctl == 0:
### Systemd available
syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE,
stdin=DEVNULL, universal_newlines=True)
stdin=DEVNULL, universal_newlines=True)
result = syscall.communicate()
srvstatus= result[0].strip().lower().split("\n")
srvstatus = result[0].strip().lower().split("\n")
if srvstatus[0] == "loadstate=not-found":
next
else:
@ -212,7 +213,7 @@ def lnx_service(services_list, memcpu=False):
elif sysctl != 0 and servic == 0:
### Systemd not available, switch to service command
syscall = Popen(["service", srvc, "status"], stdout=PIPE,
stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
result = syscall.communicate()[0].lower()
if "is running" in result:
modules += service_module(srvc, 1)
@ -223,15 +224,15 @@ def lnx_service(services_list, memcpu=False):
else:
next
else:
print ("No systemd or service commands available. Exiting...", file=stderr)
print("No systemd or service commands available. Exiting...", file=stderr)
exit()
if status:
module_list.append(srvc)
if memcpu == True:
if memcpu:
modules += get_memcpu(srvc, None)
for m in modules:
print_module (m, 1)
print_module(m, 1)
#########################################################################################
@ -339,7 +340,7 @@ def print_module(module, str_flag=False):
#### Print flag
if str_flag is not False:
print (module_xml)
print(module_xml)
return (module_xml)
@ -362,7 +363,7 @@ def main():
"postfix", "mysqld", "postgres", "oracle", "mongod"]
discover(OS, service_list)
else:
print ("OS not recognized. Exiting...", file=stderr)
print("OS not recognized. Exiting...", file=stderr)
exit()
def discover(osyst, servicelist):
@ -383,24 +384,24 @@ def discover(osyst, servicelist):
elif osyst == "Linux":
lnx_service(servicelist, memcpu)
else:
print ("\nPandora FMS Autodiscovery plugin v{}".format(version))
print ("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
print ("Usage:")
print ("{} [options] [--usage]".format(argv[0]))
print ("--help")
print ("\tPrints this help screen")
print ("--default")
print ("\tRuns this tool with default monitoring.")
print ("\tServices monitored by default for {}:".format(osyst))
print ("\t",", ".join(servicelist))
print ("--list \"<srvc1,srvc2,srvc3>\"")
print ("\tReplaces default services for a given list (comma-separated)")
print("\nPandora FMS Autodiscovery plugin v{}".format(VERSION))
print("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
print("Usage:")
print("{} [options] [--usage]".format(argv[0]))
print("--help")
print("\tPrints this help screen")
print("--default")
print("\tRuns this tool with default monitoring.")
print("\tServices monitored by default for {}:".format(osyst))
print("\t", ", ".join(servicelist))
print("--list \"<srvc1,srvc2,srvc3>\"")
print("\tReplaces default services for a given list (comma-separated)")
if osyst == "Windows":
print ("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.")
print ("\tElements under 2 characters will be discarded.")
print ("--usage")
print ("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
print("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.")
print("\tElements under 2 characters will be discarded.")
print("--usage")
print("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
##### RUN ####
main()
main()

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{221205}
{230105}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.767 Build 221205")
#define PANDORA_VERSION ("7.0NG.767 Build 230105")
string pandora_path;
string pandora_dir;

View File

@ -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 221205))"
VALUE "ProductVersion", "(7.0NG.767(Build 230105))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.767-221205
Version: 7.0NG.767-230105
Architecture: all
Priority: optional
Section: admin

View File

@ -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-221205"
pandora_version="7.0NG.767-230105"
package_pear=0
package_pandora=1

View File

@ -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": {

View File

@ -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"
}

View File

@ -1666,4 +1666,24 @@ 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
enterprise/include/class/Transactionalmap.class.php
enterprise/include/help/es/help_transactional_map_phases.php
enterprise/include/javascript/transactional/TransactionalController.js
enterprise/include/functions_transactional.php
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

View File

@ -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>

View File

@ -1,46 +0,0 @@
<?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 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;
global $networkmaps_write;
global $networkmaps_manage;
check_login();
ui_require_css_file('first_task');
?>
<?php
ui_print_info_message(['no_close' => true, 'message' => __('There are no transactions defined yet.') ]);
if ($networkmaps_write || $networkmaps_manage) {
?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
<?php
echo __(
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
Transaction graphs represent the different processes within our infrastructure that we use to deliver our service.'
);
?>
</p>
<form action="index.php?sec=network&sec2=enterprise/operation/agentes/manage_transmap_creation&create_transaction=1" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>
</div>
</div>
<?php
}

View File

@ -91,7 +91,7 @@ $login_body_class = '';
// Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
$login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\"";
}
// Support for Internet Explorer and Microsoft Edge browsers

View File

@ -59,6 +59,7 @@ ui_print_warning_message(
]
);
$table = new StdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->data = [];

View File

@ -872,6 +872,35 @@ foreach ($fields as $field) {
true,
true
);
} else if ($field['is_link_enabled']) {
list($link_text, $link_url) = json_decode($custom_value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$link_text = '';
$link_url = '';
}
$data_field[1] = '<span style="line-height: 3.5;">'.__('Link text:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_text,
'class="min-height-30px',
true
);
$data_field[1] .= '<br>';
$data_field[1] .= '<span style="line-height: 3.5;">'.__('Link URL:').'</span>';
$data_field[1] .= '<br>';
$data_field[1] .= html_print_textarea(
'customvalue_'.$field['id_field'].'[]',
2,
65,
$link_url,
'class="min-height-30px',
true
);
} else {
$data_field[1] = html_print_textarea(
'customvalue_'.$field['id_field'],

View File

@ -238,7 +238,15 @@ if ($create_agent) {
$field_values = [];
foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], '');
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
}
// Check if agent exists (BUG WC-50518-2).
@ -999,7 +1007,22 @@ if ($update_agent) {
$field_values = [];
foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], '');
$field_value = get_parameter_post('customvalue_'.$field['id_field'], '');
if ($field['is_link_enabled']) {
if ($field_value[1] !== '') {
$parsed_url = parse_url($field_value[1]);
if (empty($parsed_url['scheme']) === true) {
$field_value[1] = 'http://'.ltrim($field_value[1], '/');
}
}
$field_value = json_encode($field_value);
} else {
$field_value = (string) $field_value;
}
$field_values[$field['id_field']] = $field_value;
}
foreach ($field_values as $key => $value) {
@ -2095,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);
@ -2450,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
/*

View File

@ -30,6 +30,8 @@ $display_on_front = (bool) get_parameter('display_on_front', 0);
$is_password_type = (bool) get_parameter('is_password_type', 0);
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
$combo_values = (string) get_parameter('combo_values', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Header.
if ($id_field) {
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
@ -38,6 +40,7 @@ if ($id_field) {
$is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable'];
$is_link_enabled = $field['is_link_enabled'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
} else {
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
@ -128,6 +131,17 @@ $table->data[4][1] = html_print_textarea(
true
);
$table->data[5][0] = __('Link type');
$table->data[5][1] = html_print_checkbox_switch_extended(
'is_link_enabled',
1,
$is_link_enabled,
false,
'',
'',
true
);
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -167,25 +181,46 @@ $(document).ready (function () {
});
}
if ($('input[type=checkbox][name=is_link_enabled]').is(":checked") === true) {
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else {
$('#configure_field-1').show();
$('#configure_field-3').show();
}
$('input[type=checkbox][name=is_link_enabled]').change(function () {
if( $(this).is(":checked") ){
$('#configure_field-1').hide();
$('#configure_field-3').hide();
} else{
$('#configure_field-1').show();
$('#configure_field-3').show();
}
});
$('input[type=checkbox][name=is_combo_enable]').change(function () {
if( $(this).is(":checked") ){
$('#configure_field-4').show();
dialog_message("#message_no_set_password");
$('#configure_field-1').hide();
$('#configure_field-5').hide();
}
else{
$('#configure_field-4').hide();
$('#configure_field-1').show();
$('#configure_field-5').show();
}
});
$('input[type=checkbox][name=is_password_type]').change(function () {
if( $(this).is(":checked")){
dialog_message("#message_no_set_combo");
$('#configure_field-3').hide();
$('#configure_field-5').hide();
}
else{
$('#configure_field-3').show();
$('#configure_field-5').show();
}
});
});

View File

@ -38,11 +38,12 @@ $display_on_front = (int) get_parameter('display_on_front', 0);
$is_password_type = (int) get_parameter('is_password_type', 0);
$combo_values = (string) get_parameter('combo_values', '');
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
// Create field.
if ($create_field) {
// Check if name field is empty.
if ($name == '') {
if ($name === '') {
ui_print_error_message(__('The name must not be empty'));
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
ui_print_error_message(__('The name must be unique'));
@ -54,6 +55,7 @@ if ($create_field) {
'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type,
'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
]
);
ui_print_success_message(__('Field successfully created'));
@ -63,12 +65,13 @@ if ($create_field) {
// Update field.
if ($update_field) {
// Check if name field is empty.
if ($name != '') {
if ($name !== '') {
$values = [
'name' => $name,
'display_on_front' => $display_on_front,
'is_password_type' => $is_password_type,
'combo_values' => $combo_values,
'is_link_enabled' => $is_link_enabled,
];
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);

View File

@ -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

View File

@ -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);
@ -445,8 +446,6 @@ if ($module_action === 'delete') {
}
} else if ($module_action === 'disable') {
$id_agent_modules_disable = (array) get_parameter('id_delete');
$count_correct_delete_modules = 0;
$updated_count = 0;
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
@ -490,6 +489,52 @@ if ($module_action === 'delete') {
);
}
}
} else if ($module_action === 'enable') {
$id_agent_modules_enable = (array) get_parameter('id_delete');
$updated_count = 0;
foreach ($id_agent_modules_enable as $id_agent_module_enable) {
$sql = sprintf(
'UPDATE tagente_modulo
SET disabled = 0
WHERE id_agente_modulo = %d',
$id_agent_module_enable
);
$id_agent_changed[] = modules_get_agentmodule_agent($id_agent_module_enable);
$agent_update_result = db_process_sql_update(
'tagente',
['update_module_count' => 1],
['id_agente' => $id_agent_changed]
);
if (db_process_sql($sql) !== false && $agent_update_result !== false) {
$updated_count++;
}
}
$count_modules_to_enable = count($id_agent_modules_enable);
if ($updated_count === 0) {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to 0/%d modules.'),
$count_modules_to_enable
)
);
} else {
if ($updated_count == $count_modules_to_enable) {
ui_print_success_message(__('Operation finished successfully.'));
} else {
ui_print_error_message(
sprintf(
__('There was a problem completing the operation. Applied to %d/%d modules.'),
$updated_count,
$count_modules_to_enable
)
);
}
}
}
@ -1274,6 +1319,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
html_print_select(
[
'disable' => 'Disable selected modules',
'enable' => 'Enable selected modules',
'delete' => 'Delete selected modules',
],
'module_action',
@ -1286,6 +1332,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false
);
echo '&nbsp&nbsp&nbsp&nbsp';
html_print_submit_button(
__('Execute action'),
'submit_modules_action',

View File

@ -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);
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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);

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) {
ob_clean();
// Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"');
@ -161,7 +163,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) {
$downtime_items = [];
$downtime_items[] = $downtime_agent[alias];
$downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'),
'csv_export',
false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"'
);
echo '</div>';

View File

@ -40,6 +40,7 @@ $update_command = (bool) get_parameter('update_command');
$create_command = (bool) get_parameter('create_command');
$delete_command = (bool) get_parameter('delete_command');
$copy_command = (bool) get_parameter('copy_command');
$content_type = (string) get_parameter('content_type', 'text/plain');
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands';
@ -226,7 +227,7 @@ if (is_ajax()) {
'field'.$i.'_value',
'text/plain',
'',
'',
$content_type == 'text/plain',
$is_management_allowed,
'',
'',
@ -238,7 +239,7 @@ if (is_ajax()) {
'field'.$i.'_value',
'text/html',
'',
'text/html',
$content_type == 'text/html',
$is_management_allowed,
'',
'',

View File

@ -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') {

View File

@ -353,9 +353,18 @@ if ($delete_action) {
if ($enable_alert) {
$searchFlag = true;
$id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, false);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) {
db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
@ -380,9 +389,18 @@ if ($enable_alert) {
if ($disable_alert) {
$searchFlag = true;
$id_alert = (int) get_parameter('id_alert');
$id_agente = ($id_agente !== 0) ? $id_agente : alerts_get_agent_by_alert($id_alert);
$result = alerts_agent_module_disable($id_alert, true);
if ($id_agente) {
db_process_sql(
'UPDATE tagente
SET update_alert_count = 1
WHERE id_agente = '.$id_agente
);
}
if ($result) {
db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,

View File

@ -66,6 +66,7 @@ if ($id) {
$severity = explode(',', $filter['severity']);
$status = $filter['status'];
$search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$text_module = $filter['text_module'];
@ -73,6 +74,7 @@ if ($id) {
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep'];
$date_from = str_replace('-', '/', $filter['date_from']);
$date_to = str_replace('-', '/', $filter['date_to']);
@ -115,10 +117,12 @@ if ($id) {
$severity = '';
$status = '';
$search = '';
$not_search = 0;
$text_agent = '';
$pagination = '';
$event_view_hr = '';
$id_user_ack = '';
$owner_user = '';
$group_rep = '';
$date_from = '';
$date_to = '';
@ -140,6 +144,7 @@ if ($update || $create) {
$severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', '');
$search = get_parameter('search', '');
$not_search = get_parameter_switch('not_search', 0);
$text_agent = get_parameter('text_agent', '');
$id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', '');
@ -157,6 +162,7 @@ if ($update || $create) {
$pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', '');
@ -185,12 +191,14 @@ if ($update || $create) {
'severity' => $severity,
'status' => $status,
'search' => $search,
'not_search' => $not_search,
'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent,
'pagination' => $pagination,
'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack,
'owner_user' => $owner_user,
'group_rep' => $group_rep,
'tag_with' => $tag_with_json,
'tag_without' => $tag_without_json,
@ -376,6 +384,15 @@ $table->data[6][1] = html_print_input_text(
255,
true
);
$table->data[6][1] .= ' '.html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$table->data[7][0] = '<b>'.__('Agent search').'</b>';
$params = [];
@ -420,7 +437,12 @@ $table->data[9][1] = html_print_input_text(
true
);
$table->data[10][0] = '<b>'.__('User ack.').'</b>'.' '.ui_print_help_tip(__('Choose between the users who have validated an event. '), true);
$table->data[10][0] = '<b>'.__('User ack.').'</b>';
$table->data[10][0] .= ' ';
$table->data[10][0] .= ui_print_help_tip(
__('Choose between the users who have validated an event. '),
true
);
if ($strict_user) {
$users = [$config['id_user'] => $config['id_user']];
@ -442,14 +464,25 @@ $table->data[10][1] = html_print_select(
true
);
$table->data[11][0] = '<b>'.__('Owner.').'</b>';
$table->data[11][1] = html_print_select(
$users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$repeated_sel = [
EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
];
$table->data[11][0] = '<b>'.__('Repeated').'</b>';
$table->data[11][1] = html_print_select(
$table->data[12][0] = '<b>'.__('Repeated').'</b>';
$table->data[12][1] = html_print_select(
$repeated_sel,
'group_rep',
$group_rep,
@ -459,11 +492,11 @@ $table->data[11][1] = html_print_select(
true
);
$table->data[12][0] = '<b>'.__('Date from').'</b>';
$table->data[12][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true);
$table->data[13][0] = '<b>'.__('Date from').'</b>';
$table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true);
$table->data[13][0] = '<b>'.__('Date to').'</b>';
$table->data[13][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true);
$table->data[14][0] = '<b>'.__('Date to').'</b>';
$table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true);
$tag_with = json_decode($tag_with_json_clean, true);
if (empty($tag_with)) {
@ -502,9 +535,9 @@ $remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp);
$table->colspan[14][0] = '2';
$table->data[14][0] = '<b>'.__('Events with following tags').'</b>';
$table->data[15][0] = html_print_select(
$table->colspan[15][0] = '2';
$table->data[15][0] = '<b>'.__('Events with following tags').'</b>';
$table->data[16][0] = html_print_select(
$tags_select_with,
'select_with',
'',
@ -518,7 +551,7 @@ $table->data[15][0] = html_print_select(
false,
'width: 220px;'
);
$table->data[15][1] = html_print_button(
$table->data[16][1] = html_print_button(
__('Add'),
'add_whith',
$add_with_tag_disabled,
@ -527,7 +560,7 @@ $table->data[15][1] = html_print_button(
true
);
$table->data[16][0] = html_print_select(
$table->data[17][0] = html_print_select(
$tag_with_temp,
'tag_with_temp',
[],
@ -541,12 +574,12 @@ $table->data[16][0] = html_print_select(
false,
'width: 220px; height: 50px;'
);
$table->data[16][0] .= html_print_input_hidden(
$table->data[17][0] .= html_print_input_hidden(
'tag_with',
$tag_with_base64,
true
);
$table->data[16][1] = html_print_button(
$table->data[17][1] = html_print_button(
__('Remove'),
'remove_whith',
$remove_with_tag_disabled,
@ -555,9 +588,9 @@ $table->data[16][1] = html_print_button(
true
);
$table->colspan[17][0] = '2';
$table->data[17][0] = '<b>'.__('Events without following tags').'</b>';
$table->data[18][0] = html_print_select(
$table->colspan[18][0] = '2';
$table->data[18][0] = '<b>'.__('Events without following tags').'</b>';
$table->data[19][0] = html_print_select(
$tags_select_without,
'select_without',
'',
@ -571,7 +604,7 @@ $table->data[18][0] = html_print_select(
false,
'width: 220px;'
);
$table->data[18][1] = html_print_button(
$table->data[19][1] = html_print_button(
__('Add'),
'add_whithout',
$add_without_tag_disabled,
@ -580,7 +613,7 @@ $table->data[18][1] = html_print_button(
true
);
$table->data[19][0] = html_print_select(
$table->data[20][0] = html_print_select(
$tag_without_temp,
'tag_without_temp',
[],
@ -594,12 +627,12 @@ $table->data[19][0] = html_print_select(
false,
'width: 220px; height: 50px;'
);
$table->data[19][0] .= html_print_input_hidden(
$table->data[20][0] .= html_print_input_hidden(
'tag_without',
$tag_without_base64,
true
);
$table->data[19][1] = html_print_button(
$table->data[20][1] = html_print_button(
__('Remove'),
'remove_whithout',
$remove_without_tag_disabled,
@ -608,8 +641,8 @@ $table->data[19][1] = html_print_button(
true
);
$table->data[20][0] = '<b>'.__('Alert events').'</b>';
$table->data[20][1] = html_print_select(
$table->data[21][0] = '<b>'.__('Alert events').'</b>';
$table->data[21][1] = html_print_select(
[
'-1' => __('All'),
'0' => __('Filter alert events'),
@ -624,8 +657,8 @@ $table->data[20][1] = html_print_select(
);
if (!is_metaconsole()) {
$table->data[21][0] = '<b>'.__('Module search').'</b>';
$table->data[21][1] .= html_print_autocomplete_modules(
$table->data[22][0] = '<b>'.__('Module search').'</b>';
$table->data[22][1] .= html_print_autocomplete_modules(
'module_search',
$text_module,
false,
@ -637,17 +670,17 @@ if (!is_metaconsole()) {
);
}
$table->data[22][0] = '<b>'.__('Source').'</b>';
$table->data[22][1] = html_print_input_text('source', $source, '', 35, 255, true);
$table->data[23][0] = '<b>'.__('Source').'</b>';
$table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true);
$table->data[23][0] = '<b>'.__('Extra ID').'</b>';
$table->data[23][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$table->data[24][0] = '<b>'.__('Extra ID').'</b>';
$table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$table->data[24][0] = '<b>'.__('Comment').'</b>';
$table->data[24][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[25][0] = '<b>'.__('Comment').'</b>';
$table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true);
$table->data[25][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[25][1] = html_print_select(
$table->data[26][0] = '<b>'.__('Custom data filter type').'</b>';
$table->data[26][1] = html_print_select(
[
'0' => __('Filter custom data by name field'),
'1' => __('Filter custom data by value field'),
@ -660,12 +693,12 @@ $table->data[25][1] = html_print_select(
true
);
$table->data[26][0] = '<b>'.__('Custom data').'</b>';
$table->data[26][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
$table->data[27][0] = '<b>'.__('Custom data').'</b>';
$table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true);
if (is_metaconsole()) {
$table->data[27][0] = '<b>'.__('Id souce event').'</b>';
$table->data[27][1] = html_print_input_text(
$table->data[28][0] = '<b>'.__('Id souce event').'</b>';
$table->data[28][1] = html_print_input_text(
'id_source_event',
$id_source_event,
'',
@ -727,6 +760,14 @@ $(document).ready( function() {
});
function checked_slide_events(element) {
var value = $("#checkbox-"+element.name).val();
if (value == 0) {
$("#checkbox-"+element.name).val(1);
} else {
$("#checkbox-"+element.name).val(0);
}
}
function click_button_remove_tag(what_button) {
if (what_button == "with") {

View File

@ -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').'&nbsp;';
$form .= '<tr><td>'.__('Search').'&nbsp;&nbsp;&nbsp;';
$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>';

View File

@ -181,6 +181,7 @@ if (empty($alert_templates)) {
$alert_templates = '';
}
$table = new stdClass();
$table->id = 'delete_table';
$table->width = '98%';
$table->data = [];

View File

@ -192,6 +192,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true;
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';

View File

@ -249,6 +249,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true;
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';

View File

@ -148,6 +148,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true;
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';

View File

@ -164,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true;
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';

View File

@ -1,4 +1,5 @@
<?php
/**
* Godmode menu.
*
@ -200,14 +201,14 @@ if ($access_console_node === true) {
$sub['gmassive']['type'] = 'direct';
$sub['gmassive']['subtype'] = 'nolink';
$sub2 = [];
$sub2['godmode/massive/massive_operations&amp;tab=massive_agents']['text'] = __('Agents operations');
$sub2['godmode/massive/massive_operations&amp;tab=massive_modules']['text'] = __('Modules operations');
$sub2['godmode/massive/massive_operations&amp;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&amp;tab=massive_users']['text'] = __('Users operations');
$sub2['godmode/massive/massive_operations&tab=massive_users']['text'] = __('Users operations');
}
$sub2['godmode/massive/massive_operations&amp;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');
@ -422,10 +423,10 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
if (is_user_admin($config['id_user']) === true) {
$sub['extensions/db_status']['text'] = __('DB Schema Check');
$sub['extensions/db_status']['id'] = 'DB Schema Check';
$sub['extensions/db_status']['sec'] = 'gbman';
$sub['extensions/db_status']['sec'] = 'gextensions';
$sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface';
$sub['extensions/dbmanager']['sec'] = 'gbman';
$sub['extensions/dbmanager']['sec'] = 'gextensions';
enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu');
}
@ -578,6 +579,14 @@ if ($access_console_node === true) {
}
}
if ($access_console_node === true) {
// About.
$menu_godmode['about']['text'] = __('About');
$menu_godmode['about']['id'] = 'about';
}
if ((bool) $config['pure'] === false) {
menu_print_menu($menu_godmode);
}
echo '<div id="about-div"></div>';

View File

@ -189,6 +189,8 @@ if ($export_profile) {
}
}
// Set cookie for download control.
setDownloadCookieToken();
// Send headers to tell the browser we're sending a file
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
@ -285,7 +287,7 @@ foreach ($result as $row) {
]
);
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data);
}

View File

@ -229,7 +229,8 @@ if ($add_module === true) {
// Safe output remove all entities.
io_safe_output_array($id_modules, '');
$id_modules = array_map(function ($mod) {
$id_modules = array_map(
function ($mod) {
return io_safe_input($mod);
},
$id_modules

View File

@ -169,6 +169,7 @@ $visual_format = 0;
$filter_search = '';
$filter_exclude = '';
$use_prefix_notation = true;
// Added for select fields.
$total_time = true;
@ -461,6 +462,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break;
case 'max_value':
@ -476,6 +478,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break;
case 'min_value':
@ -491,6 +494,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
$use_prefix_notation = $item['use_prefix_notation'];
break;
case 'sumatory':
@ -504,6 +508,7 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
$uncompressed_module = $item['uncompressed_module'];
$use_prefix_notation = $item['use_prefix_notation'];
break;
case 'historical_data':
@ -773,6 +778,7 @@ switch ($action) {
$show_resume = $item['show_resume'];
$show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown'];
$use_prefix_notation = $item['use_prefix_notation'];
$text_agent = '';
if (isset($style['text_agent']) === true
@ -3404,6 +3410,22 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_use_prefix_notation" class="datos advanced_elements">
<td class="bolder">
<?php
echo __('Use prefix notation');
ui_print_help_tip(
__('Use prefix notation for numeric values (example: 20,8Kbytes/sec), otherwise full value will be displayed (example: 20.742 bytes/sec)')
);
?>
</td>
<td>
<?php
html_print_checkbox_switch('use_prefix_notation', 1, $use_prefix_notation);
?>
</td>
</tr>
<tr id="row_uncompressed_module" class="datos">
<td class="bolder">
<?php
@ -6367,6 +6389,7 @@ function chooseType() {
$("#row_show_summary").hide();
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
// SLA list default state.
$("#sla_list").hide();
@ -6561,6 +6584,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'max_value':
@ -6572,6 +6596,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'min_value':
@ -6583,6 +6608,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'sumatory':
@ -6592,6 +6618,7 @@ function chooseType() {
$("#row_period").show();
$("#row_historical_db_check").hide();
$("#row_uncompressed_module").show();
$("#row_use_prefix_notation").show();
break;
case 'historical_data':
@ -6879,6 +6906,7 @@ function chooseType() {
$("#row_show_resume").show();
$("#row_show_graph").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'exception':

View File

@ -1055,7 +1055,7 @@ switch ($action) {
]
);
$data[2] .= '</a>';
$data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">';
$data[3] = '<a onclick="blockResubmit($(this))" href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">';
$data[3] .= html_print_image(
'images/xml.png',
true,
@ -1888,6 +1888,9 @@ switch ($action) {
$values['visual_format'] = get_parameter(
'visual_format'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
@ -1911,6 +1914,9 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'combo_graph_options'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
}
@ -2176,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') {
@ -2704,6 +2712,9 @@ switch ($action) {
$values['visual_format'] = get_parameter(
'visual_format'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
@ -2720,6 +2731,9 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'combo_graph_options'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
}

View File

@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
$data = [];
$data[0] = __('Plug-in parameters');
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>';
if ($locked) {
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
}
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
$table->data['plugin_parameters'] = $data;
$data = [];
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true);
if ($locked) {
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, false, '', "class='command_macro text_input'", true);
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true);
if ($locked) {
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
}
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true);
$table->data['plugin_'.$next_name_number] = $datam;
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
$datam = [];
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : '';
$datam[1] = html_print_textarea(
$macro_help_name,
6,
100,
$macro_help_value,
'class="command_macro" class="w97p"'.$tadisabled,
'class="command_macro" class="w97p"',
true
);
if ($locked) {
$datam[1] .= html_print_image(
'images/lock_mc.png',
true,
['class' => 'command_macro lock invert_filter']
);
}
$datam[1] .= '<br><br><br>';
$table->data['plugin_'.$next_name_number] = $datam;
@ -551,15 +529,16 @@ if (($create != '') || ($view != '')) {
// Add/Delete buttons
$datam = [];
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
if (!$locked) {
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.'&nbsp;'.html_print_image(
'images/add.png',
true,
['class' => 'invert_filter']
).'</a>';
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
$delete_macro_style = '';
if ($i <= 2) {
$delete_macro_style = 'display:none;';
@ -1002,8 +981,11 @@ ui_require_javascript_file('pandora_modules');
});
update_preview();
}
$('a#add_macro_btn').click(add_macro_click_event);
if (locked === 0) {
$('a#add_macro_btn').click(add_macro_click_event);
}
// Delete macro
var delete_macro_click_event = function (event) {
delete_macro_form('table-form-plugin_');
@ -1031,45 +1013,12 @@ ui_require_javascript_file('pandora_modules');
}
}
var command_click_locked_event = function (event) {
var $element = $(this);
if (!$element.is('input') || ($element.is('input') && ($element.prop('readonly') || $element.prop('disabled')))) {
if ($element.prop('id') === 'form_parameters') {
var message = '<?php echo __('Some modules or components are using the plugin'); ?>'
+ '.\n' + '<?php echo __('Are you sure you want to unlock this item?'); ?>';
if (confirm(message)) {
if ($element.is('input')) {
$element
.prop('readonly', false)
.prop('disabled', false)
.siblings('img.command_advanced_conf.lock')
.remove();
}
else {
$element
.siblings('input.command_advanced_conf')
.prop('readonly', false)
.prop('disabled', false)
$element.remove();
}
}
}
else {
alert("<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>");
}
}
}
var macros_click_locked_event = function (event) {
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
}
if (locked) {
$('a#add_macro_btn').click(add_macro_click_locked_event);
$('.command_advanced_conf').click(command_click_locked_event);
$('.command_macro').click(macros_click_locked_event);
}

View File

@ -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();

View File

@ -77,6 +77,7 @@ if (is_ajax()) {
true
).'&nbsp;&nbsp;';
$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.'">';

View File

@ -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,

View File

@ -1312,6 +1312,27 @@ $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_f
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++;
$decimal_separators = [
',' => ',',
'.' => '.'
];
$table_other->data[$row][0] = __('Decimal separator');
$table_other->data[$row][1] = html_print_select(
$decimal_separators,
'decimal_separator',
$config['decimal_separator'],
'',
'',
'',
true,
false,
false
);
$row++;
if ($config['prominent_time'] == 'comparation') {
$timestamp = false;
$comparation = true;

View File

@ -1599,6 +1599,10 @@ $(document).ready (function () {
name: "get_recovery_fields",
value: "0"
});
values.push({
name: "content_type",
value: "<?php echo $al_field4; ?>"
})
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values,
function (data, status) {
@ -1624,8 +1628,9 @@ $(document).ready (function () {
// The row provided has a predefined class. We delete it.
$('#table_macros-field' + i)
.removeAttr('class');
$("[name=field" + i + "_value]").val(old_value).trigger('change');
if(old_value && i != 4){
$("[name=field" + i + "_value]").val(old_value).trigger('change');
}
$('#table_macros-field').show();
}
}

View File

@ -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>

View File

@ -319,6 +319,17 @@ if ($delete_user === true) {
if ($id_user != $config['id_user']) {
$user_row = users_get_user_by_id($id_user);
$private_dashboards = db_get_all_rows_filter(
'tdashboard',
['id_user' => $id_user],
'id'
);
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
header('Refresh:1');
}
$result = delete_user($id_user);
if ($result) {
@ -335,12 +346,16 @@ if ($delete_user === true) {
);
// Delete the user in all the consoles.
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user.
if (isset($private_dashboards) === true) {
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
}
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
@ -367,6 +382,8 @@ if ($delete_user === true) {
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
);
}
header('Refresh:1');
}
} else {
ui_print_error_message(__('There was a problem deleting the user'));

View File

@ -1450,17 +1450,17 @@ class DiscoveryTaskList extends HTML
// Header information.
if ((int) $task['status'] <= 0 && empty($summary)) {
if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) {
$outputMessage = __('Task completed.');
if ((int) $task['utimestamp'] !== 0) {
$output .= $this->progressTaskGraph($task);
} else {
$outputMessage = __('This task has never executed');
}
$output .= ui_print_info_message(
$outputMessage,
'',
true
);
$output .= ui_print_info_message(
$outputMessage,
'',
true
);
}
} else if ($task['status'] == 1
|| ($task['utimestamp'] == 0 && $task['interval_sweep'])
) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -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);
}
}

View File

@ -429,7 +429,9 @@ if (check_login()) {
$table_modules->data[$key][1] = remove_right_zeros(
number_format(
$value['datos'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
} else {

View File

@ -59,6 +59,7 @@ $drawConsoleSound = (bool) get_parameter('drawConsoleSound', false);
$process_buffers = (bool) get_parameter('process_buffers', false);
$get_extended_event = (bool) get_parameter('get_extended_event');
$change_status = (bool) get_parameter('change_status');
$get_Acknowledged = (bool) get_parameter('get_Acknowledged');
$change_owner = (bool) get_parameter('change_owner');
$add_comment = (bool) get_parameter('add_comment');
$dialogue_event_response = (bool) get_parameter('dialogue_event_response');
@ -351,12 +352,14 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter(
@ -409,12 +412,14 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack');
$values['owner_user'] = get_parameter('owner_user');
$values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter(
@ -481,6 +486,7 @@ if ($get_filter_values) {
'user_comment' => '',
'id_extra' => '',
'id_user_ack' => '',
'owner_user' => '',
'date_from' => '',
'time_from' => '',
'date_to' => '',
@ -642,6 +648,8 @@ function load_form_filter() {
$("#status").val(val);
if (i == 'search')
$('#text-search').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent')
$('input[name=text_agent]').val(val);
if (i == 'id_agent')
@ -654,6 +662,8 @@ function load_form_filter() {
$("#text-event_view_hr").val(val);
if (i == 'id_user_ack')
$("#id_user_ack").val(val);
if (i == 'owner_user')
$("#owner_user").val(val);
if (i == 'group_rep')
$("#group_rep").val(val);
if (i == 'tag_with')
@ -898,12 +908,14 @@ function save_new_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(),
"tag_with": Base64.decode($("#hidden-tag_with").val()),
"tag_without": Base64.decode($("#hidden-tag_without").val()),
@ -975,12 +987,14 @@ function save_update_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(),
"owner_user" : $("#owner_user").val(),
"group_rep" : $("#group_rep").val(),
"tag_with" : Base64.decode($("#hidden-tag_with").val()),
"tag_without" : Base64.decode($("#hidden-tag_without").val()),
@ -1500,6 +1514,12 @@ if ($change_status === true) {
return;
}
if ($get_Acknowledged === true) {
$event_id = get_parameter('event_id');
echo events_page_general_acknowledged($event_id);
return;
}
if ($change_owner === true) {
$new_owner = get_parameter('new_owner', '');
$event_id = (int) get_parameter('event_id', 0);
@ -2018,8 +2038,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;
}
@ -2028,8 +2050,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;
}
@ -2270,7 +2294,7 @@ if ($drawConsoleSound === true) {
],
],
[
'label' => __('Time Sound'),
'label' => __('Sound duration'),
'arguments' => [
'type' => 'select',
'fields' => $times_sound,
@ -2417,6 +2441,7 @@ if ($get_events_fired) {
'severity' => -1,
'status' => -1,
'search' => '',
'not_search' => 0,
'text_agent' => '',
'id_agent' => 0,
'id_agent_module' => 0,

View File

@ -26,6 +26,8 @@
* ============================================================================
*/
use PandoraFMS\Enterprise\Metaconsole\Node;
// Begin.
if (check_login()) {
global $config;
@ -59,6 +61,11 @@ if (check_login()) {
0
);
$get_data_dataMatrix = (bool) get_parameter(
'get_data_dataMatrix',
0
);
if ($get_agent_modules_json_by_name === true) {
$agent_name = get_parameter('agent_name');
@ -499,7 +506,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
}
@ -507,7 +516,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
}
@ -524,7 +535,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
}
@ -1430,4 +1443,190 @@ if (check_login()) {
return;
}
if ($get_data_dataMatrix === true) {
global $config;
$table_id = get_parameter('table_id', '');
$modules = json_decode(
io_safe_output(
get_parameter('modules', '')
),
true
);
$period = get_parameter('period', 0);
$slice = get_parameter('slice', 0);
// Datatables offset, limit.
$start = get_parameter('start', 0);
$formatData = (bool) get_parameter('formatData', 0);
$length = get_parameter(
'length',
$config['block_size']
);
$order = get_datatable_order(true);
// Total time per page.
$time_all_box = ($length * $slice);
// Total number of boxes.
$total_box = ceil($period / $slice);
if ($start > 0) {
$start = ($start / $length);
}
// Uncompress.
try {
ob_start();
$dateNow = get_system_time();
$final = ($dateNow - $period);
$date = ($dateNow - ($time_all_box * $start));
if (($date - $time_all_box) > $final) {
$datelimit = ($date - $time_all_box);
} else {
$datelimit = $final;
}
foreach ($modules as $key => $value) {
if (is_metaconsole() === true) {
try {
$node = new Node((int) $value['id_node']);
$node->connect();
} catch (\Exception $e) {
// Unexistent agent.
$node->disconnect();
}
}
$value['thresholds'] = [
'min_critical' => (empty($value['c_min']) === true) ? null : $value['c_min'],
'max_critical' => (empty($value['c_max']) === true) ? null : $value['c_max'],
'min_warning' => (empty($value['w_min']) === true) ? null : $value['w_min'],
'max_warning' => (empty($value['w_max']) === true) ? null : $value['w_max'],
];
$module_data = db_uncompress_module_data(
$value['id'],
$datelimit,
$date,
$slice,
true
);
$uncompressData[] = array_reduce(
$module_data,
function ($carry, $item) use ($value, $config, $formatData) {
// Last value.
$vdata = null;
if (is_array($item['data']) === true) {
foreach ($item['data'] as $v) {
$vdata = $v['datos'];
}
}
$status = get_status_data_modules(
$value['id'],
$vdata,
$value['thresholds']
);
$resultData = '<span style="color:'.$status['color'].'">';
if ($vdata !== null && $vdata !== '' && $vdata !== false) {
if (isset($formatData) === true
&& (bool) $formatData === true
) {
$resultData .= format_for_graph(
$vdata,
$config['graph_precision']
);
} else {
$resultData .= sla_truncate(
$vdata,
$config['graph_precision']
);
}
$resultData .= ' '.$value['unit'];
} else {
$resultData .= '--';
}
$resultData .= '</span>';
$carry[] = [
'utimestamp' => $item['utimestamp'],
'Column-'.$value['id'] => $resultData,
];
return $carry;
},
[]
);
if (is_metaconsole() === true) {
$node->disconnect();
}
}
if (empty($uncompressData) === false) {
$data = array_reduce(
$uncompressData,
function ($carry, $item) {
foreach ($item as $data_module) {
foreach ($data_module as $key => $value) {
if ($key === 'utimestamp') {
$carry[$data_module['utimestamp']]['date'] = date('Y-m-d H:i', (int) $value);
} else {
$carry[$data_module['utimestamp']][$key] = $value;
}
}
}
return $carry;
}
);
}
if (empty($data) === false) {
$data = array_reverse(array_values($data));
} else {
$data = [];
}
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $total_box,
'recordsFiltered' => $total_box,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
return;
}
}

View File

@ -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;
}

View File

@ -148,75 +148,37 @@ function process_user_login_local($login, $pass, $api=false)
{
global $config, $mysql_cache;
// Connect to Database
switch ($config['dbtype']) {
case 'mysql':
if (!$api) {
$sql = sprintf(
"SELECT `id_user`, `password`
FROM `tusuario`
WHERE `id_user` = '%s' AND `not_login` = 0
AND `disabled` = 0",
$login
);
} else {
$sql = sprintf(
"SELECT `id_user`, `password`
FROM `tusuario`
WHERE `id_user` = '%s'
AND `disabled` = 0",
$login
);
}
break;
case 'postgresql':
if (!$api) {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\' AND "not_login" = 0
AND "disabled" = 0',
$login
);
} else {
$sql = sprintf(
'SELECT "id_user", "password"
FROM "tusuario"
WHERE "id_user" = \'%s\'
AND "disabled" = 0',
$login
);
}
break;
case 'oracle':
if (!$api) {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\' AND not_login = 0
AND disabled = 0',
$login
);
} else {
$sql = sprintf(
'SELECT id_user, password
FROM tusuario
WHERE id_user = \'%s\'
AND disabled = 0',
$login
);
}
break;
// Connect to Database.
if (!$api) {
$sql = sprintf(
"SELECT `id_user`, `password`
FROM `tusuario`
WHERE `id_user` = '%s' AND `not_login` = 0
AND `disabled` = 0",
$login
);
} else {
$sql = sprintf(
"SELECT `id_user`, `password`
FROM `tusuario`
WHERE `id_user` = '%s'
AND `disabled` = 0",
$login
);
}
$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('')
&& $row['password'] == md5($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)
@ -231,6 +193,11 @@ function process_user_login_local($login, $pass, $api=false)
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)) {
@ -655,8 +622,16 @@ function process_user_contact(string $id_user)
function create_user($id_user, $password, $user_info)
{
$values = $user_info;
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['id_user'] = $id_user;
$values['password'] = md5($password);
$values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
$values['last_connect'] = 0;
$values['registered'] = get_system_time();
@ -747,7 +722,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.
@ -764,9 +739,19 @@ function update_user_password(string $user, string $password_new)
return false;
}
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
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 = '%s', last_pass_change = '%s' WHERE id_user = '%s'",
($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
date('Y-m-d H:i:s', get_system_time()),
$user
);
$connection = mysql_connect_db(
@ -786,7 +771,7 @@ function update_user_password(string $user, string $password_new)
return db_process_sql_update(
'tusuario',
[
'password' => md5($password_new),
'password' => ($column_type === false) ? md5($password_new) : password_hash($password_new, PASSWORD_BCRYPT),
'last_pass_change' => date('Y/m/d H:i:s', get_system_time()),
],
['id_user' => $user]
@ -1050,7 +1035,14 @@ function create_user_and_permisions_ldap(
$values['id_user'] = $id_user;
if ($config['ldap_save_password'] || $config['ad_save_password']) {
$values['password'] = md5($password);
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values['password'] = ($column_type === false) ? md5($password) : password_hash($password, PASSWORD_BCRYPT);
}
$values['last_connect'] = 0;
@ -1482,11 +1474,26 @@ 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) {
$values_update = [];
$values_update['password'] = md5($password);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
$column_type = db_get_column_type('tusuario', 'password');
if (empty($column_type) === false && isset($column_type[0]['COLUMN_TYPE'])) {
$column_type = ($column_type[0]['COLUMN_TYPE'] === 'varchar(60)');
} else {
$column_type = false;
}
$values_update = [];
if ($column_type === false) {
if (md5($password) !== $local_user_pass) {
$values_update['password'] = md5($password);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
}
} else {
if (password_hash($password, PASSWORD_BCRYPT) !== $local_user_pass) {
$values_update['password'] = password_hash($password, PASSWORD_BCRYPT);
$return = db_process_sql_update('tusuario', $values_update, ['id_user' => $id_user]);
}
}
return $return;

View File

@ -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>

View File

@ -2636,6 +2636,8 @@ class AgentWizard extends HTML
*/
private function resultsInterfaceWizard()
{
global $config;
$generalInterfaceModules = $this->getInterfacesModules();
$generalInterfaceTables = [];
$generalInterfaceModulesUpdated = [];
@ -2849,7 +2851,12 @@ class AgentWizard extends HTML
// Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) {
$decimals = (is_float($currentValue) === true) ? 2 : 0;
$currentValue = number_format($currentValue, $decimals);
$currentValue = number_format(
$currentValue,
$decimals,
$config['decimal_separator'],
$config['thousand_separator']
);
}
// It unit of measure have data, attach to current value.

View File

@ -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.

View File

@ -141,8 +141,9 @@ class Diagnostics extends Wizard
'images/pdf.png',
true,
[
'title' => __('Export to PDF'),
'class' => 'invert_filter',
'title' => __('Export to PDF'),
'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
]
);
$header_buttons = [
@ -986,7 +987,7 @@ class Diagnostics extends Wizard
],
'tablesFragmentationValue' => [
'name' => __('Tables fragmentation (current value)'),
'value' => number_format($tFragmentationValue, 2).'%',
'value' => number_format($tFragmentationValue, 2, $config['decimal_separator'], $config['thousand_separator']).'%',
],
'tablesFragmentationStatus' => [
'name' => __('Table fragmentation status'),
@ -1121,7 +1122,9 @@ class Diagnostics extends Wizard
if ($totalModuleIntervalTime !== false) {
$averageTime = number_format(
((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
3
3,
$config['decimal_separator'],
$config['thousand_separator']
);
}
@ -1748,7 +1751,7 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
$value = number_format(($fileSize / $mega), 3);
$value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs');
$status = 0;
if ($sizeServerLog <= $tenMega) {

View File

@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
header('Pragma: no-cache');
header('Expires: 0');
setDownloadCookieToken();
// Clean up output buffering
while (@ob_end_clean()) {
@ -931,7 +932,7 @@ class ModuleTemplates extends HTML
]
);
$data[3] = '<a href="'.$this->baseUrl.'&action=delete&id_np='.$row['id_np'].'" onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="'.$this->baseUrl.'&action=export&id_np='.$row['id_np'].'" onclick="blockResubmit($(this))">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data);
}

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC221205';
$build_version = 'PC230105';
$pandora_version = 'v7.0NG.767';
// Do not overwrite default timezone set if defined.

View File

@ -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));

View File

@ -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';
@ -219,6 +223,8 @@ function list_files($directory, $stringSearch, $searchHandler, $return=false)
*/
function format_numeric($number, $decimals=1)
{
global $config;
// Translate to float in case there are characters in the string so
// fmod doesn't throw a notice
$number = (float) $number;
@ -227,17 +233,11 @@ function format_numeric($number, $decimals=1)
return 0;
}
// Translators: This is separator of decimal point
$dec_point = __('.');
// Translators: This is separator of decimal point
$thousands_sep = __(',');
// If has decimals
if (fmod($number, 1) > 0) {
return number_format($number, $decimals, $dec_point, $thousands_sep);
return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']);
}
return number_format($number, 0, $dec_point, $thousands_sep);
return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']);
}
@ -967,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;
}
@ -1007,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.
*
@ -2104,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'])) {
@ -4084,14 +4106,18 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['min'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
$data_return['legend'][$key] .= ' '.__('Max:');
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['max'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
$data_return['legend'][$key] .= ' '._('Avg:');
@ -4099,7 +4125,8 @@ function series_type_graph_array($data, $show_elements_graph)
number_format(
$value['avg'],
$config['graph_precision'],
$config['csv_decimal_separator']
$config['decimal_separator'],
$config['thousand_separator']
)
).' '.$str;
}
@ -4156,7 +4183,9 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['data'][0][1],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
).' '.$str;
}
@ -4209,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';
@ -4218,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();
}
}
@ -6269,3 +6321,24 @@ function arrayOutputSorting($sort, $sortField)
}
};
}
/**
* Get dowload started cookie from js and set ready cokkie for download ready comntrol.
*
* @return
*/
function setDownloadCookieToken()
{
$download_cookie = get_cookie('downloadToken', false);
if ($download_cookie === false) {
return;
} else {
setcookie(
'downloadReady',
$download_cookie,
(time() + 15),
'/'
);
}
}

View File

@ -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) {
@ -2824,6 +2828,25 @@ function alerts_get_agent_modules(
}
/**
* Return the id_agent of the alert
*
* @param integer $id_agent_module
* @return integer id_agent
*/
function alerts_get_agent_by_alert($id_agent_module)
{
$sql = sprintf(
'SELECT id_agente FROM talert_template_modules atm INNER JOIN tagente_modulo am ON am.id_agente_modulo = atm.id_agent_module WHERE atm.id = %d
',
$id_agent_module
);
$id_agente = db_get_row_sql($sql)['id_agente'];
return $id_agente;
}
function alerts_get_actions_names($actions, $reduce=false)
{
$where = '';

View File

@ -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;
@ -604,95 +604,6 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT
}
/*
DB column mapping table used by tree_agents (and get module_properties)
*/
/*
* Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
'agent_last_contant' => 'ultimo_contacto as agent_last_contant',
'agent_mode' => 'modo as agent_mode',
'agent_interval' => 'intervalo as agent_interval',
'agent_id_os' => 'id_os as agent_id_os',
'agent_os_version' => 'os_version as agent_os_version',
'agent_version' => 'agent_version as agent_version',
'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact',
'agent_disabled' => 'disabled as agent_disabled',
'agent_id_parent' => 'id_parent as agent_id_parent',
'agent_custom_id' => 'custom_id as agent_custom_id',
'agent_server_name' => 'server_name as agent_server_name',
'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection',
'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module',
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
// module_id_agent_modulo is not in this list
$module_field_column_mampping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_user' => 'plugin_user as module_plugin_user',
'module_plugin_pass' => 'plugin_pass as module_plugin_pass',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_plugin_macros' => 'macros as module_plugin_macros',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
/***
* end of DB column mapping table
***/
@ -806,9 +717,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
'module_id_module',
'module_disabled',
'module_id_export',
'module_plugin_user',
'module_plugin_pass',
'module_plugin_parameter',
'module_plugin_pass',
'module_plugin_user',
'module_id_plugin',
'module_post_process',
'module_prediction_module',
@ -897,14 +808,88 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
'alert_actions_id_group',
];
// agent related field mappings (output field => column designation for 'tagente')
global $agent_field_column_mapping;
/*
* Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
'agent_last_contant' => 'ultimo_contacto as agent_last_contant',
'agent_mode' => 'modo as agent_mode',
'agent_interval' => 'intervalo as agent_interval',
'agent_id_os' => 'id_os as agent_id_os',
'agent_os_version' => 'os_version as agent_os_version',
'agent_version' => 'agent_version as agent_version',
'agent_last_remote_contact' => 'ultimo_contacto_remoto as agent_last_remote_contact',
'agent_disabled' => 'disabled as agent_disabled',
'agent_id_parent' => 'id_parent as agent_id_parent',
'agent_custom_id' => 'custom_id as agent_custom_id',
'agent_server_name' => 'server_name as agent_server_name',
'agent_cascade_protection' => 'cascade_protection as agent_cascade_protection',
'agent_cascade_protection_module' => 'cascade_protection_module as agent_cascade_protection_module',
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
global $module_field_column_mampping;
// module_id_agent_modulo is not in this list
// module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes.
$module_field_column_mapping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
global $estado_fields_to_columns_mapping;
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
// alert related field mappings (output field => column for 'talert_template_modules', ... )
$alert_fields_to_columns_mapping = [
@ -985,8 +970,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$agent_additional_columns .= (', '.$agent_field_column_mapping[$fld] );
}
if (array_key_exists($fld, $module_field_column_mampping)) {
$module_additional_columns .= (', '.$module_field_column_mampping[$fld]);
if (array_key_exists($fld, $module_field_column_mapping)) {
$module_additional_columns .= (', '.$module_field_column_mapping[$fld]);
}
if (array_key_exists($fld, $estado_fields_to_columns_mapping)) {
@ -1016,9 +1001,13 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$groups = [];
}
$groups = str_replace('\n', $returnReplace, $groups);
foreach ($groups as &$group) {
if (check_acl($config['id_user'], $group['group_id'], 'AR') === false) {
continue;
}
$group = str_replace('\n', $returnReplace, $group);
$group['type_row'] = 'group';
$returnVar[] = $group;
@ -1034,9 +1023,23 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$agents = [];
}
$agents = str_replace('\n', $returnReplace, $agents);
if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true) {
if (array_search('module_plugin_user', $fields) !== false) {
$module_additional_columns .= ' ,plugin_user as module_plugin_user';
}
if (array_search('module_plugin_pass', $fields) !== false) {
$module_additional_columns .= ' ,plugin_pass as module_plugin_pass';
}
if (array_search('module_plugin_macros', $fields) !== false) {
$module_additional_columns .= ' ,macros as module_plugin_macros';
}
}
foreach ($agents as $index => &$agent) {
$agent = str_replace('\n', $returnReplace, $agent);
$agent['type_row'] = 'agent';
$returnVar[] = $agent;
@ -1048,24 +1051,26 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
// SKIP collecting MODULES and ALERTS
}
$sql = 'SELECT *
FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.'
FROM tagente_modulo t1
WHERE id_agente = '.$agent['agent_id'].') t1
INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.'
FROM tagente_estado
WHERE id_agente = '.$agent['agent_id'].') t2
ON t1.module_id_agent_modulo = t2.module_id_agent_modulo';
$modules = db_get_all_rows_sql(
'SELECT *
FROM (SELECT id_agente_modulo as module_id_agent_modulo '.$module_additional_columns.'
FROM tagente_modulo
WHERE id_agente = '.$agent['agent_id'].') t1
INNER JOIN (SELECT id_agente_modulo as module_id_agent_modulo '.$estado_additional_columns.'
FROM tagente_estado
WHERE id_agente = '.$agent['agent_id'].') t2
ON t1.module_id_agent_modulo = t2.module_id_agent_modulo'
$sql
);
if ($modules === false) {
$modules = [];
}
$modules = str_replace('\n', $returnReplace, $modules);
foreach ($modules as &$module) {
$module = str_replace('\n', $returnReplace, $module);
$module['type_row'] = 'module';
if ($module['module_macros']) {
@ -1097,9 +1102,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$alerts = [];
}
$alerts = str_replace('\n', $returnReplace, $alerts);
foreach ($alerts as &$alert) {
$alert = str_replace('\n', $returnReplace, $alert);
$alert['type_row'] = 'alert';
$returnVar[] = $alert;
}
@ -1366,10 +1370,66 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
global $module_field_column_mampping;
// module_id_agent_modulo is not in this list
// module_plugin_user, module_plugin_pass, module_plugin_macros are not in this list due to security purposes.
$module_field_column_mapping = [
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
'module_name' => 'nombre as module_name',
'module_max' => 'max as module_max',
'module_min' => 'min as module_min',
'module_interval' => 'module_interval',
'module_tcp_port' => 'tcp_port as module_tcp_port',
'module_tcp_send' => 'tcp_send as module_tcp_send',
'module_tcp_rcv' => 'tcp_rcv as module_tcp_rcv',
'module_snmp_community' => 'snmp_community as module_snmp_community',
'module_snmp_oid' => 'snmp_oid as module_snmp_oid',
'module_ip_target' => 'ip_target as module_ip_target',
'module_id_module_group' => 'id_module_group as module_id_module_group',
'module_flag' => 'flag as module_flag',
'module_id_module' => 'id_modulo as module_id_module',
'module_disabled' => 'disabled as module_disabled',
'module_id_export' => 'id_export as module_id_export',
'module_plugin_parameter' => 'plugin_parameter as module_plugin_parameter',
'module_plugin_user' => 'plugin_user as module_plugin_user',
'module_plugin_pass' => 'plugin_pass as module_plugin_pass',
'module_plugin_macros' => 'macros as module_plugin_macros',
'module_id_plugin' => 'id_plugin as module_id_plugin',
'module_post_process' => 'post_process as module_post_process',
'module_prediction_module' => 'prediction_module as module_prediction_module',
'module_max_timeout' => 'max_timeout as module_max_timeout',
'module_max_retries' => 'max_retries as module_max_retries',
'module_custom_id' => 'custom_id as module_custom_id',
'module_history_data' => 'history_data as module_history_data',
'module_min_warning' => 'min_warning as module_min_warning',
'module_max_warning' => 'max_warning as module_max_warning',
'module_str_warning' => 'str_warning as module_str_warning',
'module_min_critical' => 'min_critical as module_min_critical',
'module_max_critical' => 'max_critical as module_max_critical',
'module_str_critical' => 'str_critical as module_str_critical',
'module_min_ff_event' => 'min_ff_event as module_min_ff_event',
'module_delete_pending' => 'delete_pending as module_delete_pending',
'module_macros' => 'module_macros as module_macros',
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
global $estado_fields_to_columns_mapping;
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
'module_state' => 'estado as module_state',
'module_last_try' => 'last_try as module_last_try',
'module_utimestamp' => 'utimestamp as module_utimestamp',
'module_current_interval' => 'current_interval as module_current_interval',
'module_running_by' => 'running_by as module_running_by',
'module_last_execution_try' => 'last_execution_try as module_last_execution_try',
'module_status_changes' => 'status_changes as module_status_changes',
'module_last_status' => 'last_status as module_last_status',
];
if ($fields == false) {
$fields = $module_properties_master_fields;
@ -1379,8 +1439,8 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
$module_additional_columns = '';
$estado_additional_columns = '';
foreach ($fields as $fld) {
if (array_key_exists($fld, $module_field_column_mampping)) {
$module_additional_columns .= (', '.$module_field_column_mampping[$fld]);
if (array_key_exists($fld, $module_field_column_mapping)) {
$module_additional_columns .= (', '.$module_field_column_mapping[$fld]);
}
if (array_key_exists($fld, $estado_fields_to_columns_mapping)) {
@ -1405,9 +1465,9 @@ function get_module_properties($id_module, $fields, $separator, $returnType, $re
$modules = [];
}
$modules = str_replace('\n', $returnReplace, $modules);
foreach ($modules as &$module) {
$module = str_replace('\n', $returnReplace, $module);
$module['type_row'] = 'module';
if ($module['module_macros']) {
@ -3588,6 +3648,19 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
// Column 'module_macros' cannot be null.
}
$type_exist = db_get_value_filter(
'id_tipo',
'ttipo_modulo',
[
'id_tipo' => $values['id_tipo_modulo'],
]
);
if ((bool) $type_exist === false) {
returnError('Module type does not exist');
return;
}
if ($agent_by_alias) {
$agents_affected = 0;
$idModule = false;
@ -7436,7 +7509,7 @@ function api_set_planned_downtimes_additem($id, $thrash1, $other, $thrash3)
$bad_agents = [];
$i = 0;
foreach ($total_agents as $agent_id) {
$result_agent = agents_check_access_agent($agent_id, 'AD');
$result_agent = agents_check_access_agent($agent_id, 'AR');
if (!$result_agent) {
$bad_agents[] = $agent_id;
unset($agents[$i]);
@ -9528,6 +9601,7 @@ function api_set_new_user($id, $thrash2, $other, $thrash3)
$values['default_event_filter'] = $other['data'][10];
$values['section'] = $other['data'][11];
$values['session_time'] = $other['data'][12];
$values['metaconsole_access_node'] = $other['data'][13];
if (empty($password) === true) {
returnError('Password cannot be empty.');
@ -10084,6 +10158,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;
@ -10109,6 +10185,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;
@ -16917,6 +16995,32 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
];
$group_exist = db_get_value_filter(
'id_grupo',
'tgrupo',
[
'id_grupo' => $values['id_grupo'],
]
);
if ((bool) $group_exist === false) {
returnError('Selected group does not exist');
return;
}
$profile_exist = db_get_value_filter(
'id_perfil',
'tperfil',
[
'id_perfil' => $values['id_perfil'],
]
);
if ((bool) $profile_exist === false) {
returnError('Selected profile does not exist');
return;
}
$where_id_up = ['id_up' => $other['data'][4]];
if ($exist_profile === $other['data'][4] && $where_id_up !== null) {
$sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up);

View File

@ -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':
@ -1475,6 +1465,15 @@ function config_update_config()
if (config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'), true) === false) {
$error_update[] = __('Use data multiplier');
}
if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) {
$error_update[] = __('Decimal separator');
} else {
$thousand_separator = ((string) get_parameter('decimal_separator', '.') === '.') ? ',' : '.';
if (config_update_value('thousand_separator', $thousand_separator, true) === false) {
$error_update[] = __('Thousand separator');
}
}
break;
case 'net':
@ -1966,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'])) {
@ -3446,7 +3440,7 @@ function config_process_config()
}
if (!isset($config['ehorus_port'])) {
config_update_value('ehorus_port', 18080);
config_update_value('ehorus_port', 443);
}
if (!isset($config['ehorus_req_timeout'])) {
@ -3479,6 +3473,10 @@ function config_process_config()
config_update_value('module_library_password', '');
}
if (!isset($config['decimal_separator'])) {
config_update_value('decimal_separator', '.');
}
// Finally, check if any value was overwritten in a form.
config_update_config();
}

View File

@ -757,7 +757,8 @@ function db_uncompress_module_data(
$id_agente_modulo,
$tstart=false,
$tend=false,
$slice_size=false
$slice_size=false,
$force_slice_not_data=false
) {
global $config;
@ -860,7 +861,10 @@ function db_uncompress_module_data(
$module_interval = modules_get_interval($id_agente_modulo);
if (($raw_data === false) && ( $first_utimestamp === false )) {
if (($force_slice_not_data === false)
&& ($raw_data === false)
&& ( $first_utimestamp === false )
) {
// No data.
return false;
}
@ -2313,7 +2317,13 @@ function db_get_lock(string $lockname, int $expiration_time=86400) :?int
}
if ($lock_status === false) {
return null;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'Issue in Database Lock',
'system'
);
return (int) null;
}
return (int) $lock_status;
@ -2520,3 +2530,28 @@ function db_unlock_tables()
return $result;
}
/**
* Get column type. Example: 'varchar(60)'.
*
* @param string $table Table name.
* @param string $column Column name.
*
* @return array|boolean
*/
function db_get_column_type(string $table, string $column='')
{
$sql = sprintf(
'SELECT column_type FROM information_schema.columns WHERE table_name = "%s"',
$table
);
if (empty($column) === false) {
$sql .= sprintf(' AND column_name="%s"', $column);
}
$result = db_process_sql($sql);
return $result;
}

View File

@ -640,11 +640,13 @@ function events_update_status($id_evento, $status, $filter=null)
* 'status'
* 'agent_alias'
* 'search'
* 'not_search'
* 'id_extra'
* 'id_source_event'
* 'user_comment'
* 'source'
* 'id_user_ack'
* 'owner_user'
* 'tag_with'
* 'tag_without'
* 'filter_only_alert'
@ -1058,16 +1060,40 @@ function events_get_all(
$custom_data_search = 'te.custom_data';
}
$sql_filters[] = vsprintf(
' AND (lower(ta.alias) like lower("%%%s%%")
OR te.id_evento like "%%%s%%"
OR lower(te.evento) like lower("%%%s%%")
OR lower(te.user_comment) like lower("%%%s%%")
OR lower(te.id_extra) like lower("%%%s%%")
OR lower(te.source) like lower("%%%s%%")
OR lower('.$custom_data_search.') like lower("%%%s%%") )',
array_fill(0, 7, $filter['search'])
);
$not_search = '';
$nexo = 'OR';
$array_search = [
'te.id_evento',
'lower(te.evento)',
'lower(te.user_comment)',
'lower(te.id_extra)',
'lower(te.source)',
'lower('.$custom_data_search.')',
];
if (isset($filter['not_search']) === true
&& empty($filter['not_search']) === false
) {
$not_search = 'NOT';
$nexo = 'AND';
} else {
$array_search[] = 'lower(ta.alias)';
}
$sql_search = ' AND (';
foreach ($array_search as $key => $field) {
$sql_search .= sprintf(
'%s %s %s like lower("%%%s%%")',
($key === 0) ? '' : $nexo,
$field,
$not_search,
$filter['search']
);
$sql_search .= ' ';
}
$sql_search .= ' )';
$sql_filters[] = $sql_search;
}
// Free search exclude.
@ -1152,11 +1178,19 @@ function events_get_all(
// Validated or in process by.
if (empty($filter['id_user_ack']) === false) {
$sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ',
' AND te.id_usuario like lower("%%%s%%") ',
$filter['id_user_ack']
);
}
// Owner by.
if (empty($filter['owner_user']) === false) {
$sql_filters[] = sprintf(
' AND te.owner_user like lower("%%%s%%") ',
$filter['owner_user']
);
}
$tag_names = [];
// With following tags.
if (empty($filter['tag_with']) === false) {
@ -1840,11 +1874,14 @@ function events_get_all(
);
if (isset($limit, $offset) === true
&& $limit !== 0
&& (int) $limit !== 0
&& isset($filter['csv_all']) === false
) {
$count = count($data);
$end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
// -1 For pagination 'All'.
((int) $limit === -1)
? $end = count($data)
: $end = ((int) $offset !== 0) ? ($offset + $limit) : $limit;
$finally = array_slice($data, $offset, $end, true);
$return = [
'buffers' => $buffers,
@ -2597,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) {
@ -3713,6 +3729,15 @@ function events_get_response_target(
);
}
if (strpos($target, '_group_contact_') !== false) {
$info_groups = groups_get_group_by_id($event['id_grupo']);
$target = str_replace(
'_group_contact_',
(isset($info_groups['contact']) === true) ? $info_groups['contact'] : 'N/A',
$target
);
}
if (strpos($target, '_event_utimestamp_') !== false) {
$target = str_replace(
'_event_utimestamp_',
@ -4896,12 +4921,46 @@ function events_page_general($event)
}
/**
* Return Acknowledged by value
*
* @param integer $event_id Event_id to return Acknowledged.
*
* @return string String with user and date.
*/
function events_page_general_acknowledged($event_id)
{
global $config;
$Acknowledged = '';
$event = db_get_all_rows_filter('tevento', 'id_evento', $event_id);
if ($event) {
$user_ack = db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
);
if (empty($user_ack) === true) {
$user_ack = $config['id_user'];
}
$Acknowledged = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;';
} else {
$Acknowledged = 'N/A';
}
return $Acknowledged;
}
/**
* Generate 'comments' page for event viewer.
*
* @param array $event Event.
* @param boolean $ajax If the query come from AJAX.
* @param boolean $grouped If the event must shown comments grouped.
* @param array $event Event.
* @param boolean $ajax If the query come from AJAX.
* @param boolean $groupedComments If the event must shown comments grouped.
*
* @return string HTML.
*/
@ -5166,7 +5225,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

View File

@ -1950,7 +1950,7 @@ function html_print_extended_select_for_post_process(
$found = false;
if ($selected) {
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) {
$found = true;
}
}

View File

@ -772,3 +772,292 @@ function menu_pepare_acl_select_data($pages, $sec)
return $pages;
}
if (is_ajax()) {
$about = (bool) get_parameter('about');
if ($about) {
global $config;
global $pandora_version;
global $build_version;
$product_name = io_safe_output(get_product_name());
include_once $config['homedir'].'/include/class/Diagnostics.class.php';
$d = new Diagnostics;
$db_health = json_decode($d->getDatabaseHealthStatus());
$db_info = json_decode($d->getDatabaseStatusInfo());
$db_fragmentation = json_decode($d->getTablesFragmentation());
$sys_info = json_decode($d->getSystemInfo());
$php_sys = json_decode($d->getPHPSetup());
$fragmentation_status = '';
if ($db_fragmentation->data->tablesFragmentationStatus->status === 1) {
$fragmentation_status = html_print_image(
'images/exito.png',
true,
[
'title' => __('Successfully'),
'style' => 'width:15px;',
]
);
} else {
$fragmentation_status = html_print_image(
'images/error_1.png',
true,
[
'title' => __('Error'),
'style' => 'width:15px;',
]
);
}
$dialog = '
<div id="about-tabs" class="invisible overflow-hidden">
<ul>
<li><a href="#tab-general-view">'.__('Information').'</a></li>
<li><a href="#tab-database">'.__('Database').'</a></li>
<li><a href="#tab-system-info">'.__('System Info').'</a></li>
<li><a href="#tab-php-system">'.__('PHP System').'</a></li>
<li class="ui-tabs-close-button" style="float:right!important;">
<img id="about-close" style="cursor: pointer;" src="'.ui_get_full_url('/include/styles/images/dialog-titlebar-close.png', false, false, false).'" alt="'.__('Close').'" title="'.__('Close').'" width="25px">
</li>
</ul>
<div id="tab-general-view">
<table class="table-about">
<tbody>
<tr>
<th style="width: 40%;">
<img src="'.ui_get_full_url('/images/custom_logo/'.$config['custom_logo'], false, false, false).'" alt="logo" width="70%">
</th>
<th style="width: 60%; text-align: left;">
<h1>'.$product_name.'</h1>
<p><span>'.__('Version').' '.$pandora_version.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'</span></p>
<p><span>'.__('MR version').'</span> MR'.$config['MR'].'</p>
<p><span>'.__('Build').'</span> '.$build_version.'</p>
<p style="margin-bottom: 20px!important;"><span>'.__('Support expires').'</span> 2023/04/26</p>';
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$dialog .= '
<div style="display: inline;">
<button class="sub" onclick="location.href=\''.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'\'">'.__('Update manager').'</button>
<button class="sub" onclick="location.href=\''.ui_get_full_url('/index.php?sec=gextensions&sec2=tools/diagnostics', false, false, false).'\'">'.__('System report').'</button>
</div>
';
}
$dialog .= '</th>
</tr>
</tbody>
</table>
<p class="trademark-copyright">Trademark and copyright 2004 - '.date('Y').' Pandora FMS. All rights reserved</p>
</div>
<div id="tab-database" class="div-scroll">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Database health status').'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_health->data->unknownAgents->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_health->data->unknownAgents->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_health->data->notInitAgents->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_health->data->notInitAgents->value.'</p>
</th>
</tr>
<tr class="about-last-tr">
<th style="width: 50%;">
<p class="about-last-p"><span>'.$db_health->data->pandoraDbLastRun->name.'</span></p>
</th>
<th style="width: 50%;">
<p class="about-last-p">'.$db_health->data->pandoraDbLastRun->value.'</p>
</th>
</tr>
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Database status info').'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeFirstVersion->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeFirstVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeVersion->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_info->data->dbSchemeBuild->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_info->data->dbSchemeBuild->value.'</p>
</th>
</tr>
<tr class="about-last-tr">
<th style="width: 50%;">
<p class="about-last-p"><span>'.$db_info->data->dbSize->name.'</span></p>
</th>
<th style="width: 50%;">
<p class="about-last-p">'.$db_info->data->dbSize->value.'</p>
</th>
</tr>
<tr>
<th colspan="2">
<h2><span> - </span>'.__('Tables fragmentation in the %s database', $product_name).'</h2>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationMax->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_fragmentation->data->tablesFragmentationMax->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationValue->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$db_fragmentation->data->tablesFragmentationValue->value.'</p>
</th>
</tr>
<tr>
<th style="width: 50%;">
<p><span>'.$db_fragmentation->data->tablesFragmentationStatus->name.'</span></p>
</th>
<th style="width: 50%;">
<p>'.$fragmentation_status.'</p>
</th>
</tr>
</tbody>
</table>
</div>
<div id="tab-system-info">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('System Info').'</h2>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->cpuInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->cpuInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->ramInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->ramInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->osInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->osInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->hostnameInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->hostnameInfo->value.'</p>
</th>
</tr>
<tr>
<th style="width: 15%;">
<p><span>'.$sys_info->data->ipInfo->name.'</span></p>
</th>
<th style="width: 85%;">
<p>'.$sys_info->data->ipInfo->value.'</p>
</th>
</tr>
</tbody>
</table>
</div>
<div id="tab-php-system">
<table class="table-about">
<tbody style="text-align: left;">
<tr>
<th colspan="2">
<h2><span> - </span>'.__('PHP system').'</h2>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->phpVersion->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->phpVersion->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->maxExecutionTime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->maxExecutionTime->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->maxInputTime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->maxInputTime->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->memoryLimit->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->memoryLimit->value.'</p>
</th>
</tr>
<tr>
<th style="width: 35%;">
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
</th>
<th style="width: 65%;">
<p>'.$php_sys->data->sessionLifetime->value.'</p>
</th>
</tr>
</tbody>
</table>
</div>
</div>
';
echo $dialog;
}
}

View File

@ -2589,12 +2589,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
break;
@ -2613,12 +2613,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
}
@ -2900,7 +2900,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
}
if (is_numeric($data)) {
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision']));
$title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else {
$text = io_safe_output($data);
@ -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.
@ -4336,3 +4411,129 @@ function modules_get_regex(
return $result;
}
/**
* Status for data thresholds modules.
*
* @param integer $id_module Module ID.
* @param mixed $data Data int, bool, null, etc.
* @param array $thresholds Array thresholds.
*
* @return array
*/
function get_status_data_modules(int $id_module, $data, $thresholds)
{
// Check not init.
if ($data === false) {
return ['color' => COL_NOTINIT];
}
// Check boolean.
$is_bolean = modules_is_boolean($id_module);
if ($is_bolean === true) {
if ($data > 0) {
return ['color' => COL_CRITICAL];
} else {
return ['color' => COL_NORMAL];
}
}
$thresholds = calculateThreshold($thresholds);
foreach (getStatuses() as $status) {
if ($thresholds[$status]['min'] === null
&& $thresholds[$status]['max'] === null
) {
continue;
}
if (($thresholds[$status]['min'] === null
&& $thresholds[$status]['max'] >= $data)
|| ($thresholds[$status]['max'] === null
&& $thresholds[$status]['min'] <= $data)
|| ($thresholds[$status]['min'] <= $data
&& $thresholds[$status]['max'] >= $data)
) {
if ($status === 'critical') {
return ['color' => COL_CRITICAL];
} else if ($status === 'warning') {
return ['color' => COL_WARNING];
} else {
return ['color' => COL_NORMAL];
}
}
}
return ['color' => COL_NORMAL];
}
/**
* Calculate thresholds.
*
* @param array $thresholds_array
*
* @return array
*/
function calculateThreshold(array $thresholds_array)
{
$nMax = null;
if ($thresholds_array['min_warning'] !== null) {
$nMax = $thresholds_array['min_warning'];
} else if ($thresholds_array['min_critical'] !== null) {
$nMax = $thresholds_array['min_critical'];
}
$wMin = null;
if ($thresholds_array['min_warning'] !== null) {
$wMin = $thresholds_array['min_warning'];
}
$wMax = null;
if ($thresholds_array['max_warning'] !== null) {
$wMax = $thresholds_array['max_warning'];
}
$cMin = null;
if ($thresholds_array['min_critical'] !== null) {
$cMin = $thresholds_array['min_critical'];
}
$cMax = null;
if ($thresholds_array['max_critical'] !== null) {
$cMax = $thresholds_array['max_critical'];
}
$thresholds = [
'normal' => [
'min' => null,
'max' => $nMax,
],
'warning' => [
'min' => $wMin,
'max' => $wMax,
],
'critical' => [
'min' => $cMin,
'max' => $cMax,
],
];
return $thresholds;
}
/**
* Get status.
*
* @return array
*/
function getStatuses()
{
return [
'critical',
'warning',
'normal',
];
}

View File

@ -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]);
}
}

View File

@ -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 {

View File

@ -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

View File

@ -652,18 +652,18 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$row[] = round($sla['sla_limit'], 2).'%';
if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
} else if (reporting_sla_is_ignored_from_array($sla)) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('No data').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_IGNORED.';">'.__('No data').'</span>';
// Normal calculation.
} else if ($sla['sla_status']) {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.__('OK').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">'.__('OK').'</span>';
} else {
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
}
// Second table for time globals.
@ -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%';
@ -2292,7 +2291,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0)
$row['data_module'] = remove_right_zeros(
number_format(
$data['data_module'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
} else {
@ -2785,7 +2786,7 @@ function reporting_html_historical_data($table, $item, $pdf=0)
} else {
$row = [
$data[__('Date')],
remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'])),
remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
];
}
@ -2925,7 +2926,9 @@ function reporting_html_last_value($table, $item, $pdf=0)
$dataDatos = remove_right_zeros(
number_format(
$item['data']['datos'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
} else {
@ -3460,28 +3463,32 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
$table1->head = [];
$table1->data = [];
if ($item['data']['unknown'] == 1) {
$table1->data['data']['unknown'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_UNKNOWN.';">';
$table1->data['data']['unknown'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_UNKNOWN.';">';
$table1->data['data']['unknown'] .= __('Unknown').'</p>';
} else {
$table1->data['data']['ok'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">';
$table1->data['data']['ok'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_NORMAL.';">';
$table1->data['data']['ok'] .= html_print_image(
'images/module_ok.png',
true
).' '.__('OK').': '.remove_right_zeros(
number_format(
$item['data']['ok']['value'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
).' %</p>';
$table1->data['data']['fail'] = '<p class="bolder" style="font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">';
$table1->data['data']['fail'] = '<p class="bolder" style="font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.COL_CRITICAL.';">';
$table1->data['data']['fail'] .= html_print_image(
'images/module_critical.png',
true
).' '.__('Not OK').': '.remove_right_zeros(
number_format(
$item['data']['fail']['value'],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
).' % '.'</p>';
}
@ -3835,7 +3842,9 @@ function reporting_html_value(
remove_right_zeros(
number_format(
$data[__('Maximun')],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
),
];
@ -4674,7 +4683,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
switch ($item['data'][$k_chart]['failover']) {
case 'primary_compare':
$title = '<b>'.__('Primary').' (24x7)</b>';
@ -4702,7 +4711,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
case 'result_compare':
$title = '<b>'.__('Result').' (24x7)</b>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
@ -4713,7 +4722,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$total_values += $sla_value;
$count_total_charts++;
$title = '<b>'.__('Result').'</b>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.(($pdf === 0) ? ' !important' : '').'; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
@ -4747,7 +4756,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table_summary->data = [];
$table_summary->data[0][0] = '<b>'.__('Summary').'</b>';
$table_summary->data[0][1] = '<span style = "font-weight: bold; font-size: '.$font_size.' !important;">';
$table_summary->data[0][1] = '<span style = "font-weight: bold; font-size: '.$font_size.(($pdf === 0) ? ' !important' : '').';">';
$table_summary->data[0][1] .= sla_truncate($total_values / $count_total_charts);
$table_summary->data[0][1] .= ' %';
$table_summary->data[0][1] .= '</span>';
@ -5131,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',
@ -5141,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',
@ -5150,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>';

View File

@ -46,6 +46,8 @@ function reporting_xml_get_report($report, $filename, $return=false)
// Download if marked to download.
if ($filename !== false) {
// Cookie for download control.
setDownloadCookieToken();
header('Content-Type: application/xml; charset=UTF-8');
header('Content-Disposition: attachment; filename="'.$filename.'.xml"');
}

View File

@ -1349,9 +1349,6 @@ function servers_get_server_string_name(int $server)
case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite server');
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
return __('Transactional server');
case SERVER_TYPE_ALERT:
return __('Alert server');

View File

@ -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);

View File

@ -193,7 +193,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "<span title='".$last_data['datos']."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@ -209,7 +209,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default:
if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@ -232,7 +232,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "<span title='".human_milliseconds_to_string($last_data['datos'])."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@ -248,7 +248,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default:
if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@ -271,7 +271,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']);
if ($data_macro) {
if (is_numeric($data_macro)) {
$last_data_str = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'])).'</span>';
$last_data_str = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$last_data_str = ui_print_truncate_text(
io_safe_output($data_macro),
@ -594,10 +594,10 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata);
$url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'].'&'.'loginhash=auto&'."loginhash_data=$hashdata&".'loginhash_user='.str_rot13($user);
$url = $server_data['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agent['id_agente'];
if ($grants_on_node && (bool) $user_access_node !== false) {
$cellName .= '<a href="'.$url.'">'.'<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
$cellName .= '<a onclick="sendHash(\''.$url.'\')" href="#"><b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
} else {
$cellName .= '<b><span class="bolder pandora_upper" title="'.$agent['nombre'].'">'.$agent['alias'].'</span></b>';
}
@ -690,20 +690,13 @@ 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.$url_hash.'">';
$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);
}
@ -905,5 +898,12 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
metaconsole_restore_db();
}
return;
echo "
<script>
function sendHash(url) {
window.location = url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13($user)."';
}
</script>";
}

View File

@ -3540,6 +3540,11 @@ function ui_print_datatable(array $parameters)
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'",
action: function ( e, dt, node, config ) {
blockResubmit(node);
// Call the default csvHtml5 action method to create the CSV file
$.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, node, config);
},
exportOptions : {
modifier : {
// DataTables core
@ -3547,7 +3552,7 @@ function ui_print_datatable(array $parameters)
page : "All",
search : "applied"
}'.$export_columns.'
}
},
}
] : [],
lengthMenu: '.json_encode($pagination_options).',
@ -3671,6 +3676,16 @@ function ui_print_datatable(array $parameters)
$js .= '$(".datatables_thead_tr").css("height", 0);';
}
if (isset($parameters['csv']) === true) {
$js."'$('#".$table_id."').on( 'buttons-processing', function ( e, indicator ) {
if ( indicator ) {
console.log('a');
}
else {
console.log('b');
}";
}
$js .= '});';
$js .= '</script>';
@ -6577,10 +6592,11 @@ function ui_print_comments($comments)
} else {
$rest_time = (time() - $last_comment['utimestamp']);
$time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
}

View File

@ -924,7 +924,7 @@ function visual_map_print_item(
$value_text = format_for_graph($module_value, 2);
if ($value_text <= 0) {
$value_text = remove_right_zeros(number_format($module_value, $config['graph_precision']));
$value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
if (!empty($unit_text)) {
@ -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;
@ -1743,7 +1743,7 @@ function visual_map_print_item(
|| (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0)
) {
if (is_numeric($value)) {
$img_style_title .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision']));
$img_style_title .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else {
$img_style_title .= ' <br>'.__('Last value: ').$value;
}
@ -1881,13 +1881,13 @@ function visual_map_print_item(
echo '</tr>';
echo "<tr class='bg_whitesmoke height_90p'>";
echo '<td>';
echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2)).'%</div>';
echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='critical_vm'>Critical</div>";
echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2)).'%</div>';
echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='warning_vm'>Warning</div>";
echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2)).'%</div>';
echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='normal_vm'>Normal</div>";
echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2)).'%</div>';
echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='unknown_vm'>Unknown</div>";
echo '</td>';
echo '</tr>';
@ -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],
];
}
}
@ -2462,7 +2464,7 @@ function visual_map_get_simple_value($type, $id_module, $period=SECONDS_1DAY)
} else {
if (is_numeric($value)) {
if ($config['simple_module_value']) {
$value = remove_right_zeros(number_format($value, $config['graph_precision']));
$value = remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
}
@ -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

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