Merge remote-tracking branch 'origin/develop' into ent-12688-Mejoras-sistema-datos-de-demo-y-adaptar-al-nuevo-sistema-PRD
This commit is contained in:
commit
8ff87ec93a
|
@ -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-240125
|
||||
Version: 7.0NG.775-240213
|
||||
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-240125"
|
||||
pandora_version="7.0NG.775-240213"
|
||||
|
||||
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 => '240125';
|
||||
use constant AGENT_BUILD => '240213';
|
||||
|
||||
# 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+(.*)/) {
|
||||
|
@ -3678,9 +3678,21 @@ sub write_module_xml ($@) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($module->{'func'} == \&module_logger) {
|
||||
$Xml .= $data[0];
|
||||
return
|
||||
# Is it an extraction log module?
|
||||
if($module->{'type'} eq "log"){
|
||||
my $output = join('', @data);
|
||||
|
||||
if ($output eq "") {
|
||||
return;
|
||||
}
|
||||
|
||||
$Xml .="<log_module>\n";
|
||||
$Xml .= " <source><![CDATA[" . $module->{'name'} . "]]></source>\n";
|
||||
$Xml .= " <type><![CDATA[" . $module->{'type'} . "]]></type>\n";
|
||||
$Xml .= " <encoding>base64</encoding>\n";
|
||||
$Xml .= " <data><![CDATA[" . $output . "]]></data>\n";
|
||||
$Xml .= "</log_module>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
# Critical section
|
||||
|
@ -3690,7 +3702,7 @@ sub write_module_xml ($@) {
|
|||
" <name><![CDATA[" . $module->{'name'} . "]]></name>\n" .
|
||||
" <description><![CDATA[" . $module->{'description'} . "]]></description>\n" .
|
||||
" <type>" . $module->{'type'} . "</type>\n";
|
||||
|
||||
|
||||
# Interval
|
||||
$Xml .= " <module_interval>" . $module->{'interval'} . "</module_interval>\n";
|
||||
|
||||
|
@ -3889,7 +3901,8 @@ sub module_logger ($) {
|
|||
my $status = grep_logs(
|
||||
$module->{'name'},
|
||||
$module->{'params'},
|
||||
$module->{'filter'}
|
||||
$module->{'filter'},
|
||||
$module->{'type'}
|
||||
);
|
||||
|
||||
return $status;
|
||||
|
@ -3926,20 +3939,25 @@ my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_
|
|||
};
|
||||
|
||||
sub grep_logs {
|
||||
my ($str_name, $str_file, $str_regex) = @_;
|
||||
my ($module_name, $log_file, $reg_exp, $module_type) = @_;
|
||||
|
||||
if(!$str_name){
|
||||
if(!$module_name){
|
||||
log_message("module_logger", "Missing module name");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$str_file){
|
||||
if(!$log_file){
|
||||
log_message("module_logger", "Missing file name");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$str_regex){
|
||||
$str_regex = '.*';
|
||||
if(!$module_type){
|
||||
log_message("module_logger", "Missing module type");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$reg_exp){
|
||||
$reg_exp = '.*';
|
||||
}
|
||||
|
||||
my $idx_dir = '/tmp/';
|
||||
|
@ -3947,9 +3965,6 @@ sub grep_logs {
|
|||
my $idx_pos = 0;
|
||||
my $idx_size = 0;
|
||||
my $idx_ino = '';
|
||||
my $module_name = $str_name;
|
||||
my $log_file = $str_file;
|
||||
my $reg_exp = $str_regex;
|
||||
|
||||
# Check that log file exists
|
||||
if (! -e $log_file) {
|
||||
|
@ -3975,7 +3990,7 @@ sub grep_logs {
|
|||
return if load_idx(\$idx_pos, \$idx_ino, \$idx_file, \$idx_size) == 1;
|
||||
my @data = parse_log(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$module_name, \$reg_exp, \$idx_size);
|
||||
|
||||
my $output = create_log($module_name, @data);
|
||||
my $output = create_log($module_name, $module_type, @data);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -4090,27 +4105,32 @@ sub grep_logs {
|
|||
}
|
||||
|
||||
sub create_log {
|
||||
my ($module_name, @data) = @_;
|
||||
my ($module_name, $module_type, @data) = @_;
|
||||
|
||||
# No data
|
||||
if ($#data < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Log module
|
||||
my $output = "<log_module>\n";
|
||||
$output .= "<source><![CDATA[" . $module_name . "]]></source>\n";
|
||||
$output .= "<encoding>base64</encoding>\n";
|
||||
$output .= "<data><![CDATA[";
|
||||
$output .= &$encode_sub(join('', @data), '');
|
||||
$output .= "]]></data>\n";
|
||||
$output .= "</log_module>\n";
|
||||
my $data_content = process_log_monitoring($module_type, @data);
|
||||
|
||||
return $output;
|
||||
return $data_content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub process_log_monitoring {
|
||||
my ($module_type, @data) = @_;
|
||||
my $output = "";
|
||||
|
||||
if ($module_type eq "log"){
|
||||
$output = &$encode_sub(join('', @data), '');
|
||||
} elsif ($module_type eq "generic_data") {
|
||||
$output = scalar @data;
|
||||
} elsif ($module_type eq "generic_proc"){
|
||||
$output = scalar @data > 0 ? 1 : 0;
|
||||
} elsif ($module_type eq "generic_data_string" || $module_type eq "async_string"){
|
||||
$output = join('', @data);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# TERM Handler
|
||||
################################################################################
|
||||
|
@ -4283,6 +4303,10 @@ sub init_module ($) {
|
|||
$module->{'alert_template'} = undef;
|
||||
$module->{'filter'} = undef;
|
||||
$module->{'absoluteinterval'} = undef;
|
||||
$module->{'each_ff'} = undef;
|
||||
$module->{'min_ff_event_normal'} = undef;
|
||||
$module->{'min_ff_event_warning'} = undef;
|
||||
$module->{'min_ff_event_critical'} = undef;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240125
|
||||
%define release 240213
|
||||
|
||||
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 240125
|
||||
%define release 240213
|
||||
%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 240125
|
||||
%define release 240213
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Pandora FMS Linux agent, binary version
|
||||
|
@ -13,23 +13,22 @@ Name: %{name}
|
|||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL
|
||||
Vendor: ArticaST <http://www.artica.es>
|
||||
Vendor: PandoraFMS <https://pandorafms.com>
|
||||
Source0: %{source_name}-%{version}.tar.gz
|
||||
URL: http://pandorafms.org
|
||||
URL: https://pandorafms.com
|
||||
Group: System/Monitoring
|
||||
Packager: Sancho Lerena <slerena@artica.es>
|
||||
Packager: PandoraFMS <info@pandorafms.com>
|
||||
Prefix: /usr/share
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: x86_64
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires(post): /bin/ln
|
||||
Requires(preun): /bin/rm /usr/sbin/userdel
|
||||
Requires: coreutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl-interpreter
|
||||
Requires: perl-IO-Compress
|
||||
Requires: libnsl
|
||||
Requires: libxcrypt-compat
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
@ -50,7 +49,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
|||
mkdir -p $RPM_BUILD_ROOT/usr/bin/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/sbin/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
|
||||
#mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
|
||||
|
@ -58,7 +57,7 @@ cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
|
|||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_exec $RPM_BUILD_ROOT/usr/bin/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
|
||||
#cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/rc.d/init.d/pandora_agent_daemon
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/pandora_agent.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/man/man1/tentacle_client.1.gz $RPM_BUILD_ROOT/usr/share/man/man1/
|
||||
|
||||
|
@ -119,21 +118,11 @@ then
|
|||
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
|
||||
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
|
||||
# Enable the services on SystemD
|
||||
systemctl daemon-reload
|
||||
systemctl enable pandora_agent_daemon.service
|
||||
else
|
||||
/sbin/chkconfig --add pandora_agent_daemon
|
||||
/sbin/chkconfig pandora_agent_daemon on
|
||||
fi
|
||||
|
||||
if [ "$1" -gt 1 ]
|
||||
then
|
||||
|
||||
echo "If Pandora Agent daemon was running with init.d script,"
|
||||
echo "please stop it manually and start the service with systemctl"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
%preun
|
||||
|
||||
# Upgrading
|
||||
|
@ -141,8 +130,7 @@ if [ "$1" = "1" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/chkconfig --del pandora_agent_daemon
|
||||
/etc/rc.d/init.d/pandora_agent_daemon stop >/dev/null 2>&1 || :
|
||||
systemctl stop pandora_agent_daemon.service > /dev/null 2>&1 || :
|
||||
|
||||
# Remove symbolic links
|
||||
pushd /etc/pandora
|
||||
|
@ -162,7 +150,6 @@ exit 0
|
|||
%defattr(755,root,root)
|
||||
/usr/bin/pandora_agent_exec
|
||||
/usr/bin/tentacle_client
|
||||
/etc/rc.d/init.d/pandora_agent_daemon
|
||||
|
||||
%defattr(644,root,root)
|
||||
/usr/share/man/man1/pandora_agent.1.gz
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%define name pandorafms_agent_linux_bin
|
||||
%define source_name pandorafms_agent_linux
|
||||
%define version 7.0NG.775
|
||||
%define release 240125
|
||||
%define release 240213
|
||||
|
||||
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 240125
|
||||
%define release 240213
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.775"
|
||||
PI_BUILD="240125"
|
||||
PI_BUILD="240213"
|
||||
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
|
||||
{240125}
|
||||
{240213}
|
||||
|
||||
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);
|
||||
|
|
|
@ -48,7 +48,7 @@ Pandora_Module_Freedisk_Percent::Pandora_Module_Freedisk_Percent (string name, s
|
|||
|
||||
void
|
||||
Pandora_Module_Freedisk_Percent::run () {
|
||||
long res;
|
||||
double res;
|
||||
|
||||
try {
|
||||
Pandora_Module::run ();
|
||||
|
@ -59,7 +59,7 @@ Pandora_Module_Freedisk_Percent::run () {
|
|||
try {
|
||||
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
|
||||
|
||||
this->setOutput (longtostr (res));
|
||||
this->setOutput(std::to_string(res));
|
||||
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
|
||||
this->has_output = false;
|
||||
}
|
||||
|
|
|
@ -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 240125")
|
||||
#define PANDORA_VERSION ("7.0NG.775 Build 240213")
|
||||
|
||||
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 240125))"
|
||||
VALUE "ProductVersion", "(7.0NG.775(Build 240213))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -188,11 +188,11 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
|
|||
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
|
||||
* from WMI database.
|
||||
*/
|
||||
unsigned long
|
||||
double
|
||||
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
||||
CDhInitialize init;
|
||||
CDispPtr wmi_svc, quickfixes;
|
||||
double free_space = 0, size = 0;
|
||||
double free_space = 0, size = 0;
|
||||
string query;
|
||||
|
||||
query = "SELECT Size, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = \"" + disk_id + "\"";
|
||||
|
@ -202,7 +202,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
|||
dhCheck (dhGetValue (L"%o", &quickfixes, wmi_svc,
|
||||
L".ExecQuery(%T)",
|
||||
query.c_str ()));
|
||||
|
||||
|
||||
FOR_EACH (quickfix, quickfixes, NULL) {
|
||||
dhGetValue (L"%e", &free_space, quickfix,
|
||||
L".FreeSpace");
|
||||
|
@ -213,7 +213,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
return (unsigned long) (free_space * 100 / size);
|
||||
return (free_space * 100 / size);
|
||||
} NEXT_THROW (quickfix);
|
||||
} catch (string errstr) {
|
||||
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Pandora_Wmi {
|
|||
int isProcessRunning (string process_name);
|
||||
int isServiceRunning (string service_name);
|
||||
unsigned long getDiskFreeSpace (string disk_id);
|
||||
unsigned long getDiskFreeSpacePercent (string disk_id);
|
||||
double getDiskFreeSpacePercent (string disk_id);
|
||||
int getCpuUsagePercentage (int cpu_id);
|
||||
long getFreememory ();
|
||||
long getFreememoryPercent ();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.775-240125
|
||||
Version: 7.0NG.775-240213
|
||||
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-240125"
|
||||
pandora_version="7.0NG.775-240213"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -23,6 +23,9 @@ if ($headers['Authorization']) {
|
|||
|
||||
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
|
||||
|
||||
// Prevent sql injection.
|
||||
$user = mysqli_real_escape_string($config['dbconnection'], $user);
|
||||
|
||||
// Check user login
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ if ($headers['Authorization']) {
|
|||
|
||||
list($user, $password) = explode(':', base64_decode($headers['Authorization']));
|
||||
|
||||
// Prevent sql injection.
|
||||
$user = mysqli_real_escape_string($config['dbconnection'], $user);
|
||||
|
||||
// Check user login
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
|
||||
|
|
|
@ -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] .= ' ';
|
||||
$table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true);
|
||||
|
||||
|
@ -284,7 +284,7 @@ function mainInsertData()
|
|||
currentText: '<?php echo __('Now'); ?>',
|
||||
closeText: '<?php echo __('Close'); ?>'});
|
||||
|
||||
$('#text-data').datepicker ({
|
||||
$('#text-date').datepicker ({
|
||||
dateFormat: '<?php echo DATE_FORMAT_JS; ?>',
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
|
|
|
@ -128,6 +128,6 @@ if (empty($data)) {
|
|||
}
|
||||
|
||||
echo '{
|
||||
"label": "'.htmlspecialchars($graph_title, ENT_QUOTES).'",
|
||||
"data": [["'.time().'", '.htmlspecialchars($data, ENT_QUOTES).']]
|
||||
"label": "'.htmlspecialchars(($graph_title ?? ''), ENT_QUOTES).'",
|
||||
"data": [["'.time().'", '.htmlspecialchars(($data ?? ''), ENT_QUOTES).']]
|
||||
}';
|
||||
|
|
|
@ -1,13 +1,56 @@
|
|||
START TRANSACTION;
|
||||
|
||||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
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;
|
||||
|
||||
ALTER TABLE `tevent_sound` MODIFY COLUMN `name` text NULL;
|
||||
ALTER TABLE `tevent_sound` MODIFY COLUMN `sound` text NULL;
|
||||
ALTER TABLE `treport_content` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport_content_template` MODIFY COLUMN `use_prefix_notation` tinyint unsigned NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `id_name` text NULL;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `ip` text NULL;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `type` text NULL;
|
||||
ALTER TABLE `tsesion_filter` MODIFY COLUMN `user` text NULL;
|
||||
ALTER TABLE `tncm_agent_data`
|
||||
ADD COLUMN `id_agent_data` int not null default 0 AFTER `script_type`;
|
||||
|
||||
ALTER TABLE `tusuario` CHANGE COLUMN `metaconsole_data_section` `metaconsole_data_section` TEXT NOT NULL DEFAULT '' ;
|
||||
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `icon_notification` VARCHAR(250) NULL DEFAULT NULL AFTER `url`;
|
||||
|
||||
ALTER TABLE `tdemo_data` MODIFY `item_id` TEXT NOT NULL DEFAULT '';
|
||||
|
@ -39,4 +82,14 @@ UPDATE `tdemo_data` SET `item_id` = CONCAT('{"tagente_id_agente": "',`item_id`,'
|
|||
UPDATE `tdemo_data` SET `item_id` = CONCAT('{"id_tgis_map": "',`item_id`,'"}') WHERE `table_name` = "tgis_map" AND CAST(`item_id` AS UNSIGNED) != 0;
|
||||
UPDATE `tdemo_data` SET `item_id` = CONCAT('{"id_tmap_layer": "',`item_id`,'"}') WHERE `table_name` = "tgis_map_layer" AND CAST(`item_id` AS UNSIGNED) != 0;
|
||||
|
||||
UPDATE `tncm_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
|
||||
UPDATE `tncm_agent_data_template` SET `vendors` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM vendors))), '"]'), `models` = CONCAT('["', TRIM(BOTH '"' FROM TRIM(BOTH ']' FROM TRIM(BOTH '[' FROM models))), '"]');
|
||||
|
||||
-- Update version for plugin oracle
|
||||
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.oracle';
|
||||
|
||||
SET @widget_id = NULL;
|
||||
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = 'GisMap';
|
||||
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,'GisMap','GisMap','Gis map','','GisMap.php');
|
||||
|
||||
COMMIT;
|
|
@ -1021,11 +1021,14 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
modal: {
|
||||
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||
ok: '<?php echo __('Close'); ?>'
|
||||
ok: '<?php echo __('Close'); ?>',
|
||||
overlay: true,
|
||||
overlayExtraClass: 'welcome-overlay',
|
||||
},
|
||||
onshow: {
|
||||
page: 'include/ajax/welcome_window',
|
||||
method: 'loadWelcomeWindow',
|
||||
width: 1000,
|
||||
},
|
||||
oncancel: {
|
||||
page: 'include/ajax/welcome_window',
|
||||
|
@ -1043,6 +1046,34 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onload: () => {
|
||||
$(document).ready(function () {
|
||||
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
|
||||
$(buttonpane).append(`
|
||||
<div class="welcome-wizard-buttons">
|
||||
<label>
|
||||
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
|
||||
<?php echo __('Do not show anymore'); ?>
|
||||
</label>
|
||||
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
|
||||
</div>
|
||||
`);
|
||||
|
||||
var closeWizard = $("button.close-wizard-button");
|
||||
|
||||
$(closeWizard).click(function (e) {
|
||||
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
|
||||
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
|
||||
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
|
||||
|
||||
if (checkbox === 1) {
|
||||
$(cancel).click();
|
||||
} else {
|
||||
$(close).click()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -500,21 +500,42 @@ $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'];
|
||||
if (empty($file_name) === false) {
|
||||
$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');
|
||||
|
@ -653,6 +674,19 @@ if (enterprise_installed()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($id_os === '1') {
|
||||
$modules = $agent_plugin->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/Syslog/', $row['raw']) === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$enable_log_collector = 0;
|
||||
} else {
|
||||
$enable_log_collector = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_os === '9') {
|
||||
$modules = $agent_plugin->getModules();
|
||||
foreach ($modules as $key => $row) {
|
||||
|
|
|
@ -1299,8 +1299,11 @@ if ($update_agent) {
|
|||
}
|
||||
|
||||
$modules = $agent->getModules();
|
||||
|
||||
foreach ($modules as $key => $row) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) {
|
||||
if (preg_match('/PandoraAgent_log/', $row['raw']) === 1
|
||||
|| ($id_os === 1 && preg_match('/Syslog/', $row['raw']) === 1)
|
||||
) {
|
||||
if ($enable_log_collector === 1) {
|
||||
if ($row['disabled'] === 1) {
|
||||
$agent->enableModule($row['module_name'], $row);
|
||||
|
|
|
@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
|||
$search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf(
|
||||
"(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND",
|
||||
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
||||
$search_string,
|
||||
$search_string_entities,
|
||||
$search_string,
|
||||
|
|
|
@ -150,7 +150,7 @@ if (is_ajax()) {
|
|||
$component = db_get_row('tlocal_component', 'id', $id_component);
|
||||
foreach ($component as $index => $element) {
|
||||
$component[$index] = html_entity_decode(
|
||||
$element,
|
||||
(isset($element) === true) ? $element : '',
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
|
|
|
@ -505,7 +505,7 @@ $tableBasicThresholds->data['caption_switch_warning_inverse_string'][0] = html_p
|
|||
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_str_warning">('.__('Str.').')</span>';
|
||||
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
|
||||
'str_warning',
|
||||
str_replace('"', '', $str_warning),
|
||||
str_replace('"', '', (isset($str_warning) === true) ? $str_warning : ''),
|
||||
'',
|
||||
10,
|
||||
1024,
|
||||
|
@ -602,7 +602,7 @@ $tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div(
|
|||
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_str_critical">('.__('Str.').')</span>';
|
||||
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
|
||||
'str_critical',
|
||||
str_replace('"', '', $str_critical),
|
||||
str_replace('"', '', (isset($str_critical) === true) ? $str_critical : ''),
|
||||
'',
|
||||
10,
|
||||
1024,
|
||||
|
|
|
@ -60,7 +60,12 @@ $data[1] = html_print_select_from_sql(
|
|||
$disabledBecauseInPolicy
|
||||
);
|
||||
// Store the macros in base64 into a hidden control to move between pages
|
||||
$data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
|
||||
$data[1] .= html_print_input_hidden(
|
||||
'macros',
|
||||
(isset($macros) === true) ? base64_encode($macros) : '',
|
||||
true
|
||||
);
|
||||
|
||||
$table_simple->colspan['plugin_1'][2] = 2;
|
||||
|
||||
if (!empty($id_plugin)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -319,9 +319,8 @@ if ($update_agents) {
|
|||
$secondary_groups_removed
|
||||
);
|
||||
|
||||
$agents_values = agents_get_agent((int) $array_id[1]);
|
||||
$agents_values = db_get_row_filter('tagente', ['id_agente' => (int) $array_id[1]]);
|
||||
$node->disconnect();
|
||||
|
||||
if (empty($values) === false) {
|
||||
update_agents_in_metaconsole(
|
||||
(int) $array_id[1],
|
||||
|
|
|
@ -768,7 +768,7 @@ $table_critical->tdid[0][0] = 'edit1-3-min';
|
|||
$table_critical->data[0][0] = html_print_label_input_block(
|
||||
__('Min.'),
|
||||
html_print_input_text(
|
||||
'min_warning',
|
||||
'min_critical',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
|
@ -781,7 +781,7 @@ $table_critical->tdid[0][1] = 'edit1-3-max';
|
|||
$table_critical->data[0][1] = html_print_label_input_block(
|
||||
__('Max.'),
|
||||
html_print_input_text(
|
||||
'max_warning',
|
||||
'max_critical',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
|
@ -1500,7 +1500,7 @@ $table->data[39][0] = html_print_label_input_block(
|
|||
'',
|
||||
'',
|
||||
true
|
||||
).html_print_input_hidden('macros', base64_encode($macros), true)
|
||||
).html_print_input_hidden('macros', base64_encode(($macros ?? '')), true)
|
||||
);
|
||||
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
|
|
|
@ -521,7 +521,18 @@ if ($access_console_node === true) {
|
|||
}
|
||||
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
|
||||
$show_ipam = false;
|
||||
$ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network');
|
||||
foreach ($ipam as $row) {
|
||||
if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) {
|
||||
$show_ipam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) {
|
||||
$menu_godmode['gextensions']['text'] = __('Admin tools');
|
||||
$menu_godmode['gextensions']['sec2'] = 'godmode/extensions';
|
||||
$menu_godmode['gextensions']['id'] = 'god-extensions';
|
||||
|
@ -538,8 +549,6 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
|||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
$sub['tools/diagnostics']['id'] = 'diagnostic_info';
|
||||
enterprise_hook('omnishell');
|
||||
enterprise_hook('ipam_submenu');
|
||||
|
||||
$sub['godmode/setup/news']['text'] = __('Site news');
|
||||
$sub['godmode/setup/news']['id'] = 'site_news';
|
||||
}
|
||||
|
@ -561,9 +570,15 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($
|
|||
}
|
||||
}
|
||||
|
||||
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
|
||||
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
|
||||
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
|
||||
if (((bool) check_acl($config['id_user'], 0, 'PM') === true && $access_console_node === true) || $show_ipam === true) {
|
||||
enterprise_hook('ipam_submenu');
|
||||
}
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) {
|
||||
$sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup');
|
||||
$sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup';
|
||||
$sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds'];
|
||||
}
|
||||
|
||||
$menu_godmode['gextensions']['sub'] = $sub;
|
||||
}
|
||||
|
@ -641,16 +656,18 @@ if ($access_console_node === true) {
|
|||
}
|
||||
|
||||
// Complete the submenu.
|
||||
$extension_view = [];
|
||||
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
|
||||
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
|
||||
$extension_submenu = array_merge($extension_view, $sub2);
|
||||
if (users_is_admin($config['id_user']) === true) {
|
||||
$extension_view = [];
|
||||
$extension_view['godmode/extensions']['id'] = 'extension_manager_view';
|
||||
$extension_view['godmode/extensions']['text'] = __('Extension manager view');
|
||||
$extension_submenu = array_merge($extension_view, $sub2);
|
||||
|
||||
$sub['godmode/extensions']['sub2'] = $extension_submenu;
|
||||
$sub['godmode/extensions']['text'] = __('Extension manager');
|
||||
$sub['godmode/extensions']['id'] = 'extension_manager';
|
||||
$sub['godmode/extensions']['type'] = 'direct';
|
||||
$sub['godmode/extensions']['subtype'] = 'nolink';
|
||||
$sub['godmode/extensions']['sub2'] = $extension_submenu;
|
||||
$sub['godmode/extensions']['text'] = __('Extension manager');
|
||||
$sub['godmode/extensions']['id'] = 'extension_manager';
|
||||
$sub['godmode/extensions']['type'] = 'direct';
|
||||
$sub['godmode/extensions']['subtype'] = 'nolink';
|
||||
}
|
||||
|
||||
if (is_array($menu_godmode['gextensions']['sub']) === true) {
|
||||
$submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ if ($favorite_array == false) {
|
|||
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='.$favourite_v['id'];
|
||||
}
|
||||
|
||||
echo "<a href='".$url."' title='Visual console".$favourite_v['name']."' alt='".$favourite_v['name']."'><li>";
|
||||
echo "<a href='".$url."' title='".io_safe_output($favourite_v['name'])."' alt='".io_safe_output($favourite_v['name'])."'><li>";
|
||||
echo "<div class='icon_img'>";
|
||||
echo html_print_image(
|
||||
'images/'.groups_get_icon($favourite_v['id_group']),
|
||||
|
@ -256,7 +256,7 @@ if ($favorite_array == false) {
|
|||
);
|
||||
echo '</div>';
|
||||
echo "<div class='text'>";
|
||||
echo $favourite_v['name'];
|
||||
echo io_safe_output($favourite_v['name']);
|
||||
echo '</div>';
|
||||
echo '</li></a>';
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ if ($create != '') {
|
|||
// =====================================================================
|
||||
if ($filemanager) {
|
||||
if ($edit_file) {
|
||||
$location_file = get_parameter('location_file', '');
|
||||
$location_file = io_safe_output(get_parameter('location_file', ''));
|
||||
$filename = array_pop(explode('/', $location_file));
|
||||
$file = file_get_contents($location_file);
|
||||
echo '<h4>'.__('Edit file').' '.$filename.'</h4>';
|
||||
|
@ -250,7 +250,7 @@ if ($filemanager) {
|
|||
echo '</form>';
|
||||
} else {
|
||||
if ($update_file) {
|
||||
$location_file = get_parameter('location_file', '');
|
||||
$location_file = io_safe_output(get_parameter('location_file', ''));
|
||||
$contentFile = io_safe_output(get_parameter('content_file', ''));
|
||||
$compatibility = get_parameter('compatibility', 'unix');
|
||||
$is_win_compatible = strpos($contentFile, "\r\n");
|
||||
|
@ -262,7 +262,12 @@ if ($filemanager) {
|
|||
$contentFile = str_replace("\n", "\r\n", $contentFile);
|
||||
}
|
||||
|
||||
$result = file_put_contents($location_file, $contentFile);
|
||||
if (empty($location_file) === false
|
||||
&& strpos($location_file, realpath('attachment/plugin')) !== false
|
||||
&& file_exists($location_file) === true
|
||||
) {
|
||||
$result = file_put_contents($location_file, $contentFile);
|
||||
}
|
||||
}
|
||||
|
||||
$id_plugin = (int) get_parameter('id_plugin', 0);
|
||||
|
|
|
@ -115,7 +115,7 @@ foreach ($servers as $server) {
|
|||
|
||||
$table->cellclass[] = [
|
||||
3 => 'progress_bar',
|
||||
8 => 'table_action_buttons',
|
||||
9 => 'table_action_buttons',
|
||||
];
|
||||
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ if ($idOS > 0) {
|
|||
} else {
|
||||
$name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name')))));
|
||||
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
|
||||
$icon = get_parameter('icon', 0);
|
||||
$icon = get_parameter('icon', 'os@svg.svg');
|
||||
}
|
||||
|
||||
$icon_upload = get_parameter('icon_upload', null);
|
||||
|
@ -246,7 +246,7 @@ $iconData[] = html_print_select(
|
|||
'icon',
|
||||
$icon,
|
||||
'show_icon_OS();',
|
||||
__('None'),
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
|
@ -356,6 +356,8 @@ function get_list_os_icons_dir()
|
|||
}
|
||||
}
|
||||
|
||||
$return['os@svg.svg'] = __('None');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,14 @@ switch ($tab) {
|
|||
break;
|
||||
|
||||
case 'manage_os':
|
||||
$id_os = get_parameter('id_os', '');
|
||||
if ($id_os !== '') {
|
||||
$headerTitle = __('Edit OS');
|
||||
} else {
|
||||
$headerTitle = __('Create OS');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'list':
|
||||
if ($action === 'edit') {
|
||||
$headerTitle = __('Edit OS');
|
||||
|
|
|
@ -960,60 +960,6 @@ echo '<legend>'.__('Mail configuration').'</legend>';
|
|||
);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
||||
/**
|
||||
* Print the modal window for the summary of each alerts group
|
||||
*
|
||||
* @param string $id Id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function print_email_test_modal_window($id)
|
||||
{
|
||||
// Email config table.
|
||||
$table_mail_test = new stdClass();
|
||||
$table_mail_test->width = '100%';
|
||||
$table_mail_test->class = 'filter-table-adv';
|
||||
$table_mail_test->data = [];
|
||||
|
||||
$table_mail_test->data[0][] = html_print_label_input_block(
|
||||
__('Address'),
|
||||
html_print_input_text(
|
||||
'email_test_address',
|
||||
'',
|
||||
'',
|
||||
35,
|
||||
100,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$table_mail_test->data[1][] = '  <span id="email_test_sent_message" class="invisible"><b>Email sent</b></span><span id="email_test_failure_message" class=invisible"><b>Email could not be sent</b></span>';
|
||||
|
||||
// $table_mail_test->colspan[2][0] = 2;
|
||||
$submitButton = html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons-right-forced',
|
||||
'content' => html_print_button(
|
||||
__('Send'),
|
||||
'email_test',
|
||||
false,
|
||||
'',
|
||||
[
|
||||
'icon' => 'cog',
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function show_timezone () {
|
||||
|
@ -1033,62 +979,6 @@ function show_timezone () {
|
|||
});
|
||||
}
|
||||
|
||||
function show_email_test(id) {
|
||||
$('#email_test_sent_message').hide();
|
||||
$('#email_test_failure_message').hide();
|
||||
|
||||
$("#email_test_"+id).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 450,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function perform_email_test () {
|
||||
$('#email_test_sent_message').hide();
|
||||
$('#email_test_failure_message').hide();
|
||||
|
||||
var test_address = $('#text-email_test_address').val();
|
||||
params = {
|
||||
email_smtpServer : $('#text-email_smtpServer').val(),
|
||||
email_smtpPort : $('#text-email_smtpPort').val(),
|
||||
email_username : $('#text-email_username').val(),
|
||||
email_password : $('#password-email_password').val(),
|
||||
email_encryption : $( "#email_encryption option:selected" ).val(),
|
||||
email_from_dir : $('#text-email_from_dir').val(),
|
||||
email_from_name : $('#text-email_from_name').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data : {
|
||||
page: "godmode/setup/setup_general",
|
||||
test_address: test_address,
|
||||
params: params
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (parseInt(data) === 1) {
|
||||
$('#email_test_sent_message').show();
|
||||
$('#email_test_failure_message').hide();
|
||||
} else {
|
||||
$('#email_test_failure_message').show();
|
||||
$('#email_test_sent_message').hide();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('#email_test_failure_message').show();
|
||||
$('#email_test_sent_message').hide();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#zone").attr("hidden", true);
|
||||
|
@ -1146,8 +1036,6 @@ $(document).ready (function () {
|
|||
}
|
||||
})
|
||||
|
||||
$('#button-email_test').click(perform_email_test);
|
||||
|
||||
$("#right_iblacklist").click (function () {
|
||||
jQuery.each($("select[name='inventory_changes_blacklist_out[]'] option:selected"), function (key, value) {
|
||||
imodule_name = $(value).html();
|
||||
|
|
|
@ -386,7 +386,7 @@ if (empty($result) === false) {
|
|||
$data[4] = $output;
|
||||
|
||||
$phone_large = io_safe_output($tag['phone']);
|
||||
$phone_small = substr($phone_large, 0, 24);
|
||||
$phone_small = substr(($phone_large ?? ''), 0, 24);
|
||||
if ($phone_large == $phone_small) {
|
||||
$output = $phone_large;
|
||||
} else {
|
||||
|
|
|
@ -770,7 +770,7 @@ if ($update_user) {
|
|||
$id_user = (string) get_parameter('id_user', '');
|
||||
|
||||
if ($password_new != '') {
|
||||
if ($config['auth'] !== 'mysql') {
|
||||
if ($config['auth'] !== 'mysql' && $values['local_user'] === false) {
|
||||
ui_print_error_message(__('It is not possible to change the password because external authentication is being used'));
|
||||
} else {
|
||||
$correct_password = false;
|
||||
|
@ -1581,7 +1581,7 @@ $autorefresh_list_out['operation/events/events'] = 'Events';
|
|||
|
||||
if (isset($autorefresh_list) === false || empty($autorefresh_list) === true || empty($autorefresh_list[0]) === true) {
|
||||
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$id."'");
|
||||
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
|
||||
$autorefresh_list = json_decode(($select[0]['autorefresh_white_list'] ?? ''));
|
||||
if ($autorefresh_list === null || $autorefresh_list === 0) {
|
||||
$autorefresh_list = [];
|
||||
$autorefresh_list[0] = __('None');
|
||||
|
|
|
@ -37,6 +37,20 @@ class Applications extends Wizard
|
|||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* Task properties.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $task;
|
||||
|
||||
/**
|
||||
* Class of styles.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -37,6 +37,20 @@ class Custom extends Wizard
|
|||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* Task properties.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $task;
|
||||
|
||||
/**
|
||||
* Class of styles.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $class;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -47,6 +47,13 @@ ui_require_javascript_file('simTree');
|
|||
class DiscoveryTaskList extends HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Task properties.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $task;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -1109,7 +1109,7 @@ class HostDevices extends Wizard
|
|||
'return' => true,
|
||||
'selected' => explode(
|
||||
',',
|
||||
$this->task['id_network_profile']
|
||||
(isset($this->task['id_network_profile']) === true) ? $this->task['id_network_profile'] : ''
|
||||
),
|
||||
'nothing_value' => 0,
|
||||
'nothing' => __('None'),
|
||||
|
|
|
@ -97,6 +97,13 @@ class Wizard
|
|||
*/
|
||||
public $access = 'AR';
|
||||
|
||||
/**
|
||||
* Root url.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $rootUrl;
|
||||
|
||||
|
||||
/**
|
||||
* Setter for breadcrum
|
||||
|
@ -550,7 +557,7 @@ class Wizard
|
|||
}
|
||||
|
||||
echo '<ul class="bigbuttonlist">';
|
||||
array_map('self::printBigButtonElement', $list_data);
|
||||
array_map(['Wizard', 'printBigButtonElement'], $list_data);
|
||||
echo '</ul>';
|
||||
|
||||
if ($return === true) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
|
@ -117,12 +117,25 @@ if ($method === 'draw') {
|
|||
$where_name = 'name LIKE "%'.$filter['free_search'].'%"';
|
||||
}
|
||||
|
||||
if (is_user_admin($config['id_user']) === false) {
|
||||
$group_list = \users_get_groups(
|
||||
$config['id_ser'],
|
||||
'RR',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$where_group = '';
|
||||
if (empty($filter['group']) === false && $filter['group'] !== '0') {
|
||||
$where_group = sprintf('id_group = %s', $filter['group']);
|
||||
if (empty($where_name) === false) {
|
||||
$where_group = 'AND '.$where_group;
|
||||
}
|
||||
} else if (empty($group_list) === false) {
|
||||
$where_group = sprintf('id_group IN (%s)', implode(',', array_keys($group_list)));
|
||||
if (empty($where_name) === false) {
|
||||
$where_group = 'AND '.$where_group;
|
||||
}
|
||||
}
|
||||
|
||||
$where = '';
|
||||
|
|
|
@ -2542,15 +2542,12 @@ if ($drawConsoleSound === true) {
|
|||
$output .= '<div id="progressbar_time"></div>';
|
||||
$output .= '<div class="buttons-sound-modal">';
|
||||
$output .= '<div class="container-button-play">';
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Start'),
|
||||
'type' => 'button',
|
||||
'name' => 'start-search',
|
||||
'attributes' => [ 'class' => 'play secondary' ],
|
||||
'return' => true,
|
||||
],
|
||||
'div',
|
||||
$output .= html_print_button(
|
||||
__('Start'),
|
||||
'start-search',
|
||||
false,
|
||||
'',
|
||||
['icon' => 'play'],
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
|
|
@ -250,6 +250,7 @@ if (is_ajax() === true) {
|
|||
|
||||
if ($getInfo === true) {
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
include_once $config['homedir'].'/include/functions_graph.php';
|
||||
$id = get_parameter('id', 0);
|
||||
$id_server = get_parameter('id_server', 0);
|
||||
if (empty($id_server) === 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);
|
||||
|
@ -1979,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',
|
||||
|
@ -1996,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
|
||||
);
|
||||
|
@ -2023,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
|
||||
);
|
||||
|
@ -2055,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
|
||||
);
|
||||
|
|
|
@ -380,5 +380,7 @@ if (session_status() !== PHP_SESSION_DISABLED) {
|
|||
// Could give a warning if no session file is created. Ignore.
|
||||
@session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
if (isset($_COOKIE[session_name()]) === true) {
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -572,10 +572,10 @@ function get_user_info($user)
|
|||
*
|
||||
* @return array An array of user information
|
||||
*/
|
||||
function get_users($order='fullname', $filter=false, $fields=false)
|
||||
function get_users($order='fullname', $filter=[], $fields=false)
|
||||
{
|
||||
if (is_array($order) === true) {
|
||||
$filter['order'] = $order['field'].' '.$order['order'];
|
||||
$filter['order'] = (string) $order['field'].' '.(string) $order['order'];
|
||||
} else {
|
||||
if ($order !== 'registered' || $order !== 'last_connect' || $order !== 'fullname') {
|
||||
$order = 'fullname';
|
||||
|
|
|
@ -53,6 +53,48 @@ class AuditLog extends HTML
|
|||
*/
|
||||
private $ajaxController;
|
||||
|
||||
/**
|
||||
* TableId
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $tableId;
|
||||
|
||||
/**
|
||||
* FilterIp
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $filterIp;
|
||||
|
||||
/**
|
||||
* FilterPeriod
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $filterPeriod;
|
||||
|
||||
/**
|
||||
* FilterText
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filterText;
|
||||
|
||||
/**
|
||||
* FilterType
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filterType;
|
||||
|
||||
/**
|
||||
* FilterUser
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filterUser;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
|
|
|
@ -66,6 +66,13 @@ class CalendarManager
|
|||
*/
|
||||
private $message;
|
||||
|
||||
/**
|
||||
* Access
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $access;
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
use PandoraFMS\Tools\Files;
|
||||
use PandoraFMS\Agent;
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -1214,6 +1215,7 @@ class ConsoleSupervisor
|
|||
'',
|
||||
$config['num_files_attachment']
|
||||
);
|
||||
|
||||
if ($filecount > $config['num_files_attachment']) {
|
||||
$this->notify(
|
||||
[
|
||||
|
@ -1331,17 +1333,28 @@ class ConsoleSupervisor
|
|||
$MAX_FILES_DATA_IN = 1000;
|
||||
$MAX_BADXML_FILES_DATA_IN = 150;
|
||||
|
||||
$filecount = $this->countFiles(
|
||||
$remote_config_dir,
|
||||
'',
|
||||
$MAX_FILES_DATA_IN
|
||||
);
|
||||
$filecount = 0;
|
||||
|
||||
$agentId = db_get_value('id_agente', 'tagente', 'nombre', 'pandora.internals');
|
||||
if ($agentId !== false) {
|
||||
$agent = new Agent($agentId);
|
||||
|
||||
$moduleId = $agent->searchModules(
|
||||
['nombre' => 'Data_in_files'],
|
||||
1
|
||||
)->toArray()['id_agente_modulo'];
|
||||
|
||||
if ($moduleId > 0) {
|
||||
$filecount = (int) modules_get_last_value($moduleId);
|
||||
}
|
||||
}
|
||||
|
||||
// If cannot open directory, count is '-1', skip.
|
||||
if ($filecount > $MAX_FILES_DATA_IN) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.FILES.DATAIN',
|
||||
'title' => __('There are too much files in spool').'.',
|
||||
'title' => __('There are too many files in spool').'.',
|
||||
'message' => __(
|
||||
'There are more than %d files in %s. Consider checking DataServer performance',
|
||||
$MAX_FILES_DATA_IN,
|
||||
|
@ -1671,6 +1684,10 @@ class ConsoleSupervisor
|
|||
ini_get('upload_max_filesize')
|
||||
);
|
||||
|
||||
$PHPpost_max_size = config_return_in_bytes(
|
||||
ini_get('post_max_size')
|
||||
);
|
||||
|
||||
// PHP configuration.
|
||||
$PHPmax_input_time = ini_get('max_input_time');
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
|
@ -1678,6 +1695,7 @@ class ConsoleSupervisor
|
|||
$PHPsafe_mode = ini_get('safe_mode');
|
||||
$PHPdisable_functions = ini_get('disable_functions');
|
||||
$PHPupload_max_filesize_min = config_return_in_bytes('800M');
|
||||
$PHPpost_max_size_min = config_return_in_bytes('800M');
|
||||
$PHPmemory_limit_min = config_return_in_bytes('800M');
|
||||
$PHPSerialize_precision = ini_get('serialize_precision');
|
||||
|
||||
|
@ -1728,7 +1746,7 @@ class ConsoleSupervisor
|
|||
'message' => sprintf(
|
||||
__('Recommended value is %s'),
|
||||
'-1 ('.__('Unlimited').')'
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
|
||||
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Do not forget to restart Apache process after)'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
|
@ -1753,7 +1771,7 @@ class ConsoleSupervisor
|
|||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
'0 ('.__('Unlimited').')'
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
|
@ -1778,7 +1796,7 @@ class ConsoleSupervisor
|
|||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf(__('%s or greater'), '800M')
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
|
@ -1808,7 +1826,7 @@ class ConsoleSupervisor
|
|||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf(__('%s or greater'), $recommended_memory)
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_INFORMATION,
|
||||
]
|
||||
|
@ -1915,6 +1933,25 @@ class ConsoleSupervisor
|
|||
} else {
|
||||
$this->cleanNotifications('NOTIF.PHP.VERSION.SUPPORT');
|
||||
}
|
||||
|
||||
if ($PHPpost_max_size < $PHPpost_max_size_min && (int) $PHPpost_max_size !== -1) {
|
||||
$url = 'https://www.php.net/manual/en/ini.core.php#ini.post-max-size';
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PHP.POST_MAX_SIZE',
|
||||
'title' => __('PHP POST MAX SIZE'),
|
||||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf(__('%sM or greater'), ($PHPpost_max_size_min / 1024 / 1024))
|
||||
).'<br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
'url' => $url,
|
||||
'icon_notification' => self::ICON_HEADSUP,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$this->cleanNotifications('NOTIF.PHP.POST_MAX_SIZE');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -850,7 +850,7 @@ class CredentialStore extends Wizard
|
|||
'privilege' => 'AR',
|
||||
'type' => 'select_groups',
|
||||
'nothing' => false,
|
||||
'selected' => (defined($id_group_filter) ? $id_group_filter : 0),
|
||||
'selected' => ((isset($id_group_filter) === true) ? $id_group_filter : 0),
|
||||
'return' => true,
|
||||
'size' => '80%',
|
||||
],
|
||||
|
@ -1637,7 +1637,7 @@ class CredentialStore extends Wizard
|
|||
$(".ui-dialog-content").dialog("close");
|
||||
$('.info').hide();
|
||||
cleanupDOM();
|
||||
dt_keystore.draw(false);
|
||||
window.location.reload();
|
||||
} else {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
|
|
|
@ -54,6 +54,13 @@ class Diagnostics extends Wizard
|
|||
*/
|
||||
public $pdf;
|
||||
|
||||
/**
|
||||
* Product name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $product_name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -483,7 +490,7 @@ class Diagnostics extends Wizard
|
|||
],
|
||||
'isEnterprise' => [
|
||||
'name' => __('Enterprise installed'),
|
||||
'value' => (enterprise_installed()) ? __('true') : __('false'),
|
||||
'value' => $this->getStatusLicense(),
|
||||
],
|
||||
'customerKey' => [
|
||||
'name' => __('Update Key'),
|
||||
|
@ -505,6 +512,29 @@ class Diagnostics extends Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return status of license.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStatusLicense():string
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
if (isset($config['license_mode'])
|
||||
&& (int) $config['license_mode'] === 1
|
||||
) {
|
||||
return __('FREE/TRIAL');
|
||||
} else {
|
||||
return __('LICENSED');
|
||||
}
|
||||
} else {
|
||||
return __('OpenSource');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHP Status.
|
||||
*
|
||||
|
@ -517,23 +547,31 @@ class Diagnostics extends Wizard
|
|||
$result = [
|
||||
'error' => false,
|
||||
'data' => [
|
||||
'phpVersion' => [
|
||||
'phpVersion' => [
|
||||
'name' => __('PHP Version'),
|
||||
'value' => phpversion(),
|
||||
],
|
||||
'maxExecutionTime' => [
|
||||
'maxExecutionTime' => [
|
||||
'name' => __('PHP Max execution time'),
|
||||
'value' => ini_get('max_execution_time'),
|
||||
],
|
||||
'maxInputTime' => [
|
||||
'maxInputTime' => [
|
||||
'name' => __('PHP Max input time'),
|
||||
'value' => ini_get('max_input_time'),
|
||||
],
|
||||
'memoryLimit' => [
|
||||
'memoryLimit' => [
|
||||
'name' => __('PHP Memory limit'),
|
||||
'value' => ini_get('memory_limit'),
|
||||
],
|
||||
'sessionLifetime' => [
|
||||
'postMaxSize' => [
|
||||
'name' => __('PHP Post max size'),
|
||||
'value' => ini_get('post_max_size'),
|
||||
],
|
||||
'uploadMaxFilesize' => [
|
||||
'name' => __('PHP Upload max file size'),
|
||||
'value' => ini_get('upload_max_filesize'),
|
||||
],
|
||||
'sessionLifetime' => [
|
||||
'name' => __('Session cookie lifetime'),
|
||||
'value' => ini_get('session.cookie_lifetime'),
|
||||
],
|
||||
|
|
|
@ -452,6 +452,7 @@ class ExtensionsDiscovery extends Wizard
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
ui_require_javascript_file('select2.min');
|
||||
ui_require_javascript_file('extensions_discovery');
|
||||
$_iniFile = $this->loadIni();
|
||||
if ($_iniFile === false) {
|
||||
|
|
|
@ -38,6 +38,62 @@ require_once $config['homedir'].'/include/class/HTML.class.php';
|
|||
class ExternalTools extends HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Origin
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $origin;
|
||||
|
||||
/**
|
||||
* PathCustomComm
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathCustomComm;
|
||||
|
||||
/**
|
||||
* PathDig
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathDig;
|
||||
|
||||
/**
|
||||
* PathNmap
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathNmap;
|
||||
|
||||
/**
|
||||
* PathPing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathPing;
|
||||
|
||||
/**
|
||||
* PathSnmpget
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathSnmpget;
|
||||
|
||||
/**
|
||||
* PathTraceroute
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $pathTraceroute;
|
||||
|
||||
/**
|
||||
* UpdatePaths
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $updatePaths;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -706,7 +706,7 @@ class NetworkMap
|
|||
*/
|
||||
public function setNodes($nodes)
|
||||
{
|
||||
$this->nodes = $nodes;
|
||||
$this->nodes = (array) $nodes;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,13 @@ class OrderInterpreter extends Wizard
|
|||
*/
|
||||
public $ajaxController;
|
||||
|
||||
/**
|
||||
* Pages menu
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $pages_menu;
|
||||
|
||||
|
||||
/**
|
||||
* Generates a JSON error.
|
||||
|
|
|
@ -67,6 +67,34 @@ class SatelliteAgent extends HTML
|
|||
*/
|
||||
private $ajaxController;
|
||||
|
||||
/**
|
||||
* Satellite_name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $satellite_name;
|
||||
|
||||
/**
|
||||
* Satellite_server
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $satellite_server;
|
||||
|
||||
/**
|
||||
* TableId
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $tableId;
|
||||
|
||||
/**
|
||||
* Satellite_config
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $satellite_config;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
|
|
|
@ -1257,8 +1257,8 @@ class WelcomeWindow extends Wizard
|
|||
draggable: true,
|
||||
modal: true,
|
||||
close: false,
|
||||
height: 375,
|
||||
width: 480,
|
||||
height: 400,
|
||||
width: 500,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
|
@ -1274,7 +1274,7 @@ class WelcomeWindow extends Wizard
|
|||
draggable: true,
|
||||
modal: true,
|
||||
close: false,
|
||||
height: 265,
|
||||
height: 300,
|
||||
width: 480,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC240125';
|
||||
$build_version = 'PC240213';
|
||||
$pandora_version = 'v7.0NG.775';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -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;
|
||||
|
@ -2925,6 +2917,10 @@ function delete_dir($dir)
|
|||
*/
|
||||
function is_image_data($data)
|
||||
{
|
||||
if (isset($data) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (substr($data, 0, 10) == 'data:image');
|
||||
}
|
||||
|
||||
|
@ -2947,7 +2943,7 @@ function is_snapshot_data($data)
|
|||
*/
|
||||
function is_text_to_black_string($data)
|
||||
{
|
||||
if (is_image_data($data)) {
|
||||
if (isset($data) === false || is_image_data($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -541,7 +541,7 @@ function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db)
|
|||
}
|
||||
|
||||
|
||||
function api_get_agent_module_name_last_value($agentName, $moduleName, $other=';', $returnType)
|
||||
function api_get_agent_module_name_last_value($agentName, $moduleName, $other=';', $returnType='string')
|
||||
{
|
||||
$idAgent = agents_get_agent_id($agentName);
|
||||
|
||||
|
@ -558,7 +558,7 @@ function api_get_agent_module_name_last_value($agentName, $moduleName, $other=';
|
|||
}
|
||||
|
||||
|
||||
function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other=';', $returnType)
|
||||
function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other=';', $returnType='string')
|
||||
{
|
||||
$sql = sprintf(
|
||||
'SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
|
||||
|
@ -573,7 +573,7 @@ function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other=
|
|||
}
|
||||
|
||||
|
||||
function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnType)
|
||||
function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnType='string')
|
||||
{
|
||||
global $config;
|
||||
if (defined('METACONSOLE')) {
|
||||
|
@ -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()) {
|
||||
|
@ -3685,6 +3683,7 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
|
|||
'warning_inverse' => $other['data'][29],
|
||||
'ff_type' => $other['data'][30],
|
||||
'ignore_unknown' => $other['data'][32],
|
||||
'warning_time' => $other['data'][33],
|
||||
];
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
|
@ -3850,6 +3849,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3)
|
|||
'policy_linked',
|
||||
'ff_type',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -3964,6 +3964,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
|
|||
'warning_inverse' => $other['data'][34],
|
||||
'ff_type' => $other['data'][35],
|
||||
'ignore_unknown' => $other['data'][37],
|
||||
'warning_time' => $other['data'][38],
|
||||
];
|
||||
|
||||
$plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
|
||||
|
@ -4126,6 +4127,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
|
|||
'policy_linked',
|
||||
'ff_type',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -4253,6 +4255,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
|
|||
'warning_inverse' => $other['data'][25],
|
||||
'ff_type' => $other['data'][26],
|
||||
'ignore_unknown' => $other['data'][27],
|
||||
'warning_time' => $other['data'][28],
|
||||
];
|
||||
|
||||
if (! $values['descripcion']) {
|
||||
|
@ -4776,6 +4779,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
|
|||
'policy_linked',
|
||||
'ff_type',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
@ -4917,6 +4921,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_critical' => $other['data'][33],
|
||||
'ff_type' => $other['data'][34],
|
||||
'ignore_unknown' => $other['data'][36],
|
||||
'warning_time' => $other['data'][37],
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
|
@ -4950,6 +4955,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
|
|||
'min_ff_event_critical' => $other['data'][27],
|
||||
'ff_type' => $other['data'][28],
|
||||
'ignore_unknown' => $other['data'][29],
|
||||
'warning_time' => $other['data'][30],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -5119,6 +5125,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
'policy_linked',
|
||||
'ff_type',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
} else {
|
||||
$snmp_module_fields = [
|
||||
|
@ -5152,6 +5159,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
|
|||
'policy_linked',
|
||||
'ff_type',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -7273,8 +7281,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 +7343,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 +7434,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;
|
||||
|
@ -8000,6 +8002,7 @@ function api_set_update_data_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'disabled_types_event',
|
||||
'module_macros',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$cont = 0;
|
||||
|
@ -8242,6 +8245,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'disabled_types_event',
|
||||
'module_macros',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$cont = 0;
|
||||
|
@ -8486,6 +8490,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'macros',
|
||||
'module_macros',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
|
||||
$cont = 0;
|
||||
|
@ -8969,6 +8974,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'plugin_user',
|
||||
'plugin_pass',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
} else {
|
||||
$fields_snmp_module = [
|
||||
|
@ -8994,6 +9000,7 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
|
|||
'custom_id',
|
||||
'description',
|
||||
'ignore_unknown',
|
||||
'warning_time',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -12101,8 +12108,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 +12174,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 +12219,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 +12270,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 +12315,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 +12366,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 +12444,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 +13177,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 +13606,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 +13690,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 +16797,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 +16871,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 +16945,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 +17029,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 +17086,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;
|
||||
|
|
|
@ -6468,10 +6468,10 @@ function event_print_graph(
|
|||
$color[] = '#82b92f';
|
||||
}
|
||||
} else {
|
||||
$interval_length = 0;
|
||||
|
||||
if ($num_intervals > 0) {
|
||||
$interval_length = (int) ($period / $num_intervals);
|
||||
} else {
|
||||
$interval_length = 0;
|
||||
}
|
||||
|
||||
$intervals = [];
|
||||
|
|
|
@ -440,7 +440,7 @@ function extensions_add_operation_menu_option($name, $fatherId=null, $icon=null,
|
|||
$option_menu['acl'] = $acl;
|
||||
$extension = &$config['extensions'][$extension_file];
|
||||
|
||||
$option_menu['sec2'] = $extension['dir'].'/'.mb_substr($extension_file, 0, -4);
|
||||
$option_menu['sec2'] = $extension['dir'].'/'.mb_substr(($extension_file ?? ''), 0, -4);
|
||||
$option_menu['fatherId'] = $fatherId;
|
||||
$option_menu['subfatherId'] = $subfatherId;
|
||||
$option_menu['icon'] = $icon;
|
||||
|
|
|
@ -100,7 +100,7 @@ function forecast_projection_graph(
|
|||
|
||||
$data[0] = '';
|
||||
$data[1] = $cont;
|
||||
$data[2] = date($config['date_format'], $row[0]);
|
||||
$data[2] = date($config['date_format'], (int) $row[0]);
|
||||
$data[3] = $row[0];
|
||||
$data[4] = $row[1];
|
||||
$data[5] = ($row[0] * $row[1]);
|
||||
|
|
|
@ -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);
|
||||
|
@ -7695,3 +7691,52 @@ function html_print_wizard_diagnosis(
|
|||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print the modal window for the summary of each alerts group
|
||||
*
|
||||
* @param string $id Id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function print_email_test_modal_window($id)
|
||||
{
|
||||
// Email config table.
|
||||
$table_mail_test = new stdClass();
|
||||
$table_mail_test->width = '100%';
|
||||
$table_mail_test->class = 'filter-table-adv';
|
||||
$table_mail_test->data = [];
|
||||
$table_mail_test->data[0][] = html_print_label_input_block(
|
||||
__('Address'),
|
||||
html_print_input_text(
|
||||
'email_test_address',
|
||||
'',
|
||||
'',
|
||||
35,
|
||||
100,
|
||||
true
|
||||
)
|
||||
);
|
||||
$table_mail_test->data[1][] = '  <span id="email_test_sent_message" class="invisible"><b>Email sent</b></span><span id="email_test_failure_message" class=invisible"><b>Email could not be sent</b></span>';
|
||||
// $table_mail_test->colspan[2][0] = 2;
|
||||
$submitButton = html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons-right-forced',
|
||||
'content' => html_print_button(
|
||||
__('Send'),
|
||||
'email_test',
|
||||
false,
|
||||
'perform_email_test()',
|
||||
[
|
||||
'icon' => 'cog',
|
||||
'mode' => 'mini',
|
||||
],
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" class="invisible">'.html_print_table($table_mail_test, true).$submitButton.'</div>';
|
||||
}
|
||||
|
|
|
@ -82,11 +82,11 @@ function io_safe_input($value)
|
|||
return $value;
|
||||
}
|
||||
|
||||
if (! mb_check_encoding($value, 'UTF-8')) {
|
||||
if (isset($value) === true && !mb_check_encoding($value, 'UTF-8')) {
|
||||
$value = utf8_encode($value);
|
||||
}
|
||||
|
||||
$valueHtmlEncode = htmlentities($value, ENT_QUOTES, 'UTF-8', true);
|
||||
$valueHtmlEncode = htmlentities(($value ?? ''), ENT_QUOTES, 'UTF-8', true);
|
||||
|
||||
// Replace the character '\' for the equivalent html entitie
|
||||
$valueHtmlEncode = str_replace('\\', '\', $valueHtmlEncode);
|
||||
|
@ -561,10 +561,8 @@ function io_output_password($password, $wrappedBy='')
|
|||
]
|
||||
);
|
||||
|
||||
$output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
|
||||
|
||||
// If password already decrypt return same password.
|
||||
$output = (empty($plaintext) === true) ? $password : $plaintext;
|
||||
$output = (empty($plaintext) === true || $plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
|
||||
|
||||
return sprintf(
|
||||
'%s%s%s',
|
||||
|
|
|
@ -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') {
|
||||
|
@ -1228,6 +1230,22 @@ if (is_ajax()) {
|
|||
<p style="font-size: 10pt;">'.$php_sys->data->memoryLimit->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->postMaxSize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->postMaxSize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->uploadMaxFilesize->name.'</span></p>
|
||||
</th>
|
||||
<th style="width: 65%;">
|
||||
<p style="font-size: 10pt;">'.$php_sys->data->uploadMaxFilesize->value.'</p>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 35%;">
|
||||
<p><span>'.$php_sys->data->sessionLifetime->name.'</span></p>
|
||||
|
|
|
@ -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 = [
|
||||
|
@ -2293,3 +2404,50 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advan
|
|||
array_merge($relations, $orphan_hosts)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run whois command and return all results as array.
|
||||
*
|
||||
* @param integer $ip Ip for search info with command whois.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function command_whois($ip)
|
||||
{
|
||||
$command = 'whois '.$ip;
|
||||
$result = '';
|
||||
exec($command, $result);
|
||||
if (empty($result) === false && is_array($result) === true) {
|
||||
$resultArray = parse_whois_output($result);
|
||||
} else {
|
||||
$resultArray = [];
|
||||
}
|
||||
|
||||
return $resultArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse the result of command whois to array.
|
||||
*
|
||||
* @param array $lines Lines result of command whois.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function parse_whois_output($lines)
|
||||
{
|
||||
$resultArray = [];
|
||||
if (is_array($lines) === true) {
|
||||
foreach ($lines as $line) {
|
||||
$parts = explode(':', $line, 2);
|
||||
if (count($parts) === 2 && strpos($line, '#') !== 0) {
|
||||
$key = trim($parts[0]);
|
||||
$value = trim($parts[1]);
|
||||
$resultArray[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $resultArray;
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ function notifications_get_subtypes(?string $source=null)
|
|||
'NOTIF.PHP.INPUT_TIME',
|
||||
'NOTIF.PHP.EXECUTION_TIME',
|
||||
'NOTIF.PHP.UPLOAD_MAX_FILESIZE',
|
||||
'NOTIF.PHP.POST_MAX_SIZE',
|
||||
'NOTIF.PHP.MEMORY_LIMIT',
|
||||
'NOTIF.PHP.DISABLE_FUNCTIONS',
|
||||
'NOTIF.PHP.CHROMIUM',
|
||||
|
@ -818,7 +819,7 @@ function notifications_print_global_source_configuration($source)
|
|||
|
||||
$html_checkboxes = '';
|
||||
|
||||
$blacklist = json_decode($source['subtype_blacklist'], 1);
|
||||
$blacklist = json_decode(($source['subtype_blacklist'] ?? ''), 1);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$blacklist = [];
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c
|
|||
$profile = json_decode($profile);
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$result[] = [
|
||||
'id_grupo' => $profile->group,
|
||||
'id_perfil' => $profile->profile,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1039,7 +1039,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
echo "
|
||||
<script>
|
||||
function sendHash(url) {
|
||||
window.open(url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13($user)."', '_blank');
|
||||
window.open(url+'&loginhash=auto&loginhash_data=".$hashdata.'&loginhash_user='.str_rot13(($user ?? ''))."', '_blank');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ function ui_print_truncate_text(
|
|||
$text_html_decoded = io_safe_output($text);
|
||||
$text_has_entities = $text != $text_html_decoded;
|
||||
|
||||
if (mb_strlen($text_html_decoded, 'UTF-8') > ($numChars)) {
|
||||
if (isset($text_html_decoded) === true && mb_strlen($text_html_decoded, 'UTF-8') > ($numChars)) {
|
||||
// '/2' because [...] is in the middle of the word.
|
||||
$half_length = intval(($numChars - 3) / 2);
|
||||
|
||||
|
@ -969,15 +969,27 @@ function ui_print_os_icon(
|
|||
$options['title'] = $os_name;
|
||||
}
|
||||
|
||||
$output = html_print_image(
|
||||
'images/'.$subfolder.'/'.$icon,
|
||||
true,
|
||||
$options,
|
||||
false,
|
||||
$relative,
|
||||
$no_in_meta,
|
||||
true
|
||||
);
|
||||
if ($icon === '.png') {
|
||||
$output = html_print_image(
|
||||
'images/os@svg.svg',
|
||||
true,
|
||||
$options,
|
||||
false,
|
||||
$relative,
|
||||
$no_in_meta,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$output = html_print_image(
|
||||
'images/'.$subfolder.'/'.$icon,
|
||||
true,
|
||||
$options,
|
||||
false,
|
||||
$relative,
|
||||
$no_in_meta,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// $output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>";
|
||||
|
@ -4261,15 +4273,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>';
|
||||
|
||||
|
|
|
@ -98,25 +98,6 @@ function update_manager_get_current_package()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a trial license is in use.
|
||||
*
|
||||
* @return boolean true if a trial license is in use, false otherwise.
|
||||
*/
|
||||
function update_manager_verify_trial()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['license_licensed_to'])
|
||||
&& strstr($config['license_licensed_to'], 'info@pandorafms.com') !== false
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if there are packages available to be installed.
|
||||
*
|
||||
|
|
|
@ -3791,7 +3791,7 @@ function visual_map_get_user_layouts(
|
|||
$retval = [];
|
||||
foreach ($layouts as $layout) {
|
||||
if ($only_names) {
|
||||
$retval[$layout['id']] = $layout['name'];
|
||||
$retval[$layout['id']] = io_safe_output($layout['name']);
|
||||
} else {
|
||||
$retval[$layout['id']] = $layout;
|
||||
}
|
||||
|
|
|
@ -301,6 +301,13 @@ function gd_progress_bubble($width, $height, $progress, $title, $font, $out_of_l
|
|||
|
||||
function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color)
|
||||
{
|
||||
$x1 = (int) $x1;
|
||||
$y1 = (int) $y1;
|
||||
$x2 = (int) $x2;
|
||||
$y2 = (int) $y2;
|
||||
$radius = (int) $radius;
|
||||
$color = (int) $color;
|
||||
|
||||
// Draw rectangle without corners
|
||||
imagefilledrectangle($im, ($x1 + $radius), $y1, ($x2 - $radius), $y2, $color);
|
||||
imagefilledrectangle($im, $x1, ($y1 + $radius), $x2, ($y2 - $radius), $color);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global $ */
|
||||
|
||||
var dt = dt;
|
||||
var config = config;
|
||||
|
||||
|
@ -66,6 +68,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;
|
||||
|
@ -136,6 +143,8 @@ if (dt.no_move_elements_to_action === true) {
|
|||
noMoveElementsToAction = true;
|
||||
}
|
||||
|
||||
var showAlwaysPagination = false;
|
||||
|
||||
$(document).ready(function() {
|
||||
function checkPages() {
|
||||
if (dt_table.page.info().pages > 1) {
|
||||
|
@ -248,7 +257,11 @@ $(document).ready(function() {
|
|||
$("div.pagination-child-div").hide();
|
||||
$("div.dataTables_info").hide();
|
||||
$(`#${dt.id}_wrapper`).hide();
|
||||
$(`.action_buttons_right_content .pagination-child-div`).hide();
|
||||
if (showAlwaysPagination) {
|
||||
$(`.action_buttons_right_content .pagination-child-div`).show();
|
||||
} else {
|
||||
$(`.action_buttons_right_content .pagination-child-div`).hide();
|
||||
}
|
||||
} else {
|
||||
$(`.datatable-msg-info-${dt.id}`).hide();
|
||||
$(`table#${dt.id}`).show();
|
||||
|
@ -278,6 +291,12 @@ $(document).ready(function() {
|
|||
$(`#${dt.form_id}_loading`).remove();
|
||||
}
|
||||
|
||||
if (json.showAlwaysPagination) {
|
||||
showAlwaysPagination = true;
|
||||
} else {
|
||||
showAlwaysPagination = false;
|
||||
}
|
||||
|
||||
if (json.error) {
|
||||
console.error(json.error);
|
||||
$(`#error-${dt.id}`).html(json.error);
|
||||
|
|
|
@ -4,7 +4,7 @@ $(document).ready(() => {
|
|||
$("#_credentials_").select2({
|
||||
closeOnSelect: true
|
||||
});
|
||||
|
||||
var interval;
|
||||
if (interval === "0") {
|
||||
setTimeout(() => {
|
||||
$("#mode_interval")
|
||||
|
|
|
@ -2621,3 +2621,60 @@ function christmas_click(flagEasternEgg) {
|
|||
}, 120000);
|
||||
}
|
||||
}
|
||||
|
||||
function perform_email_test() {
|
||||
$("#email_test_sent_message").hide();
|
||||
$("#email_test_failure_message").hide();
|
||||
|
||||
var test_address = $("#text-email_test_address").val();
|
||||
var params = {
|
||||
email_smtpServer: $("#text-email_smtpServer").val(),
|
||||
email_smtpPort: $("#text-email_smtpPort").val(),
|
||||
email_username: $("#text-email_username").val(),
|
||||
email_password: $("#password-email_password").val(),
|
||||
email_encryption: $("#email_encryption option:selected").val(),
|
||||
email_from_dir: $("#text-email_from_dir").val(),
|
||||
email_from_name: $("#text-email_from_name").val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "godmode/setup/setup_general",
|
||||
test_address: test_address,
|
||||
params: params
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (parseInt(data) === 1) {
|
||||
$("#email_test_sent_message").show();
|
||||
$("#email_test_failure_message").hide();
|
||||
} else {
|
||||
console.log($("#email_test_failure_message"));
|
||||
$("#email_test_failure_message").show();
|
||||
$("#email_test_sent_message").hide();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$("#email_test_failure_message").show();
|
||||
$("#email_test_sent_message").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function show_email_test(id) {
|
||||
$("#email_test_sent_message").hide();
|
||||
$("#email_test_failure_message").hide();
|
||||
|
||||
$("#email_test_" + id).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 450,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1261,6 +1261,10 @@ function action_events_sound(mode, settings) {
|
|||
$("#button-start-search")
|
||||
.removeClass("play")
|
||||
.addClass("stop");
|
||||
$("#button-start-search")
|
||||
.find("div")
|
||||
.removeClass("play")
|
||||
.addClass("stop");
|
||||
// Change value button.
|
||||
$("#button-start-search").val(settings.stop);
|
||||
$("#button-start-search > span").text(settings.stop);
|
||||
|
@ -1277,6 +1281,10 @@ function action_events_sound(mode, settings) {
|
|||
$("#button-start-search")
|
||||
.removeClass("stop")
|
||||
.addClass("play");
|
||||
$("#button-start-search")
|
||||
.find("div")
|
||||
.removeClass("stop")
|
||||
.addClass("play");
|
||||
// Change value button.
|
||||
$("#button-start-search").val(settings.start);
|
||||
$("#button-start-search > span").text(settings.start);
|
||||
|
@ -1601,9 +1609,7 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
|||
|
||||
// Add the minimize icon to the minimize button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon",
|
||||
style:
|
||||
"background-color: rgb(51, 51, 51); -webkit-mask: url('images/arrow-down-white.png') no-repeat / contain !important;"
|
||||
class: "ui-button-icon ui-icon"
|
||||
}).appendTo(minimizeButton);
|
||||
|
||||
$("<span>", {
|
||||
|
@ -1617,23 +1623,9 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
|||
class:
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage disengage-buttom-image",
|
||||
type: "button",
|
||||
title: "Disengage",
|
||||
style: "float: right; position:relative;"
|
||||
title: "Disengage"
|
||||
}).insertBefore(minimizeButton);
|
||||
|
||||
// Add the disengage icon to the disengage button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon",
|
||||
style:
|
||||
"background-color: rgb(51, 51, 51); -webkit-mask: url('images/dashboard.menu.png') no-repeat center / contain !important;"
|
||||
}).appendTo(disengageButton);
|
||||
|
||||
$("<span>", {
|
||||
class: "ui-button-icon-space"
|
||||
})
|
||||
.html(" ")
|
||||
.appendTo(disengageButton);
|
||||
|
||||
minimizeButton.click(function(e) {
|
||||
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
|
||||
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
|
||||
|
|
|
@ -82,6 +82,7 @@ function removeInputImage(e) {
|
|||
}
|
||||
}
|
||||
function render({ title, text, url, files, method }) {
|
||||
var positionButtonsBefore = $(".ui-dialog-buttonset").offset().top;
|
||||
$("#title_tip").html(title);
|
||||
$("#text_tip").html(text);
|
||||
if (url) {
|
||||
|
@ -123,6 +124,7 @@ function render({ title, text, url, files, method }) {
|
|||
}
|
||||
});
|
||||
activeCarousel();
|
||||
checkPositionButtons(positionButtonsBefore);
|
||||
}
|
||||
|
||||
function close_dialog() {
|
||||
|
@ -429,3 +431,20 @@ function validateImages() {
|
|||
});
|
||||
return validate;
|
||||
}
|
||||
|
||||
function checkPositionButtons(positionButtonsBefore) {
|
||||
// posicion actual botones
|
||||
var buttonsNow = $(".ui-dialog-buttonset").offset().top;
|
||||
// Position of dialog
|
||||
var dialogPosition = $(".dialog_tips").position().top;
|
||||
var positionFinal;
|
||||
if (positionButtonsBefore > buttonsNow) {
|
||||
positionFinal = dialogPosition + (positionButtonsBefore - buttonsNow);
|
||||
positionFinal = positionFinal < 0 ? "100" : positionFinal;
|
||||
$(".dialog_tips").css("top", positionFinal);
|
||||
} else if (positionButtonsBefore < buttonsNow) {
|
||||
positionFinal = dialogPosition - (buttonsNow - positionButtonsBefore);
|
||||
positionFinal = positionFinal < 0 ? "100" : positionFinal;
|
||||
$(".dialog_tips").css("top", positionFinal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,13 @@ class ClusterWizard extends \HTML
|
|||
*/
|
||||
private $agent;
|
||||
|
||||
/**
|
||||
* Id of clusters.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $id;
|
||||
|
||||
|
||||
/**
|
||||
* Builds a Cluster Wizard.
|
||||
|
|
|
@ -167,6 +167,20 @@ class Manager implements PublicLogin
|
|||
*/
|
||||
private $duplicateCellId;
|
||||
|
||||
/**
|
||||
* Url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Widget
|
||||
*
|
||||
* @var Widget
|
||||
*/
|
||||
public $cWidget;
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
|
@ -311,6 +325,15 @@ class Manager implements PublicLogin
|
|||
|
||||
if ($this->dashboardId !== 0) {
|
||||
$this->dashboardFields = $this->get();
|
||||
if ($this->deleteDashboard === false && is_array($this->dashboardFields) === true && count($this->dashboardFields) === 0) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_HACK_ATTEMPT,
|
||||
'Trying to access to dashboard that not exist'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->cells = Cell::getCells($this->dashboardId);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,27 @@ class Widget
|
|||
*/
|
||||
private $dateTo;
|
||||
|
||||
/**
|
||||
* Data cell
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $dataCell;
|
||||
|
||||
/**
|
||||
* Overflow scrollbar.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $overflow_scrollbars;
|
||||
|
||||
/**
|
||||
* Position
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $position;
|
||||
|
||||
|
||||
/**
|
||||
* Contructor widget.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue