Merge branch 'develop' into ent-12460-cientos-de-errores-en-el-log-de-apache

This commit is contained in:
Daniel Cebrian 2024-01-30 13:21:44 +01:00
commit 5b7a123086
79 changed files with 994 additions and 418 deletions
pandora_agents
pandora_console
pandora_server

@ -585,7 +585,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.775-240124
Version: 7.0NG.775-240126
Architecture: all
Priority: optional
Section: admin

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

@ -1039,7 +1039,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.775';
use constant AGENT_BUILD => '240124';
use constant AGENT_BUILD => '240126';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1860,7 +1860,7 @@ sub write_broker_conf($){
# Change the agent name
if ($line =~ m/^\s*#*\s*agent_name\s+/) {
$line = "agent_name $broker_agent\n";
$line = "agent_name $broker_agent\n#broker active\n";
}
# Change the logfile
elsif ($line =~ m/^\s*logfile\s+(.*)/) {

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240124
%define release 240126
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240124
%define release 240126
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240124
%define release 240126
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240124
%define release 240126
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.775
%define release 240124
%define release 240126
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240124"
PI_BUILD="240126"
OS_NAME=`uname -s`
FORCE=0

@ -1,9 +1,9 @@
bin_PROGRAMS = PandoraAgent
if DEBUG
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_CXXFLAGS=-g -O0
else
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_CXXFLAGS=-O2
endif

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{240124}
{240126}
ViewReadme
{Yes}

@ -236,6 +236,8 @@ Module_Kind
Pandora_Module::parseModuleKindFromString (string kind) {
if (kind == module_exec_str) {
return MODULE_EXEC;
} else if (kind == module_exec_powershell_str) {
return MODULE_EXEC_POWERSHELL;
} else if (kind == module_proc_str) {
return MODULE_PROC;
} else if (kind == module_service_str) {

@ -94,7 +94,8 @@ namespace Pandora_Modules {
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
MODULE_PLUGIN, /**< Plugin */
MODULE_PING, /**< Ping module */
MODULE_SNMPGET /**< SNMP get module */
MODULE_SNMPGET, /**< SNMP get module */
MODULE_EXEC_POWERSHELL /**< The module run a custom powershell command */
} Module_Kind;
/**
@ -109,24 +110,25 @@ namespace Pandora_Modules {
regex_t regexp;
} Condition;
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_str = "module_exec";
const string module_proc_str = "module_proc";
const string module_service_str = "module_service";
const string module_freedisk_str = "module_freedisk";
const string module_freedisk_percent_str = "module_freedisk_percent";
const string module_freememory_str = "module_freememory";
const string module_freememory_percent_str = "module_freememory_percent";
const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck";
const string module_regexp_str = "module_regexp";
const string module_plugin_str = "module_plugin";
const string module_ping_str = "module_ping";
const string module_snmpget_str = "module_snmpget";
const string module_exec_powershell_str = "module_exec_powershell";
/**
* Pandora module super-class exception.

@ -0,0 +1,91 @@
/* Pandora exec module. These modules exec a powershell command.
Copyright (c) 2006-2023 Pandora FMS.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "pandora_module_exec_powershell.h"
#include "../pandora_strutils.h"
#include <iostream>
#include <stdexcept>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#define EXEC_OK 0
#define EXEC_ERR -1
#define BUFSIZE 4096
using namespace Pandora;
using namespace Pandora_Strutils;
using namespace Pandora_Modules;
/**
* Creates a Pandora_Module_Exec_Powershell object.
*
* @param name Module name
* @param exec Command to be executed.
*/
Pandora_Module_Exec_Powershell::Pandora_Module_Exec_Powershell(string name, string exec)
: Pandora_Module (name) {
string escaped_exec;
for (char c : exec) {
if (c == '"' || c == '\\') {
escaped_exec += '\\';
}
escaped_exec += c;
}
this->module_exec = "powershell -C \"" + escaped_exec + "\"";
this->setKind (module_exec_powershell_str);
}
void Pandora_Module_Exec_Powershell::run() {
string output_result;
this->has_output = false;
FILE* pipe = popen(this->module_exec.c_str(), "r");
if (!pipe) {
pandoraLog ("Error while executing command.", GetLastError ());
return;
}
char buffer[BUFSIZE];
while (fgets(buffer, BUFSIZE, pipe) != NULL) {
output_result += buffer;
}
int result = pclose(pipe);
if (result == EXEC_ERR) {
pandoraLog ("Error while closing command process.", GetLastError ());
return;
}
if (result != EXEC_OK) {
pandoraLog ("Error invalid powershell command.", GetLastError ());
return;
}
this->has_output = true;
this->setOutput (output_result);
}

@ -0,0 +1,43 @@
/* Pandora exec module. These modules exec a powershell command
Copyright (c) 2006-2023 Pandora FMS.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#define __PANDORA_MODULE_EXEC_POWERWSHELL_H__
#include "pandora_module.h"
namespace Pandora_Modules {
/**
* Module to execute a powershell command.
*
* Any custom order that want to be executed can be put in
* the <code>util</code> directory into the Pandora agent path.
*/
class Pandora_Module_Exec_Powershell : public Pandora_Module {
private:
string module_exec;
public:
Pandora_Module_Exec_Powershell (string name, string exec);
void run ();
};
}
#endif

@ -22,6 +22,7 @@
#include "pandora_module_factory.h"
#include "pandora_module.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -129,6 +130,7 @@ using namespace Pandora_Strutils;
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
#define TOKEN_EXEC_POWERSHELL ("module_exec_powershell ")
string
parseLine (string line, string token) {
@ -158,7 +160,7 @@ Pandora_Module *
Pandora_Module_Factory::getModuleFromDefinition (string definition) {
list<string> tokens;
list<string>::iterator iter;
string module_name, module_type, module_exec;
string module_name, module_type, module_exec, module_exec_powershell;
string module_min, module_max, module_description;
string module_interval, module_absoluteinterval;
string module_proc, module_service;
@ -268,6 +270,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_user_session = "";
macro = "";
module_wait_timeout = "";
module_exec_powershell = "";
stringtok (tokens, definition, "\n");
@ -302,6 +305,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
if (module_exec_powershell == "") {
module_exec_powershell = parseLine (line, TOKEN_EXEC_POWERSHELL);
}
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
@ -626,6 +632,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
}
}
if (module_exec_powershell != "") {
pos_macro = module_exec_powershell.find(macro_name);
if (pos_macro != string::npos){
module_exec_powershell.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_proc != "") {
pos_macro = module_proc.find(macro_name);
if (pos_macro != string::npos){
@ -1155,6 +1168,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_exec_powershell != "") {
module = new Pandora_Module_Exec_Powershell (module_name, module_exec_powershell);
} else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name,
module_proc);

@ -21,6 +21,7 @@
#include "pandora_module_factory.h"
#include "pandora_module_list.h"
#include "pandora_module_exec.h"
#include "pandora_module_exec_powershell.h"
#include "pandora_module_proc.h"
#include "pandora_module_service.h"
#include "pandora_module_freedisk.h"
@ -235,6 +236,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Plugin *module_plugin;
Pandora_Module_Ping *module_ping;
Pandora_Module_SNMPGet *module_snmpget;
Pandora_Module_Exec_Powershell *module_exec_powershell;
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
@ -244,6 +246,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_exec = (Pandora_Module_Exec *) module;
modules->push_back (module_exec);
break;
case MODULE_EXEC_POWERSHELL:
module_exec_powershell = (Pandora_Module_Exec_Powershell *) module;
modules->push_back (module_exec_powershell);
break;
case MODULE_PROC:
module_proc = (Pandora_Module_Proc *) module;

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

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.775(Build 240124))"
VALUE "ProductVersion", "(7.0NG.775(Build 240126))"
VALUE "FileVersion", "1.0.0.0"
END
END

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.775-240124
Version: 7.0NG.775-240126
Architecture: all
Priority: optional
Section: admin

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

@ -280,18 +280,17 @@ function dbmgr_extension_main()
if (is_array($result) === false) {
echo '<strong>Output: <strong>'.$result;
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
return;
}
db_pandora_audit(
AUDIT_LOG_SYSTEM,
'DB Interface Extension. SQL',
false,
false,
$sql
);
echo "<div class='overflow'>";
$table = new stdClass();
$table->width = '100%';

@ -223,7 +223,7 @@ function mainInsertData()
'',
empty($agent_id)
);
$table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] = html_print_input_text('date', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true);
$table->data[1][2] .= '&nbsp;';
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
@ -283,8 +283,14 @@ function mainInsertData()
secondText: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'});
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('#text-date').datepicker ({
dateFormat: '<?php echo DATE_FORMAT_JS; ?>',
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
firstDay: "<?php echo $config['datepicker_first_day']; ?>",
});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
});

