mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-22 09:28:09 +02:00
Merge remote-tracking branch 'origin/develop' into ent-8619-copiando-a-grafana-2-data-table-como-widget-en-dashboard
This commit is contained in:
commit
2d638a61cf
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, AIX version
|
# Version 7.0NG.767, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, FreeBSD Version
|
# Version 7.0NG.767, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, HP-UX Version
|
# Version 7.0NG.767, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, GNU/Linux
|
# Version 7.0NG.767, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, GNU/Linux
|
# Version 7.0NG.767, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, Solaris Version
|
# Version 7.0NG.767, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
# Foundation; either version 2 of the Licence or any later version
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.766, AIX version
|
# Version 7.0NG.767, AIX version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# FreeBSD/IPSO version
|
# FreeBSD/IPSO version
|
||||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.766, HPUX Version
|
# Version 7.0NG.767, HPUX Version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
# (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.766, Solaris version
|
# Version 7.0NG.767, Solaris version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, AIX version
|
# Version 7.0NG.767, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.766-221110
|
Version: 7.0NG.767-221213
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.766-221110"
|
pandora_version="7.0NG.767-221213"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -31,7 +31,7 @@ fi
|
|||||||
if [ "$#" -ge 2 ]; then
|
if [ "$#" -ge 2 ]; then
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
else
|
else
|
||||||
VERSION="7.0NG.766"
|
VERSION="7.0NG.767"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Path for the generated DMG file
|
# Path for the generated DMG file
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
<choice id="com.pandorafms.pandorafms_src" visible="false">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
<pkg-ref id="com.pandorafms.pandorafms_src"/>
|
||||||
</choice>
|
</choice>
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.766" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.767" onConclusion="none">pandorafms_src.pdk</pkg-ref>
|
||||||
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
|
||||||
</choice>
|
</choice>
|
||||||
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.766" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.767" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
|
||||||
<!-- <installation-check script="check()" />
|
<!-- <installation-check script="check()" />
|
||||||
<script>
|
<script>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
|
||||||
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
|
||||||
|
|
||||||
<key>CFBundleVersion</key> <string>7.0NG.766</string>
|
<key>CFBundleVersion</key> <string>7.0NG.767</string>
|
||||||
<key>CFBundleGetInfoString</key> <string>7.0NG.766 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
<key>CFBundleGetInfoString</key> <string>7.0NG.767 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
|
||||||
<key>CFBundleShortVersionString</key> <string>7.0NG.766</string>
|
<key>CFBundleShortVersionString</key> <string>7.0NG.767</string>
|
||||||
|
|
||||||
<key>NSPrincipalClass</key><string>NSApplication</string>
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
||||||
<key>NSMainNibFile</key><string>MainMenu</string>
|
<key>NSMainNibFile</key><string>MainMenu</string>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, GNU/Linux
|
# Version 7.0NG.767, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, FreeBSD Version
|
# Version 7.0NG.767, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, HP-UX Version
|
# Version 7.0NG.767, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, GNU/Linux
|
# Version 7.0NG.767, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, GNU/Linux
|
# Version 7.0NG.767, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, NetBSD Version
|
# Version 7.0NG.767, NetBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.766, Solaris Version
|
# Version 7.0NG.767, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
@ -1014,8 +1014,8 @@ my $Sem = undef;
|
|||||||
# Semaphore used to control the number of threads
|
# Semaphore used to control the number of threads
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.766';
|
use constant AGENT_VERSION => '7.0NG.767';
|
||||||
use constant AGENT_BUILD => '221110';
|
use constant AGENT_BUILD => '221213';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.766
|
%define version 7.0NG.767
|
||||||
%define release 221110
|
%define release 221213
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.766
|
%define version 7.0NG.767
|
||||||
%define release 221110
|
%define release 221213
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.766"
|
PI_VERSION="7.0NG.767"
|
||||||
PI_BUILD="221110"
|
PI_BUILD="221213"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -12,19 +12,21 @@
|
|||||||
#
|
#
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
from sys import argv
|
try:
|
||||||
from sys import path
|
from sys import argv
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
from subprocess import DEVNULL
|
from subprocess import DEVNULL
|
||||||
from subprocess import getstatusoutput
|
from subprocess import getstatusoutput
|
||||||
import psutil
|
import psutil
|
||||||
|
except ModuleNotFoundError as err:
|
||||||
|
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
global module_list
|
|
||||||
module_list = []
|
module_list = []
|
||||||
version = "1.1"
|
VERSION = "1.2"
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -50,15 +52,15 @@ class PSCheck:
|
|||||||
procname = PSCheck.get_serviceprocess(element)
|
procname = PSCheck.get_serviceprocess(element)
|
||||||
# Get process status
|
# Get process status
|
||||||
parstatus = PSCheck.getstatus(element)
|
parstatus = PSCheck.getstatus(element)
|
||||||
if memcpu == True and parstatus == 1:
|
if memcpu and parstatus == 1:
|
||||||
usage = get_memcpu(str(procname), str(element))
|
usage = get_memcpu(str(procname), str(element))
|
||||||
output += usage
|
output += usage
|
||||||
# Generate module with name and status
|
# Generate module with name and status
|
||||||
parent = service_module(str(element), parstatus)
|
parent = service_module(str(element), parstatus)
|
||||||
output += parent
|
output += parent
|
||||||
if option == True:
|
if option:
|
||||||
children = PSCheck.getchildren(element, memcpu)
|
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:
|
for child in children:
|
||||||
output += child
|
output += child
|
||||||
else:
|
else:
|
||||||
@ -66,7 +68,6 @@ class PSCheck:
|
|||||||
else:
|
else:
|
||||||
next
|
next
|
||||||
|
|
||||||
#if output != '':
|
|
||||||
if output and element and procname:
|
if output and element and procname:
|
||||||
return ({"name" : element, "process" : procname, "modules": output})
|
return ({"name" : element, "process" : procname, "modules": output})
|
||||||
else:
|
else:
|
||||||
@ -84,13 +85,13 @@ class PSCheck:
|
|||||||
status = PSCheck.getstatus(child)
|
status = PSCheck.getstatus(child)
|
||||||
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
|
kids += service_module(str(child), status, "Service " + str(servicename) + " - Status")
|
||||||
if status:
|
if status:
|
||||||
if memcpu == True:
|
if memcpu:
|
||||||
kidsusage = get_memcpu(str(child))
|
kidsusage = get_memcpu(str(child))
|
||||||
for usage in kidsusage:
|
for usage in kidsusage:
|
||||||
kids += usage
|
kids += usage
|
||||||
else:
|
else:
|
||||||
next
|
next
|
||||||
return (kids)
|
return kids
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getstatus(servicename):
|
def getstatus(servicename):
|
||||||
@ -99,7 +100,7 @@ class PSCheck:
|
|||||||
"' |", "Select-Object", "-ExpandProperty", "Status"],
|
"' |", "Select-Object", "-ExpandProperty", "Status"],
|
||||||
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True)
|
||||||
status = running.communicate()[0].strip()
|
status = running.communicate()[0].strip()
|
||||||
return (int(status == "Running"))
|
return int(status == "Running")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_serviceprocess(servicename):
|
def get_serviceprocess(servicename):
|
||||||
@ -108,7 +109,7 @@ class PSCheck:
|
|||||||
srv_pid = service.pid()
|
srv_pid = service.pid()
|
||||||
process = psutil.Process(srv_pid)
|
process = psutil.Process(srv_pid)
|
||||||
proc_name = process.name()
|
proc_name = process.name()
|
||||||
return (proc_name)
|
return proc_name
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -124,13 +125,13 @@ def service_module(name, value, parent=None):
|
|||||||
"module_parent" : parent,
|
"module_parent" : parent,
|
||||||
}]
|
}]
|
||||||
#print ("service_module END "+str(now(0,1)))
|
#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."""
|
"""Creates a module for Memory and CPU for a given process. Returns a list of dictionaries."""
|
||||||
modules = []
|
modules = []
|
||||||
if process:
|
if process:
|
||||||
if servicename != None:
|
if servicename is not None:
|
||||||
parentname = servicename
|
parentname = servicename
|
||||||
else:
|
else:
|
||||||
parentname = process
|
parentname = process
|
||||||
@ -147,7 +148,7 @@ def get_memcpu (process, servicename):
|
|||||||
"unit" : "%",
|
"unit" : "%",
|
||||||
"module_parent" : "Service "+ parentname + " - Status",
|
"module_parent" : "Service "+ parentname + " - Status",
|
||||||
}]
|
}]
|
||||||
return (modules)
|
return modules
|
||||||
|
|
||||||
def proc_percentbyname(procname): ############# 03/03/2020
|
def proc_percentbyname(procname): ############# 03/03/2020
|
||||||
"""Gets Memory and CPU usage for a given process. Returns a list."""
|
"""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:
|
except psutil.NoSuchProcess:
|
||||||
next
|
next
|
||||||
#print ("proc_percentbyname END "+str(now(0,1)))
|
#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):
|
def win_service(servicelist, option=False, memcpu=False):
|
||||||
"""Creates modules for Windows servers."""
|
"""Creates modules for Windows servers."""
|
||||||
@ -173,7 +174,7 @@ def win_service(servicelist, option=False, memcpu=False):
|
|||||||
for srvc in servicelist:
|
for srvc in servicelist:
|
||||||
if srvc and len(srvc) > 2:
|
if srvc and len(srvc) > 2:
|
||||||
output = PSCheck.check_service(srvc, option, memcpu)
|
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"]
|
modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"]
|
||||||
module_list.append(srvc)
|
module_list.append(srvc)
|
||||||
#winprocess = output["name"]
|
#winprocess = output["name"]
|
||||||
@ -199,7 +200,7 @@ def lnx_service(services_list, memcpu=False):
|
|||||||
syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE,
|
syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE,
|
||||||
stdin=DEVNULL, universal_newlines=True)
|
stdin=DEVNULL, universal_newlines=True)
|
||||||
result = syscall.communicate()
|
result = syscall.communicate()
|
||||||
srvstatus= result[0].strip().lower().split("\n")
|
srvstatus = result[0].strip().lower().split("\n")
|
||||||
if srvstatus[0] == "loadstate=not-found":
|
if srvstatus[0] == "loadstate=not-found":
|
||||||
next
|
next
|
||||||
else:
|
else:
|
||||||
@ -223,15 +224,15 @@ def lnx_service(services_list, memcpu=False):
|
|||||||
else:
|
else:
|
||||||
next
|
next
|
||||||
else:
|
else:
|
||||||
print ("No systemd or service commands available. Exiting...", file=stderr)
|
print("No systemd or service commands available. Exiting...", file=stderr)
|
||||||
exit()
|
exit()
|
||||||
if status:
|
if status:
|
||||||
module_list.append(srvc)
|
module_list.append(srvc)
|
||||||
if memcpu == True:
|
if memcpu:
|
||||||
modules += get_memcpu(srvc, None)
|
modules += get_memcpu(srvc, None)
|
||||||
|
|
||||||
for m in modules:
|
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
|
#### Print flag
|
||||||
if str_flag is not False:
|
if str_flag is not False:
|
||||||
print (module_xml)
|
print(module_xml)
|
||||||
|
|
||||||
return (module_xml)
|
return (module_xml)
|
||||||
|
|
||||||
@ -362,7 +363,7 @@ def main():
|
|||||||
"postfix", "mysqld", "postgres", "oracle", "mongod"]
|
"postfix", "mysqld", "postgres", "oracle", "mongod"]
|
||||||
discover(OS, service_list)
|
discover(OS, service_list)
|
||||||
else:
|
else:
|
||||||
print ("OS not recognized. Exiting...", file=stderr)
|
print("OS not recognized. Exiting...", file=stderr)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
def discover(osyst, servicelist):
|
def discover(osyst, servicelist):
|
||||||
@ -383,23 +384,23 @@ def discover(osyst, servicelist):
|
|||||||
elif osyst == "Linux":
|
elif osyst == "Linux":
|
||||||
lnx_service(servicelist, memcpu)
|
lnx_service(servicelist, memcpu)
|
||||||
else:
|
else:
|
||||||
print ("\nPandora FMS Autodiscovery plugin v{}".format(version))
|
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("Checks the status of the services in list and monitors CPU and Memory for each of them.\n")
|
||||||
print ("Usage:")
|
print("Usage:")
|
||||||
print ("{} [options] [--usage]".format(argv[0]))
|
print("{} [options] [--usage]".format(argv[0]))
|
||||||
print ("--help")
|
print("--help")
|
||||||
print ("\tPrints this help screen")
|
print("\tPrints this help screen")
|
||||||
print ("--default")
|
print("--default")
|
||||||
print ("\tRuns this tool with default monitoring.")
|
print("\tRuns this tool with default monitoring.")
|
||||||
print ("\tServices monitored by default for {}:".format(osyst))
|
print("\tServices monitored by default for {}:".format(osyst))
|
||||||
print ("\t",", ".join(servicelist))
|
print("\t", ", ".join(servicelist))
|
||||||
print ("--list \"<srvc1,srvc2,srvc3>\"")
|
print("--list \"<srvc1,srvc2,srvc3>\"")
|
||||||
print ("\tReplaces default services for a given list (comma-separated)")
|
print("\tReplaces default services for a given list (comma-separated)")
|
||||||
if osyst == "Windows":
|
if osyst == "Windows":
|
||||||
print ("\tEach element of the list will be treated as a regexp, but they must be over 2 characters.")
|
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("\tElements under 2 characters will be discarded.")
|
||||||
print ("--usage")
|
print("--usage")
|
||||||
print ("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
|
print("\tAdds modules for CPU and Memory usage per service/process (optional, can take some time).\n")
|
||||||
|
|
||||||
|
|
||||||
##### RUN ####
|
##### RUN ####
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
# (c) 2006-2021 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.766
|
# Version 7.0NG.767
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
# Foundation; either version 2 of the Licence or any later version
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||||||
{Yes}
|
{Yes}
|
||||||
|
|
||||||
AppName
|
AppName
|
||||||
{Pandora FMS Windows Agent v7.0NG.766}
|
{Pandora FMS Windows Agent v7.0NG.767}
|
||||||
|
|
||||||
ApplicationID
|
ApplicationID
|
||||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{221110}
|
{221213}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.766 Build 221110")
|
#define PANDORA_VERSION ("7.0NG.767 Build 221213")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.766(Build 221110))"
|
VALUE "ProductVersion", "(7.0NG.767(Build 221213))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.766-221110
|
Version: 7.0NG.767-221213
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.766-221110"
|
pandora_version="7.0NG.767-221213"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
9
pandora_console/extras/mr/59.sql
Normal file
9
pandora_console/extras/mr/59.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tevent_filter` MODIFY COLUMN `server_id` TEXT;
|
||||||
|
|
||||||
|
UPDATE tconfig SET value = 'Hope' WHERE token LIKE 'lts_name';
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout_template` ADD COLUMN `maintenance_mode` TEXT;
|
||||||
|
|
||||||
|
COMMIT;
|
5
pandora_console/extras/mr/60.sql
Normal file
5
pandora_console/extras/mr/60.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tagent_custom_fields` ADD `is_link_enabled` TINYINT(1) NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
COMMIT;
|
@ -91,7 +91,7 @@ $login_body_class = '';
|
|||||||
// Overrides the default background with the defined by the user.
|
// Overrides the default background with the defined by the user.
|
||||||
if (!empty($config['login_background'])) {
|
if (!empty($config['login_background'])) {
|
||||||
$background_url = 'images/backgrounds/'.$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
|
// Support for Internet Explorer and Microsoft Edge browsers
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config['language'] == 'es') {
|
if ($config['language'] == 'es') {
|
||||||
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
|
$url_help = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
|
||||||
} else {
|
} else {
|
||||||
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
|
$url_help = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints help dialog information
|
// Prints help dialog information
|
||||||
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" class="invisible">';
|
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" class="invisible">';
|
||||||
echo '<div class="login_help_dialog">';
|
echo '<div class="login_help_dialog">';
|
||||||
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'</b></p>';
|
echo "<p><b class='font_10'>".__('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'</b></p>';
|
||||||
echo "<p class='font_10'><b>".__('Otherwise, functionalities will be lost.').'</b></p>';
|
echo "<p class='font_10'><b>".__('Otherwise, functionalities will be lost.').'</b></p>';
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
echo "<li class='pdd_5px'>".__('Report download in PDF format').'</li>';
|
echo "<li class='pdd_5px'>".__('Report download in PDF format').'</li>';
|
@ -309,7 +309,7 @@ $table_ip .= '<div class="label_select_child_right">'.html_print_input(
|
|||||||
'name' => 'fixed_ip',
|
'name' => 'fixed_ip',
|
||||||
'value' => $fixed_ip,
|
'value' => $fixed_ip,
|
||||||
]
|
]
|
||||||
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
|
).__('Fix IP address').'<p style="margin-right: 15px">'.ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</p></div>';
|
||||||
|
|
||||||
$table_ip .= '</div></div>';
|
$table_ip .= '</div></div>';
|
||||||
|
|
||||||
@ -872,6 +872,35 @@ foreach ($fields as $field) {
|
|||||||
true,
|
true,
|
||||||
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 {
|
} else {
|
||||||
$data_field[1] = html_print_textarea(
|
$data_field[1] = html_print_textarea(
|
||||||
'customvalue_'.$field['id_field'],
|
'customvalue_'.$field['id_field'],
|
||||||
|
@ -238,7 +238,15 @@ if ($create_agent) {
|
|||||||
$field_values = [];
|
$field_values = [];
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
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).
|
// Check if agent exists (BUG WC-50518-2).
|
||||||
@ -999,7 +1007,22 @@ if ($update_agent) {
|
|||||||
$field_values = [];
|
$field_values = [];
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
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) {
|
foreach ($field_values as $key => $value) {
|
||||||
|
@ -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_password_type = (bool) get_parameter('is_password_type', 0);
|
||||||
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
|
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
|
||||||
$combo_values = (string) get_parameter('combo_values', '');
|
$combo_values = (string) get_parameter('combo_values', '');
|
||||||
|
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
|
||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
if ($id_field) {
|
if ($id_field) {
|
||||||
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $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'];
|
$is_password_type = $field['is_password_type'];
|
||||||
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
|
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
|
||||||
$is_combo_enable = $config['is_combo_enable'];
|
$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, '');
|
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
|
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
|
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">';
|
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
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 () {
|
$('input[type=checkbox][name=is_combo_enable]').change(function () {
|
||||||
if( $(this).is(":checked") ){
|
if( $(this).is(":checked") ){
|
||||||
$('#configure_field-4').show();
|
$('#configure_field-4').show();
|
||||||
dialog_message("#message_no_set_password");
|
dialog_message("#message_no_set_password");
|
||||||
$('#configure_field-1').hide();
|
$('#configure_field-1').hide();
|
||||||
|
$('#configure_field-5').hide();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#configure_field-4').hide();
|
$('#configure_field-4').hide();
|
||||||
$('#configure_field-1').show();
|
$('#configure_field-1').show();
|
||||||
|
$('#configure_field-5').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('input[type=checkbox][name=is_password_type]').change(function () {
|
$('input[type=checkbox][name=is_password_type]').change(function () {
|
||||||
if( $(this).is(":checked")){
|
if( $(this).is(":checked")){
|
||||||
dialog_message("#message_no_set_combo");
|
dialog_message("#message_no_set_combo");
|
||||||
$('#configure_field-3').hide();
|
$('#configure_field-3').hide();
|
||||||
|
$('#configure_field-5').hide();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#configure_field-3').show();
|
$('#configure_field-3').show();
|
||||||
|
$('#configure_field-5').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -38,11 +38,12 @@ $display_on_front = (int) get_parameter('display_on_front', 0);
|
|||||||
$is_password_type = (int) get_parameter('is_password_type', 0);
|
$is_password_type = (int) get_parameter('is_password_type', 0);
|
||||||
$combo_values = (string) get_parameter('combo_values', '');
|
$combo_values = (string) get_parameter('combo_values', '');
|
||||||
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
|
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
|
||||||
|
$is_link_enabled = (bool) get_parameter('is_link_enabled', 0);
|
||||||
|
|
||||||
// Create field.
|
// Create field.
|
||||||
if ($create_field) {
|
if ($create_field) {
|
||||||
// Check if name field is empty.
|
// Check if name field is empty.
|
||||||
if ($name == '') {
|
if ($name === '') {
|
||||||
ui_print_error_message(__('The name must not be empty'));
|
ui_print_error_message(__('The name must not be empty'));
|
||||||
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
|
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
|
||||||
ui_print_error_message(__('The name must be unique'));
|
ui_print_error_message(__('The name must be unique'));
|
||||||
@ -54,6 +55,7 @@ if ($create_field) {
|
|||||||
'display_on_front' => $display_on_front,
|
'display_on_front' => $display_on_front,
|
||||||
'is_password_type' => $is_password_type,
|
'is_password_type' => $is_password_type,
|
||||||
'combo_values' => $combo_values,
|
'combo_values' => $combo_values,
|
||||||
|
'is_link_enabled' => $is_link_enabled,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
ui_print_success_message(__('Field successfully created'));
|
ui_print_success_message(__('Field successfully created'));
|
||||||
@ -63,12 +65,13 @@ if ($create_field) {
|
|||||||
// Update field.
|
// Update field.
|
||||||
if ($update_field) {
|
if ($update_field) {
|
||||||
// Check if name field is empty.
|
// Check if name field is empty.
|
||||||
if ($name != '') {
|
if ($name !== '') {
|
||||||
$values = [
|
$values = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'display_on_front' => $display_on_front,
|
'display_on_front' => $display_on_front,
|
||||||
'is_password_type' => $is_password_type,
|
'is_password_type' => $is_password_type,
|
||||||
'combo_values' => $combo_values,
|
'combo_values' => $combo_values,
|
||||||
|
'is_link_enabled' => $is_link_enabled,
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);
|
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);
|
||||||
|
@ -445,8 +445,6 @@ if ($module_action === 'delete') {
|
|||||||
}
|
}
|
||||||
} else if ($module_action === 'disable') {
|
} else if ($module_action === 'disable') {
|
||||||
$id_agent_modules_disable = (array) get_parameter('id_delete');
|
$id_agent_modules_disable = (array) get_parameter('id_delete');
|
||||||
|
|
||||||
$count_correct_delete_modules = 0;
|
|
||||||
$updated_count = 0;
|
$updated_count = 0;
|
||||||
|
|
||||||
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
|
foreach ($id_agent_modules_disable as $id_agent_module_disable) {
|
||||||
@ -490,6 +488,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 +1318,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
|||||||
html_print_select(
|
html_print_select(
|
||||||
[
|
[
|
||||||
'disable' => 'Disable selected modules',
|
'disable' => 'Disable selected modules',
|
||||||
|
'enable' => 'Enable selected modules',
|
||||||
'delete' => 'Delete selected modules',
|
'delete' => 'Delete selected modules',
|
||||||
],
|
],
|
||||||
'module_action',
|
'module_action',
|
||||||
@ -1286,6 +1331,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
echo '    ';
|
||||||
|
|
||||||
html_print_submit_button(
|
html_print_submit_button(
|
||||||
__('Execute action'),
|
__('Execute action'),
|
||||||
'submit_modules_action',
|
'submit_modules_action',
|
||||||
|
@ -124,6 +124,8 @@ if (!empty($groups)) {
|
|||||||
if (!empty($downtimes)) {
|
if (!empty($downtimes)) {
|
||||||
ob_clean();
|
ob_clean();
|
||||||
// Show contentype header
|
// Show contentype header
|
||||||
|
// Set cookie for download control.
|
||||||
|
setDownloadCookieToken();
|
||||||
header('Content-type: text/csv');
|
header('Content-type: text/csv');
|
||||||
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.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)) {
|
if (!empty($downtime_agents)) {
|
||||||
foreach ($downtime_agents as $downtime_agent) {
|
foreach ($downtime_agents as $downtime_agent) {
|
||||||
$downtime_items = [];
|
$downtime_items = [];
|
||||||
$downtime_items[] = $downtime_agent[alias];
|
$downtime_items[] = $downtime_agent['alias'];
|
||||||
|
|
||||||
if (!$downtime_agent['all_modules']) {
|
if (!$downtime_agent['all_modules']) {
|
||||||
$agent_id = $downtime_agent['agent_id'];
|
$agent_id = $downtime_agent['agent_id'];
|
||||||
|
@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
|
|||||||
__('Export to CSV'),
|
__('Export to CSV'),
|
||||||
'csv_export',
|
'csv_export',
|
||||||
false,
|
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"'
|
'class="sub next"'
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -451,7 +451,7 @@ $simple_alerts = agents_get_alerts_simple(
|
|||||||
if (!$id_agente) {
|
if (!$id_agente) {
|
||||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'&offset='.$offset.$form_params;
|
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'&offset='.$offset.$form_params;
|
||||||
} else {
|
} else {
|
||||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
|
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Urls to sort the table.
|
// Urls to sort the table.
|
||||||
@ -570,7 +570,7 @@ foreach ($simple_alerts as $alert) {
|
|||||||
|
|
||||||
if ($alert['times_fired'] > 0) {
|
if ($alert['times_fired'] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
|
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
|
||||||
} else if ($alert['disabled'] > 0) {
|
} else if ($alert['disabled'] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
$title = __('Alert disabled');
|
$title = __('Alert disabled');
|
||||||
|
@ -102,7 +102,7 @@ $table_details->data[] = $data;
|
|||||||
|
|
||||||
if ($alert['times_fired'] > 0) {
|
if ($alert['times_fired'] > 0) {
|
||||||
$status = STATUS_ALERT_FIRED;
|
$status = STATUS_ALERT_FIRED;
|
||||||
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
|
$title = __('Alert fired').' '.$alert['times_fired'].' '.__('time(s)');
|
||||||
} else if ($alert['disabled'] > 0) {
|
} else if ($alert['disabled'] > 0) {
|
||||||
$status = STATUS_ALERT_DISABLED;
|
$status = STATUS_ALERT_DISABLED;
|
||||||
$title = __('Alert disabled');
|
$title = __('Alert disabled');
|
||||||
|
@ -370,7 +370,7 @@ $table->data[5][1] = html_print_select(
|
|||||||
$table->data[6][0] = '<b>'.__('Free search').'</b>';
|
$table->data[6][0] = '<b>'.__('Free search').'</b>';
|
||||||
$table->data[6][1] = html_print_input_text(
|
$table->data[6][1] = html_print_input_text(
|
||||||
'search',
|
'search',
|
||||||
io_safe_output($search),
|
$search,
|
||||||
'',
|
'',
|
||||||
15,
|
15,
|
||||||
255,
|
255,
|
||||||
|
@ -42,7 +42,6 @@ require_once $config['homedir'].'/include/functions_users.php';
|
|||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||||
enterprise_hook('open_meta_frame');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ajax() === true) {
|
if (is_ajax() === true) {
|
||||||
@ -270,6 +269,7 @@ if (is_ajax() === true) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
$tab = (string) get_parameter('tab', 'groups');
|
$tab = (string) get_parameter('tab', 'groups');
|
||||||
|
|
||||||
|
@ -100,16 +100,15 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
|
|||||||
|
|
||||||
$options_policies = [];
|
$options_policies = [];
|
||||||
$policies_options = enterprise_hook('massive_policies_options');
|
$policies_options = enterprise_hook('massive_policies_options');
|
||||||
$policies_options = array_unique($policies_options);
|
|
||||||
|
|
||||||
if ($policies_options != ENTERPRISE_NOT_HOOK) {
|
if ($policies_options != ENTERPRISE_NOT_HOOK) {
|
||||||
|
$policies_options = array_unique($policies_options);
|
||||||
$options_policies = array_merge($options_policies, $policies_options);
|
$options_policies = array_merge($options_policies, $policies_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$options_snmp = [];
|
$options_snmp = [];
|
||||||
$snmp_options = enterprise_hook('massive_snmp_options');
|
$snmp_options = enterprise_hook('massive_snmp_options');
|
||||||
$snmp_options = array_reverse($snmp_options);
|
|
||||||
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
|
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
|
||||||
|
$snmp_options = array_reverse($snmp_options);
|
||||||
$options_snmp = array_merge($options_snmp, $snmp_options);
|
$options_snmp = array_merge($options_snmp, $snmp_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +189,8 @@ if ($export_profile) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set cookie for download control.
|
||||||
|
setDownloadCookieToken();
|
||||||
// Send headers to tell the browser we're sending a file
|
// Send headers to tell the browser we're sending a file
|
||||||
header('Content-type: application/octet-stream');
|
header('Content-type: application/octet-stream');
|
||||||
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
|
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'.'&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);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,11 @@ if ($add_module === true) {
|
|||||||
// Safe output remove all entities.
|
// Safe output remove all entities.
|
||||||
io_safe_output_array($id_modules, '');
|
io_safe_output_array($id_modules, '');
|
||||||
|
|
||||||
|
$id_modules = array_map(function ($mod) {
|
||||||
|
return io_safe_input($mod);
|
||||||
|
},
|
||||||
|
$id_modules
|
||||||
|
);
|
||||||
|
|
||||||
$id_agent_modules = db_get_all_rows_sql(
|
$id_agent_modules = db_get_all_rows_sql(
|
||||||
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
|
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
|
||||||
|
@ -1055,7 +1055,7 @@ switch ($action) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
$data[2] .= '</a>';
|
$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(
|
$data[3] .= html_print_image(
|
||||||
'images/xml.png',
|
'images/xml.png',
|
||||||
true,
|
true,
|
||||||
|
@ -886,6 +886,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submit_delete_multiple_items() {
|
function submit_delete_multiple_items() {
|
||||||
|
event.preventDefault();
|
||||||
delete_items = [];
|
delete_items = [];
|
||||||
jQuery.each($("input[name='multiple_delete_items']:checked"),
|
jQuery.each($("input[name='multiple_delete_items']:checked"),
|
||||||
function(i, item) {
|
function(i, item) {
|
||||||
@ -893,7 +894,22 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("input[name='id_item_json']").val(JSON.stringify(delete_items));
|
$.ajax({
|
||||||
$("#form_multiple_delete").submit();
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
data: {
|
||||||
|
page: "godmode/reporting/visual_console_builder",
|
||||||
|
action: "multiple_delete",
|
||||||
|
tab: "list_elements",
|
||||||
|
id_item_json: JSON.stringify(delete_items),
|
||||||
|
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
complete: function (data) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) {
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
|
$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.'>';
|
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
|
||||||
if ($locked) {
|
|
||||||
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
|
$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);
|
$data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
|
||||||
@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) {
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Plug-in parameters');
|
$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.'>';
|
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" >';
|
||||||
if ($locked) {
|
|
||||||
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data['plugin_parameters'] = $data;
|
$table->data['plugin_parameters'] = $data;
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) {
|
|||||||
$datam = [];
|
$datam = [];
|
||||||
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
|
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
|
||||||
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
$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);
|
$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);
|
||||||
if ($locked) {
|
|
||||||
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
|
$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);
|
$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);
|
||||||
if ($locked) {
|
|
||||||
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data['plugin_'.$next_name_number] = $datam;
|
$table->data['plugin_'.$next_name_number] = $datam;
|
||||||
|
|
||||||
@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) {
|
|||||||
|
|
||||||
$datam = [];
|
$datam = [];
|
||||||
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
|
$datam[0] = __('Help')."<span class='normal_weight'> ($macro_name)</span><br><br><br>";
|
||||||
$tadisabled = $locked === true ? ' disabled' : '';
|
|
||||||
$datam[1] = html_print_textarea(
|
$datam[1] = html_print_textarea(
|
||||||
$macro_help_name,
|
$macro_help_name,
|
||||||
6,
|
6,
|
||||||
100,
|
100,
|
||||||
$macro_help_value,
|
$macro_help_value,
|
||||||
'class="command_macro" class="w97p"'.$tadisabled,
|
'class="command_macro" class="w97p"',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($locked) {
|
|
||||||
$datam[1] .= html_print_image(
|
|
||||||
'images/lock_mc.png',
|
|
||||||
true,
|
|
||||||
['class' => 'command_macro lock invert_filter']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$datam[1] .= '<br><br><br>';
|
$datam[1] .= '<br><br><br>';
|
||||||
|
|
||||||
$table->data['plugin_'.$next_name_number] = $datam;
|
$table->data['plugin_'.$next_name_number] = $datam;
|
||||||
@ -551,6 +529,8 @@ if (($create != '') || ($view != '')) {
|
|||||||
|
|
||||||
// Add/Delete buttons
|
// Add/Delete buttons
|
||||||
$datam = [];
|
$datam = [];
|
||||||
|
|
||||||
|
if (!$locked) {
|
||||||
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.' '.html_print_image(
|
$datam[0] = '<a id="add_macro_btn" href="javascript:;">'.'<span class="bolder">'.__('Add macro').'</span>'.' '.html_print_image(
|
||||||
'images/add.png',
|
'images/add.png',
|
||||||
true,
|
true,
|
||||||
@ -559,7 +539,6 @@ if (($create != '') || ($view != '')) {
|
|||||||
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
|
$datam[0] .= '<div id="next_macro" class="invisible">'.$i.'</div>';
|
||||||
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
|
$datam[0] .= '<div id="next_row" class="invisible">'.$next_name_number.'</div>';
|
||||||
|
|
||||||
if (!$locked) {
|
|
||||||
$delete_macro_style = '';
|
$delete_macro_style = '';
|
||||||
if ($i <= 2) {
|
if ($i <= 2) {
|
||||||
$delete_macro_style = 'display:none;';
|
$delete_macro_style = 'display:none;';
|
||||||
@ -1002,7 +981,10 @@ ui_require_javascript_file('pandora_modules');
|
|||||||
});
|
});
|
||||||
update_preview();
|
update_preview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (locked === 0) {
|
||||||
$('a#add_macro_btn').click(add_macro_click_event);
|
$('a#add_macro_btn').click(add_macro_click_event);
|
||||||
|
}
|
||||||
|
|
||||||
// Delete macro
|
// Delete macro
|
||||||
var delete_macro_click_event = function (event) {
|
var delete_macro_click_event = function (event) {
|
||||||
@ -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) {
|
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'); ?>");
|
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
$('a#add_macro_btn').click(add_macro_click_locked_event);
|
$('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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
$table->class = 'info_table';
|
$table->class = 'info_table';
|
||||||
$table->width = '98%';
|
$table->width = '98%';
|
||||||
$table->head[0] = __('Map connection name');
|
$table->head[0] = __('Map connection name');
|
||||||
|
@ -207,6 +207,7 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table = new stdClass();
|
||||||
$table->width = '90%';
|
$table->width = '90%';
|
||||||
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
@ -45,7 +45,7 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
|||||||
$php_version = phpversion();
|
$php_version = phpversion();
|
||||||
$php_version_array = explode('.', $php_version);
|
$php_version_array = explode('.', $php_version);
|
||||||
if ($php_version_array[0] < 7) {
|
if ($php_version_array[0] < 7) {
|
||||||
include_once 'general/php7_message.php';
|
include_once 'general/php_message.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$tab = get_parameter('tab', 'online');
|
$tab = get_parameter('tab', 'online');
|
||||||
|
@ -35,8 +35,6 @@ require_once $config['homedir'].'/vendor/autoload.php';
|
|||||||
|
|
||||||
use PandoraFMS\Dashboard\Manager;
|
use PandoraFMS\Dashboard\Manager;
|
||||||
|
|
||||||
enterprise_hook('open_meta_frame');
|
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_profile.php';
|
require_once $config['homedir'].'/include/functions_profile.php';
|
||||||
require_once $config['homedir'].'/include/functions_users.php';
|
require_once $config['homedir'].'/include/functions_users.php';
|
||||||
require_once $config['homedir'].'/include/functions_groups.php';
|
require_once $config['homedir'].'/include/functions_groups.php';
|
||||||
@ -130,6 +128,8 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
|
|||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$delete_profile = (bool) get_parameter('delete_profile');
|
$delete_profile = (bool) get_parameter('delete_profile');
|
||||||
|
$get_user_profile = (bool) get_parameter('get_user_profile');
|
||||||
|
|
||||||
if ($delete_profile) {
|
if ($delete_profile) {
|
||||||
$id2 = (string) get_parameter('id_user');
|
$id2 = (string) get_parameter('id_user');
|
||||||
$id_up = (int) get_parameter('id_user_profile');
|
$id_up = (int) get_parameter('id_user_profile');
|
||||||
@ -211,9 +211,64 @@ if (is_ajax()) {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($get_user_profile === true) {
|
||||||
|
$profile_id = (int) get_parameter('profile_id');
|
||||||
|
$group_id = (int) get_parameter('group_id', -1);
|
||||||
|
$user_id = (string) get_parameter('user_id', '');
|
||||||
|
$no_hierarchy = (int) get_parameter('no_hierarchy', -1);
|
||||||
|
$assigned_by = (string) get_parameter('assigned_by', '');
|
||||||
|
$id_policy = (int) get_parameter('id_policy', -1);
|
||||||
|
$tags = (string) get_parameter('id_policy', '');
|
||||||
|
|
||||||
|
$filter = [];
|
||||||
|
|
||||||
|
if ($group_id > -1) {
|
||||||
|
$filter['id_perfil'] = $profile_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($group_id > -1) {
|
||||||
|
$filter['id_grupo'] = $group_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_id !== '') {
|
||||||
|
$filter['id_usuario'] = $user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($no_hierarchy > -1) {
|
||||||
|
$filter['no_hierarchy'] = $no_hierarchy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($assigned_by !== '') {
|
||||||
|
$filter['assigned_by'] = $assigned_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_policy > -1) {
|
||||||
|
$filter['id_policy'] = $id_policy;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tags !== '') {
|
||||||
|
$filter['tags'] = $tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
$profile = db_get_all_rows_filter(
|
||||||
|
'tusuario_perfil',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($profile !== false && count($profile) > 0) {
|
||||||
|
echo json_encode($profile);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
echo json_encode('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
$tab = get_parameter('tab', 'user');
|
$tab = get_parameter('tab', 'user');
|
||||||
|
|
||||||
@ -442,7 +497,7 @@ if ($create_user) {
|
|||||||
$password_new = '';
|
$password_new = '';
|
||||||
$password_confirm = '';
|
$password_confirm = '';
|
||||||
$new_user = true;
|
$new_user = true;
|
||||||
} else if (excludedPassword($password_new) === true) {
|
} else if (enterprise_hook('excludedPassword', [$password_new]) === true) {
|
||||||
$is_err = true;
|
$is_err = true;
|
||||||
ui_print_error_message(__('The password provided is not valid. Please set another one.'));
|
ui_print_error_message(__('The password provided is not valid. Please set another one.'));
|
||||||
$user_info = $values;
|
$user_info = $values;
|
||||||
@ -1718,12 +1773,13 @@ $(document).ready (function () {
|
|||||||
var data = [];
|
var data = [];
|
||||||
var aux = 0;
|
var aux = 0;
|
||||||
|
|
||||||
if(json_profile.val() != '') {
|
function addProfile(form) {
|
||||||
|
try {
|
||||||
var data = JSON.parse(json_profile.val());
|
var data = JSON.parse(json_profile.val());
|
||||||
|
} catch {
|
||||||
|
var data = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input:image[name="add"]').click(function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var profile = $('#assign_profile').val();
|
var profile = $('#assign_profile').val();
|
||||||
var profile_text = $('#assign_profile option:selected').text();
|
var profile_text = $('#assign_profile option:selected').text();
|
||||||
var group = $('#assign_group').val();
|
var group = $('#assign_group').val();
|
||||||
@ -1739,14 +1795,26 @@ $(document).ready (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (profile === '0' || group === '-1') {
|
if (profile === '0' || group === '-1') {
|
||||||
alert('<?php echo __('please select profile and group'); ?>');
|
alert('<?php echo __('Please select profile and group'); ?>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id_user == '' || is_err == 1) {
|
if (id_user == '' || is_err == 1) {
|
||||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||||
|
|
||||||
|
var profile_is_added = Object.entries(data).find(function(_data) {
|
||||||
|
return _data[1] === new_json;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (typeof profile_is_added === 'undefined') {
|
||||||
data.push(new_json);
|
data.push(new_json);
|
||||||
|
} else {
|
||||||
|
alert('<?php echo __('This profile is already defined'); ?>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
json_profile.val(JSON.stringify(data));
|
json_profile.val(JSON.stringify(data));
|
||||||
|
|
||||||
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
|
profile_text = `<a href="index.php?sec2=godmode/users/configure_profile&id=${profile}">${profile_text}</a>`;
|
||||||
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
|
group_img = `<img id="img_group_${aux}" src="" data-title="${group_text}" data-use_title_for_force_title="1" class="bot forced_title" alt="${group_text}"/>`;
|
||||||
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
|
group_text = `<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=${group}">${group_img}${group_text}</a>`;
|
||||||
@ -1765,8 +1833,39 @@ $(document).ready (function () {
|
|||||||
aux++;
|
aux++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('input:image[name="add"]').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (id_user.length === 0) {
|
||||||
|
addProfile(this.form);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
params.push("get_user_profile=1");
|
||||||
|
params.push("profile_id=" + $('#assign_profile').val())
|
||||||
|
params.push("group_id=" + $('#assign_group').val());
|
||||||
|
params.push("user_id=" + id_user);
|
||||||
|
params.push("page=godmode/users/configure_user");
|
||||||
|
jQuery.ajax ({
|
||||||
|
data: params.join("&"),
|
||||||
|
type: 'POST',
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
form: this.form,
|
||||||
|
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.length > 0) {
|
||||||
|
alert('<?php echo __('This profile is already defined'); ?>');
|
||||||
|
} else {
|
||||||
|
addProfile(this.form);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input:image[name="del"]').click(function (e) {
|
$('input:image[name="del"]').click(function (e) {
|
||||||
@ -1841,9 +1940,11 @@ function delete_profile(event, btn) {
|
|||||||
|
|
||||||
var json = json_profile.val();
|
var json = json_profile.val();
|
||||||
var test = JSON.parse(json);
|
var test = JSON.parse(json);
|
||||||
delete test[position-1];
|
|
||||||
json_profile.val(JSON.stringify(test));
|
|
||||||
|
|
||||||
|
var position_offset = <?php echo (is_metaconsole() === true) ? 2 : 1; ?>;
|
||||||
|
|
||||||
|
test.splice(position-position_offset, 1);
|
||||||
|
json_profile.val(JSON.stringify(test));
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_data_section () {
|
function show_data_section () {
|
||||||
|
@ -319,6 +319,17 @@ if ($delete_user === true) {
|
|||||||
if ($id_user != $config['id_user']) {
|
if ($id_user != $config['id_user']) {
|
||||||
$user_row = users_get_user_by_id($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);
|
$result = delete_user($id_user);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -335,12 +346,16 @@ if ($delete_user === true) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Delete the user in all the consoles.
|
// Delete the user in all the consoles.
|
||||||
if (is_metaconsole() === true && isset($_GET['delete_all'])) {
|
if (is_metaconsole() === true) {
|
||||||
$servers = metaconsole_get_servers();
|
$servers = metaconsole_get_servers();
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
// Connect to the remote console.
|
// Connect to the remote console.
|
||||||
if (metaconsole_connect($server) === NOERR) {
|
if (metaconsole_connect($server) === NOERR) {
|
||||||
// Delete the user.
|
// Delete the user.
|
||||||
|
if (isset($private_dashboards) === true) {
|
||||||
|
db_process_sql_delete('tdashboard', ['id_user' => $id_user]);
|
||||||
|
}
|
||||||
|
|
||||||
$result = delete_user($id_user);
|
$result = delete_user($id_user);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit(
|
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']))
|
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header('Refresh:1');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(__('There was a problem deleting the user'));
|
ui_print_error_message(__('There was a problem deleting the user'));
|
||||||
|
@ -553,7 +553,7 @@ if ($load_filter_modal) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
echo '<div id="load-filter-select" class="load-filter-modal">';
|
echo '<div id="load-filter-select" class="load-filter-modal">';
|
||||||
echo '<form method="post" id="form_load_filter">';
|
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
|
||||||
|
|
||||||
$table = new StdClass;
|
$table = new StdClass;
|
||||||
$table->id = 'load_filter_form';
|
$table->id = 'load_filter_form';
|
||||||
@ -1580,7 +1580,7 @@ if ($get_extended_event) {
|
|||||||
$filter = get_parameter('filter', []);
|
$filter = get_parameter('filter', []);
|
||||||
$similar_ids = get_parameter('similar_ids', $event_id);
|
$similar_ids = get_parameter('similar_ids', $event_id);
|
||||||
$group_rep = $filter['group_rep'];
|
$group_rep = $filter['group_rep'];
|
||||||
$event_rep = $group_rep;
|
$event_rep = (empty($group_rep) === true) ? EVENT_GROUP_REP_EVENTS : $group_rep;
|
||||||
$timestamp_first = $event['timestamp_first'];
|
$timestamp_first = $event['timestamp_first'];
|
||||||
$timestamp_last = $event['timestamp_last'];
|
$timestamp_last = $event['timestamp_last'];
|
||||||
$server_id = $event['server_id'];
|
$server_id = $event['server_id'];
|
||||||
@ -2270,7 +2270,7 @@ if ($drawConsoleSound === true) {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => __('Time Sound'),
|
'label' => __('Sound duration'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'fields' => $times_sound,
|
'fields' => $times_sound,
|
||||||
|
@ -250,9 +250,9 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
{
|
{
|
||||||
global $config, $mysql_cache;
|
global $config, $mysql_cache;
|
||||||
|
|
||||||
// Remote authentication
|
// Remote authentication.
|
||||||
switch ($config['auth']) {
|
switch ($config['auth']) {
|
||||||
// LDAP
|
// LDAP.
|
||||||
case 'ldap':
|
case 'ldap':
|
||||||
$sr = ldap_process_user_login($login, $pass);
|
$sr = ldap_process_user_login($login, $pass);
|
||||||
// Try with secondary server if not login.
|
// Try with secondary server if not login.
|
||||||
@ -265,7 +265,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Active Directory
|
// Active Directory.
|
||||||
case 'ad':
|
case 'ad':
|
||||||
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
|
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
|
||||||
$config['auth_error'] = 'User not found in database or incorrect password';
|
$config['auth_error'] = 'User not found in database or incorrect password';
|
||||||
@ -273,7 +273,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Remote Pandora FMS
|
// Remote Pandora FMS.
|
||||||
case 'pandora':
|
case 'pandora':
|
||||||
if (enterprise_hook('remote_pandora_process_user_login', [$login, $pass]) === false) {
|
if (enterprise_hook('remote_pandora_process_user_login', [$login, $pass]) === false) {
|
||||||
$config['auth_error'] = 'User not found in database or incorrect password';
|
$config['auth_error'] = 'User not found in database or incorrect password';
|
||||||
@ -281,7 +281,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Remote Integria
|
// Remote Integria.
|
||||||
case 'integria':
|
case 'integria':
|
||||||
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
|
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
|
||||||
$config['auth_error'] = 'User not found in database or incorrect password';
|
$config['auth_error'] = 'User not found in database or incorrect password';
|
||||||
@ -289,7 +289,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Unknown authentication method
|
// Unknown authentication method.
|
||||||
default:
|
default:
|
||||||
$config['auth_error'] = 'User not found in database or incorrect password';
|
$config['auth_error'] = 'User not found in database or incorrect password';
|
||||||
return false;
|
return false;
|
||||||
@ -303,7 +303,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Authentication ok, check if the user exists in the local database
|
// Authentication ok, check if the user exists in the local database.
|
||||||
if (is_user($login)) {
|
if (is_user($login)) {
|
||||||
if (!user_can_login($login) && $api === false) {
|
if (!user_can_login($login) && $api === false) {
|
||||||
return false;
|
return false;
|
||||||
@ -370,7 +370,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||||||
return $login;
|
return $login;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user does not exist and can not be created
|
// The user does not exist and can not be created.
|
||||||
if ($config['autocreate_remote_users'] == 0 || is_user_blacklisted($login)) {
|
if ($config['autocreate_remote_users'] == 0 || is_user_blacklisted($login)) {
|
||||||
$config['auth_error'] = __(
|
$config['auth_error'] = __(
|
||||||
'Ooops User not found in
|
'Ooops User not found in
|
||||||
@ -759,7 +759,7 @@ function update_user_password(string $user, string $password_new)
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (excludedPassword($password_new) === true) {
|
if (enterprise_hook('excludedPassword', [$password_new]) === true) {
|
||||||
$config['auth_error'] = __('The password provided is not valid. Please, set another one.');
|
$config['auth_error'] = __('The password provided is not valid. Please, set another one.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -967,6 +967,12 @@ function ldap_process_user_login($login, $password, $secondary_server=false)
|
|||||||
|
|
||||||
$sr = ldap_search($ds, io_safe_output($ldap['ldap_base_dn']), $filter);
|
$sr = ldap_search($ds, io_safe_output($ldap['ldap_base_dn']), $filter);
|
||||||
|
|
||||||
|
if (empty($sr) === true) {
|
||||||
|
$config['auth_error'] = 'ldap search failed';
|
||||||
|
@ldap_close($ds);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$memberof = ldap_get_entries($ds, $sr);
|
$memberof = ldap_get_entries($ds, $sr);
|
||||||
|
|
||||||
if ($memberof['count'] == 0 && !isset($memberof[0]['memberof'])) {
|
if ($memberof['count'] == 0 && !isset($memberof[0]['memberof'])) {
|
||||||
|
@ -1594,17 +1594,21 @@ class ConsoleSupervisor
|
|||||||
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS');
|
$this->cleanNotifications('NOTIF.PHP.PHANTOMJS');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($php_version_array[0] < 7) {
|
if ($php_version_array[0] < 8) {
|
||||||
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/14_php_7';
|
$url = 'https://pandorafms.com/manual/en/documentation/07_technical_annexes/18_php_8';
|
||||||
if ($config['language'] == 'es') {
|
if ($config['language'] == 'es') {
|
||||||
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/14_php_7';
|
$url = 'https://pandorafms.com/manual/es/documentation/07_technical_annexes/18_php_8';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($config['language'] == 'ja') {
|
||||||
|
$url = 'https://pandorafms.com/manual/ja/documentation/07_technical_annexes/18_php_8';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PHP.VERSION',
|
'type' => 'NOTIF.PHP.VERSION',
|
||||||
'title' => __('PHP UPDATE REQUIRED'),
|
'title' => __('PHP UPDATE REQUIRED'),
|
||||||
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
|
'message' => __('For a correct operation of PandoraFMS, PHP must be updated to version 8.0 or higher.').'<br>'.__('Otherwise, functionalities will be lost.').'<br>'."<ol><li class='color_67'>".__('Report download in PDF format').'</li>'."<li class='color_67'>".__('Emails Sending').'</li><li class="color_67">'.__('Metaconsole Collections').'</li><li class="color_67">...</li></ol>',
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -143,6 +143,7 @@ class Diagnostics extends Wizard
|
|||||||
[
|
[
|
||||||
'title' => __('Export to PDF'),
|
'title' => __('Export to PDF'),
|
||||||
'class' => 'invert_filter',
|
'class' => 'invert_filter',
|
||||||
|
'onclick' => 'blockResubmit($(this))',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$header_buttons = [
|
$header_buttons = [
|
||||||
|
@ -506,6 +506,7 @@ class ModuleTemplates extends HTML
|
|||||||
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
|
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $fileName).'.csv');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header('Expires: 0');
|
header('Expires: 0');
|
||||||
|
setDownloadCookieToken();
|
||||||
|
|
||||||
// Clean up output buffering
|
// Clean up output buffering
|
||||||
while (@ob_end_clean()) {
|
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=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);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -2215,8 +2215,10 @@ class NetworkMap
|
|||||||
// Store relationships.
|
// Store relationships.
|
||||||
$this->relations = array_merge($edges, $orphans);
|
$this->relations = array_merge($edges, $orphans);
|
||||||
} else {
|
} else {
|
||||||
|
if (empty($this->relations) === true && empty($this->$edges) === false) {
|
||||||
$this->relations = $edges;
|
$this->relations = $edges;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close dot file.
|
// Close dot file.
|
||||||
$graph .= $this->closeDotFile();
|
$graph .= $this->closeDotFile();
|
||||||
@ -2409,6 +2411,13 @@ class NetworkMap
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->mapOptions['map_filter']['node_separation']) === true) {
|
||||||
|
foreach ($graph['nodes'] as $key => $value) {
|
||||||
|
$graph['nodes'][$key]['x'] *= $this->mapOptions['map_filter']['node_separation'];
|
||||||
|
$graph['nodes'][$key]['y'] *= $this->mapOptions['map_filter']['node_separation'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unlink($filename_plain);
|
unlink($filename_plain);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC221110';
|
$build_version = 'PC221213';
|
||||||
$pandora_version = 'v7.0NG.766';
|
$pandora_version = 'v7.0NG.767';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
$script_tz = @date_default_timezone_get();
|
$script_tz = @date_default_timezone_get();
|
||||||
|
@ -1046,7 +1046,7 @@ function mysql_db_get_row_filter($table, $filter, $fields=false, $where_join='AN
|
|||||||
*
|
*
|
||||||
* @return mixed Array of the row or false in case of error.
|
* @return mixed Array of the row or false in case of error.
|
||||||
*/
|
*/
|
||||||
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false)
|
function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_join='AND', $search_history_db=false, $returnSQL=false, $cache=true)
|
||||||
{
|
{
|
||||||
// TODO: Validate and clean fields
|
// TODO: Validate and clean fields
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
@ -1077,7 +1077,7 @@ function mysql_db_get_all_rows_filter($table, $filter=[], $fields=false, $where_
|
|||||||
if ($returnSQL) {
|
if ($returnSQL) {
|
||||||
return $sql;
|
return $sql;
|
||||||
} else {
|
} else {
|
||||||
return db_get_all_rows_sql($sql, $search_history_db);
|
return db_get_all_rows_sql($sql, $search_history_db, $cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6269,3 +6269,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),
|
||||||
|
'/'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4325,7 +4325,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
|
|||||||
{
|
{
|
||||||
ui_require_css_file('heatmap');
|
ui_require_css_file('heatmap');
|
||||||
|
|
||||||
$all_modules = agents_get_modules($id_agent);
|
$all_modules = agents_get_modules($id_agent, 'id_agente_modulo', ['disabled' => 0]);
|
||||||
if (empty($all_modules)) {
|
if (empty($all_modules)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -4367,7 +4367,6 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
|
|||||||
$status = modules_get_agentmodule_status($key);
|
$status = modules_get_agentmodule_status($key);
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case 0:
|
case 0:
|
||||||
case 4:
|
|
||||||
case 300:
|
case 300:
|
||||||
$status = 'normal';
|
$status = 'normal';
|
||||||
break;
|
break;
|
||||||
@ -4386,6 +4385,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
|
|||||||
$status = 'unknown';
|
$status = 'unknown';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
$status = 'notinit';
|
$status = 'notinit';
|
||||||
break;
|
break;
|
||||||
|
@ -64,6 +64,7 @@ use PandoraFMS\Agent;
|
|||||||
use PandoraFMS\Module;
|
use PandoraFMS\Module;
|
||||||
use PandoraFMS\Enterprise\Cluster;
|
use PandoraFMS\Enterprise\Cluster;
|
||||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
use PandoraFMS\Event;
|
||||||
use PandoraFMS\SpecialDay;
|
use PandoraFMS\SpecialDay;
|
||||||
|
|
||||||
|
|
||||||
@ -3587,6 +3588,19 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
|
|||||||
// Column 'module_macros' cannot be null.
|
// 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) {
|
if ($agent_by_alias) {
|
||||||
$agents_affected = 0;
|
$agents_affected = 0;
|
||||||
$idModule = false;
|
$idModule = false;
|
||||||
@ -11228,366 +11242,6 @@ function api_set_gis_agent($id_agent, $trash1, $other, $return_type, $user_in_db
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db)
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$table_events = 'tevento';
|
|
||||||
|
|
||||||
// By default.
|
|
||||||
$status = 3;
|
|
||||||
$search = '';
|
|
||||||
$event_type = '';
|
|
||||||
$severity = -1;
|
|
||||||
$id_agent = -1;
|
|
||||||
$id_agentmodule = -1;
|
|
||||||
$id_alert_am = -1;
|
|
||||||
$id_event = -1;
|
|
||||||
$id_user_ack = 0;
|
|
||||||
$event_view_hr = 0;
|
|
||||||
$tag = '';
|
|
||||||
$group_rep = EVENT_GROUP_REP_ALL;
|
|
||||||
$utimestamp_upper = 0;
|
|
||||||
$utimestamp_bottom = 0;
|
|
||||||
$id_alert_template = -1;
|
|
||||||
|
|
||||||
$use_agent_name = ($other['data'][16] === '1') ? true : false;
|
|
||||||
|
|
||||||
$filter = otherParameter2Filter($other, true, $use_agent_name);
|
|
||||||
|
|
||||||
if (isset($filter['criticity'])) {
|
|
||||||
$severity = $filter['criticity'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['id_agente'])) {
|
|
||||||
$id_agent = $filter['id_agente'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['id_agentmodule'])) {
|
|
||||||
$id_agentmodule = $filter['id_agentmodule'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['id_alert_am'])) {
|
|
||||||
$id_alert_am = $filter['id_alert_am'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['id_usuario'])) {
|
|
||||||
$id_user_ack = $filter['id_usuario'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['estado'])) {
|
|
||||||
$status = $filter['estado'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['evento'])) {
|
|
||||||
$search = $filter['evento'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['id_alert_template'])) {
|
|
||||||
$id_alert_template = $filter['id_alert_template'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$id_group = (int) $filter['id_group'];
|
|
||||||
|
|
||||||
$user_groups = users_get_groups($user_in_db, 'ER');
|
|
||||||
$user_id_groups = [];
|
|
||||||
if (!empty($user_groups)) {
|
|
||||||
$user_id_groups = array_keys($user_groups);
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_admin = (bool) db_get_value(
|
|
||||||
'is_admin',
|
|
||||||
'tusuario',
|
|
||||||
'id_user',
|
|
||||||
$user_in_db
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($filter['id_group'])) {
|
|
||||||
// The admin can see all groups
|
|
||||||
if ($is_admin) {
|
|
||||||
if (($id_group !== -1) && ($id_group !== 0)) {
|
|
||||||
$id_groups = [$id_group];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (empty($id_group)) {
|
|
||||||
$id_groups = $user_id_groups;
|
|
||||||
} else {
|
|
||||||
if (in_array($id_group, $user_id_groups)) {
|
|
||||||
$id_groups = [$id_group];
|
|
||||||
} else {
|
|
||||||
$id_groups = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!$is_admin) {
|
|
||||||
$id_groups = $user_id_groups;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['tag'])) {
|
|
||||||
$tag = $filter['tag'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['event_type'])) {
|
|
||||||
$event_type = $filter['event_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filter['utimestamp']) {
|
|
||||||
if (isset($filter['utimestamp']['>'])) {
|
|
||||||
$utimestamp_upper = $filter['utimestamp']['>'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['utimestamp']['<'])) {
|
|
||||||
$utimestamp_bottom = $filter['utimestamp']['<'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO MOVE THIS CODE AND THE CODE IN pandora_console/operation/events/events_list.php
|
|
||||||
// to a function.
|
|
||||||
$sql_post = '';
|
|
||||||
|
|
||||||
if (!empty($id_groups)) {
|
|
||||||
$sql_post = ' AND id_grupo IN ('.implode(',', $id_groups).')';
|
|
||||||
} else {
|
|
||||||
// The admin can see all groups
|
|
||||||
if (!$is_admin) {
|
|
||||||
$sql_post = ' AND 1=0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip system messages if user is not PM
|
|
||||||
if (!check_acl($user_in_db, 0, 'PM')) {
|
|
||||||
$sql_post .= ' AND id_grupo != 0';
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($status) {
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
$sql_post .= ' AND estado = '.$status;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
$sql_post .= ' AND (estado = 0 OR estado = 2)';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($search != '') {
|
|
||||||
$sql_post .= " AND evento LIKE '%".io_safe_input($search)."%'";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($event_type != '') {
|
|
||||||
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
|
||||||
// for the user so for him is presented only "warning, critical and normal"
|
|
||||||
if ($event_type == 'warning' || $event_type == 'critical' || $event_type == 'normal') {
|
|
||||||
$sql_post .= " AND event_type LIKE '%$event_type%' ";
|
|
||||||
} else if ($event_type == 'not_normal') {
|
|
||||||
$sql_post .= " AND ( event_type LIKE '%warning%'
|
|
||||||
OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' ) ";
|
|
||||||
} else {
|
|
||||||
$sql_post .= " AND event_type = '".$event_type."'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($severity != -1) {
|
|
||||||
$sql_post .= ' AND criticity = '.$severity;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_agent != -1) {
|
|
||||||
$sql_post .= ' AND id_agente = '.$id_agent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_agentmodule != -1) {
|
|
||||||
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_event != -1) {
|
|
||||||
$sql_post .= ' AND id_evento = '.$id_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_user_ack != '0') {
|
|
||||||
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($utimestamp_upper != 0) {
|
|
||||||
$sql_post .= ' AND utimestamp >= '.$utimestamp_upper;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($utimestamp_bottom != 0) {
|
|
||||||
$sql_post .= ' AND utimestamp <= '.$utimestamp_bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($event_view_hr > 0) {
|
|
||||||
// Put hours in seconds
|
|
||||||
$unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR));
|
|
||||||
$sql_post .= ' AND (utimestamp > '.$unixtime.' OR estado = 2)';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search by tag
|
|
||||||
if ($tag != '') {
|
|
||||||
$sql_post .= " AND tags LIKE '".io_safe_input($tag)."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject the raw sql
|
|
||||||
if (isset($filter['sql'])) {
|
|
||||||
$sql_post .= ' AND ('.$filter['sql'].') ';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject agent ID filter (it is set as the first numeric key in filter array).
|
|
||||||
if (isset($filter[0]) === true) {
|
|
||||||
$sql_post .= ' AND '.$filter[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id_alert_template !== -1) {
|
|
||||||
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
|
|
||||||
}
|
|
||||||
|
|
||||||
$alert_join = '';
|
|
||||||
|
|
||||||
if ($id_alert_template !== -1) {
|
|
||||||
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($group_rep == EVENT_GROUP_REP_ALL) {
|
|
||||||
if ($filter['total']) {
|
|
||||||
$sql = 'SELECT COUNT(*)
|
|
||||||
FROM '.$table_events.'
|
|
||||||
WHERE 1=1 '.$sql_post;
|
|
||||||
} else if ($filter['more_criticity']) {
|
|
||||||
$sql = 'SELECT criticity
|
|
||||||
FROM '.$table_events.'
|
|
||||||
WHERE 1=1 '.$sql_post.'
|
|
||||||
ORDER BY criticity DESC
|
|
||||||
LIMIT 1';
|
|
||||||
} else {
|
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
$sql = 'SELECT *,
|
|
||||||
(SELECT t2.nombre
|
|
||||||
FROM tgrupo t2
|
|
||||||
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_name,
|
|
||||||
(SELECT t2.icon
|
|
||||||
FROM tgrupo t2
|
|
||||||
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
|
|
||||||
FROM '.$table_events.$alert_join.'
|
|
||||||
WHERE 1=1 '.$sql_post.'
|
|
||||||
ORDER BY utimestamp DESC';
|
|
||||||
} else {
|
|
||||||
$sql = 'SELECT *,
|
|
||||||
(SELECT t1.alias
|
|
||||||
FROM tagente t1
|
|
||||||
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
|
|
||||||
(SELECT t2.nombre
|
|
||||||
FROM tgrupo t2
|
|
||||||
WHERE t2.id_grupo = tevento.id_grupo) AS group_name,
|
|
||||||
(SELECT t2.icon
|
|
||||||
FROM tgrupo t2
|
|
||||||
WHERE t2.id_grupo = tevento.id_grupo) AS group_icon,
|
|
||||||
(SELECT tmodule.name
|
|
||||||
FROM tmodule
|
|
||||||
WHERE id_module IN (
|
|
||||||
SELECT tagente_modulo.id_modulo
|
|
||||||
FROM tagente_modulo
|
|
||||||
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
|
|
||||||
FROM '.$table_events.$alert_join.'
|
|
||||||
WHERE 1=1 '.$sql_post.'
|
|
||||||
ORDER BY utimestamp DESC';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
db_process_sql('SET group_concat_max_len = 9999999');
|
|
||||||
|
|
||||||
$sql = "SELECT *, MAX(id_evento) AS id_evento,
|
|
||||||
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
|
|
||||||
MIN(estado) AS min_estado, MAX(estado) AS max_estado,
|
|
||||||
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_last
|
|
||||||
FROM ".$table_events.'
|
|
||||||
WHERE 1=1 '.$sql_post.'
|
|
||||||
GROUP BY evento, id_agentmodule
|
|
||||||
ORDER BY timestamp_last DESC';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
|
||||||
if ($other['data'] != '') {
|
|
||||||
returnError('Parameter error.');
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
// Default values
|
|
||||||
$separator = ';';
|
|
||||||
}
|
|
||||||
} else if ($other['type'] == 'array') {
|
|
||||||
$separator = $other['data'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if (($result !== false)
|
|
||||||
&& (!$filter['total'])
|
|
||||||
&& (!$filter['more_criticity'])
|
|
||||||
) {
|
|
||||||
$urlImage = ui_get_full_url(false);
|
|
||||||
|
|
||||||
// Add the description and image
|
|
||||||
foreach ($result as $key => $row) {
|
|
||||||
if (defined('METACONSOLE')) {
|
|
||||||
$row['agent_name'] = agents_meta_get_name(
|
|
||||||
$row['id_agente'],
|
|
||||||
'none',
|
|
||||||
$row['server_id']
|
|
||||||
);
|
|
||||||
|
|
||||||
$row['module_name'] = meta_modules_get_name(
|
|
||||||
$row['id_agentmodule'],
|
|
||||||
$row['server_id']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FOR THE TEST THE API IN THE ANDROID
|
|
||||||
// $row['evento'] = $row['id_evento'];
|
|
||||||
$row['description_event'] = events_print_type_description($row['event_type'], true);
|
|
||||||
$row['img_description'] = events_print_type_img($row['event_type'], true, true);
|
|
||||||
$row['criticity_name'] = get_priority_name($row['criticity']);
|
|
||||||
|
|
||||||
switch ($row['criticity']) {
|
|
||||||
default:
|
|
||||||
case EVENT_CRIT_MAINTENANCE:
|
|
||||||
$img_sev = $urlImage.'/images/status_sets/default/severity_maintenance.png';
|
|
||||||
break;
|
|
||||||
case EVENT_CRIT_INFORMATIONAL:
|
|
||||||
$img_sev = $urlImage.'/images/status_sets/default/severity_informational.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVENT_CRIT_NORMAL:
|
|
||||||
$img_sev = $urlImage.'/images/status_sets/default/severity_normal.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVENT_CRIT_WARNING:
|
|
||||||
$img_sev = $urlImage.'/images/status_sets/default/severity_warning.png';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVENT_CRIT_CRITICAL:
|
|
||||||
$img_sev = $urlImage.'/images/status_sets/default/severity_critical.png';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$row['img_criticy'] = $img_sev;
|
|
||||||
|
|
||||||
$result[$key] = $row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['type'] = 'array';
|
|
||||||
$data['data'] = $result;
|
|
||||||
|
|
||||||
returnData($returnType, $data, $separator);
|
|
||||||
if (empty($result)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an event
|
* Update an event
|
||||||
*
|
*
|
||||||
@ -11657,71 +11311,162 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get events.
|
||||||
*
|
*
|
||||||
* @param $trash1
|
* @param $trash1
|
||||||
* @param $trah2
|
* @param $trah2
|
||||||
* @param $other
|
* @param $other
|
||||||
* @param $returnType
|
* @param $returnType
|
||||||
* @param $user_in_db
|
|
||||||
*/
|
*/
|
||||||
function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
|
function api_get_events($node_id, $trash2, $other, $returnType)
|
||||||
{
|
{
|
||||||
if ($user_in_db !== null) {
|
$separator = (isset($other['data'][0]) === true && empty($other['data'][0]) === false) ? $other['data'][0] : ';';
|
||||||
$correct = get_events_with_user(
|
|
||||||
$trash1,
|
if (is_metaconsole() === true) {
|
||||||
$trash2,
|
if (empty($node_id) === true && $node_id != 0) {
|
||||||
$other,
|
$node_id = array_keys(metaconsole_get_names(['disabled' => 0]));
|
||||||
$returnType,
|
$node_id[] = 0;
|
||||||
$user_in_db
|
} else {
|
||||||
|
$node_id = [(int) $node_id];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$node_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filters = [
|
||||||
|
'group_rep' => EVENT_GROUP_REP_ALL,
|
||||||
|
'severity' => (isset($other['data'][1]) === true) ? $other['data'][1] : null,
|
||||||
|
'agent_alias' => (isset($other['data'][2]) === true) ? $other['data'][2] : null,
|
||||||
|
'module_search' => (isset($other['data'][3]) === true) ? $other['data'][3] : null,
|
||||||
|
'filter_only_alert' => (isset($other['data'][4]) === true) ? $other['data'][4] : null,
|
||||||
|
'id_user_ack' => (isset($other['data'][5]) === true) ? $other['data'][5] : null,
|
||||||
|
'date_from' => (isset($other['data'][6]) === true && empty($other['data'][6]) === false) ? date('y-m-d', $other['data'][6]) : null,
|
||||||
|
'date_to' => (isset($other['data'][7]) === true && empty($other['data'][7]) === false) ? date('y-m-d', $other['data'][7]) : null,
|
||||||
|
'time_from' => (isset($other['data'][6]) === true && empty($other['data'][6]) === false) ? date('h:i:s', $other['data'][6]) : null,
|
||||||
|
'time_to' => (isset($other['data'][7]) === true && empty($other['data'][7]) === false) ? date('h:i:s', $other['data'][7]) : null,
|
||||||
|
'status' => (isset($other['data'][8]) === true) ? $other['data'][8] : null,
|
||||||
|
'search' => (isset($other['data'][9]) === true) ? $other['data'][9] : null,
|
||||||
|
'id_group_filter' => (isset($other['data'][13]) === true) ? $other['data'][13] : null,
|
||||||
|
'tag_with' => (isset($other['data'][14]) === true) ? base64_encode(io_safe_output($other['data'][14])) : null,
|
||||||
|
'event_type' => (isset($other['data'][15]) === true) ? $other['data'][15] : null,
|
||||||
|
'id_server' => $node_id,
|
||||||
|
];
|
||||||
|
|
||||||
|
$limit = null;
|
||||||
|
if (isset($other['data'][10]) === true) {
|
||||||
|
if (empty($other['data'][10]) === true) {
|
||||||
|
$limit = 0;
|
||||||
|
} else {
|
||||||
|
$limit = $other['data'][10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset = null;
|
||||||
|
if (isset($other['data'][11]) === true) {
|
||||||
|
if (empty($other['data'][11]) === true) {
|
||||||
|
$offset = 0;
|
||||||
|
} else {
|
||||||
|
$offset = $other['data'][11];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isset($other['data'][10]) === true) {
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fields = ['te.*'];
|
||||||
|
$order_direction = 'desc';
|
||||||
|
$order_field = 'te.utimestamp';
|
||||||
|
$filter_total = false;
|
||||||
|
if (isset($other['data'][12]) === true
|
||||||
|
&& empty($other['data'][12]) === false
|
||||||
|
) {
|
||||||
|
$filter_total = true;
|
||||||
|
if ($other['data'][12] === 'total') {
|
||||||
|
$fields = ['count'];
|
||||||
|
$limit = null;
|
||||||
|
$offset = null;
|
||||||
|
} else if ($other['data'][12] === 'more_criticity') {
|
||||||
|
$fields = ['te.criticity'];
|
||||||
|
$order_direction = 'desc';
|
||||||
|
$order_field = 'te.criticity';
|
||||||
|
$limit = 1;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$events = Event::search(
|
||||||
|
$fields,
|
||||||
|
$filters,
|
||||||
|
$offset,
|
||||||
|
$limit,
|
||||||
|
$order_direction,
|
||||||
|
$order_field
|
||||||
);
|
);
|
||||||
|
|
||||||
$last_error = error_get_last();
|
$result = $events;
|
||||||
if (!$correct && !empty($last_error)) {
|
if (is_metaconsole() === true && empty($limit) === false) {
|
||||||
$errors = [
|
$result = $events['data'];
|
||||||
E_ERROR,
|
}
|
||||||
E_WARNING,
|
|
||||||
E_USER_ERROR,
|
if (is_array($result) === true && $filter_total === false) {
|
||||||
E_USER_WARNING,
|
$urlImage = ui_get_full_url(false);
|
||||||
];
|
|
||||||
if (in_array($last_error['type'], $errors)) {
|
// Add the description and image.
|
||||||
returnError('ERROR_API_PANDORAFMS', $returnType);
|
foreach ($result as $key => $row) {
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
if (empty($row['id_agente']) === false) {
|
||||||
|
$row['agent_name'] = agents_meta_get_name(
|
||||||
|
$row['id_agente'],
|
||||||
|
'none',
|
||||||
|
$row['server_id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($row['id_agentmodule']) === false) {
|
||||||
|
$row['module_name'] = meta_modules_get_name(
|
||||||
|
$row['id_agentmodule'],
|
||||||
|
$row['server_id']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
// FOR THE TEST THE API IN THE ANDROID.
|
||||||
|
$row['description_event'] = events_print_type_description($row['event_type'], true);
|
||||||
|
$row['img_description'] = events_print_type_img($row['event_type'], true, true);
|
||||||
|
$row['criticity_name'] = get_priority_name($row['criticity']);
|
||||||
|
|
||||||
|
switch ($row['criticity']) {
|
||||||
|
default:
|
||||||
|
case EVENT_CRIT_MAINTENANCE:
|
||||||
|
$img_sev = $urlImage.'/images/status_sets/default/severity_maintenance.png';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_CRIT_INFORMATIONAL:
|
||||||
|
$img_sev = $urlImage.'/images/status_sets/default/severity_informational.png';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_CRIT_NORMAL:
|
||||||
|
$img_sev = $urlImage.'/images/status_sets/default/severity_normal.png';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_CRIT_WARNING:
|
||||||
|
$img_sev = $urlImage.'/images/status_sets/default/severity_warning.png';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_CRIT_CRITICAL:
|
||||||
|
$img_sev = $urlImage.'/images/status_sets/default/severity_critical.png';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($other['type'] == 'string') {
|
$row['img_criticy'] = $img_sev;
|
||||||
if ($other['data'] != '') {
|
|
||||||
returnError('Parameter error.');
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
// Default values
|
|
||||||
$separator = ';';
|
|
||||||
}
|
|
||||||
} else if ($other['type'] == 'array') {
|
|
||||||
$separator = $other['data'][0];
|
|
||||||
|
|
||||||
// By default it uses agent alias.
|
$result[$key] = $row;
|
||||||
$use_agent_name = ($other['data'][16] === '1') ? true : false;
|
|
||||||
|
|
||||||
$filterString = otherParameter2Filter($other, false, $use_agent_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dataRows = db_get_all_rows_filter('tevento', $filterString);
|
|
||||||
|
|
||||||
$last_error = error_get_last();
|
|
||||||
if (empty($dataRows)) {
|
|
||||||
if (!empty($last_error)) {
|
|
||||||
returnError('ERROR_API_PANDORAFMS', $returnType);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['type'] = 'array';
|
$data['type'] = $returnType;
|
||||||
$data['data'] = $dataRows;
|
$data['data'] = $result;
|
||||||
|
|
||||||
returnData($returnType, $data, $separator);
|
returnData($returnType, $data, $separator);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -89,23 +89,34 @@ function cron_next_execution($cron, $module_interval, $module_id)
|
|||||||
'id_agente_modulo',
|
'id_agente_modulo',
|
||||||
$module_id
|
$module_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$cron_elems = explode(' ', $cron);
|
||||||
|
|
||||||
|
if (isset($cron_elems[4]) === true) {
|
||||||
|
$cron_elems[4] = '*';
|
||||||
|
}
|
||||||
|
|
||||||
|
$cron = implode(' ', $cron_elems);
|
||||||
|
|
||||||
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
$cur_time = ($last_execution !== false) ? $last_execution : time();
|
||||||
$nex_time = cron_next_execution_date($cron, $cur_time, $module_interval);
|
$nex_time = cron_next_execution_date($cron, $cur_time, $module_interval);
|
||||||
$nex_wday = (int) date('w', $nex_time);
|
$nex_wday = (int) date('w', $nex_time);
|
||||||
|
|
||||||
// Check the wday values to avoid infinite loop.
|
// Check the wday values to avoid infinite loop.
|
||||||
$wday_int = cron_get_interval($wday);
|
$wday_int = cron_get_interval($wday);
|
||||||
if ($wday_int['down'] !== '*' && ($wday_int['down'] > 6 || ($wday_int['up'] !== false && $wday_int['up'] > 6))) {
|
if ($wday_int['down'] !== '*' && ($wday_int['down'] > 6 || ($wday_int['up'] !== false && $wday_int['up'] > 6))) {
|
||||||
$wday = '*';
|
$wday = '*';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check day of the way.
|
// Check week day.
|
||||||
while (!cron_check_interval($nex_wday, $wday)) {
|
while (!cron_check_interval($nex_wday, $wday)) {
|
||||||
// If it does not acomplish the day of the week, go to the next day.
|
// If it does not acomplish the day of the week, go to the next day.
|
||||||
$nex_time += SECONDS_1DAY;
|
$nex_time += SECONDS_1DAY;
|
||||||
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
|
|
||||||
$nex_wday = (int) date('w', $nex_time);
|
$nex_wday = (int) date('w', $nex_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$nex_time = cron_next_execution_date($cron, $nex_time, 0);
|
||||||
|
|
||||||
return ($nex_time - $cur_time);
|
return ($nex_time - $cur_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,6 +796,10 @@ function db_uncompress_module_data(
|
|||||||
$flag_async = true;
|
$flag_async = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strstr($module_type_str, 'async_string') !== false) {
|
||||||
|
$flag_async = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (strstr($module_type_str, 'async_proc') !== false) {
|
if (strstr($module_type_str, 'async_proc') !== false) {
|
||||||
$flag_async = true;
|
$flag_async = true;
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($filter['severity']) === true && $filter['severity'] > 0) {
|
if (isset($filter['severity']) === true && $filter['severity'] !== '' && (int) $filter['severity'] > -1) {
|
||||||
if (is_array($filter['severity']) === true) {
|
if (is_array($filter['severity']) === true) {
|
||||||
if (in_array(-1, $filter['severity']) === false) {
|
if (in_array(-1, $filter['severity']) === false) {
|
||||||
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
|
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
|
||||||
@ -1033,14 +1033,13 @@ function events_get_all(
|
|||||||
// Prepare agent join sql filters.
|
// Prepare agent join sql filters.
|
||||||
$table = 'tevento';
|
$table = 'tevento';
|
||||||
$tevento = 'tevento te';
|
$tevento = 'tevento te';
|
||||||
$agent_join_filters = [];
|
|
||||||
$tagente_table = 'tagente';
|
$tagente_table = 'tagente';
|
||||||
$tagente_field = 'id_agente';
|
$tagente_field = 'id_agente';
|
||||||
$conditionMetaconsole = '';
|
$conditionMetaconsole = '';
|
||||||
|
|
||||||
// Agent alias.
|
// Agent alias.
|
||||||
if (empty($filter['agent_alias']) === false) {
|
if (empty($filter['agent_alias']) === false) {
|
||||||
$agent_join_filters[] = sprintf(
|
$sql_filters[] = sprintf(
|
||||||
' AND ta.alias = "%s" ',
|
' AND ta.alias = "%s" ',
|
||||||
$filter['agent_alias']
|
$filter['agent_alias']
|
||||||
);
|
);
|
||||||
@ -1124,27 +1123,27 @@ function events_get_all(
|
|||||||
$sql_filters[] = sprintf(
|
$sql_filters[] = sprintf(
|
||||||
' AND JSON_VALID(custom_data) = 1
|
' AND JSON_VALID(custom_data) = 1
|
||||||
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
|
AND (JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) ',
|
||||||
io_safe_output($filter['custom_data'])
|
io_safe_output_html($filter['custom_data'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql_filters[] = sprintf(
|
$sql_filters[] = sprintf(
|
||||||
' AND JSON_VALID(custom_data) = 1
|
' AND JSON_VALID(custom_data) = 1
|
||||||
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
|
AND (JSON_SEARCH(JSON_KEYS(custom_data), "all", lower("%%%s%%") COLLATE utf8mb4_0900_ai_ci) IS NOT NULL) ',
|
||||||
io_safe_output($filter['custom_data'])
|
io_safe_output_html($filter['custom_data'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($filter['custom_data_filter_type'] === '1') {
|
if ($filter['custom_data_filter_type'] === '1') {
|
||||||
$sql_filters[] = sprintf(
|
$sql_filters[] = sprintf(
|
||||||
' AND JSON_VALID(custom_data) = 1 AND JSON_EXTRACT(custom_data, "$.*") LIKE lower("%%%s%%") ',
|
' AND JSON_VALID(custom_data) = 1
|
||||||
$filter['custom_data'],
|
AND cast(JSON_EXTRACT(custom_data, "$.*") as CHAR) LIKE lower("%%%s%%") ',
|
||||||
$filter['custom_data']
|
io_safe_output($filter['custom_data'])
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql_filters[] = sprintf(
|
$sql_filters[] = sprintf(
|
||||||
' AND JSON_VALID(custom_data) = 1 AND JSON_KEYS(custom_data) REGEXP "%s" ',
|
' AND JSON_VALID(custom_data) = 1
|
||||||
$filter['custom_data'],
|
AND cast(JSON_KEYS(custom_data) as CHAR) REGEXP "%s" ',
|
||||||
$filter['custom_data']
|
io_safe_output($filter['custom_data'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1311,7 +1310,7 @@ function events_get_all(
|
|||||||
'te.',
|
'te.',
|
||||||
// Alt table tag for id_grupo.
|
// Alt table tag for id_grupo.
|
||||||
$user_admin_group_all,
|
$user_admin_group_all,
|
||||||
(bool) $filter['search_secondary_groups']
|
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
|
||||||
);
|
);
|
||||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||||
} else if (check_acl($config['id_user'], 0, 'EW')) {
|
} else if (check_acl($config['id_user'], 0, 'EW')) {
|
||||||
@ -1338,7 +1337,7 @@ function events_get_all(
|
|||||||
'te.',
|
'te.',
|
||||||
// Alt table tag for id_grupo.
|
// Alt table tag for id_grupo.
|
||||||
$user_admin_group_all,
|
$user_admin_group_all,
|
||||||
(bool) $filter['search_secondary_groups']
|
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
|
||||||
);
|
);
|
||||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||||
} else if (check_acl($config['id_user'], 0, 'EM')) {
|
} else if (check_acl($config['id_user'], 0, 'EM')) {
|
||||||
@ -1365,7 +1364,7 @@ function events_get_all(
|
|||||||
'te.',
|
'te.',
|
||||||
// Alt table tag for id_grupo.
|
// Alt table tag for id_grupo.
|
||||||
$user_admin_group_all,
|
$user_admin_group_all,
|
||||||
(bool) $filter['search_secondary_groups']
|
(bool) (isset($filter['search_secondary_groups']) === true) ? $filter['search_secondary_groups'] : false
|
||||||
);
|
);
|
||||||
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
|
||||||
}
|
}
|
||||||
@ -1561,7 +1560,6 @@ function events_get_all(
|
|||||||
%s JOIN %s ta
|
%s JOIN %s ta
|
||||||
ON ta.%s = te.id_agente
|
ON ta.%s = te.id_agente
|
||||||
%s
|
%s
|
||||||
%s
|
|
||||||
%s JOIN tgrupo tg
|
%s JOIN tgrupo tg
|
||||||
ON %s
|
ON %s
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
@ -1577,7 +1575,6 @@ function events_get_all(
|
|||||||
%s JOIN %s ta
|
%s JOIN %s ta
|
||||||
ON ta.%s = te.id_agente
|
ON ta.%s = te.id_agente
|
||||||
%s
|
%s
|
||||||
%s
|
|
||||||
%s JOIN tgrupo tg
|
%s JOIN tgrupo tg
|
||||||
ON %s
|
ON %s
|
||||||
%s
|
%s
|
||||||
@ -1593,7 +1590,6 @@ function events_get_all(
|
|||||||
$tagente_table,
|
$tagente_table,
|
||||||
$tagente_field,
|
$tagente_field,
|
||||||
$conditionMetaconsole,
|
$conditionMetaconsole,
|
||||||
join(' ', $agent_join_filters),
|
|
||||||
$tgrupo_join,
|
$tgrupo_join,
|
||||||
join(' ', $tgrupo_join_filters),
|
join(' ', $tgrupo_join_filters),
|
||||||
join(' ', $sql_filters),
|
join(' ', $sql_filters),
|
||||||
@ -1607,7 +1603,6 @@ function events_get_all(
|
|||||||
$tagente_table,
|
$tagente_table,
|
||||||
$tagente_field,
|
$tagente_field,
|
||||||
$conditionMetaconsole,
|
$conditionMetaconsole,
|
||||||
join(' ', $agent_join_filters),
|
|
||||||
$tgrupo_join,
|
$tgrupo_join,
|
||||||
join(' ', $tgrupo_join_filters),
|
join(' ', $tgrupo_join_filters),
|
||||||
join(' ', $sql_filters),
|
join(' ', $sql_filters),
|
||||||
@ -1623,7 +1618,6 @@ function events_get_all(
|
|||||||
%s JOIN %s ta
|
%s JOIN %s ta
|
||||||
ON ta.%s = te.id_agente
|
ON ta.%s = te.id_agente
|
||||||
%s
|
%s
|
||||||
%s
|
|
||||||
%s JOIN tgrupo tg
|
%s JOIN tgrupo tg
|
||||||
ON %s
|
ON %s
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
@ -1642,7 +1636,6 @@ function events_get_all(
|
|||||||
$tagente_table,
|
$tagente_table,
|
||||||
$tagente_field,
|
$tagente_field,
|
||||||
$conditionMetaconsole,
|
$conditionMetaconsole,
|
||||||
join(' ', $agent_join_filters),
|
|
||||||
$tgrupo_join,
|
$tgrupo_join,
|
||||||
join(' ', $tgrupo_join_filters),
|
join(' ', $tgrupo_join_filters),
|
||||||
join(' ', $sql_filters),
|
join(' ', $sql_filters),
|
||||||
@ -1657,8 +1650,7 @@ function events_get_all(
|
|||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user_is_admin) {
|
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
|
||||||
// XXX: Confirm there's no extra grants unhandled!.
|
|
||||||
$can_manage = '0 as user_can_manage';
|
$can_manage = '0 as user_can_manage';
|
||||||
if (empty($EM_groups) === false) {
|
if (empty($EM_groups) === false) {
|
||||||
$can_manage = sprintf(
|
$can_manage = sprintf(
|
||||||
@ -1848,11 +1840,14 @@ function events_get_all(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (isset($limit, $offset) === true
|
if (isset($limit, $offset) === true
|
||||||
&& $limit !== 0
|
&& (int) $limit !== 0
|
||||||
&& isset($filter['csv_all']) === false
|
&& isset($filter['csv_all']) === false
|
||||||
) {
|
) {
|
||||||
$count = count($data);
|
$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);
|
$finally = array_slice($data, $offset, $end, true);
|
||||||
$return = [
|
$return = [
|
||||||
'buffers' => $buffers,
|
'buffers' => $buffers,
|
||||||
@ -1870,7 +1865,7 @@ function events_get_all(
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
} else {
|
} else {
|
||||||
return $data;
|
return ['count' => count($data)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3721,6 +3716,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) {
|
if (strpos($target, '_event_utimestamp_') !== false) {
|
||||||
$target = str_replace(
|
$target = str_replace(
|
||||||
'_event_utimestamp_',
|
'_event_utimestamp_',
|
||||||
@ -4701,22 +4705,30 @@ function events_page_general($event)
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Timestamp');
|
$data[0] = __('Timestamp');
|
||||||
|
|
||||||
if ($group_rep == 1 && $event['event_rep'] > 1) {
|
if ($event['event_rep'] > 1) {
|
||||||
$data[1] = __('First event').': '.date($config['date_format'], $event['timestamp_first']).'<br>'.__('Last event').': '.date($config['date_format'], $event['timestamp_last']);
|
$data[1] = __('First event').': ';
|
||||||
|
$data[1] .= date($config['date_format'], $event['timestamp_first']);
|
||||||
|
$data[1] .= '<br>';
|
||||||
|
$data[1] .= __('Last event').': ';
|
||||||
|
$data[1] .= date($config['date_format'], $event['timestamp_last']);
|
||||||
} else {
|
} else {
|
||||||
$data[1] = date($config['date_format'], $event['utimestamp']);
|
$data[1] = date($config['date_format'], $event['utimestamp']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_general->data[] = $data;
|
$table_general->data[] = $data;
|
||||||
|
|
||||||
// $event['owner_user'] = $event['id_usuario'];
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Owner');
|
$data[0] = __('Owner');
|
||||||
if (empty($event['owner_user'])) {
|
if (empty($event['owner_user']) === true) {
|
||||||
$data[1] = '<i>'.__('N/A').'</i>';
|
$data[1] = '<i>'.__('N/A').'</i>';
|
||||||
} else {
|
} else {
|
||||||
$user_owner = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']);
|
$user_owner = db_get_value(
|
||||||
if (empty($user_owner)) {
|
'fullname',
|
||||||
|
'tusuario',
|
||||||
|
'id_user',
|
||||||
|
$event['owner_user']
|
||||||
|
);
|
||||||
|
if (empty($user_owner) === true) {
|
||||||
$user_owner = $event['owner_user'];
|
$user_owner = $event['owner_user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,7 +1100,7 @@ function gis_update_map(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('layer_agent_list', $layer)) {
|
if (array_key_exists('layer_agent_list', $layer)) {
|
||||||
if (count($layer['layer_agent_list']) > 0) {
|
if (empty($layer['layer_agent_list']) === false && count($layer['layer_agent_list']) > 0) {
|
||||||
foreach ($layer['layer_agent_list'] as $agent) {
|
foreach ($layer['layer_agent_list'] as $agent) {
|
||||||
$id = db_process_sql_insert(
|
$id = db_process_sql_insert(
|
||||||
'tgis_map_layer_has_tagente',
|
'tgis_map_layer_has_tagente',
|
||||||
@ -1114,7 +1114,7 @@ function gis_update_map(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('layer_group_list', $layer)) {
|
if (array_key_exists('layer_group_list', $layer)) {
|
||||||
if (count($layer['layer_group_list']) > 0) {
|
if (empty($layer['layer_group_list']) === false && count($layer['layer_group_list']) > 0) {
|
||||||
foreach ($layer['layer_group_list'] as $group) {
|
foreach ($layer['layer_group_list'] as $group) {
|
||||||
$id = db_process_sql_insert(
|
$id = db_process_sql_insert(
|
||||||
'tgis_map_layer_groups',
|
'tgis_map_layer_groups',
|
||||||
|
@ -1416,7 +1416,7 @@ function graphic_combined_module(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($sources) && is_array($sources)) {
|
if (isset($sources) === true && is_array($sources) === true) {
|
||||||
$weights = [];
|
$weights = [];
|
||||||
$labels = [];
|
$labels = [];
|
||||||
$modules = [];
|
$modules = [];
|
||||||
@ -1498,6 +1498,10 @@ function graphic_combined_module(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((bool) $params_combined['from_interface'] === true) {
|
||||||
|
$labels = [];
|
||||||
|
}
|
||||||
|
|
||||||
if ($module_list) {
|
if ($module_list) {
|
||||||
$params_combined['modules_id'] = $module_list;
|
$params_combined['modules_id'] = $module_list;
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,6 +126,7 @@ function network_general_map_configuration($nodes, $relations)
|
|||||||
'map_filter' => [
|
'map_filter' => [
|
||||||
'node_radius' => 40,
|
'node_radius' => 40,
|
||||||
'node_sep' => 7,
|
'node_sep' => 7,
|
||||||
|
'node_separation' => 5,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@ -171,8 +172,8 @@ function network_init_node_map($name)
|
|||||||
return [
|
return [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'type' => NODE_GENERIC,
|
'type' => NODE_GENERIC,
|
||||||
'width' => 20,
|
'width' => 40,
|
||||||
'height' => 20,
|
'height' => 40,
|
||||||
'status' => '#82B92E',
|
'status' => 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false)
|
|||||||
if (empty($profile['tags'])) {
|
if (empty($profile['tags'])) {
|
||||||
$data['tags'] = '';
|
$data['tags'] = '';
|
||||||
} else {
|
} else {
|
||||||
if (is_array($profile['tags'] === false)) {
|
if (is_array($profile['tags']) === false) {
|
||||||
$tags_ids = explode(',', $profile['tags']);
|
$tags_ids = explode(',', $profile['tags']);
|
||||||
} else {
|
} else {
|
||||||
$tags_ids = $profile['tags'];
|
$tags_ids = $profile['tags'];
|
||||||
|
@ -8368,9 +8368,11 @@ function reporting_advanced_sla(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$time_out += $time_interval;
|
$time_out += $time_interval;
|
||||||
|
if (isset($wt_check['wt_in_downtime']) === true) {
|
||||||
if ($wt_check['wt_in_downtime']) {
|
if ($wt_check['wt_in_downtime']) {
|
||||||
$time_out += $wt_check['downtime_interval'];
|
$time_out += $wt_check['downtime_interval'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore worktime, is in an invalid period:
|
// Ignore worktime, is in an invalid period:
|
||||||
// scheduled downtimes in exclusion mode
|
// scheduled downtimes in exclusion mode
|
||||||
@ -8680,8 +8682,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
$item['id_agent_module']
|
$item['id_agent_module']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($item['compare']) === true
|
if (isset($item['compare']) === false
|
||||||
&& empty($item['compare']) === true
|
|| empty($item['compare']) === true
|
||||||
) {
|
) {
|
||||||
$row['data']['compare'] = false;
|
$row['data']['compare'] = false;
|
||||||
} else {
|
} else {
|
||||||
@ -14860,9 +14862,7 @@ function reporting_sla_get_status_period_compliance(
|
|||||||
return REPORT_STATUS_ERR;
|
return REPORT_STATUS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($priority_mode == REPORT_PRIORITY_MODE_OK
|
if ($sla['time_ok'] > 0 && ($time_compliance >= $sla_limit)) {
|
||||||
&& $sla['time_ok'] > 0 && ($time_compliance >= $sla_limit)
|
|
||||||
) {
|
|
||||||
return REPORT_STATUS_OK;
|
return REPORT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4007,7 +4007,7 @@ function reporting_html_text(&$table, $item)
|
|||||||
*/
|
*/
|
||||||
function reporting_html_availability($table, $item, $pdf=0)
|
function reporting_html_availability($table, $item, $pdf=0)
|
||||||
{
|
{
|
||||||
$retun_pdf = '';
|
$return_pdf = '';
|
||||||
|
|
||||||
$style = db_get_value(
|
$style = db_get_value(
|
||||||
'style',
|
'style',
|
||||||
@ -4234,7 +4234,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
} else {
|
} else {
|
||||||
$table_row[] = $row['agent'];
|
$table_row[] = $row['agent'];
|
||||||
$item_name = $row['availability_item'];
|
$item_name = $row['availability_item'];
|
||||||
if ((bool) $row['compare'] === false) {
|
if ((bool) $row['compare'] === true) {
|
||||||
$item_name .= ' ('.__('24 x 7').')';
|
$item_name .= ' ('.__('24 x 7').')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4422,6 +4422,7 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$table2->data[] = $table_row2;
|
$table2->data[] = $table_row2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$table = new stdClass();
|
||||||
$table->colspan['error']['cell'] = 3;
|
$table->colspan['error']['cell'] = 3;
|
||||||
$table->data['error']['cell'] = __(
|
$table->data['error']['cell'] = __(
|
||||||
'There are no Agent/Modules defined'
|
'There are no Agent/Modules defined'
|
||||||
@ -5980,11 +5981,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
|
|||||||
include_once '../../include/graphs/functions_gd.php';
|
include_once '../../include/graphs/functions_gd.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$max_value = count($events);
|
$period = SECONDS_1DAY;
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
|
||||||
$max_value = SECONDS_1HOUR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$text_header_event) {
|
if (!$text_header_event) {
|
||||||
$text_header_event = __('Events info (1hr.)');
|
$text_header_event = __('Events info (1hr.)');
|
||||||
@ -6057,7 +6054,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
|
|||||||
} else {
|
} else {
|
||||||
$graph_data[] = [
|
$graph_data[] = [
|
||||||
'data' => $color,
|
'data' => $color,
|
||||||
'utimestamp' => 1,
|
'utimestamp' => SECONDS_1DAY,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6076,9 +6073,9 @@ function reporting_get_event_histogram($events, $text_header_event=false)
|
|||||||
|
|
||||||
$slicebar = flot_slicesbar_graph(
|
$slicebar = flot_slicesbar_graph(
|
||||||
$graph_data,
|
$graph_data,
|
||||||
$max_value,
|
$period,
|
||||||
'450px;border:0',
|
'400px;border:0',
|
||||||
25,
|
40,
|
||||||
$full_legend,
|
$full_legend,
|
||||||
$colors,
|
$colors,
|
||||||
$config['fontpath'],
|
$config['fontpath'],
|
||||||
@ -6091,7 +6088,7 @@ function reporting_get_event_histogram($events, $text_header_event=false)
|
|||||||
[],
|
[],
|
||||||
true,
|
true,
|
||||||
1,
|
1,
|
||||||
false,
|
450,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ function reporting_xml_get_report($report, $filename, $return=false)
|
|||||||
|
|
||||||
// Download if marked to download.
|
// Download if marked to download.
|
||||||
if ($filename !== false) {
|
if ($filename !== false) {
|
||||||
|
// Cookie for download control.
|
||||||
|
setDownloadCookieToken();
|
||||||
header('Content-Type: application/xml; charset=UTF-8');
|
header('Content-Type: application/xml; charset=UTF-8');
|
||||||
header('Content-Disposition: attachment; filename="'.$filename.'.xml"');
|
header('Content-Disposition: attachment; filename="'.$filename.'.xml"');
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1107,7 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
|
|||||||
|
|
||||||
$profiles_without_tags = db_get_value_sql($query);
|
$profiles_without_tags = db_get_value_sql($query);
|
||||||
|
|
||||||
if ($profiles_without_tags == 0) {
|
if (users_is_admin() === true || $profiles_without_tags == 0) {
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// FIXED FOR TICKET #1921
|
// FIXED FOR TICKET #1921
|
||||||
//
|
//
|
||||||
|
@ -3540,6 +3540,11 @@ function ui_print_datatable(array $parameters)
|
|||||||
titleAttr: "'.__('Export current page to CSV').'",
|
titleAttr: "'.__('Export current page to CSV').'",
|
||||||
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
|
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
|
||||||
fieldSeparator: "'.$config['csv_divider'].'",
|
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 : {
|
exportOptions : {
|
||||||
modifier : {
|
modifier : {
|
||||||
// DataTables core
|
// DataTables core
|
||||||
@ -3547,7 +3552,7 @@ function ui_print_datatable(array $parameters)
|
|||||||
page : "All",
|
page : "All",
|
||||||
search : "applied"
|
search : "applied"
|
||||||
}'.$export_columns.'
|
}'.$export_columns.'
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
] : [],
|
] : [],
|
||||||
lengthMenu: '.json_encode($pagination_options).',
|
lengthMenu: '.json_encode($pagination_options).',
|
||||||
@ -3671,6 +3676,16 @@ function ui_print_datatable(array $parameters)
|
|||||||
$js .= '$(".datatables_thead_tr").css("height", 0);';
|
$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 .= '});';
|
||||||
|
|
||||||
$js .= '</script>';
|
$js .= '</script>';
|
||||||
@ -4001,11 +4016,12 @@ function ui_toggle(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Options.
|
// Options.
|
||||||
|
$style = 'overflow:hidden;';
|
||||||
if ($hidden_default) {
|
if ($hidden_default) {
|
||||||
$style = 'display:none';
|
$style .= 'height:0;position:absolute;';
|
||||||
$original = $img_b;
|
$original = $img_b;
|
||||||
} else {
|
} else {
|
||||||
$style = '';
|
$style .= 'height:auto;position:relative;';
|
||||||
$original = $img_a;
|
$original = $img_a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4111,24 +4127,28 @@ function ui_toggle(
|
|||||||
$output .= ' if (is_metaconsole == 0) {';
|
$output .= ' if (is_metaconsole == 0) {';
|
||||||
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
||||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
|
||||||
|
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
|
||||||
$output .= " }\n";
|
$output .= " }\n";
|
||||||
$output .= " else {\n";
|
$output .= " else {\n";
|
||||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
|
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
|
||||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
|
||||||
|
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
|
||||||
$output .= " }\n";
|
$output .= " }\n";
|
||||||
$output .= " }\n";
|
$output .= " }\n";
|
||||||
$output .= " });\n";
|
$output .= " });\n";
|
||||||
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
|
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
|
||||||
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
|
||||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
|
||||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
|
||||||
|
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
|
||||||
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
|
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
|
||||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
|
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
|
||||||
$output .= " }\n";
|
$output .= " }\n";
|
||||||
$output .= " else {\n";
|
$output .= " else {\n";
|
||||||
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
|
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
|
||||||
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
|
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
|
||||||
|
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
|
||||||
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
|
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
|
||||||
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
|
$output .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
|
||||||
$output .= " }\n";
|
$output .= " }\n";
|
||||||
|
@ -51,6 +51,9 @@ $default_filename = 'data_exported - '.date($config['date_format']);
|
|||||||
$filename = (string) get_parameter('filename', $default_filename);
|
$filename = (string) get_parameter('filename', $default_filename);
|
||||||
$filename = io_safe_output($filename);
|
$filename = io_safe_output($filename);
|
||||||
|
|
||||||
|
// Set cookie for download control.
|
||||||
|
setDownloadCookieToken();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $data = array(
|
* $data = array(
|
||||||
* 'head' => array(<column>,<column>,...,<column>),
|
* 'head' => array(<column>,<column>,...,<column>),
|
||||||
|
@ -2461,14 +2461,14 @@ function pandoraFlotArea(
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$.each(update_legend, function(index, value) {
|
$.each(update_legend, function(index, value) {
|
||||||
if (typeof value[x] !== "undefined") {
|
if (typeof value[x - 1] !== "undefined") {
|
||||||
data_legend[index] =
|
data_legend[index] =
|
||||||
" Min: " +
|
" Min: " +
|
||||||
number_format(value[x].min, 0, unit, short_data, divisor) +
|
number_format(value[x - 1].min, 0, unit, short_data, divisor) +
|
||||||
" Max: " +
|
" Max: " +
|
||||||
number_format(value[x].max, 0, unit, short_data, divisor) +
|
number_format(value[x - 1].max, 0, unit, short_data, divisor) +
|
||||||
" Avg: " +
|
" Avg: " +
|
||||||
number_format(value[x].avg, 0, unit, short_data, divisor);
|
number_format(value[x - 1].avg, 0, unit, short_data, divisor);
|
||||||
} else {
|
} else {
|
||||||
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
|
data_legend[index] = " Min: " + 0 + " Max: " + 0 + " Avg: " + 0;
|
||||||
}
|
}
|
||||||
@ -2716,6 +2716,7 @@ function pandoraFlotArea(
|
|||||||
|
|
||||||
$("#menu_export_csv_" + graph_id).click(function(e) {
|
$("#menu_export_csv_" + graph_id).click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
blockResubmit($(this));
|
||||||
plot.exportDataCSV();
|
plot.exportDataCSV();
|
||||||
var es_firefox =
|
var es_firefox =
|
||||||
navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
|
navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -583,8 +583,7 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
|
|||||||
status_module: status_module,
|
status_module: status_module,
|
||||||
"module_name[]": idModules,
|
"module_name[]": idModules,
|
||||||
selection_mode: selection_mode,
|
selection_mode: selection_mode,
|
||||||
tags: tags_selected,
|
tags: tags_selected
|
||||||
id_group: id_group
|
|
||||||
},
|
},
|
||||||
function(data) {
|
function(data) {
|
||||||
$("#agents").append(
|
$("#agents").append(
|
||||||
|
@ -72,7 +72,7 @@ function initialiceLayout(data) {
|
|||||||
|
|
||||||
var positionGrid = grid.el.getBoundingClientRect();
|
var positionGrid = grid.el.getBoundingClientRect();
|
||||||
var gridWidth = positionGrid.width;
|
var gridWidth = positionGrid.width;
|
||||||
|
var title = data.title;
|
||||||
getCellsLayout();
|
getCellsLayout();
|
||||||
|
|
||||||
function getCellsLayout() {
|
function getCellsLayout() {
|
||||||
@ -548,7 +548,7 @@ function initialiceLayout(data) {
|
|||||||
function addWidgetDialog(id) {
|
function addWidgetDialog(id) {
|
||||||
$("#modal-add-widget")
|
$("#modal-add-widget")
|
||||||
.dialog({
|
.dialog({
|
||||||
title: "New Widget",
|
title: data.title,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
|
@ -846,7 +846,56 @@ function check_execute_response_massive(response_id, response_parameters) {
|
|||||||
|
|
||||||
function event_widget_options() {
|
function event_widget_options() {
|
||||||
if ($("#customFilter").val() != "-1") {
|
if ($("#customFilter").val() != "-1") {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
page: "include/ajax/events",
|
||||||
|
get_filter_values: 1,
|
||||||
|
id: $("#customFilter").val()
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
if (data["event_type"] === "") {
|
||||||
|
$("#eventType").val("0");
|
||||||
|
$("#eventType").trigger("change");
|
||||||
|
} else {
|
||||||
|
$("#eventType").val(data["event_type"]);
|
||||||
|
$("#eventType").trigger("change");
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#limit").val(data["pagination"]);
|
||||||
|
$("#limit").trigger("change");
|
||||||
|
|
||||||
|
$("input[name='maxHours']").val(data["event_view_hr"]);
|
||||||
|
|
||||||
|
$("#eventStatus").val(data["status"]);
|
||||||
|
$("#eventStatus").trigger("change");
|
||||||
|
|
||||||
|
let posicion = data["severity"].indexOf(-1);
|
||||||
|
if (posicion !== -1) {
|
||||||
|
$("#severity").val(-1);
|
||||||
|
$("#severity").trigger("change");
|
||||||
|
} else {
|
||||||
|
const severity_array = data["severity"].split(",");
|
||||||
|
$("#severity").val(severity_array[0]);
|
||||||
|
$("#severity").trigger("change");
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#tagsId option").attr("selected", false);
|
||||||
|
$.each(
|
||||||
|
atob(data["tag_with"])
|
||||||
|
.slice(0, -1)
|
||||||
|
.slice(1)
|
||||||
|
.split(","),
|
||||||
|
function(i, e) {
|
||||||
|
$(`#tagsId option[value=${e}]`).prop("selected", true);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$(".event-widget-input").disable();
|
$(".event-widget-input").disable();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$(".event-widget-input").enable();
|
$(".event-widget-input").enable();
|
||||||
}
|
}
|
||||||
@ -920,7 +969,7 @@ function openSoundEventModal(settings) {
|
|||||||
sound = true;
|
sound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
test_sound_button(sound);
|
test_sound_button(sound, settings.urlSound);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Play Stop.
|
// Play Stop.
|
||||||
@ -977,9 +1026,9 @@ function openSoundEventModal(settings) {
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_sound_button(test_sound) {
|
function test_sound_button(test_sound, urlSound) {
|
||||||
if (test_sound === true) {
|
if (test_sound === true) {
|
||||||
add_audio();
|
add_audio(urlSound);
|
||||||
} else {
|
} else {
|
||||||
remove_audio();
|
remove_audio();
|
||||||
}
|
}
|
||||||
@ -1035,8 +1084,8 @@ function action_events_sound(mode, settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_audio() {
|
function add_audio(urlSound) {
|
||||||
var sound = "./include/sounds/" + $("#tabs-sound-modal #sound_id").val();
|
var sound = urlSound + $("#tabs-sound-modal #sound_id").val();
|
||||||
$(".actions-sound-modal").append(
|
$(".actions-sound-modal").append(
|
||||||
"<audio id='id_sound_event' src='" +
|
"<audio id='id_sound_event' src='" +
|
||||||
sound +
|
sound +
|
||||||
@ -1062,7 +1111,7 @@ function listen_event_sound(settings) {
|
|||||||
|
|
||||||
function check_event_sound(settings) {
|
function check_event_sound(settings) {
|
||||||
jQuery.post(
|
jQuery.post(
|
||||||
"./ajax.php",
|
settings.url,
|
||||||
{
|
{
|
||||||
page: "include/ajax/events",
|
page: "include/ajax/events",
|
||||||
get_events_fired: 1,
|
get_events_fired: 1,
|
||||||
@ -1091,7 +1140,7 @@ function check_event_sound(settings) {
|
|||||||
remove_audio();
|
remove_audio();
|
||||||
|
|
||||||
// Apend audio.
|
// Apend audio.
|
||||||
add_audio();
|
add_audio(settings.urlSound);
|
||||||
|
|
||||||
// Add elements.
|
// Add elements.
|
||||||
data.forEach(function(element) {
|
data.forEach(function(element) {
|
||||||
|
@ -456,8 +456,7 @@ function load_modal(settings) {
|
|||||||
// Function that shows a dialog box to confirm closures of generic manners.
|
// Function that shows a dialog box to confirm closures of generic manners.
|
||||||
// The modal id is random.
|
// The modal id is random.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function confirmDialog(settings) {
|
function confirmDialog(settings, idDialog = uniqId()) {
|
||||||
var randomStr = uniqId();
|
|
||||||
var hideOkButton = "";
|
var hideOkButton = "";
|
||||||
var hideCancelButton = "";
|
var hideCancelButton = "";
|
||||||
|
|
||||||
@ -487,11 +486,11 @@ function confirmDialog(settings) {
|
|||||||
|
|
||||||
if (typeof settings.message == "function") {
|
if (typeof settings.message == "function") {
|
||||||
$("body").append(
|
$("body").append(
|
||||||
'<div id="confirm_' + randomStr + '">' + settings.message() + "</div>"
|
'<div id="confirm_' + idDialog + '">' + settings.message() + "</div>"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$("body").append(
|
$("body").append(
|
||||||
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
|
'<div id="confirm_' + idDialog + '">' + settings.message + "</div>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,8 +541,8 @@ function confirmDialog(settings) {
|
|||||||
buttons.unshift(newButton);
|
buttons.unshift(newButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#confirm_" + randomStr);
|
$("#confirm_" + idDialog);
|
||||||
$("#confirm_" + randomStr)
|
$("#confirm_" + idDialog)
|
||||||
.dialog({
|
.dialog({
|
||||||
open: settings.open,
|
open: settings.open,
|
||||||
title: settings.title,
|
title: settings.title,
|
||||||
@ -763,3 +762,75 @@ function getGroupIcon(id_group, img_container) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prepare download control */
|
||||||
|
function getCookie(name) {
|
||||||
|
var parts = document.cookie.split(name + "=");
|
||||||
|
if (parts.length == 2)
|
||||||
|
return parts
|
||||||
|
.pop()
|
||||||
|
.split(";")
|
||||||
|
.shift();
|
||||||
|
}
|
||||||
|
|
||||||
|
function expireCookie(cName) {
|
||||||
|
document.cookie =
|
||||||
|
encodeURIComponent(cName) +
|
||||||
|
"=deleted; expires=" +
|
||||||
|
new Date(0).toUTCString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCursor(buttonStyle, button) {
|
||||||
|
button.css("cursor", buttonStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setToken(tokenName, token) {
|
||||||
|
token = typeof token !== "undefined" ? token : new Date().getTime();
|
||||||
|
document.cookie = tokenName + "=" + token + ";" + "-1" + ";path=/";
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
var downloadTimer;
|
||||||
|
var attempts = 30;
|
||||||
|
|
||||||
|
// Prevents double-submits by waiting for a cookie from the server.
|
||||||
|
function blockResubmit(button) {
|
||||||
|
var downloadToken = setToken("downloadToken");
|
||||||
|
setCursor("wait", button);
|
||||||
|
|
||||||
|
// Disable butoon to prevent clicking until download is ready.
|
||||||
|
button.disable();
|
||||||
|
button.click(false);
|
||||||
|
|
||||||
|
//Show dialog.
|
||||||
|
confirmDialog(
|
||||||
|
{
|
||||||
|
title: get_php_value("prepareDownloadTitle"),
|
||||||
|
message: get_php_value("prepareDownloadMsg"),
|
||||||
|
hideCancelButton: true
|
||||||
|
},
|
||||||
|
"downloadDialog"
|
||||||
|
);
|
||||||
|
|
||||||
|
downloadTimer = setInterval(function() {
|
||||||
|
var downloadReady = getCookie("downloadReady");
|
||||||
|
|
||||||
|
if (downloadToken == downloadReady || attempts == 0) {
|
||||||
|
unblockSubmit(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
attempts--;
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unblockSubmit(button) {
|
||||||
|
setCursor("pointer", button);
|
||||||
|
button.enable();
|
||||||
|
button.on("click");
|
||||||
|
clearInterval(downloadTimer);
|
||||||
|
$("#confirm_downloadDialog").dialog("close");
|
||||||
|
expireCookie("downloadToken");
|
||||||
|
expireCookie("downloadReady");
|
||||||
|
attempts = 30;
|
||||||
|
}
|
||||||
|
@ -170,7 +170,7 @@ class AlertsFiredWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (isset($this->values['groupId']) === false) {
|
if (isset($this->values['groupId']) === false) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
} else {
|
} else if ($this->values['groupId'] !== '0') {
|
||||||
$check_exist = \db_get_value(
|
$check_exist = \db_get_value(
|
||||||
'id_grupo',
|
'id_grupo',
|
||||||
'tgrupo',
|
'tgrupo',
|
||||||
|
@ -375,11 +375,19 @@ class TopNWidget extends Widget
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent double safe input in agents_get_group_agents function.
|
||||||
|
$agentRegex = io_safe_output($agentRegex);
|
||||||
|
|
||||||
// This function check ACL.
|
// This function check ACL.
|
||||||
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
|
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
|
||||||
$agentsId = \array_keys($agents);
|
$agentsId = \array_keys($agents);
|
||||||
$agentsIdString = \implode(',', $agentsId);
|
$agentsIdString = \implode(',', $agentsId);
|
||||||
|
|
||||||
|
// Prevent from error when performing IN clause with an empty string.
|
||||||
|
if ($agentsIdString === '') {
|
||||||
|
$agentsIdString = 'NULL';
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize variables.
|
// Initialize variables.
|
||||||
$date = \get_system_time();
|
$date = \get_system_time();
|
||||||
$datelimit = ($date - $period);
|
$datelimit = ($date - $period);
|
||||||
|
@ -23,4 +23,8 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||||||
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
|
||||||
set_js_value('homeurl', $config['homeurl']);
|
set_js_value('homeurl', $config['homeurl']);
|
||||||
set_js_value('homedir', $config['homedir'].'/');
|
set_js_value('homedir', $config['homedir'].'/');
|
||||||
|
// Prevent double request message.
|
||||||
|
set_js_value('prepareDownloadTitle', __('Generating content'));
|
||||||
|
set_js_value('prepareDownloadMsg', __('Generating content, please wait'));
|
||||||
|
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
@ -181,7 +181,7 @@ final class Container extends Model
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
return ($backgroundImage === 'None.png') ? null : $backgroundImage;
|
return ($backgroundImage === 'None.png') ? null : str_replace(' ', '%20', $backgroundImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2296,6 +2296,7 @@ class Item extends CachedModel
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$aux_images = $all_images;
|
||||||
foreach ($all_images as $image_file) {
|
foreach ($all_images as $image_file) {
|
||||||
$image_file = substr($image_file, 0, (strlen($image_file) - 4));
|
$image_file = substr($image_file, 0, (strlen($image_file) - 4));
|
||||||
|
|
||||||
@ -2311,9 +2312,13 @@ class Item extends CachedModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the 4 images.
|
||||||
|
$array_images = preg_grep('/'.$image_file.'(_ok|_bad|_warning)*\./', $aux_images);
|
||||||
|
if (count($array_images) >= 4) {
|
||||||
$result[$image_file] = $image_file;
|
$result[$image_file] = $image_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($service === true) {
|
if ($service === true) {
|
||||||
\array_unshift($result, ['name' => __('None')]);
|
\array_unshift($result, ['name' => __('None')]);
|
||||||
|
@ -121,7 +121,7 @@ final class BarsGraph extends Item
|
|||||||
*
|
*
|
||||||
* @return mixed String representing the grid color (not empty) or null.
|
* @return mixed String representing the grid color (not empty) or null.
|
||||||
*/
|
*/
|
||||||
private function extractGridColor(array $data): string
|
private static function extractGridColor(array $data): string
|
||||||
{
|
{
|
||||||
return static::notEmptyStringOr(
|
return static::notEmptyStringOr(
|
||||||
static::issetInArray($data, ['gridColor', 'border_color']),
|
static::issetInArray($data, ['gridColor', 'border_color']),
|
||||||
@ -138,7 +138,7 @@ final class BarsGraph extends Item
|
|||||||
* @return string One of 'white', 'black' or 'transparent'.
|
* @return string One of 'white', 'black' or 'transparent'.
|
||||||
* 'white' by default.
|
* 'white' by default.
|
||||||
*/
|
*/
|
||||||
private function extractBackgroundColor(array $data): string
|
private static function extractBackgroundColor(array $data): string
|
||||||
{
|
{
|
||||||
$backgroundColor = static::notEmptyStringOr(
|
$backgroundColor = static::notEmptyStringOr(
|
||||||
static::issetInArray($data, ['backgroundColor', 'image']),
|
static::issetInArray($data, ['backgroundColor', 'image']),
|
||||||
@ -163,7 +163,7 @@ final class BarsGraph extends Item
|
|||||||
*
|
*
|
||||||
* @return string One of 'vertical' or 'horizontal'. 'vertical' by default.
|
* @return string One of 'vertical' or 'horizontal'. 'vertical' by default.
|
||||||
*/
|
*/
|
||||||
private function extractTypeGraph(array $data): string
|
private static function extractTypeGraph(array $data): string
|
||||||
{
|
{
|
||||||
$typeGraph = static::notEmptyStringOr(
|
$typeGraph = static::notEmptyStringOr(
|
||||||
static::issetInArray($data, ['typeGraph', 'type_graph']),
|
static::issetInArray($data, ['typeGraph', 'type_graph']),
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user