Merge remote-tracking branch 'origin/develop' into ent-9002-Eliminar-monitorizacion-transaccional-Servidor-transaccional

This commit is contained in:
alejandro.campos@artica.es 2022-12-09 12:49:04 +01:00
commit 39920692ef
83 changed files with 270 additions and 178 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, AIX version
# Version 7.0NG.767, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, FreeBSD Version
# Version 7.0NG.767, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, GNU/Linux
# Version 7.0NG.767, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, GNU/Linux
# Version 7.0NG.767, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, Solaris Version
# Version 7.0NG.767, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# 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

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.766, AIX version
# Version 7.0NG.767, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.766
# Version 7.0NG.767
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.766, HPUX Version
# Version 7.0NG.767, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766
# Version 7.0NG.767
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766
# Version 7.0NG.767
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766
# Version 7.0NG.767
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 7.0NG.766, Solaris version
# Version 7.0NG.767, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, AIX version
# Version 7.0NG.767, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.766-221123"
pandora_version="7.0NG.767-221209"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -31,7 +31,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.766"
VERSION="7.0NG.767"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.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">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</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()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.766</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.766 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.766</string>
<key>CFBundleVersion</key> <string>7.0NG.767</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.767</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, GNU/Linux
# Version 7.0NG.767, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, FreeBSD Version
# Version 7.0NG.767, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, GNU/Linux
# Version 7.0NG.767, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, GNU/Linux
# Version 7.0NG.767, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, NetBSD Version
# Version 7.0NG.767, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 7.0NG.766, Solaris Version
# Version 7.0NG.767, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1014,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.766';
use constant AGENT_BUILD => '221123';
use constant AGENT_VERSION => '7.0NG.767';
use constant AGENT_BUILD => '221209';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_BUILD="221123"
PI_VERSION="7.0NG.767"
PI_BUILD="221209"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# 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

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v7.0NG.766}
{Pandora FMS Windows Agent v7.0NG.767}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{221123}
{221209}
ViewReadme
{Yes}

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.766(Build 221123))"
VALUE "ProductVersion", "(7.0NG.767(Build 221209))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.766-221123"
pandora_version="7.0NG.767-221209"
package_pear=0
package_pandora=1

View File

@ -2,4 +2,8 @@ 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;

View File