@ -1,5 +1,45 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tmerge_error` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`step` int(10) default 0,
`msg` LONGTEXT default "",
`action` text default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_error` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `tmerge_steps` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`total` int(10) default 0,
`step` int(10) default 0,
`debug` varchar(1024) default "",
`action` varchar(100) default "",
`affected` varchar(100) default "",
`query` mediumtext default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_steps` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `tmerge_queries` (
`steps` int(10) NOT NULL auto_increment,
`action` varchar(100) default "",
`affected` varchar(100) default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
`query` LONGTEXT NOT NULL default "",
PRIMARY KEY (`steps`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tmerge_queries` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
-- Update version for plugin oracle
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
@ -11,4 +51,4 @@ ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_dat
ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`;
COMMIT;
COMMIT;

@ -500,21 +500,40 @@ $tableAgent->data['primary_group'][0] .= ui_print_group_icon(
);
$tableAgent->data['primary_group'][0] .= '</span>';
$tableAgent->data['caption_interval'][0] = __('Interval');
// $tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent->rowclass['interval'] = 'w540px';
$tableAgent->data['interval'][0] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w33p'
);
$broker = false;
if (enterprise_installed()) {
// CHECK BROKER FOR SHOW INTERVAL.
enterprise_include('include/functions_config_agents.php');
// Read configuration file.
$files = config_agents_get_agent_config_filenames($id_agente);
$file_name = $files['conf'];
$agent_config = file_get_contents($file_name);
$encoding = 'UTF-8';
$agent_config_utf8 = mb_convert_encoding($agent_config, 'UTF-8', $encoding);
if ($agent_config_utf8 !== false) {
$agent_config = $agent_config_utf8;
}
$broker = str_contains($agent_config, '#broker active');
}
if ($broker === false) {
$tableAgent->data['caption_interval'][0] = __('Interval');
// $tableAgent->rowstyle['interval'] = 'width: 260px';
$tableAgent->rowclass['interval'] = 'w540px';
$tableAgent->data['interval'][0] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w33p'
);
}
if ($intervalo < SECONDS_5MINUTES) {
$tableAgent->data['interval'][0] .= clippy_context_help('interval_agent_min');

@ -308,13 +308,18 @@ $table->head[0] = __('Actions');
$table->style[0] = 'font-weight: bold; text-align: left;';
if (count($actions) == 1 && isset($actions[0])) {
$table->head[1] = __('Every time that the alert is fired');
$table->data[0][0] = $actions[0]['name'];
$table->data[0][1] = html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
if (!empty($actions[0]['name'])) {
$table->head[1] = __('Every time that the alert is fired');
$table->data[0][0] = $actions[0]['name'];
$table->data[0][1] = html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
} else {
$table->colspan[0] = 2;
$table->data[0] = __('No action defined.');
}
} else {
foreach ($actions as $kaction => $action) {
$table->data[$kaction][0] = $action['name'];

@ -285,20 +285,25 @@ if (enterprise_installed()) {
$data = [];
$data[0] = html_print_label_input_block(
'<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
'<div id="server_to_exec_value" class="invisible" >'.html_print_select(
'<div id="server_to_exec_value" class="w100p margin-top-10 invisible" >'.html_print_select(
$servers_to_exec,
'server_to_exec',
$event_response['server_to_exec'],
'',
'',
'',
true
true,
false,
true,
'w100p',
false,
'width: 100%'
).'</div>'
);
$data[1] = html_print_label_input_block(
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
'<div id="command_timeout_value" class="invisible">'.html_print_input_text(
'<div id="command_timeout_value" class=" w100p margin-top-10 invisible">'.html_print_input_text(
'command_timeout',
$event_response['command_timeout'],
'',
@ -358,18 +363,18 @@ $('#type').change(function() {
$('#new_window option[value="0"]')
.prop('selected', true);
$('#new_window').attr('disabled','disabled');
$('#server_to_exec_label').css('display','');
$('#server_to_exec_value').css('display','');
$('#command_timeout_label').css('display','');
$('#command_timeout_value').css('display','');
$('#server_to_exec_label').show();
$('#server_to_exec_value').show();
$('#command_timeout_label').show();
$('#command_timeout_value').show();
break;
case 'url':
$('#new_window').removeAttr('disabled');
$('#server_to_exec_label').css('display','none');
$('#server_to_exec_value').css('display','none');
$('#command_timeout_label').css('display','none');
$('#command_timeout_value').css('display','none');
$('#server_to_exec_label').hide();
$('#server_to_exec_value').hide();
$('#command_timeout_label').hide();
$('#command_timeout_value').hide();
break;
}

@ -250,6 +250,12 @@ if ($delete_layout || $copy_layout) {
$result = db_process_sql_insert('tlayout', $values);
$auditMessage = ((bool) $result !== false) ? 'Copy visual console' : 'Fail try to copy visual console';
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('%s %s #%s', $auditMessage, $visualConsoleName, $id_layout)
);
$idNewVisualConsole = $result;
if ($result) {

@ -1058,7 +1058,11 @@ switch ($action) {
$resolution = $item['top_n'];
// Interval resolution.
$max_values = $item['top_n_value'];
// Max values.
$es = json_decode($item['external_source'], true);
$top_n_type = $es['top_n_type'];
$display_graph = $es['display_graph'];
$display_summary = $es['display_summary'];
$display_data_table = $es['display_data_table'];
break;
case 'permissions_report':
@ -1703,6 +1707,75 @@ if (is_metaconsole() === true) {
</td>
</tr>
<tr id="row_top_n_type" class="datos">
<td class="bolder"><?php echo __('Type'); ?></td>
<td >
<?php
$types = [
0 => __('Show aggregate by destination port'),
1 => __('Show InBound/Outbound traffic per SrcIP/DestIP'),
];
html_print_select(
$types,
'top_n_type',
$top_n_type,
''
);
?>
</td>
</tr>
<tr id="row_display_graph" class="datos">
<td class="bolder">
<?php
echo __('Display graph');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_graph',
1,
($display_graph ?? true)
);
?>
</td>
</tr>
<tr id="row_display_summary_table" class="datos">
<td class="bolder">
<?php
echo __('Display summary table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_summary',
1,
($display_summary ?? true)
);
?>
</td>
</tr>
<tr id="row_display_data_table" class="datos">
<td class="bolder">
<?php
echo __('Display data table');
?>
</td>
<td >
<?php
html_print_checkbox_switch(
'display_data_table',
1,
($display_data_table ?? true)
);
?>
</td>
</tr>
<tr id="row_period_service_level" class="datos">
<td class="bolder">
<?php
@ -7420,6 +7493,10 @@ function chooseType() {
$("#row_alert_templates").hide();
$("#row_alert_actions").hide();
$("#row_servers").hide();
$("#row_top_n_type").hide();
$("#row_display_graph").hide();
$("#row_display_summary_table").hide();
$("#row_display_data_table").hide();
$("#row_servers_all_opt").hide();
$("#row_servers_all").hide();
$("#row_multiple_servers").hide();
@ -8374,6 +8451,10 @@ function chooseType() {
$("#row_max_values").show();
$("#row_resolution").show();
$("#row_servers").show();
$("#row_top_n_type").show();
$("#row_display_graph").show();
$("#row_display_summary_table").show();
$("#row_display_data_table").show();
$("#row_historical_db_check").hide();
break;

@ -626,7 +626,7 @@ switch ($action) {
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $report['name'], $idReport)
);
ui_print_result_message(
@ -1465,7 +1465,7 @@ switch ($action) {
$auditMessage = ($resultOperationDB === true) ? 'Update report' : 'Fail try to update report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('%s #%s', $auditMessage, $idReport)
sprintf('%s %s #%s', $auditMessage, $new_values['name'], $idReport),
);
} else {
$resultOperationDB = false;
@ -1517,7 +1517,7 @@ switch ($action) {
]
);
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report #%s', $idOrResult) : 'Fail try to create report';
$auditMessage = ((bool) $idOrResult === true) ? sprintf('Create report %s #%s', $reportName, $idOrResult) : 'Fail try to create report';
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
$auditMessage
@ -1878,6 +1878,13 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;
@ -2962,6 +2969,12 @@ switch ($action) {
$values['top_n_value'] = get_parameter(
'max_values'
);
$es['top_n_type'] = get_parameter('top_n_type', '');
$es['display_graph'] = get_parameter('display_graph', '');
$es['display_summary'] = get_parameter('display_summary', '');
$es['display_data_table'] = get_parameter('display_data_table', '');
$values['external_source'] = json_encode($es);
$good_format = true;
break;

@ -300,7 +300,7 @@ switch ($activeTab) {
ui_update_name_fav_element($idVisualConsole, 'Visual_Console', $values['name']);
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Update visual console #%s', $idVisualConsole)
sprintf('Update visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -320,7 +320,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Fail update visual console #%s', $idVisualConsole)
sprintf('Fail update visual console %s #%s', $values['name'], $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,
@ -339,7 +339,7 @@ switch ($activeTab) {
if ($idVisualConsole !== false) {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
sprintf('Create visual console #%s', $idVisualConsole)
sprintf('Create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$action = 'edit';
$statusProcessInDB = [
@ -359,7 +359,7 @@ switch ($activeTab) {
} else {
db_pandora_audit(
AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT,
'Fail try to create visual console'
sprintf('Fail try to create visual console %s #%s', io_safe_output($values['name']), $idVisualConsole)
);
$statusProcessInDB = [
'flag' => false,

@ -1875,6 +1875,8 @@ if (check_login()) {
$table_id = get_parameter('table_id', '');
$search = get_parameter('search', '');
$search_agent = get_parameter('search_agent', '');
$groupId = (int) get_parameter('groupId', 0);
$module_name = get_parameter('module_name', '');
$status = get_parameter('status', '');
$start = get_parameter('start', 0);
@ -1886,13 +1888,36 @@ if (check_login()) {
$nodes = get_parameter('nodes', 0);
$disabled_modules = (bool) get_parameter('disabled_modules', false);
$groups_array = [];
if ($groupId === 0) {
if (users_can_manage_group_all('AR') === false) {
$groups_array = users_get_groups(false, 'AR', false);
}
} else {
$groups_array = [$groupId];
}
$where = '1=1';
$recordsTotal = 0;
if (empty($groups_array) === false) {
$where .= sprintf(
' AND (tagente.id_grupo IN (%s)
OR tagent_secondary_group.id_group IN(%s))',
implode(',', $groups_array),
implode(',', $groups_array)
);
}
if (empty($search) === false) {
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
}
if (empty($search_agent) === false) {
$where .= ' AND tagente.alias LIKE "%%'.$search_agent.'%%"';
}
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
@ -1900,12 +1925,24 @@ if (check_login()) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
array_push($expl, '1', '2', '3', '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false) {
if (str_contains($status, '5') === true) {
$expl = explode(',', $status);
$exist = array_search('5', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '4', '5');
$status = implode(',', $expl);
}
if (empty($status) === false || $status === '0') {
$where .= sprintf(
' AND tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
@ -1967,6 +2004,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s
ORDER BY %s
LIMIT %d, %d',
@ -1984,6 +2023,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2011,6 +2052,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2043,6 +2086,8 @@ if (check_login()) {
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE %s',
$where
);
@ -2148,24 +2193,25 @@ if (check_login()) {
);
switch ((int) $row['estado']) {
case 0:
case AGENT_MODULE_STATUS_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true);
break;
case 1:
case 6:
case AGENT_MODULE_STATUS_CRITICAL_BAD:
case AGENT_MODULE_STATUS_NOT_NORMAL:
$status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true);
break;
case 2:
case AGENT_MODULE_STATUS_WARNING:
$status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true);
break;
case 3:
case AGENT_MODULE_STATUS_UNKNOWN:
$status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true);
break;
case 5:
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
$status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true);
break;

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

@ -819,6 +819,7 @@ define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Warp Manager');
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
define('AUDIT_LOG_ENTERPRISE_VIOLATION', 'Enterprise Violation');
define('AUDIT_LOG_CRON_TASK', 'Cron task');
// MIMEs.
define(

@ -875,8 +875,6 @@ function get_parameterBetweenListValues($name, $values, $default)
*
* @return mixed Whatever was in that parameter, cleaned however
*/
function get_parameter_checkbox($name, $default='')
{
$sent = get_parameter($name.'_sent', 0);
@ -2002,8 +2000,6 @@ function index_array($array, $index='id', $value='name')
* @param int Id of module type
* @return string Graph type, as used in stat_win.php (Graphs launcher)
*/
function return_graphtype($id_module_type)
{
switch ($id_module_type) {
@ -2360,8 +2356,6 @@ function string2image(
* @param string SQL code
* @return string SQL code validated (it will return empty if SQL is not ok)
**/
function check_sql($sql)
{
// We remove "*" to avoid things like SELECT * FROM tusuario
@ -2383,8 +2377,6 @@ function check_sql($sql)
*
* @return boolean 0 on success exit() on no success
*/
function check_login($output=true)
{
global $config;

@ -3258,8 +3258,6 @@ function api_get_group_agent_by_alias($thrash1, $thrash2, $other, $thrash3)
*
* @param $thrash3 Don't use.
*/
function api_get_locate_agent($id, $thrash1, $thrash2, $thrash3)
{
if (!is_metaconsole()) {
@ -7273,8 +7271,6 @@ function api_set_tag($id, $thrash1, $other, $thrash3)
*
* @param type of return json or csv.
*/
function api_get_all_planned_downtimes($thrash1, $thrash2, $other, $returnType='json')
{
global $config;
@ -7337,8 +7333,6 @@ function api_get_all_planned_downtimes($thrash1, $thrash2, $other, $returnType='
*
* @param type of return json or csv.
*/
function api_get_planned_downtimes_items($thrash1, $thrash2, $other, $returnType='json')
{
global $config;
@ -7430,8 +7424,6 @@ function api_get_planned_downtimes_items($thrash1, $thrash2, $other, $returnType
*
* @param type of return json or csv.
*/
function api_set_planned_downtimes_deleted($id, $thrash1, $thrash2, $returnType)
{
global $config;
@ -12101,8 +12093,6 @@ function api_set_disable_module($agent_name, $module_name, $other, $thrash4)
* @param $thrash3 Don't use.
* @param $thrash4 Don't use.
*/
function api_set_enable_module($agent_name, $module_name, $other, $thrash4)
{
if (defined('METACONSOLE')) {
@ -12169,8 +12159,6 @@ function api_set_enable_module($agent_name, $module_name, $other, $thrash4)
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=c2cea5860613e363e25f4ba185b54fe28f869ff8a5e8bb46343288337c903531&id2=Status&other=Warning%20condition
*/
function api_set_disable_alert($agent_name, $module_name, $template_name, $thrash4)
{
global $config;
@ -12216,8 +12204,6 @@ function api_set_disable_alert($agent_name, $module_name, $template_name, $thras
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert_alias&id=garfio&id2=Status&other=Warning%20condition
*/
function api_set_disable_alert_alias($agent_alias, $module_name, $template_name, $thrash4)
{
global $config;
@ -12269,8 +12255,6 @@ function api_set_disable_alert_alias($agent_alias, $module_name, $template_name,
// http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert&id=garfio&id2=Status&other=Warning%20condition
*/
function api_set_enable_alert($agent_name, $module_name, $template_name, $thrash4)
{
global $config;
@ -12316,8 +12300,6 @@ function api_set_enable_alert($agent_name, $module_name, $template_name, $thrash
// http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert_alias&id=garfio&id2=Status&other=Warning%20condition
*/
function api_set_enable_alert_alias($agent_alias, $module_name, $template_name, $thrash4)
{
global $config;
@ -12369,8 +12351,6 @@ function api_set_enable_alert_alias($agent_alias, $module_name, $template_name,
// http://localhost/pandora_console/include/api.php?op=set&op2=disable_module_alerts&id=garfio&id2=Status
*/
function api_set_disable_module_alerts($agent_name, $module_name, $other, $thrash4)
{
global $config;
@ -12449,8 +12429,6 @@ function api_set_disable_module_alerts($agent_name, $module_name, $other, $thras
* @param $thrash4 Don't use.
* // http://localhost/pandora_console/include/api.php?op=set&op2=enable_module_alerts&id=garfio&id2=Status
*/
function api_set_enable_module_alerts($agent_name, $module_name, $other, $thrash4)
{
global $config;
@ -13184,7 +13162,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($other['data'][21] != '') {
$values['event_custom_id'] = $other['data'][21];
}else{
} else {
$values['event_custom_id'] = '';
}
@ -13613,8 +13591,6 @@ function api_get_pandora_servers($trash1, $trash2, $other, $returnType)
*
* @param $thrash3 Don't use.
*/
function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3)
{
if (defined('METACONSOLE')) {
@ -13699,8 +13675,6 @@ function api_set_enable_disable_agent($id, $thrash2, $other, $thrash3)
*
* TODO: Add support to events.
*/
function api_set_pagerduty_webhook($type, $matchup_path, $tresh2, $return_type)
{
global $config;
@ -16808,8 +16782,6 @@ function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3)
* api.php?op=get&op2=list_all_user&return_type=json&apipass=1234&user=admin&pass=pandora
* @return
*/
function api_get_list_all_user($thrash1, $thrash2, $other, $returnType)
{
global $config;
@ -16884,8 +16856,6 @@ function api_get_list_all_user($thrash1, $thrash2, $other, $returnType)
*
* @return
*/
function api_get_info_user_name($thrash1, $thrash2, $other, $returnType)
{
global $config;
@ -16960,8 +16930,6 @@ function api_get_info_user_name($thrash1, $thrash2, $other, $returnType)
*
* @return
*/
function api_get_filter_user_group($thrash1, $thrash2, $other, $returnType)
{
global $config;
@ -17046,8 +17014,6 @@ function api_get_filter_user_group($thrash1, $thrash2, $other, $returnType)
*
* @return void
*/
function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
{
global $config;
@ -17105,8 +17071,6 @@ function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
*
* @return void
*/
function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType)
{
global $config;

@ -104,6 +104,7 @@ function config_update_value($token, $value, $noticed=false, $password=false)
return true;
}
$prev_value = $config[$token];
$config[$token] = $value;
$value = io_safe_output($value);
@ -117,13 +118,24 @@ function config_update_value($token, $value, $noticed=false, $password=false)
return true;
} else {
// Something in setup changes.
if ($noticed === false) {
$value_token = (empty($config[$token]) === true) ? 0 : $config[$token];
$prev_value = (empty($prev_value) === true) ? 0 : $prev_value;
if (is_array($prev_value) === true) {
$prev_value = implode(';', $prev_value);
}
if ($noticed === true && $prev_value !== $value_token) {
db_pandora_audit(
AUDIT_LOG_SETUP,
'Setup has changed',
false,
false,
sprintf('Token << %s >> updated.', $token)
sprintf(
'Token << %s >> updated %s -> %s',
$token,
$prev_value,
$value_token
)
);
}
@ -2094,11 +2106,6 @@ function config_update_config()
} else {
$config['error_config_update_config'] = [];
$config['error_config_update_config']['correct'] = true;
db_pandora_audit(
AUDIT_LOG_SETUP,
'Setup has changed'
);
}
if (count($errors) > 0) {

@ -426,6 +426,14 @@ function cron_task_run(
WHERE id=".$id_user_task;
}
db_pandora_audit(
AUDIT_LOG_CRON_TASK,
'Executed cron task: '.$task['name'].' #'.$task['id'],
false,
false,
''
);
db_process_sql($sql);
db_process_sql($sql2);
}

@ -6467,9 +6467,13 @@ function event_print_graph(
];
$color[] = '#82b92f';
}
} else if ((int) $num_intervals > 0) {
// We assume that if num_interval is 0, not exist events.
$interval_length = (int) ($period / $num_intervals);
} else {
$interval_length = 0;
if ($num_intervals > 0) {
$interval_length = (int) ($period / $num_intervals);
}
$intervals = [];
$intervals[0] = $start_utimestamp;
for ($i = 0; $i < $num_intervals; $i++) {

@ -183,8 +183,6 @@ function html_f2str($function, $params)
*
* @return string HTML code if return parameter is true.
*/
function html_print_side_layer($params)
{
global $config;
@ -4592,8 +4590,6 @@ function html_print_checkbox_switch_extended(
*
* @return string HTML code if return parameter is true.
*/
function html_print_checkbox_switch($name, $value, $checked=false, $return=false, $disabled=false, $script='', $disabled_hidden=false, $class='')
{
$output = html_print_checkbox_switch_extended($name, $value, (bool) $checked, $disabled, $script, '', true, '', $class);

@ -155,6 +155,8 @@ function menu_print_menu(&$menu)
}
} else if ($sec2 === 'godmode/users/configure_user') {
$sec2 = 'godmode/users/user_list';
} else if ($sec2 === 'godmode/modules/manage_inventory_modules_form') {
$sec2 = 'godmode/modules/manage_inventory_modules';
} else if ($sec2 === 'godmode/groups/configure_group') {
$sec2 = 'godmode/groups/group_list';
} else if ($sec2 === 'godmode/users/configure_profile') {

@ -328,12 +328,13 @@ function netflow_data_table($data, $start_date, $end_date, $aggregate, $pdf=fals
/**
* Show a table with netflow top N data.
*
* @param array $data Netflow data.
* @param integer $total_bytes Total bytes count to calculate percent data.
* @param array $data Netflow data.
* @param integer $total_bytes Total bytes count to calculate percent data.
* @param boolean $show_extended Display extended table.
*
* @return string HTML data table.
*/
function netflow_top_n_table(array $data, int $total_bytes)
function netflow_top_n_table(array $data, int $total_bytes, bool $show_extended=false)
{
global $nfdump_date_format;
@ -344,31 +345,44 @@ function netflow_top_n_table(array $data, int $total_bytes)
$table->data = [];
$table->head = [];
$table->head[0] = '<b>'.__('Source IP').'</b>';
$table->head[1] = '<b>'.__('Destination IP').'</b>';
$table->head[2] = '<b>'.__('Bytes').'</b>';
$table->head[3] = '<b>'.__('% Traffic').'</b>';
$table->head[4] = '<b>'.__('Avg. Throughput').'</b>';
$table->style[0] = 'padding: 4px';
if ($show_extended === false) {
$table->head[0] = '<b>'.__('Source IP').'</b>';
$table->head[1] = '<b>'.__('Destination IP').'</b>';
$table->head[2] = '<b>'.__('Bytes').'</b>';
$table->head[3] = '<b>'.__('Packets').'</b>';
$table->head[4] = '<b>'.__('% Traffic').'</b>';
$table->head[5] = '<b>'.__('Avg. Throughput').'</b>';
$table->style[0] = 'padding: 4px';
} else {
$table->head[0] = '<b>'.__('Source IP').'</b>';
$table->head[1] = '<b>'.__('Destination IP').'</b>';
$table->head[2] = '<b>'.__('Ingress bytes').'</b>';
$table->head[3] = '<b>'.__('Egress bytes').'</b>';
$table->head[4] = '<b>'.__('Ingress packets').'</b>';
$table->head[5] = '<b>'.__('Egress packets').'</b>';
$table->head[6] = '<b>'.__('% Traffic').'</b>';
$table->head[7] = '<b>'.__('Avg. Throughput').'</b>';
$table->style[0] = 'padding: 4px';
}
$i = 0;
foreach ($data as $value) {
$table->data[$i][0] = $value['ip_src'];
$table->data[$i][1] = $value['ip_dst'];
$table->data[$i][2] = network_format_bytes($value['bytes']);
$traffic = '-';
if ($total_bytes > 0) {
$traffic = sprintf(
'%.2f',
(($value['bytes'] / $total_bytes) * 100)
);
if ($show_extended === true) {
$table->data[$i][2] = network_format_bytes($value['ibytes']);
$table->data[$i][3] = network_format_bytes($value['obytes']);
$table->data[$i][4] = (empty($value['ipackages']) === true) ? 0 : $value['ipackages'];
$table->data[$i][5] = (empty($value['opackages']) === true) ? 0 : $value['opackages'];
$table->data[$i][6] = $value['traffic'].' %';
} else {
$table->data[$i][2] = network_format_bytes($value['bytes']);
$table->data[$i][3] = (empty($value['ipackages']) === true) ? 0 : $value['ipackages'];
$table->data[$i][4] = $value['traffic'].' %';
}
$table->data[$i][3] = $traffic.' %';
$units = [
'bps',
'Kbps',
@ -382,7 +396,11 @@ function netflow_top_n_table(array $data, int $total_bytes)
$value['bps'] /= pow(1024, $pow);
$table->data[$i][4] = round($value['bps'], 2).' '.$units[$pow];
if ($show_extended === true) {
$table->data[$i][7] = round($value['bps'], 2).' '.$units[$pow];
} else {
$table->data[$i][5] = round($value['bps'], 2).' '.$units[$pow];
}
$i++;
}
@ -481,7 +499,9 @@ function netflow_get_top_N(
string $end_date,
array $filter,
int $max,
string $connection_name=''
string $connection_name='',
bool $extended_info=false,
int $total_bytes=0
) {
global $nfdump_date_format;
@ -496,7 +516,8 @@ function netflow_get_top_N(
return json_decode($data, true);
}
$options = '-o "fmt:%sap,%dap,%ibyt,%bps" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$opts = ($extended_info === true) ? 'fmt:%sap,%dap,%ibyt,%obyt,%ipkt,%opkt,%bps' : 'fmt:%sap,%dap,%ibyt,%ipkt,%bps';
$options = '-o "'.$opts.'" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter, $start_date, $end_date);
@ -516,8 +537,29 @@ function netflow_get_top_N(
$values[$i]['ip_src'] = $parsed_line[0];
$values[$i]['ip_dst'] = $parsed_line[1];
$values[$i]['bytes'] = $parsed_line[2];
$values[$i]['bps'] = $parsed_line[3];
$traffic = '-';
if ($total_bytes > 0) {
$conn_bytes = $parsed_line[2];
$traffic = sprintf(
'%.2f',
(($conn_bytes / $total_bytes) * 100)
);
}
$values[$i]['traffic'] = $traffic;
if ($extended_info === true) {
$values[$i]['ibytes'] = $parsed_line[2];
$values[$i]['obytes'] = $parsed_line[3];
$values[$i]['ipackets'] = $parsed_line[4];
$values[$i]['opackets'] = $parsed_line[5];
$values[$i]['bps'] = $parsed_line[6];
} else {
$values[$i]['bytes'] = $parsed_line[2];
$values[$i]['bps'] = $parsed_line[3];
}
$i++;
}
@ -1341,7 +1383,11 @@ function netflow_draw_item(
$output='HTML',
$address_resolution=false,
$width_content=false,
$height_content=false
$height_content=false,
$extended=false,
$show_graph=true,
$show_summary=true,
$show_table=true
) {
$aggregate = $filter['aggregate'];
$interval = ($end_date - $start_date);
@ -1496,7 +1542,9 @@ function netflow_draw_item(
$end_date,
$filter,
$max_aggregates,
$connection_name
$connection_name,
$extended,
$data_summary['totalbytes']
);
if (empty($data_top_n) === true) {
@ -1505,16 +1553,76 @@ function netflow_draw_item(
if ($output === 'HTML' || $output === 'PDF') {
$html = '<table class="w100p">';
$html .= '<tr>';
$html .= "<td class='w50p'>";
$html .= netflow_summary_table($data_summary);
$html .= '</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= "<td class='w100p'>";
$html .= netflow_top_n_table($data_top_n, $data_summary['totalbytes']);
$html .= '</td>';
$html .= '</tr>';
if ($show_graph === true) {
$labels = array_map(
function ($conn) {
return __('% Traffic').' '.$conn['ip_src'].' - '.$conn['ip_dst'];
},
$data_top_n
);
$pie_data = array_map(
function ($conn) {
return $conn['traffic'];
},
$data_top_n
);
$graph_output = pie_graph(
$pie_data,
[
'width' => 200,
'height' => 200,
'ttl' => ($output === 'PDF') ? 2 : 1,
'dataLabel' => ['display' => 'auto'],
'layout' => [
'padding' => [
'top' => 15,
'bottom' => 15,
],
],
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
]
);
$html .= '<tr>';
$html .= "<td class='w500p padding-bottom-25px'>";
if ($output === 'PDF') {
$html .= '<img src="data:image/png;base64,'.$graph_output.'" />';
} else {
$html .= $graph_output;
}
$html .= '</td>';
$html .= '</tr>';
}
if ($show_summary === true) {
$html .= '<tr>';
$html .= "<td class='w50p'>";
$html .= netflow_summary_table($data_summary);
$html .= '</td>';
$html .= '</tr>';
}
if ($show_table === true) {
$html .= '<tr>';
$html .= "<td class='w100p'>";
$html .= netflow_top_n_table(
$data_top_n,
$data_summary['totalbytes'],
$extended
);
$html .= '</td>';
$html .= '</tr>';
}
$html .= '</table>';
return $html;
@ -1638,7 +1746,8 @@ function netflow_get_item_data(
string $type_netflow,
array $filter,
int $max_aggregates,
string $connection_name
string $connection_name,
bool $extended=false
) {
$data = [];
@ -1656,7 +1765,9 @@ function netflow_get_item_data(
$end_date,
$filter,
$max_aggregates,
$connection_name
$connection_name,
$extended,
$data_summary['totalbytes']
);
$data = [

@ -6981,6 +6981,20 @@ function reporting_netflow(
$filter['aggregate'] = 'dstport';
}
$es = json_decode($content['external_source'], true);
$extended = false;
$show_graph = false;
$show_summary = false;
$show_table = false;
if (empty($es) === false) {
$extended = ((int) $es['top_n_type'] === 1);
$show_graph = ((int) $es['display_graph'] === 1);
$show_summary = ((int) $es['display_summary'] === 1);
$show_table = ((int) $es['display_data_table'] === 1);
}
switch ($type) {
case 'dinamic':
case 'static':
@ -6992,7 +7006,14 @@ function reporting_netflow(
$filter,
$content['top_n_value'],
$content['server_name'],
(($pdf === true) ? 'PDF' : 'HTML')
(($pdf === true) ? 'PDF' : 'HTML'),
false,
false,
false,
$extended,
$show_graph,
$show_summary,
$show_table
);
break;
@ -7015,11 +7036,15 @@ function reporting_netflow(
break;
}
$return['subtitle'] = netflow_generate_subtitle_report(
$filter['aggregate'],
$content['top_n'],
$type_netflow
);
if ($extended === true) {
$return['subtitle'] = __('InBound/Outbound traffic per SrcIP/DestIP');
} else {
$return['subtitle'] = netflow_generate_subtitle_report(
$filter['aggregate'],
$content['top_n'],
$type_netflow
);
}
return reporting_check_structure_content($return);
}
@ -15969,8 +15994,8 @@ function reporting_translate_sla_status_for_graph($status)
*/
function reporting_header_table_for_pdf($title='', $description='')
{
$result_pdf = '<pagebreak>';
$result_pdf .= '<table class="header_table databox">';
// $result_pdf = '<pagebreak>';
$result_pdf = '<table class="header_table databox">';
$result_pdf .= '<thead class="header_tr"><tr>';
$result_pdf .= '<th class="th_first" colspan="2">';
$result_pdf .= $title;

@ -4257,15 +4257,15 @@ function ui_print_datatable(array $parameters)
// * END JAVASCRIPT.
$info_msg_arr = [];
$info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-info-massage datatable-msg-info-'.$table_id;
$info_msg_arr_filter = [];
$info_msg_arr_filter['message'] = __('Please apply a filter to display the data.');
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-msg-info-filter-'.$table_id;
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-info-massage datatable-msg-info-filter-'.$table_id;
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$info_msg = '<div>'.ui_print_info_message($info_msg_arr, '', true).'</div>';
$info_msg = '<div class="datatable-container-info-massage">'.ui_print_info_message($info_msg_arr, '', true).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';

@ -66,6 +66,11 @@ if (typeof dt.pagination_options !== "undefined") {
lengthMenu = dt.pagination_options;
}
if (dt.pagination_options_order === "true") {
lengthMenu[0] = lengthMenu[0].sort((a, b) => a - b);
lengthMenu[1] = lengthMenu[1].sort((a, b) => a - b);
}
var ordering = true;
if (typeof dt.ordering !== "undefined" && dt.ordering === false) {
ordering = dt.ordering;

@ -578,6 +578,13 @@ class Manager implements PublicLogin
];
}
$auditMessage = ($res === false) ? sprintf('Fail try update dashboard %s #%s', $values['name'], $this->dashboardId) : sprintf('Dashboard update %s #%s', $values['name'], $this->dashboardId);
db_pandora_audit(
AUDIT_LOG_DASHBOARD_MANAGEMENT,
$auditMessage,
false,
);
return $result;
}
@ -758,6 +765,13 @@ class Manager implements PublicLogin
}
}
$auditMessage = ($result === false) ? sprintf('Fail try copy dashboard %s #%s', $values['name'], $this->dashboardId) : sprintf('Copy dashboard %s #%s', $values['name'], $this->dashboardId);
db_pandora_audit(
AUDIT_LOG_DASHBOARD_MANAGEMENT,
$auditMessage,
false,
);
return $result;
}

@ -207,6 +207,14 @@ class ModulesByStatus extends Widget
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['groupId']) === true) {
$values['groupId'] = $decoder['groupId'];
}
if (isset($decoder['search_agent']) === true) {
$values['search_agent'] = $decoder['search_agent'];
}
if (isset($decoder['search']) === true) {
$values['search'] = $decoder['search'];
}
@ -247,9 +255,39 @@ class ModulesByStatus extends Widget
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
$return_all_group = false;
if (users_can_manage_group_all('RM') || $values['groupId'] == 0) {
$return_all_group = true;
}
// Groups.
$inputs[] = [
'label' => __('Group'),
'arguments' => [
'type' => 'select_groups',
'name' => 'groupId',
'returnAllGroup' => $return_all_group,
'privilege' => 'AR',
'selected' => $values['groupId'],
'return' => true,
],
];
// Search Agent.
$inputs[] = [
'label' => __('Search agent').ui_print_help_tip(__('Search filter by Agent name field content'), true),
'arguments' => [
'name' => 'search_agent',
'type' => 'text',
'value' => $values['search_agent'],
'return' => true,
'size' => 0,
],
];
// Search.
$inputs[] = [
'label' => __('Free search').ui_print_help_tip(__('Search filter by Module name field content'), true),
'label' => __('Search module').ui_print_help_tip(__('Search filter by Module name field content'), true),
'arguments' => [
'name' => 'search',
'type' => 'text',
@ -380,7 +418,9 @@ class ModulesByStatus extends Widget
// Retrieve global - common inputs.
$values = parent::getPost();
$values['groupId'] = \get_parameter('groupId', 0);
$values['search'] = \get_parameter('search', '');
$values['search_agent'] = \get_parameter('search_agent', '');
$values['status'] = \get_parameter('status', '');
$values['limit'] = \get_parameter('limit', '');
$values['nodes'] = \get_parameter('nodes', '');
@ -393,173 +433,73 @@ class ModulesByStatus extends Widget
/**
* Draw widget.
*
* @return string;
* @return void Html output;
*/
public function load()
{
$this->size = parent::getSize();
// Datatables list.
try {
$info_columns = $this->columns();
$column_names = $info_columns['column_names'];
$columns = $info_columns['columns'];
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
global $config;
$output = '';
if (is_metaconsole() === true) {
$modules = [];
$servers_ids = array_column(metaconsole_get_servers(), 'id');
foreach ($servers_ids as $server_id) {
try {
$node = new Node((int) $server_id);
$node->connect();
$modules_tmp = $this->getInfoModules(
$this->values['search'],
$this->values['status'],
$this->values['nodes']
);
$modules[$node->id()] = $modules_tmp[0];
$node->disconnect();
} catch (\Exception $e) {
// Unexistent modules.
$node->disconnect();
}
}
} else {
$modules = $this->getInfoModules(
$this->values['search'],
$this->values['status']
$tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table align-left-important',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
'ajax_data' => [
'get_data_ModulesByStatus' => 1,
'table_id' => $tableId,
'search_agent' => $this->values['search_agent'],
'search' => $this->values['search'],
'groupId' => $this->values['groupId'],
'status' => $this->values['status'],
'nodes' => $this->values['nodes'],
'disabled_modules' => $this->values['disabled_modules'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
],
'default_pagination' => $this->values['limit'],
'order' => [
'field' => 'last_status_change',
'direction' => 'desc',
],
'csv' => 0,
'pagination_options' => [
[
5,
10,
25,
100,
200,
500,
1000,
],
[
5,
10,
25,
100,
200,
500,
1000,
],
],
'dom_elements' => 'frtilp',
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
if ($modules !== false && empty($modules) === false) {
// Datatables list.
try {
$info_columns = $this->columns();
$column_names = $info_columns['column_names'];
$columns = $info_columns['columns'];
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table align-left-important',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
'ajax_data' => [
'get_data_ModulesByStatus' => 1,
'table_id' => $tableId,
'search' => $this->values['search'],
'status' => $this->values['status'],
'nodes' => $this->values['nodes'],
'disabled_modules' => $this->values['disabled_modules'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
],
'default_pagination' => $this->values['limit'],
'order' => [
'field' => 'last_status_change',
'direction' => 'desc',
],
'csv' => 0,
'pagination_options' => [
[
5,
10,
25,
100,
200,
500,
1000,
],
[
5,
10,
25,
100,
200,
500,
1000,
],
],
'dom_elements' => 'frtilp',
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
} else {
$output = '';
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Not found modules'),
'',
true
);
$output .= '</div>';
return $output;
}
}
/**
* Get info modules.
*
* @param string $search Free search.
* @param string $status Modules status.
*
* @return array Data.
*/
private function getInfoModules(string $search, string $status): array
{
if (empty($search) === false) {
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
}
if (str_contains($status, '6') === true) {
$expl = explode(',', $status);
$exist = array_search('6', $expl);
if (isset($exist) === true) {
unset($expl[$exist]);
}
array_push($expl, '1', '2');
$status = implode(',', $expl);
}
$where .= sprintf(
'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status
);
$sql = sprintf(
'SELECT
COUNT(*) AS "modules"
FROM tagente_modulo
INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
WHERE %s',
$where
);
$modules = db_get_all_rows_sql($sql);
if ($modules === false) {
$modules = [];
}
return $modules;
}
@ -586,7 +526,10 @@ class ModulesByStatus extends Widget
'nombre',
'alias',
'server_name',
'last_status_change',
[
'text' => 'last_status_change',
'class' => '',
],
'estado',
];
} else {
@ -600,7 +543,10 @@ class ModulesByStatus extends Widget
$columns = [
'nombre',
'alias',
'last_status_change',
[
'text' => 'last_status_change',
'class' => '',
],
'estado',
];
}
@ -649,12 +595,12 @@ class ModulesByStatus extends Widget
$height_counter = (((int) count($nodes_fields)) * 20);
$size = [
'width' => 450,
'width' => 470,
'height' => (520 + $height_counter),
];
} else {
$size = [
'width' => 450,
'width' => 470,
'height' => 480,
];
}

@ -637,6 +637,7 @@ class View extends \HTML
* Returns a popup for networkLink viewer.
*
* @return void
*
* phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.Missing
*/
public function networkLinkPopup()

@ -977,3 +977,19 @@ input.resize_button {
.event-cardboard-widget td {
cursor: pointer;
}
.datatable-container-info-massage:not(:has(.invisible_important)) {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
}
.info_box_information.datatable-info-massage.info_box_container
.info_box.info.textodialogo {
display: flex;
width: 100%;
justify-content: center;
}

@ -505,10 +505,10 @@ div.multi-response-buttons {
justify-content: flex-start;
}
td:has(div#server_to_exec_label),
/*td:has(div#server_to_exec_label),
td:has(div#server_to_exec_value) {
padding: 0px;
}
}*/
table#save_filter_form,
table#load_filter_form {

@ -1040,6 +1040,10 @@ select:-internal-list-box {
padding-bottom: 5px;
}
.padding-bottom-25px {
padding-bottom: 25px;
}
.padding-right-2 {
padding-right: 2em;
}

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.775';
$build = '240124';
$build = '240126';
$banner = "v$version Build $build";
error_reporting(0);

@ -536,19 +536,21 @@ echo '</div>';
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('cluetip');
$system_higher = false;
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
if (is_array($modules_agent)) {
$all_modules = db_get_all_rows_sql('SELECT id_agente FROM tagente_modulo');
$all_agents = db_get_all_rows_sql('SELECT id_agente FROM tagente');
if (is_array($all_modules) && is_array($all_agents)) {
if ((count($all_modules) / count($all_agents)) >= 200) {
$system_higher = true;
if (isset($id_agente)) {
$system_higher = false;
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
if (is_array($modules_agent)) {
$all_modules = db_get_all_rows_sql('SELECT id_agente FROM tagente_modulo');
$all_agents = db_get_all_rows_sql('SELECT id_agente FROM tagente');
if (is_array($all_modules) && is_array($all_agents)) {
if ((count($all_modules) / count($all_agents)) >= 200) {
$system_higher = true;
}
}
}
}
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
}
?>

@ -1253,6 +1253,15 @@ if (is_ajax() === true) {
);
}
$data = array_values(
array_filter(
($data ?? []),
function ($item) {
return (bool) (array) $item;
}
)
);
$count = count($data);
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
@ -2819,7 +2828,7 @@ try {
'extra_html' => $active_filters_div.$graph_div,
'pagination_options' => [
[
$config['block_size'],
(int) $config['block_size'],
10,
25,
100,
@ -2827,7 +2836,7 @@ try {
500,
],
[
$config['block_size'],
(int) $config['block_size'],
10,
25,
100,
@ -2835,6 +2844,7 @@ try {
500,
],
],
'pagination_options_order' => 'true',
'order' => [
'field' => 'timestamp',
'direction' => 'desc',

@ -428,6 +428,13 @@ echo '</div>';
ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
db_pandora_audit(
AUDIT_LOG_REPORT_MANAGEMENT,
sprintf('Report visualized %s #%s.', $report['name'], $report['id_report']),
false,
false
);
?>
<script language="javascript" type="text/javascript">

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240124
%define release 240126
# User and Group under which Apache is running
%define httpd_name httpd

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.775
%define release 240124
%define release 240126
# User and Group under which Apache is running
%define httpd_name httpd

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.775
%define release 240124
%define release 240126
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

@ -4556,7 +4556,6 @@ PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ---------------------------------------------------------------------
-- Table `tdemo_data`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tdemo_data` (
@ -4566,6 +4565,7 @@ CREATE TABLE IF NOT EXISTS `tdemo_data` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ---------------------------------------------------------------------
-- Table `tpandora_cve`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tpandora_cve` (
@ -4597,7 +4597,6 @@ CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
FOREIGN KEY (`id_file`) REFERENCES tfiles_repo(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tmodule_synth`
-- -----------------------------------------------------
@ -4611,4 +4610,47 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_synth` (
FOREIGN KEY (`id_agent_module_target`) REFERENCES tpolicy_modules(`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- -----------------------------------------------------
-- Table `tmerge_error`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmerge_error` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`step` int(10) default 0,
`msg` LONGTEXT default "",
`action` text default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ---------------------------------------------------------------------
-- Table `tmerge_steps`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmerge_steps` (
`id` int(10) NOT NULL auto_increment,
`id_node` int(10) default 0,
`phase` int(10) default 0,
`total` int(10) default 0,
`step` int(10) default 0,
`debug` varchar(1024) default "",
`action` varchar(100) default "",
`affected` varchar(100) default "",
`query` mediumtext default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
-- ---------------------------------------------------------------------
-- Table `tmerge_queries`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmerge_queries` (
`steps` int(10) NOT NULL auto_increment,
`action` varchar(100) default "",
`affected` varchar(100) default "",
`utimestamp` int(20) unsigned NOT NULL default 0,
`query` LONGTEXT NOT NULL default "",
PRIMARY KEY (`steps`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Dark / 14 / info@svg</title>
<desc>Created with Sketch.</desc>
<g id="Dark-/-14-/-info" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Icons/Elements/Help-mini" fill="#f3b200">
<path d="M7,0 C10.8659932,0 14,3.13400675 14,7 C14,10.8659932 10.8659932,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 Z M7,6 C6.44771525,6 6,6.44771525 6,7 L6,7 L6,10 C6,10.5522847 6.44771525,11 7,11 C7.55228475,11 8,10.5522847 8,10 L8,10 L8,7 C8,6.44771525 7.55228475,6 7,6 Z M7,3 C6.44771525,3 6,3.44771525 6,4 C6,4.55228475 6.44771525,5 7,5 C7.55228475,5 8,4.55228475 8,4 C8,3.44771525 7.55228475,3 7,3 Z" id="Elements-/-Help-mini"></path>
</g>
</g>
</svg>

After

(image error) Size: 959 B

@ -428,11 +428,14 @@ function install_package(url, auth, packageId, version, serverUpdate) {
var response = d.result;
document.getElementById("log_zone").innerText = response.result;
$("#input-progress")
.val(100)
.change();
if (response.error == undefined || response.error == "") {
$("#input-progress")
.val(100)
.change();
$("#result li").removeClass("error");
}
$("#result li").removeClass("error");
$("#result li")
.find("p")
.text(response.result);

@ -438,7 +438,7 @@ div#upload span.browse {
span.warning {
min-width: 10em;
min-height: 10em;
background: url(../images/icono_warning.png);
background: url(../images/info-warning.svg);
background-repeat: no-repeat;
background-position: center;
background-size: 80%;

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.775-240124
Version: 7.0NG.775-240126
Architecture: all
Priority: optional
Section: admin

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

@ -816,3 +816,5 @@ madeserver_autofit 7d
# Model sensitivity. A lower value triggers less anomalies (PANDORA FMS ENTERPRISE ONLY).
madeserver_sensitivity 0.1
# Encoding to use on mail subject (MIME-Header by default)
# mail_subject_encoding MIME-Header-ISO_2022_JP

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775";
my $pandora_build = "240124";
my $pandora_build = "240126";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -589,6 +589,8 @@ sub pandora_load_config {
$pa_config->{"madeserver"} = 0; # 774.
$pa_config->{"mail_subject_encoding"} = 'MIME-Header'; # 776.
# Check for UID0
if ($pa_config->{"quiet"} != 0){
if ($> == 0){
@ -691,6 +693,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^mail_in_separate\s+([0-9]*)/i) {
$pa_config->{'mail_in_separate'}= clean_blank($1);
}
elsif ($parametro =~ m/^mail_subject_encoding\s(.*)/i) {
$pa_config->{'mail_subject_encoding'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) {
$pa_config->{'snmp_logfile'}= clean_blank($1);
}

@ -7191,10 +7191,18 @@ Puts all autodisable agents with all modules unknown on disabled mode
sub pandora_disable_autodisable_agents ($$) {
my ($pa_config, $dbh) = @_;
my $sql = 'SELECT id_agente FROM tagente
WHERE disabled=0 AND
tagente.unknown_count>0 AND
tagente.modo=2';
my $sql = 'SELECT id_agente
FROM (
SELECT tm.id_agente, count(*) as sync_modules, ta.unknown_count
FROM tagente_modulo tm
JOIN tagente ta ON ta.id_agente = tm.id_agente
WHERE ta.disabled = 0
AND NOT ((id_tipo_modulo >= 21 AND id_tipo_modulo <= 23) OR id_tipo_modulo = 100)
GROUP BY tm.id_agente
) AS subquery
WHERE subquery.unknown_count >= subquery.sync_modules;';
my @agents_autodisabled = get_db_rows ($dbh, $sql);
return if ($#agents_autodisabled < 0);

@ -1533,7 +1533,7 @@ sub get_agent_addr_id ($$$) {
########################################################################
sub db_do ($$;@) {
my ($dbh, $query, @values) = @_;
#DBI->trace( 3, '/tmp/dbitrace.log' );
eval {
$dbh->do($query, undef, @values);

@ -418,8 +418,10 @@ sub process_xml_data ($$$$$) {
# A module with No-learn mode (modo = 0) creates its modules on database only when it is created
my $new_agent = 0;
# Get agent id
my $agent_id = get_agent_id ($dbh, $agent_name);
# Get agent id from tagente.
my $agent_id = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ?", safe_input($agent_name));
$agent_id = -1 unless defined($agent_id);
my $group_id = 0;
if ($agent_id < 1) {
if ($pa_config->{'autocreate'} == 0) {
@ -627,6 +629,11 @@ sub process_xml_data ($$$$$) {
my $module_type = get_tag_value ($module_data, 'type', 'generic_data');
# Apply timezone offset to module if timestamp is set.
if (defined($module_data->{'timestamp'} && $module_data->{'timestamp'} ne '')) {
$module_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime($module_data->{'timestamp'} + ($timezone_offset * 3600)));
}
# Single data
if (! defined ($module_data->{'datalist'})) {
my $data_timestamp = get_tag_value ($module_data, 'timestamp', $timestamp);

@ -524,6 +524,7 @@ sub exec_recon_app ($$$) {
logger($pa_config, 'Invalid summary for recon app ID ' . $task->{'id_app'}, 10);
} else {
db_do($dbh, "UPDATE trecon_task SET summary=? WHERE id_rt=?", $summary_json, $task->{'id_rt'});
pandora_audit ($pa_config, 'Discovery task' . ' Executed task '.$task->{'name'}.'#'.$task->{'id_app'}, 'SYSTEM', 'Discovery task', $dbh);
}
update_recon_task($dbh, $task->{'id_rt'}, $status);

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.775";
my $pandora_build = "240124";
my $pandora_build = "240126";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

@ -748,6 +748,7 @@ sub pandora_sendmail {
my $subject = $_[2];
my $message = $_[3];
my $content_type = $_[4];
my $encoding = $pa_config->{"mail_subject_encoding"} || 'MIME-Header';
$subject = decode_entities ($subject);
@ -758,7 +759,7 @@ sub pandora_sendmail {
my %mail = ( To => $to_address,
Message => $message,
Subject => encode('MIME-Header', $subject),
Subject => encode($encoding, $subject),
'X-Mailer' => $pa_config->{"rb_product_name"},
Smtp => $pa_config->{"mta_address"},
Port => $pa_config->{"mta_port"},

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.775
%define release 240124
%define release 240126
Summary: Pandora FMS Server
Name: %{name}

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.775
%define release 240124
%define release 240126
Summary: Pandora FMS Server
Name: %{name}

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.775"
PI_BUILD="240124"
PI_BUILD="240126"
MODE=$1
if [ $# -gt 1 ]; then

@ -38,7 +38,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.775 Build 240124";
my $version = "7.0NG.775 Build 240126";
# Pandora server configuration
my %conf;

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

@ -172,5 +172,5 @@ foreach my $k (keys %{$fields_values}){
# Get operation result
my $result = eval $operation;
if (defined($result)){
print $result . "\n";
print $result, "\n";
}