@ -570,7 +570,7 @@ foreach ($simple_alerts as $alert) {
if ($alert['times_fired'] > 0) {
$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) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

@ -102,7 +102,7 @@ $table_details->data[] = $data;
if ($alert['times_fired'] > 0) {
$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) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

@ -42,7 +42,6 @@ require_once $config['homedir'].'/include/functions_users.php';
if (is_metaconsole() === true) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_hook('open_meta_frame');
}
if (is_ajax() === true) {
@ -270,6 +269,7 @@ if (is_ajax() === true) {
return;
}
enterprise_hook('open_meta_frame');
$tab = (string) get_parameter('tab', 'groups');

View File

@ -100,16 +100,15 @@ if (! check_acl($config['id_user'], 0, 'AW')) {
$options_policies = [];
$policies_options = enterprise_hook('massive_policies_options');
$policies_options = array_unique($policies_options);
if ($policies_options != ENTERPRISE_NOT_HOOK) {
$policies_options = array_unique($policies_options);
$options_policies = array_merge($options_policies, $policies_options);
}
$options_snmp = [];
$snmp_options = enterprise_hook('massive_snmp_options');
$snmp_options = array_reverse($snmp_options);
if ($snmp_options != ENTERPRISE_NOT_HOOK) {
$snmp_options = array_reverse($snmp_options);
$options_snmp = array_merge($options_snmp, $snmp_options);
}

View File

@ -63,6 +63,7 @@ switch ($action) {
break;
}
$table = new stdClass();
$table->class = 'info_table';
$table->width = '98%';
$table->head[0] = __('Map connection name');

View File

@ -207,6 +207,7 @@ switch ($action) {
break;
}
$table = new stdClass();
$table->width = '90%';
$table->data = [];

View File

@ -35,8 +35,6 @@ require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php';
@ -270,7 +268,7 @@ if (is_ajax()) {
}
}
enterprise_hook('open_meta_frame');
$tab = get_parameter('tab', 'user');
@ -1942,7 +1940,10 @@ function delete_profile(event, btn) {
var json = json_profile.val();
var test = JSON.parse(json);
test.splice(position-1, 1);
var position_offset = <?php echo (is_metaconsole() === true) ? 2 : 1; ?>;
test.splice(position-position_offset, 1);
json_profile.val(JSON.stringify(test));
}

View File

@ -250,9 +250,9 @@ function process_user_login_remote($login, $pass, $api=false)
{
global $config, $mysql_cache;
// Remote authentication
// Remote authentication.
switch ($config['auth']) {
// LDAP
// LDAP.
case 'ldap':
$sr = ldap_process_user_login($login, $pass);
// Try with secondary server if not login.
@ -265,7 +265,7 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Active Directory
// Active Directory.
case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
$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;
// Remote Pandora FMS
// Remote Pandora FMS.
case 'pandora':
if (enterprise_hook('remote_pandora_process_user_login', [$login, $pass]) === false) {
$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;
// Remote Integria
// Remote Integria.
case 'integria':
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
$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;
// Unknown authentication method
// Unknown authentication method.
default:
$config['auth_error'] = 'User not found in database or incorrect password';
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 (!user_can_login($login) && $api === false) {
return false;
@ -370,10 +370,10 @@ function process_user_login_remote($login, $pass, $api=false)
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)) {
$config['auth_error'] = __(
'Ooops User not found in
'Ooops User not found in
database or incorrect password'
);
@ -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);
if (empty($sr) === true) {
$config['auth_error'] = 'ldap search failed';
@ldap_close($ds);
return false;
}
$memberof = ldap_get_entries($ds, $sr);
if ($memberof['count'] == 0 && !isset($memberof[0]['memberof'])) {

View File

@ -2215,7 +2215,9 @@ class NetworkMap
// Store relationships.
$this->relations = array_merge($edges, $orphans);
} else {
$this->relations = $edges;
if (empty($this->relations) === true && empty($this->$edges) === false) {
$this->relations = $edges;
}
}
// Close dot file.
@ -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);
/*

View File

@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC221123';
$pandora_version = 'v7.0NG.766';
$build_version = 'PC221209';
$pandora_version = 'v7.0NG.767';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -4367,7 +4367,6 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
$status = modules_get_agentmodule_status($key);
switch ($status) {
case 0:
case 4:
case 300:
$status = 'normal';
break;
@ -4386,6 +4385,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0)
$status = 'unknown';
break;
case 4:
case 5:
$status = 'notinit';
break;

View File

@ -1100,7 +1100,7 @@ function gis_update_map(
}
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) {
$id = db_process_sql_insert(
'tgis_map_layer_has_tagente',
@ -1114,7 +1114,7 @@ function gis_update_map(
}
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) {
$id = db_process_sql_insert(
'tgis_map_layer_groups',

View File

@ -124,8 +124,9 @@ function network_general_map_configuration($nodes, $relations)
'map_options' => [
'generation_method' => LAYOUT_SPRING1,
'map_filter' => [
'node_radius' => 40,
'node_sep' => 7,
'node_radius' => 40,
'node_sep' => 7,
'node_separation' => 5,
],
],
];
@ -171,8 +172,8 @@ function network_init_node_map($name)
return [
'name' => $name,
'type' => NODE_GENERIC,
'width' => 20,
'height' => 20,
'status' => '#82B92E',
'width' => 40,
'height' => 40,
'status' => 0,
];
}

View File

@ -284,7 +284,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false)
if (empty($profile['tags'])) {
$data['tags'] = '';
} else {
if (is_array($profile['tags'] === false)) {
if (is_array($profile['tags']) === false) {
$tags_ids = explode(',', $profile['tags']);
} else {
$tags_ids = $profile['tags'];

View File

@ -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);
if ($profiles_without_tags == 0) {
if (users_is_admin() === true || $profiles_without_tags == 0) {
// --------------------------------------------------------------
// FIXED FOR TICKET #1921
//

View File

@ -4003,10 +4003,10 @@ function ui_toggle(
// Options.
$style = 'overflow:hidden;';
if ($hidden_default) {
$style .= 'height:0;';
$style .= 'height:0;position:absolute;';
$original = $img_b;
} else {
$style .= 'height:auto;';
$style .= 'height:auto;position:relative;';
$original = $img_a;
}
@ -4113,10 +4113,12 @@ function ui_toggle(
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 0);\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'absolute');\n";
$output .= " }\n";
$output .= " }\n";
$output .= " });\n";
@ -4124,12 +4126,14 @@ function ui_toggle(
$output .= ' if (hide_tgl_ctrl_'.$uniqid.") {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').css('height', 'auto');\n";
$output .= " $('#tgl_div_".$uniqid."').css('position', 'relative');\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " $('#checkbox-".$switch_name."').prop('checked', true);\n";
$output .= " }\n";
$output .= " else {\n";
$output .= ' hide_tgl_ctrl_'.$uniqid." = 1;\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 .= " $('#checkbox-".$switch_name."').prop('checked', false);\n";
$output .= " }\n";

View File

@ -583,8 +583,7 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
status_module: status_module,
"module_name[]": idModules,
selection_mode: selection_mode,
tags: tags_selected,
id_group: id_group
tags: tags_selected
},
function(data) {
$("#agents").append(

View File

@ -846,7 +846,56 @@ function check_execute_response_massive(response_id, response_parameters) {
function event_widget_options() {
if ($("#customFilter").val() != "-1") {
$(".event-widget-input").disable();
$.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();
}
});
} else {
$(".event-widget-input").enable();
}

View File

@ -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.
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
$agentsId = \array_keys($agents);
$agentsIdString = \implode(',', $agentsId);
// Prevent from error when performing IN clause with an empty string.
if ($agentsIdString === '') {
$agentsIdString = 'NULL';
}
// Initialize variables.
$date = \get_system_time();
$datelimit = ($date - $period);

View File

@ -121,7 +121,7 @@ final class BarsGraph extends Item
*
* @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(
static::issetInArray($data, ['gridColor', 'border_color']),
@ -138,7 +138,7 @@ final class BarsGraph extends Item
* @return string One of 'white', 'black' or 'transparent'.
* 'white' by default.
*/
private function extractBackgroundColor(array $data): string
private static function extractBackgroundColor(array $data): string
{
$backgroundColor = static::notEmptyStringOr(
static::issetInArray($data, ['backgroundColor', 'image']),
@ -163,7 +163,7 @@ final class BarsGraph extends Item
*
* @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(
static::issetInArray($data, ['typeGraph', 'type_graph']),

View File

@ -77,7 +77,7 @@ final class EventsHistory extends Item
*
* @return mixed String representing the grid color (not empty) or null.
*/
private function extractLegendColor(array $data): string
private static function extractLegendColor(array $data): string
{
return static::notEmptyStringOr(
static::issetInArray($data, ['legendColor', 'border_color']),

View File

@ -21,7 +21,7 @@
.agent_options_column_left,
.agent_options_column_right {
width: 50%;
width: calc(50% - 40px);
box-sizing: border-box;
}

View File

@ -4762,8 +4762,11 @@ input:checked + .p-slider:before {
.white_box {
background-color: #fff;
border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 20px 50px;
border-radius: 0px 0px 5px 5px;
}
.white_box > div {
margin: 20px;
}
/*

View File

@ -128,8 +128,8 @@
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.766';
$build = '221123';
$version = '7.0NG.767';
$build = '221209';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -321,7 +321,7 @@ class Alerts
if ($alert['times_fired'] > 0) {
$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) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');

View File

@ -53,7 +53,7 @@ $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$filter = get_parameter('disabled', 'all_enabled');
$filter = get_parameter('filter', 'all_enabled');
$filter_standby = get_parameter('standby', 'all');
$id_group = (int) get_parameter('ag_group', 0);
// 0 is the All group (selects all groups)

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_VERSION="7.0NG.767"
FORCE=0
DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

@ -3625,6 +3625,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
`background_color` VARCHAR(50) NOT NULL DEFAULT '#FFF',
`is_favourite` INT UNSIGNED NOT NULL DEFAULT 0,
`auto_adjust` INT UNSIGNED NOT NULL DEFAULT 0,
`maintenance_mode` TEXT,
PRIMARY KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -112,10 +112,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
('MR', 58),
('MR', 59),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package', 766),
('current_package', 767),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),
@ -146,7 +146,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('gotty', '/usr/bin/gotty'),
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'),
('server_unique_identifier', replace(uuid(),'-','')),
('lts_name', '');
('lts_name', 'Hope');
UNLOCK TABLES;
--

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.766-221123
Version: 7.0NG.767-221209
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.766-221123"
pandora_version="7.0NG.767-221209"
package_cpan=0
package_pandora=1

View File

@ -1,7 +1,7 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 7.0NG.766
# Version 7.0NG.767
# Licensed under GPL license v2,
# (c) 2003-2021 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -45,8 +45,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.766";
my $pandora_build = "221123";
my $pandora_version = "7.0NG.767";
my $pandora_build = "221209";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -1300,13 +1300,17 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
$group = get_db_single_row ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo = ?', $agent->{'id_grupo'});
}
my $agent_status;
if(ref ($module) eq "HASH") {
$agent_status = get_db_single_row ($dbh, 'SELECT * FROM tagente_estado WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
my $time_down;
if ($alert_mode == RECOVERED_ALERT && defined($extra_macros->{'_modulelaststatuschange_'})) {
$time_down = (time() - $extra_macros->{'_modulelaststatuschange_'});
} else {
my $agent_status;
if(ref ($module) eq "HASH") {
$agent_status = get_db_single_row ($dbh, 'SELECT * FROM tagente_estado WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
}
$time_down = (defined ($agent_status)) ? (time() - $agent_status->{'last_status_change'}) : undef;
}
my $time_down = (defined ($agent_status)) ? (time() - $agent_status->{'last_status_change'}) : undef;
if (is_numeric($data)) {
my $data_precision = $pa_config->{'graph_precision'};
$data = sprintf("%.$data_precision" . "f", $data);

View File

@ -1041,6 +1041,7 @@ sub get_db_rows_parallel ($$;@) {
no warnings 'redefine';
local *PandoraFMS::ProducerConsumerServer::DESTROY = sub {};
local *PandoraFMS::BlockProducerConsumerServer::DESTROY = sub {};
local *PandoraFMS::SNMPServer::DESTROY = sub {};
# Query the nodes.
foreach my $node (@{$nodes}) {

View File

@ -33,8 +33,8 @@ use base 'Exporter';
our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.766";
my $pandora_build = "221123";
my $pandora_version = "7.0NG.767";
my $pandora_build = "221209";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 7.0NG.766
%define release 221123
%define version 7.0NG.767
%define release 221209
Summary: Pandora FMS Server
Name: %{name}

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.766"
PI_BUILD="221123"
PI_VERSION="7.0NG.767"
PI_BUILD="221209"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.766 Build 221123";
my $version = "7.0NG.767 Build 221209";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.766 Build 221123";
my $version = "7.0NG.767 Build 221209";
# save program name for logging
my $progname = basename($0);