Merge remote-tracking branch 'origin/develop' into ent-11125-pandora-security-monitoring-vulnerability-scanner

This commit is contained in:
Ramon Novoa 2023-11-10 09:53:17 +01:00
commit 8ec1432414
130 changed files with 2708 additions and 1415 deletions

View File

@ -1,6 +1,6 @@
Source: pandora_gotty Source: pandora_gotty
Section: utils Section: utils
Version: 1.0.0 Version: 1.1.0
Priority: optional Priority: optional
Maintainer: PandoraFMS Maintainer: PandoraFMS
Build-Depends: debhelper (>= 12) Build-Depends: debhelper (>= 12)

View File

@ -1,5 +1,5 @@
%define name pandora_gotty %define name pandora_gotty
%define version 1.0 %define version 1.1
%define release 1%{?dist} %define release 1%{?dist}
Summary: pandora_gptty for Pandora FMS Summary: pandora_gptty for Pandora FMS
Name: %{name} Name: %{name}

View File

@ -74,7 +74,7 @@ def exec_ssh (user:str, add:str, port:int):
try: try:
print("> Starting SSH connection...") print("> Starting SSH connection...")
ssh_command = f"ssh {user}@{add} -p {port}" ssh_command = f"ssh {user}@{add} -p {port}"
subprocess.run(ssh_command, shell=True) subprocess.run(ssh_command, shell=True, encoding='utf-8', text=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
raise SystemExit(e) raise SystemExit(e)
@ -88,7 +88,7 @@ def exec_telnet (add:str, port:int):
try: try:
print("> Starting Telnet connection...") print("> Starting Telnet connection...")
ssh_command = f"telnet -E {add} {port}" ssh_command = f"telnet -E {add} {port}"
subprocess.run(ssh_command, shell=True) subprocess.run(ssh_command, shell=True, encoding='utf-8', text=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
raise SystemExit(e) raise SystemExit(e)

View File

@ -22,13 +22,16 @@ else
fi fi
SPEC_FILES="$CODEHOME/pandora_console/pandora_console.spec \ SPEC_FILES="$CODEHOME/pandora_console/pandora_console.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
$CODEHOME/pandora_server/pandora_server.spec \ $CODEHOME/pandora_server/pandora_server.spec \
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \
$CODEHOME/pandora_console/pandora_console.redhat.spec \ $CODEHOME/pandora_console/pandora_console.redhat.spec \
$CODEHOME/pandora_console/pandora_console.rhel7.spec \ $CODEHOME/pandora_console/pandora_console.rhel7.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat_bin.spec \
$CODEHOME/pandora_server/pandora_server.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \
$PANDHOME_ENT/pandora_agents/pandora_agent.spec \ $PANDHOME_ENT/pandora_agents/pandora_agent.spec \
$PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \ $PANDHOME_ENT/pandora_server/pandora_server_enterprise.redhat.spec \

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, FreeBSD Version # Version 7.0NG.774, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, HP-UX Version # Version 7.0NG.774, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, Solaris Version # Version 7.0NG.774, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS # (c) 2006-2023 Pandora FMS
# Version 7.0NG.773.3 # Version 7.0NG.774
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version

View File

@ -54,7 +54,6 @@ if (!$@) {
use constant AGENT_VERSION => '4.0.1'; use constant AGENT_VERSION => '4.0.1';
use constant AGENT_BUILD => '111213'; use constant AGENT_BUILD => '111213';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {
linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'', linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'',
@ -117,7 +116,6 @@ my $ConfDir = '';
# Pandora FMS agent configuration file # Pandora FMS agent configuration file
my $ConfFile = 'pandora_agent.conf'; my $ConfFile = 'pandora_agent.conf';
# Broker agent configuration files # Broker agent configuration files
my @BrokerPid; my @BrokerPid;
@ -264,7 +262,6 @@ sub valid_regexp ($) {
sub rmrf { sub rmrf {
my $path = shift; my $path = shift;
local *DIR; local *DIR;
if (-d $path) { if (-d $path) {
opendir (DIR, $path) || return; opendir (DIR, $path) || return;
while (defined (my $file_name = readdir(DIR))) { while (defined (my $file_name = readdir(DIR))) {
@ -348,7 +345,6 @@ sub log_message ($$;$) {
} }
} }
} }
################################################################################ ################################################################################
# Add the given directory to the PATH. # Add the given directory to the PATH.
################################################################################ ################################################################################
@ -582,7 +578,6 @@ sub write_broker_conf($){
} }
while (my $line = <CONF_FILE>){ while (my $line = <CONF_FILE>){
# Skip broker definitions # Skip broker definitions
if ($line =~ m/^\s*broker_agent/) { if ($line =~ m/^\s*broker_agent/) {
next; next;
@ -1810,7 +1805,6 @@ sub exec_plugin ($) {
$Sem->down () if (defined ($Sem)); $Sem->down () if (defined ($Sem));
$Xml .= $output; $Xml .= $output;
$Sem->up () if (defined ($Sem)); $Sem->up () if (defined ($Sem));
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1); $ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
} }
@ -2287,4 +2281,4 @@ This is released under the GNU Lesser General Public License.
Copyright (c) 2005-2023 Pandora FMS Copyright (c) 2005-2023 Pandora FMS
=cut =cut

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3 # Version 7.0NG.774
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS # (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3 # Version 7.0NG.774
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2023 Pandora FMS # (c) 2003-2023 Pandora FMS
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.773.3-231024 Version: 7.0NG.774-231110
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false"> <choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/> <pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.773.3" onConclusion="none">pandorafms_src.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.774" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications"> <choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/> <pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice> </choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.773.3" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref> <pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.774" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" /> <!-- <installation-check script="check()" />
<script> <script>
<![CDATA[ <![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string> <key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string> <key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.773.3</string> <key>CFBundleVersion</key> <string>7.0NG.774</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.773.3 Pandora FMS on Aug 2020</string> <key>CFBundleGetInfoString</key> <string>7.0NG.774 Pandora FMS on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.773.3</string> <key>CFBundleShortVersionString</key> <string>7.0NG.774</string>
<key>NSPrincipalClass</key><string>NSApplication</string> <key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string> <key>NSMainNibFile</key><string>MainMenu</string>

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, FreeBSD Version # Version 7.0NG.774, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, HP-UX Version # Version 7.0NG.774, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3 # Version 7.0NG.774
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2004-2023 Pandora FMS # Copyright (c) 2004-2023 Pandora FMS
# https://pandorafms.com # https://pandorafms.com
@ -313,6 +313,15 @@ module_plugin autodiscover --default
#Hardening plugin for security compliance analysis. Enable to use it. #Hardening plugin for security compliance analysis. Enable to use it.
#module_begin #module_begin
#module_plugin /usr/share/pandora_agent/plugins/pandora_sca -t 150 #module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
#module_absoluteinterval 7d #module_absoluteinterval 7d
#module_end #module_end
# Logs extraction
#module_begin
#module_name Syslog
#module_description Logs extraction module
#module_type log
#module_regexp /var/log/logfile.log
#module_pattern .*
#module_end

View File

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

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, NetBSD Version # Version 7.0NG.774, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.773.3, Solaris Version # Version 7.0NG.774, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2023 Pandora FMS # Copyright (c) 2003-2023 Pandora FMS
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -39,6 +39,14 @@ BEGIN {
use File::Copy; use File::Copy;
use Scalar::Util qw(looks_like_number); use Scalar::Util qw(looks_like_number);
use File::Basename;
BEGIN {
eval {
require MIME::Base64;
};
}
BEGIN { push @INC, '/usr/lib/perl5'; } BEGIN { push @INC, '/usr/lib/perl5'; }
################################################################################ ################################################################################
@ -1030,8 +1038,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3'; use constant AGENT_VERSION => '7.0NG.774';
use constant AGENT_BUILD => '231024'; use constant AGENT_BUILD => '231110';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1562,6 +1570,9 @@ sub parse_conf_modules($) {
} elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) { } elsif ($line =~ /^\s*module_occupiedpercentdisk\s+(.*)$/) {
$module->{'func'} = \&module_occupiedpercentdisk; $module->{'func'} = \&module_occupiedpercentdisk;
$module->{'params'} = $1; $module->{'params'} = $1;
}elsif ($line =~ /^\s*module_regexp\s+(.*)$/) {
$module->{'func'} = \&module_logger;
$module->{'params'} = $1;
} elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) {
$module->{'max'} = $1; $module->{'max'} = $1;
} elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) {
@ -1817,7 +1828,11 @@ sub parse_conf_modules($) {
# Macros # Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2; $module->{'macros'}{$1} = $2;
# Regexp
} }
elsif ($line =~ /^\s*module_pattern(\S+)\s+(.*)\s*$/) {
$module->{'filter'} = $1;
}
} }
return; return;
} }
@ -3663,6 +3678,11 @@ sub write_module_xml ($@) {
return; return;
} }
if ($module->{'func'} == \&module_logger) {
$Xml .= $data[0];
return
}
# Critical section # Critical section
$Sem->down () if (defined ($Sem)); $Sem->down () if (defined ($Sem));
@ -3860,6 +3880,237 @@ sub module_plugin ($) {
return ($output); return ($output);
} }
################################################################################
# Read the logs
################################################################################
sub module_logger ($) {
my $module = shift;
my $status = grep_logs(
$module->{'name'},
$module->{'params'},
$module->{'filter'}
);
return $status;
}
my $encode_sub = defined(&MIME::Base64::encode_base64) ? \&MIME::Base64::encode_base64 : sub {
my ($str, $endl) = @_;
my @ALPHABET = ('A'..'Z', 'a'..'z', 0..9, '+', '/');
my $str_len = length($str);
my $str_base64 = '';
for (my $i = 0; $i < $str_len; $i += 3) {
my $chunk = substr($str, $i, 3);
my $chunk_len = length($chunk);
my $num = 0;
$num |= ord(substr($chunk, 0, 1)) << 16 if ($chunk_len >= 1);
$num |= ord(substr($chunk, 1, 1)) << 8 if ($chunk_len >= 2);
$num |= ord(substr($chunk, 2, 1)) if ($chunk_len == 3);
my $enc_1 = ($num & 0xfc0000) >> 18;
my $enc_2 = ($num & 0x03f000) >> 12;
my $enc_3 = ($num & 0x000fc0) >> 6;
my $enc_4 = ($num & 0x00003f);
$str_base64 .= $ALPHABET[$enc_1];
$str_base64 .= $ALPHABET[$enc_2];
$str_base64 .= $chunk_len >= 2 ? $ALPHABET[$enc_3] : '=';
$str_base64 .= $chunk_len == 3 ? $ALPHABET[$enc_4] : '=';
}
return $str_base64;
};
sub grep_logs {
my ($str_name, $str_file, $str_regex) = @_;
if(!$str_name){
log_message("module_logger", "Missing module name");
return;
}
if(!$str_file){
log_message("module_logger", "Missing file name");
return;
}
if(!$str_regex){
$str_regex = '.*';
}
my $idx_dir = '/tmp/';
my $idx_file = '';
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) {
log_message("module_logger", "File $log_file does not exist");
return;
}
# Create index file storage directory
if (! -d $idx_dir) {
if (!mkdir($idx_dir)){
log_message("module_logger", "Error creating directory $idx_dir: " . $!);
return;
}
}
# Create index file if it does not exist
$idx_file = $idx_dir.$module_name."_".basename($log_file).".idx";
if (! -e $idx_file) {
return if create_idx(\$idx_pos, \$idx_ino, \$idx_file, \$log_file, \$idx_size) == 1;
return
} else{
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);
return $output;
}
# Start the function definition
sub create_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $idx_size_ref) = @_;
my $first_line;
log_message("module_logger", "Creating index file $$idx_file_ref");
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: ".$!);
return 1;
}
# Go to EOF and save the position
seek(LOGFILE, 0, 2);
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the file inode number
$$idx_ino_ref = (stat($$log_file_ref))[1];
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return 0;
}
sub save_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
log_message("module_logger", "Saving index file $$idx_file_ref");
if (!open(IDXFILE, "> $$idx_file_ref")){
log_message("module_logger", "Error opening file $$idx_file_ref: ". $!);
return 1;
}
print (IDXFILE $$idx_pos_ref . " " . $$idx_ino_ref . " " . $$idx_size_ref);
close(IDXFILE);
return 0;
}
sub load_idx {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) = @_;
my $line;
my $current_ino;
my $current_size;
log_message("module_logger", "Loading index file $$idx_file_ref");
if (!open(IDXFILE, $$idx_file_ref)){
log_message("module_logger", "Error opening file $$idx_file_ref: " .$!);
return 1;
}
# Read position and date
$line = <IDXFILE>;
($$idx_pos_ref, $$idx_ino_ref, $$idx_size_ref) = split(' ', $line);
close(IDXFILE);
# Reset the file index if the file has changed
$current_ino = (stat($$idx_file_ref))[1];
$current_size = -s "$$idx_file_ref";
if ($current_ino != $$idx_ino_ref || $current_size < $$idx_size_ref) {
log_message("module_logger", "File changed, resetting index");
$$idx_pos_ref = 0;
$$idx_ino_ref = $current_ino;
}
$$idx_size_ref = $current_size;
return 0;
}
sub parse_log {
my ($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $log_file_ref, $module_name_ref, $reg_exp_ref, $idx_size_ref) = @_;
my $line;
log_message("module_logger", "Parsing log file $$log_file_ref");
# Open log file for reading
if (!open(LOGFILE, $$log_file_ref)){
log_message("module_logger", "Error opening file $$log_file_ref: " . $!);
return 1;
}
# Go to starting position.
seek(LOGFILE, $$idx_pos_ref, 0);
# Parse log file
my @data;
while ($line = <LOGFILE>) {
if ($line =~ m/$$reg_exp_ref/i) {
push (@data, $line);
}
}
$$idx_pos_ref = tell(LOGFILE);
close(LOGFILE);
# Save the index file
return 1 if save_idx($idx_pos_ref, $idx_ino_ref, $idx_file_ref, $idx_size_ref) == 1;
return @data;
}
sub create_log {
my ($module_name, @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";
return $output;
}
}
################################################################################ ################################################################################
# TERM Handler # TERM Handler
################################################################################ ################################################################################
@ -4030,6 +4281,8 @@ sub init_module ($) {
$module->{'module_ff_interval'} = undef; $module->{'module_ff_interval'} = undef;
$module->{'macros'} = {}; $module->{'macros'} = {};
$module->{'alert_template'} = undef; $module->{'alert_template'} = undef;
$module->{'filter'} = undef;
$module->{'absoluteinterval'} = undef;
} }
################################################################################ ################################################################################

View File

@ -3,8 +3,8 @@
# #
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 231024 %define release 231110
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 230919 %define release 231110
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 230919 %define release 231110
%define debug_package %{nil} %define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 231024 %define release 231110
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -3,8 +3,8 @@
# #
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.774
%define release 231024 %define release 231110
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2023 Pandora FMS # (c) 2006-2023 Pandora FMS
# Version 7.0NG.773.3 # Version 7.0NG.774
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence or any later version # Foundation; either version 2 of the Licence or any later version
@ -526,7 +526,15 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
# Hardening plugin for security compliance analysis. # Hardening plugin for security compliance analysis.
#module_begin #module_begin
#module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_sca.exe -t 150" #module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
#module_absoluteinterval 7d #module_absoluteinterval 7d
#module_end #module_end
# Logs extraction
#module_begin
#module_name X_Server_log
#module_description Logs extraction module
#module_type log
#module_regexp C:\server\logs\xserver.log
#module_pattern .*
#module_end

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773.3 Build 231024") #define PANDORA_VERSION ("7.0NG.774 Build 231110")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.773.3-231024 Version: 7.0NG.774-231110
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -223,6 +223,8 @@ function quickShell()
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch); $response = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
@ -541,6 +543,9 @@ if (is_ajax() === true) {
// Maximum time to establish a connection. // Maximum time to establish a connection.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_exec($ch); curl_exec($ch);
$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch); curl_close($ch);

View File

@ -1718,3 +1718,5 @@ operation/incidents/list_integriaims_incidents.php
include/functions_incidents.php include/functions_incidents.php
include/functions_integriaims.php include/functions_integriaims.php
include/ajax/integria_incidents.ajax.php include/ajax/integria_incidents.ajax.php
enterprise/operation/log/log_source.php
enterprise/include/class/LogSource.class.php

View File

@ -1,4 +1,4 @@
pandorafms.vmware=459175dce8ab811e874ce2e7216f0db4 pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
pandorafms.mssql=1cc215409741d19080269ffba112810e pandorafms.mssql=1cc215409741d19080269ffba112810e
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6 pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6

View File

@ -160,6 +160,9 @@ UPDATE tagente_modulo SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tpolicy_modules SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2'; UPDATE tnetwork_component SET `tcp_send` = '2c' WHERE `tcp_send` = '2';
ALTER TABLE tagente_modulo ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE tpolicy_modules ADD COLUMN `made_enabled` TINYINT UNSIGNED DEFAULT 0;
ALTER TABLE talert_templates ALTER TABLE talert_templates
ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'), ADD COLUMN `time_window` ENUM ('thirty_days','this_month','seven_days','this_week','one_day','today'),
ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'), ADD COLUMN `math_function` ENUM ('avg', 'min', 'max', 'sum'),
@ -15843,7 +15846,90 @@ SET @id_os = 9;
INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) INSERT INTO tmodule_inventory (`id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`)
SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp SELECT * FROM (SELECT @id_os id_os, @tmodule_name name, @tmodule_description description, '' interpreter, 'ID:STATUS' data_format, '' code, '0' block_mode, 2 script_mode) AS tmp
WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os); WHERE NOT EXISTS (SELECT name, description FROM tmodule_inventory WHERE name = @tmodule_name and description = @tmodule_description and id_os = @id_os);
INSERT INTO tmodule_group (name) SELECT ('Security') WHERE NOT EXISTS (SELECT name FROM tmodule_group WHERE LOWER(name) = 'security');
ALTER TABLE tagente_modulo ADD COLUMN `last_compact` TIMESTAMP NOT NULL DEFAULT 0;
UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_alert SET disabled=1 WHERE er.log_agent IS NOT NULL OR er.log_content IS NOT NULL OR er.log_source IS NOT NULL; UPDATE `tevent_alert` ea INNER JOIN `tevent_rule` er ON ea.id = er.id_event_alert SET disabled=1 WHERE er.log_agent IS NOT NULL OR er.log_content IS NOT NULL OR er.log_source IS NOT NULL;
ALTER TABLE `tnetwork_explorer_filter`
MODIFY COLUMN `id` INT NOT NULL AUTO_INCREMENT;
-- Add messaging alerts
SET @command_name = 'Pandora&#x20;Google&#x20;chat';
SET @action_name = 'Pandora&#x20;Google&#x20;chat';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-gchat-cli&#x20;-u&#x20;&quot;_field1_&quot;&#x20;-d&#x20;&quot;_field2_&quot;&#x20;-t&#x20;&quot;_field3_&quot;&#x20;-D&#x20;&quot;_field4_&quot;', 'Send&#x20;messages&#x20;using&#x20;Google&#x20;chat&#x20;API', 0, '["Google&#x20;chat&#x20;webhook&#x20;URL","Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Title","Description"]', '["","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "data=_data_", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "", "data=_data_", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Slack';
SET @action_name = 'Pandora&#x20;Slack';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-slack-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-d&#x20;&quot;_field1_&quot;&#x20;-c&#x20;&quot;_field2_&quot;&#x20;-e&#x20;&quot;_field3_&quot;&#x20;-T&#x20;&quot;_field4_&quot;&#x20;-D&#x20;&quot;_field5_&quot;', 'Send&#x20;messages&#x20;using&#x20;Slack&#x20;API', 0, '["Data&#x20;in&#x20;coma&#x20;separate&#x20;keypairs","Slack&#x20;channel&#x20;id/name","Title&#x20;emoji","Title","Description"]', '["","",":red_circle:,Red&#x20;circle;:green_circle:,Green&#x20;circle","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "data=_data_", "", ":red_circle:", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", 0, 0, "data=_data_", "", ":green_circle:", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Telegram';
SET @action_name = 'Pandora&#x20;Telegram';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora-telegram-cli&#x20;-t&#x20;&quot;TOKEN&quot;&#x20;-c&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;messages&#x20;using&#x20;Telegram&#x20;API', 0, '["Chat&#x20;ID","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;ilert';
SET @action_name = 'Pandora&#x20;ilert';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_ilert&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-t&#x20;&quot;_field1_&quot;&#x20;-k&#x20;&quot;_field2_&quot;&#x20;-T&#x20;&quot;_field3_&quot;&#x20;-d&#x20;&quot;_field4_&quot;&#x20;-A&#x20;&quot;_agentname_&quot;&#x20;-m&#x20;&quot;_module_&quot;&#x20;-p&#x20;&quot;_alert_text_severity_&quot;&#x20;-D&#x20;&quot;_data_&quot;&#x20;-C&#x20;&quot;_timestamp_&quot;', 'Send&#x20;SMS&#x20;using&#x20;ilert&#x20;API:&#x20;https://docs.ilert.com/integrations/pandorafms/', 0, '["Event&#x20;type","Event&#x20;title","Title","Description"]', '["alert,Alert;resolved,Resolved","","",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "alert", "", "[PANDORA] Alert FIRED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "", 0, 0, "resolved", "", "[PANDORA] Alert RECOVERED on _agent_ / _module_", "_agent_ | _module_ | _data_ | _timestamp_", "", "", "", "", "", "");
SET @command_name = 'Pandora&#x20;Vonage';
SET @action_name = 'Pandora&#x20;Vonage';
-- Get command ID in case it exists
SET @id_command = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
INSERT IGNORE INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@id_command, @command_name, '/usr/share/pandora_server/util/plugin/pandora_vonage&#x20;-a&#x20;&quot;API_KEY&quot;&#x20;-s&#x20;&quot;SECRET&quot;&#x20;-f&#x20;&quot;FROM_ALIAS&quot;&#x20;-n&#x20;&quot;_field1_&quot;&#x20;-m&#x20;&quot;_field2_&quot;', 'Send&#x20;SMS&#x20;using&#x20;Vonage&#x20;API:&#x20;https://www.vonage.com/communications-apis/sms/', 0, '["Phone&#x20;number","Message"]', '["",""]');
-- Get command ID again in case it has been created
SET @id_command = NULL;
SET @id_action = NULL;
SELECT @id_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
SELECT @id_action := `id` FROM `talert_actions` WHERE `name` = @action_name;
INSERT IGNORE INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES (@id_action, @action_name, @id_command, "", "[PANDORA] Alert FIRED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "", 0, 0, "", "[PANDORA] Alert RECOVERED on _agent_ / _module_ / _tiemstamp_ / _data_", "", "", "", "", "", "", "", "");
COMMIT; COMMIT;

View File

@ -1339,6 +1339,12 @@ if ($update_module === true || $create_module === true) {
*/ */
$post_process = (string) get_parameter('post_process', 0.0); $post_process = (string) get_parameter('post_process', 0.0);
if (modules_made_compatible($id_module_type) === true) {
$made_enabled = (bool) get_parameter_checkbox('made_enabled', 0);
} else {
$made_enabled = false;
}
$prediction_module = (int) get_parameter('prediction_module'); $prediction_module = (int) get_parameter('prediction_module');
$max_timeout = (int) get_parameter('max_timeout'); $max_timeout = (int) get_parameter('max_timeout');
$max_retries = (int) get_parameter('max_retries'); $max_retries = (int) get_parameter('max_retries');
@ -1361,6 +1367,14 @@ if ($update_module === true || $create_module === true) {
} }
$configuration_data = (string) get_parameter('configuration_data'); $configuration_data = (string) get_parameter('configuration_data');
$array_configuration_data = explode(PHP_EOL, io_safe_output($configuration_data));
$configuration_data = '';
foreach ($array_configuration_data as $value) {
$configuration_data .= trim($value).PHP_EOL;
}
$configuration_data = io_safe_input($configuration_data);
$old_configuration_data = (string) get_parameter('old_configuration_data'); $old_configuration_data = (string) get_parameter('old_configuration_data');
$new_configuration_data = ''; $new_configuration_data = '';
@ -1501,6 +1515,14 @@ if ($update_module === true || $create_module === true) {
} }
$plugin_parameter = (string) get_parameter('plugin_parameter'); $plugin_parameter = (string) get_parameter('plugin_parameter');
$array_plugin_parameter = explode(PHP_EOL, io_safe_output($plugin_parameter));
$plugin_parameter = '';
foreach ($array_plugin_parameter as $value) {
$plugin_parameter .= trim($value).PHP_EOL;
}
$plugin_parameter = io_safe_input($plugin_parameter);
} }
$parent_module_id = (int) get_parameter('parent_module_id'); $parent_module_id = (int) get_parameter('parent_module_id');
@ -1717,6 +1739,7 @@ if ($update_module) {
'plugin_parameter' => $plugin_parameter, 'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin, 'id_plugin' => $id_plugin,
'post_process' => $post_process, 'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module, 'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout, 'max_timeout' => $max_timeout,
'max_retries' => $max_retries, 'max_retries' => $max_retries,
@ -1915,6 +1938,7 @@ if ($create_module) {
'plugin_parameter' => $plugin_parameter, 'plugin_parameter' => $plugin_parameter,
'id_plugin' => $id_plugin, 'id_plugin' => $id_plugin,
'post_process' => $post_process, 'post_process' => $post_process,
'made_enabled' => $made_enabled,
'prediction_module' => $prediction_module, 'prediction_module' => $prediction_module,
'max_timeout' => $max_timeout, 'max_timeout' => $max_timeout,
'max_retries' => $max_retries, 'max_retries' => $max_retries,

View File

@ -294,6 +294,7 @@ if ($id_agent_module) {
$plugin_parameter = $module['plugin_parameter']; $plugin_parameter = $module['plugin_parameter'];
$id_plugin = $module['id_plugin']; $id_plugin = $module['id_plugin'];
$post_process = $module['post_process']; $post_process = $module['post_process'];
$made_enabled = $module['made_enabled'];
$prediction_module = $module['prediction_module']; $prediction_module = $module['prediction_module'];
$custom_integer_1 = $module['custom_integer_1']; $custom_integer_1 = $module['custom_integer_1'];
$custom_integer_2 = $module['custom_integer_2']; $custom_integer_2 = $module['custom_integer_2'];
@ -408,6 +409,7 @@ if ($id_agent_module) {
$id_module_group = 1; $id_module_group = 1;
$id_module_type = 1; $id_module_type = 1;
$post_process = ''; $post_process = '';
$made_enabled = false;
$max_timeout = 0; $max_timeout = 0;
$max_retries = 0; $max_retries = 0;
$min = ''; $min = '';

View File

@ -318,7 +318,7 @@ foreach ($texts as $code => $text) {
return; return;
} }
$(plugin_parameter).val('task_begin\ncookie 0\nresource 0\ntask_end'); $(plugin_parameter).val('task_begin\nget https://demoweb.com/page/\ncheck_string text string or HTML code to search (regexp)\ntask_end\n');
$('#button-btn_loadbasic').attr('disabled', 'disabled'); $('#button-btn_loadbasic').attr('disabled', 'disabled');

View File

@ -484,6 +484,7 @@ echo '</form>';
ui_require_javascript_file('pandora_alerts'); ui_require_javascript_file('pandora_alerts');
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/'); ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
ui_require_javascript_file('alert');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -500,194 +501,6 @@ $(document).ready (function () {
render_command_description(command_description); render_command_description(command_description);
} }
function ajax_get_integria_custom_fields(ticket_type_id, values, recovery_values) {
var values = values || [];
var recovery_values = recovery_values || [];
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
if (ticket_type_id === null || ticket_type_id === '' || (Array.isArray(values) && values.length === 0 && Array.isArray(recovery_values) && recovery_values.length === 0)) {
for (var i=8; i <= max_macro_fields; i++) {
$('[name=field'+i+'_value\\[\\]').val('');
$('[name=field'+i+'_recovery_value\\[\\]').val('');
}
}
// On ticket type change, hide all table rows and inputs corresponding to custom fields, regardless of what its type is.
for (var i=8; i <= max_macro_fields; i++) {
$('[name=field'+i+'_value\\[\\]').hide();
$('[name=field'+i+'_recovery_value\\[\\]').hide();
$('#table_macros-field'+i).hide();
$('[name=field'+i+'_value_container').hide();
$('[name=field'+i+'_recovery_value_container').hide();
}
jQuery.post(
"ajax.php",
{
page: "godmode/alerts/configure_alert_action",
get_integria_ticket_custom_types: 1,
ticket_type_id: ticket_type_id
},
function(data) {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
data.forEach(function(custom_field, key) {
var custom_field_key = key+8; // Custom fields start from field 8.
if (custom_field_key > max_macro_fields) {
return;
}
// Display field row for current input.
var custom_field_row = $('#table_macros-field'+custom_field_key);
custom_field_row.show();
// Replace label text of field row for current input.
var label_html = $('#table_macros-field'+custom_field_key+' td').first().html();
var label_name = label_html.split('<br>')[0];
var new_html_content = custom_field_row.html().replace(label_name, custom_field.label);
custom_field_row.html(new_html_content);
switch (custom_field.type) {
case 'CHECKBOX':
var checkbox_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]');
checkbox_selector.on('change', function() {
if (checkbox_selector.prop('checked')) {
checkbox_selector.attr('value', "1");
} else {
checkbox_selector.attr('value', "0");
}
});
checkbox_recovery_selector.on('change', function() {
if (checkbox_recovery_selector.prop('checked')) {
checkbox_recovery_selector.attr('value', "1");
} else {
checkbox_recovery_selector.attr('value', "0");
}
});
if (typeof values[key] !== "undefined") {
if (values[key] == 1) {
checkbox_selector.prop('checked', true);
checkbox_selector.attr('value', "1");
} else {
checkbox_selector.prop('checked', false);
checkbox_selector.attr('value', "0");
}
}
if (typeof recovery_values[key] !== "undefined") {
if (recovery_values[key] == 1) {
checkbox_recovery_selector.prop('checked', true);
checkbox_recovery_selector.attr('value', "1");
} else {
checkbox_recovery_selector.prop('checked', false);
checkbox_recovery_selector.attr('value', "0");
}
}
$('[name=field'+custom_field_key+'_value_container]').show();
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'COMBO':
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
var combo_input_recovery = $('select[name=field'+custom_field_key+'_recovery_value\\[\\]]');
combo_input.find('option').remove();
combo_input_recovery.find('option').remove();
var combo_values_array = custom_field.comboValue.split(',');
combo_values_array.forEach(function(value) {
combo_input.append($('<option>', {
value: value,
text: value
}));
combo_input_recovery.append($('<option>', {
value: value,
text: value
}));
});
if (typeof values[key] !== "undefined") {
combo_input.val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
combo_input_recovery.val(recovery_values[key]);
}
combo_input.show();
combo_input_recovery.show();
break;
case 'DATE':
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
if (typeof values[key] !== "undefined") {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
break;
case 'NUMERIC':
if (typeof values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXT':
if (typeof values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXTAREA':
default:
if (typeof values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').show();
$('textarea[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
}
});
},
"json"
);
}
$("#id_command").change (function () { $("#id_command").change (function () {
values = Array (); values = Array ();
// No se envia el valor del commando. // No se envia el valor del commando.
@ -914,12 +727,22 @@ $(document).ready (function () {
} }
if ($('#field5_value').val() !== '') { if ($('#field5_value').val() !== '') {
ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues); ajax_get_integria_custom_fields(
$('#field5_value').val(),
integria_custom_fields_values,
integria_custom_fields_rvalues,
max_macro_fields
);
$('#field5_value').trigger('change'); $('#field5_value').trigger('change');
} }
$('#field5_value').on('change', function() { $('#field5_value').on('change', function() {
ajax_get_integria_custom_fields($(this).val()); ajax_get_integria_custom_fields(
$(this).val(),
[],
[],
max_macro_fields
);
}); });
} }

View File

@ -916,7 +916,24 @@ $table->data[17][0] = html_print_label_input_block(
) )
); );
$table->data[17][1] = html_print_label_input_block( $table->data['made_enabled'][1] = html_print_label_input_block(
__('MADE enabled').ui_print_help_tip(
__('By activating this option, the module data will be processed by the MADE engine (if active), and events will be generated automatically by the IA engine'),
true
),
html_print_checkbox_switch(
'made_enabled',
1,
false,
true,
false,
'',
false,
'wp100 static'
)
);
$table->data[17][2] = html_print_label_input_block(
__('SNMP community'), __('SNMP community'),
html_print_input_text( html_print_input_text(
'snmp_community', 'snmp_community',
@ -1653,7 +1670,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide(); "tr#delete_table-40").hide();
var params = { var params = {
@ -1728,7 +1746,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").show (); "tr#delete_table-40").show ();
switch($('#module_type').val()) { switch($('#module_type').val()) {
@ -1838,7 +1857,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide (); "tr#delete_table-40").hide ();
$('input[type=checkbox]').attr('checked', false); $('input[type=checkbox]').attr('checked', false);
$('input[type=checkbox]').attr('disabled', true); $('input[type=checkbox]').attr('disabled', true);
@ -1877,7 +1897,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").show(); "tr#delete_table-40").show();
} }
else { else {
@ -1908,7 +1929,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide(); "tr#delete_table-40").hide();
} }
} }
@ -1932,6 +1954,9 @@ $(document).ready (function () {
else if (this.id == "checkbox-dynamic_two_tailed") { else if (this.id == "checkbox-dynamic_two_tailed") {
return; //Do none return; //Do none
} }
else if (this.id == "checkbox-made_enabled") {
return; //Do none
}
else { else {
if (this.id == "checkbox-force_group") { if (this.id == "checkbox-force_group") {
$("#checkbox-recursion").prop("checked", false); $("#checkbox-recursion").prop("checked", false);
@ -1964,7 +1989,7 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-40").show (); "tr#delete_table-40").show ();
} }
else { else {
@ -1995,7 +2020,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide(); "tr#delete_table-40").hide();
} }
} }
@ -2085,7 +2111,8 @@ $(document).ready (function () {
"tr#delete_table-36, " + "tr#delete_table-36, " +
"tr#delete_table-37, " + "tr#delete_table-37, " +
"tr#delete_table-38, " + "tr#delete_table-38, " +
"tr#delete_table-39, " + "tr#delete_table-39, " +
"tr#delete_table-made_enabled, " +
"tr#delete_table-40").hide(); "tr#delete_table-40").hide();
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
@ -2315,6 +2342,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
'module_interval', 'module_interval',
'disabled', 'disabled',
'post_process', 'post_process',
'made_enabled',
'unit_select', 'unit_select',
'snmp_community', 'snmp_community',
'snmp_oid', 'snmp_oid',
@ -2626,6 +2654,10 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$values['macros'] = json_encode($module_macros); $values['macros'] = json_encode($module_macros);
} }
if (modules_made_compatible($module['id_tipo_modulo']) === false) {
$values['made_enabled'] = 0;
}
$result = modules_update_agent_module( $result = modules_update_agent_module(
$module['id_agente_modulo'], $module['id_agente_modulo'],
$values, $values,

View File

@ -571,6 +571,7 @@ if (!$maps && is_metaconsole() === false) {
} }
if ($maps || is_metaconsole() === true) { if ($maps || is_metaconsole() === true) {
$buttons = '';
if ($vconsoles_write || $vconsoles_manage) { if ($vconsoles_write || $vconsoles_manage) {
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
$actionUrl = 'index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder'; $actionUrl = 'index.php?sec=network&amp;sec2=godmode/reporting/visual_console_builder';
@ -578,20 +579,22 @@ if ($maps || is_metaconsole() === true) {
$actionUrl = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure='.$pure; $actionUrl = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure='.$pure;
} }
echo '<form action="'.$actionUrl.'" method="post">'; $buttons .= '<form action="'.$actionUrl.'" method="post">';
html_print_input_hidden('edit_layout', 1); $buttons .= html_print_input_hidden('edit_layout', 1, true);
html_print_action_buttons( $buttons .= html_print_submit_button(
html_print_submit_button( __('Create'),
__('Create'), '',
'', false,
false, [ 'icon' => 'next'],
[ 'icon' => 'next'], true
true
),
[ 'right_content' => $tablePagination ]
); );
echo '</form>'; $buttons .= '</form>';
} }
html_print_action_buttons(
$buttons,
[ 'right_content' => $tablePagination ]
);
} }

View File

@ -1932,33 +1932,8 @@ if (is_metaconsole() === true) {
<td class="bolder"><?php echo __('Source'); ?></td> <td class="bolder"><?php echo __('Source'); ?></td>
<td > <td >
<?php <?php
$agents = agents_get_group_agents($group); html_print_select(
if ((empty($agents)) || $agents == -1) { [],
$agents = [];
}
$sql_log = 'SELECT source AS k, source AS v
FROM tagente,tagent_module_log
WHERE tagente.id_agente = tagent_module_log.id_agent
AND tagente.disabled = 0';
if (!empty($agents)) {
$index = 0;
foreach ($agents as $key => $a) {
if ($index == 0) {
$sql_log .= ' AND (id_agente = '.$key;
} else {
$sql_log .= ' OR id_agente = '.$key;
}
$index++;
}
$sql_log .= ')';
}
html_print_select_from_sql(
$sql_log,
'source', 'source',
$source, $source,
'onselect=source_change_agents();', 'onselect=source_change_agents();',
@ -1966,7 +1941,7 @@ if (is_metaconsole() === true) {
'', '',
false, false,
false, false,
false false,
); );
?> ?>
</td> </td>
@ -6702,68 +6677,41 @@ function loadGeneralAgents(agent_group) {
function loadLogAgents() { function loadLogAgents() {
var params = []; var params = [];
params.push("get_log_agents=1"); let source = '<?php echo $source; ?>';
params.push("source=<?php echo $source; ?>"); let agent = '<?php echo json_encode($id_agents); ?>';
params.push('id_agents=<?php echo json_encode($id_agents); ?>'); agent = JSON.parse(agent);
params.push("page=include/ajax/reporting.ajax");
$('#id_agents3') var params = {};
.find('option') params["get_agent_source"] = 1;
.remove(); params["log_alert"] = 1;
params["page"] = "enterprise/include/ajax/log_viewer.ajax";
$('#id_agents3') jQuery.ajax({
.append('<option>Loading agents...</option>'); data: params,
dataType: "json",
jQuery.ajax ({ type: "POST",
data: params.join ("&"), url: "ajax.php",
type: 'POST', async: true,
url: action= success: function(data) {
<?php $('#id_agents3')
echo '"'.ui_get_full_url( .find('option')
false, .remove();
false, $.each(data['source'],function(key,value) {
false, if (value === source) {
false $('#source').append( `<option selected='selected' value='${key}'>${value}</option>`);
).'"';
?>
+ "/ajax.php",
timeout: 300000,
dataType: 'json',
success: function (data) {
if (data['correct']) {
$('#id_agents3')
.find('option')
.remove();
var selectElements = [];
var selectedStr = 'selected="selected"';
if (data['select_agents'] === null) {
return;
}
if (Array.isArray(data['select_agents'])) {
data['select_agents'].forEach(function(agentAlias, agentID) {
var optionAttr = '';
if (typeof data['agents_selected'][agentID] !== 'undefined') {
optionAttr = ' selected="selected"';
}
$('#id_agents3')
.append('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
});
} else { } else {
for (const [agentID, agentAlias] of Object.entries(data['select_agents'])) { $('#source').append( `<option value='${key}'>${value}</option>`);
var optionAttr = '';
if (typeof data['agents_selected'][agentID] !== 'undefined') {
optionAttr = ' selected="selected"';
}
$('#id_agents3')
.append('<option value="'+agentID+'" '+optionAttr+'>'+agentAlias+'</option>');
}
} }
} });
$.each(data['agent'],function(key,value) {
const result = agent.includes(key);
if (result === true) {
$('#id_agents3').append( `<option selected='selected' value='${key}'>${value}</option>`);
} else {
$('#id_agents3').append( `<option value='${key}'>${value}</option>`);
}
});
} }
}); });
} }
@ -7948,23 +7896,46 @@ function set_last_value_period() {
} }
function source_change_agents() { function source_change_agents() {
$("#id_agents3").empty(); const source = $("#source").val();
$("#spinner_hack").show(); if (source === '') {
jQuery.post ("ajax.php", $("#id_agents3 option[value!=0]").attr("style","display:");
{"page" : "operation/agentes/ver_agente", } else {
"get_agents_source_json" : 1, $("#spinner_hack").show();
"source" : $("#source").val() $("#id_agents3 option").attr("style","display:none");
},
function (data, status) { var params = {};
for (var clave in data) { params["get_agent_source"] = 1;
$("#id_agents3").append( params["page"] = "enterprise/include/ajax/log_viewer.ajax";
'<option value="'+clave+'">'+data[clave]+'</option>'
); jQuery.ajax({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
async: true,
success: function(data) {
let source_array = [];
$.each(data['source'],function(key,value) {
if (value === source) {
const split = key.split('-');
source_array.push(split[1]);
}
});
$.each(data['agent'],function(key,value) {
const result = source_array.includes(key);
if (result === true) {
$(`#id_agents3 option[value*='${key}']`).attr("style","display:");
}
});
$("#spinner_hack").hide();
},
error: function(error){
$("#spinner_hack").hide();
} }
$("#spinner_hack").hide(); });
}, }
"json"
);
} }
function dialog_message(message_id) { function dialog_message(message_id) {

View File

@ -151,6 +151,10 @@ if (isset($_GET['server']) === true) {
$title .= __('Netflow server').' ID: '.$id_server; $title .= __('Netflow server').' ID: '.$id_server;
break; break;
case SERVER_TYPE_MADE:
$title .= __('MADE server').' ID: '.$id_server;
break;
default: default:
$title = __('Update server').' ID: '.$id_server; $title = __('Update server').' ID: '.$id_server;
break; break;

View File

@ -97,6 +97,24 @@ try {
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'include/ajax/os', 'ajax_url' => 'include/ajax/os',
'ajax_data' => ['method' => 'drawOSTable'], 'ajax_data' => ['method' => 'drawOSTable'],
'pagination_options' => [
[
$config['block_size'],
10,
25,
100,
200,
500,
],
[
$config['block_size'],
10,
25,
100,
200,
500,
],
],
'ajax_postprocess' => 'process_datatables_item(item)', 'ajax_postprocess' => 'process_datatables_item(item)',
'no_sortable_columns' => [ 'no_sortable_columns' => [
-1, -1,
@ -137,6 +155,10 @@ if (is_metaconsole() === true) {
true true
); );
$buttons .= '</form>'; $buttons .= '</form>';
} else {
$buttons .= '<form method="post" action="index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit">';
$buttons .= html_print_submit_button(__('Create OS'), 'update_button', false, ['icon' => 'next'], true);
$buttons .= '</form>';
} }
html_print_action_buttons( html_print_action_buttons(
@ -150,15 +172,6 @@ html_print_action_buttons(
echo '<div id="aux" class="invisible"></div>'; echo '<div id="aux" class="invisible"></div>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit">';
html_print_action_buttons(
html_print_submit_button(__('Create OS'), 'update_button', false, ['icon' => 'next'], true),
['type' => 'form_action']
);
echo '</form>';
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
function process_datatables_item(item) { function process_datatables_item(item) {

View File

@ -2129,6 +2129,15 @@ $table_other->data[$row][] = html_print_label_input_block(
__('Data multiplier to use in graphs/data'), __('Data multiplier to use in graphs/data'),
html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false) html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false)
); );
$table_other->data[$row][] = html_print_label_input_block(
__('Hide general stats for non admin users in tactical view'),
html_print_checkbox_switch(
'disable_general_statistics',
1,
$config['disable_general_statistics'],
true
)
);
$row++; $row++;
/* /*

View File

@ -2063,7 +2063,7 @@ if ($create_alert || $update_alert) {
} }
// DIALOG ADD MORE ACTIONS. // DIALOG ADD MORE ACTIONS.
echo '<div id="add_action_snmp-div" class="invisible left">'; echo '<div id="add_action_snmp-div" class="invisible">';
echo '<form id="add_action_form" method="post">'; echo '<form id="add_action_form" method="post">';
echo '<table class="w100p">'; echo '<table class="w100p">';
@ -2212,6 +2212,7 @@ if ($create_alert || $update_alert) {
ui_require_javascript_file('pandora', 'include/javascript/', true); ui_require_javascript_file('pandora', 'include/javascript/', true);
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/'); ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
ui_require_javascript_file('alert');
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -2287,6 +2288,7 @@ $(document).ready (function () {
name: "content_type", name: "content_type",
value: "<?php echo $al_field4; ?>" value: "<?php echo $al_field4; ?>"
}) })
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>, jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values, values,
function (data, status) { function (data, status) {
@ -2317,6 +2319,26 @@ $(document).ready (function () {
} }
$('#table_macros-field').show(); $('#table_macros-field').show();
} }
if($("#alert_type option:selected").text() === "Create Pandora ITSM ticket") {
// At start hide all rows and inputs corresponding to custom fields, regardless of what its type is.
if (i>=8) {
$('[name=field'+i+'_value\\[\\]').hide();
$('[name=field'+i+'_recovery_value\\[\\]').hide();
$('#table_macros-field'+i).hide();
$('[name=field'+i+'_value_container').hide();
$('[name=field'+i+'_recovery_value_container').hide();
}
if ($('#field5_value').val() !== '') {
ajax_get_integria_custom_fields($('#field5_value').val(), [], [], max_fields);
$('#field5_value').trigger('change');
}
$('#field5_value').on('change', function() {
ajax_get_integria_custom_fields($(this).val(), [], [], max_fields);
});
}
} }
}, },
"json" "json"
@ -2341,7 +2363,8 @@ $(document).ready (function () {
}); });
function show_add_action_snmp(id_alert_snmp) { function show_add_action_snmp(id_alert_snmp) {
$("#add_action_snmp-div").hide() $("#add_action_snmp-div")
.hide()
.dialog ({ .dialog ({
resizable: true, resizable: true,
draggable: true, draggable: true,

View File

@ -33,8 +33,6 @@ check_login();
require_once $config['homedir'].'/vendor/autoload.php'; require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
require_once $config['homedir'].'/include/functions_profile.php'; require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php'; require_once $config['homedir'].'/include/functions_groups.php';
@ -1376,72 +1374,6 @@ if (is_metaconsole() === true) {
); );
} }
$values = [
-1 => __('Use global conf'),
1 => __('Yes'),
0 => __('No'),
];
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(
__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'),
true
).'</p>';
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
}
$home_screen .= '<div id="show_db" style="display: none; width: 100%;">';
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$home_screen .= '</div>';
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
$home_screen .= '<div id="show_vc" style="display: none; width: 100%;">';
$home_screen .= html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true
);
$home_screen .= '</div>';
$home_screen .= html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true,
false
);
$home_screen = '';
$size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Block size for pagination').'</p>'; $size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Block size for pagination').'</p>';
$size_pagination .= html_print_input_text( $size_pagination .= html_print_input_text(
'block_size', 'block_size',
@ -2078,17 +2010,20 @@ if (is_metaconsole() === false) {
} }
function show_data_section() { function show_data_section() {
var $section = $("#section").val(); var section = $("#section").val();
var $allElements = $('div[id^="custom_home_screen_"]'); if(section === 'other'){
var $elementSelected = $('div[id="custom_home_screen_' + $section + '"]'); section = 'external_link';
}
var allElements = $('div[id^="custom_home_screen_"]');
var elementSelected = $('div[id="custom_home_screen_' + section + '"]');
// Hide all elements. // Hide all elements.
$allElements.each(function() { allElements.each(function() {
$(this).addClass('invisible'); $(this).addClass('invisible');
$(this).children().addClass('invisible'); $(this).children().addClass('invisible');
}) })
// Show only the selected. // Show only the selected.
$elementSelected.removeClass('invisible'); elementSelected.removeClass('invisible');
$elementSelected.children().removeClass('invisible'); elementSelected.children().removeClass('invisible');
} }
function switch_ehorus_conf() { function switch_ehorus_conf() {

View File

@ -26,6 +26,8 @@
* ============================================================================ * ============================================================================
*/ */
use PandoraFMS\Dashboard\Manager;
// Load global vars. // Load global vars.
global $config; global $config;
@ -45,16 +47,75 @@ $homeScreenValues = [
HOME_SCREEN_DASHBOARD => __('Dashboard'), HOME_SCREEN_DASHBOARD => __('Dashboard'),
]; ];
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
}
// Custom Home Screen controls. // Custom Home Screen controls.
$customHomeScreenAddition = []; $customHomeScreenAddition = [];
// Home screen. Dashboard. // Home screen. Dashboard.
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
// Home screen. Visual consoles. $dashboards_aux,
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); 'dashboard',
// Home screen. External link and Other. $user_info['data_section'],
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); '',
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); '',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true
);
$customHomeScreenDataField = ''; $customHomeScreenDataField = '';
foreach ($customHomeScreenAddition as $key => $customField) { foreach ($customHomeScreenAddition as $key => $customField) {
$customHomeScreenDataField .= html_print_div( $customHomeScreenDataField .= html_print_div(
@ -576,7 +637,7 @@ $userManagementTable->data['fields_autorefreshTime'][0] .= ui_print_input_placeh
true true
); );
// eHorus conf // EHorus conf.
if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) { if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) {
$userManagementTable->data['captions_ehorus_user_level_enabled'][1] = __('Pandora RC user access enabled'); $userManagementTable->data['captions_ehorus_user_level_enabled'][1] = __('Pandora RC user access enabled');
$userManagementTable->data['fields_ehorus_user_level_enabled'][1] = html_print_checkbox_switch( $userManagementTable->data['fields_ehorus_user_level_enabled'][1] = html_print_checkbox_switch(
@ -791,7 +852,7 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
5, 5,
65, 65,
$user_info['comments'], $user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''), ($view_mode) ? 'readonly="readonly"' : '',
true, true,
'' ''
); );
@ -945,15 +1006,7 @@ $(document).ready(function () {
$('#advanced-line1_looknfeel-1 > a').css('display', 'block'); $('#advanced-line1_looknfeel-1 > a').css('display', 'block');
}) })
var ehorus_user_level_enabled = var ehorus_user_level_enabled = '<?php echo (isset($user_info['ehorus_user_level_enabled']) === true) ? $user_info['ehorus_user_level_enabled'] : 0; ?>';
<?php
if (isset($user_info['ehorus_user_level_enabled']) === true) {
echo $user_info['ehorus_user_level_enabled'];
} else {
echo 0;
}
?>
;
var chk_ehorus_user_level_enabled = ehorus_user_level_enabled; var chk_ehorus_user_level_enabled = ehorus_user_level_enabled;
if (ehorus_user_level_enabled == 0) { if (ehorus_user_level_enabled == 0) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Anomaly detection@svg</title>
<g id="Anomaly-detection" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Dark-/-20-/-details">
<g id="Group">
<rect id="Rectangle" x="0" y="0" width="20" height="20"></rect>
<line x1="14" y1="14" x2="18" y2="18" id="Path-9" stroke="#3F3F3F" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></line>
<circle id="Oval" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" cx="8" cy="8" r="7"></circle>
</g>
<path d="M2,11 C2,11 3.33333333,11 6,11 C7.33333333,7 8,5 8,5 C8,5 8.66666667,7 10,11 L14,11" id="Path" stroke="#3F3F3F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1013 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Dark / 20 / alert@svg</title>
<desc>Created with Sketch.</desc>
<g id="Dark-/-20-/-alert" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,20 C11.4190985,20 12.5702076,18.8808594 12.5702076,17.5 L7.42979244,17.5 C7.42979244,18.8808594 8.5809015,20 10,20 Z M18.6540098,14.1519531 C17.8777645,13.3410156 16.425318,12.1210937 16.425318,8.125 C16.425318,5.08984375 14.2364028,2.66015625 11.2849029,2.0640625 L11.2849029,1.25 C11.2849029,0.559765625 10.7095493,0 10,0 C9.29045075,0 8.71509711,0.559765625 8.71509711,1.25 L8.71509711,2.0640625 C5.76359722,2.66015625 3.57468198,5.08984375 3.57468198,8.125 C3.57468198,12.1210938 2.12223547,13.3410156 1.3459902,14.1519531 C1.10492023,14.4039062 0.998045886,14.7050781 1.00002702,15 C1.00447442,15.640625 1.52156948,16.25 2.28977909,16.25 L17.7102209,16.25 C18.4784305,16.25 18.9959274,15.640625 18.999973,15 C19.0019541,14.7050781 18.8950798,14.4035156 18.6540098,14.1519531 L18.6540098,14.1519531 Z" id="Shape" fill="#82b92e"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -2065,14 +2065,6 @@ if ($table_events) {
// (propagate ACL funct!). // (propagate ACL funct!).
$groups = users_get_groups($config['id_user']); $groups = users_get_groups($config['id_user']);
$tags_condition = tags_get_acl_tags(
$config['id_user'],
array_keys($groups),
'ER',
'event_condition',
'AND'
);
$tableEvents24h = new stdClass(); $tableEvents24h = new stdClass();
$tableEvents24h->class = 'filter_table'; $tableEvents24h->class = 'filter_table';
$tableEvents24h->styleTable = 'border: 0;padding: 0;margin: 0 0 10px;'; $tableEvents24h->styleTable = 'border: 0;padding: 0;margin: 0 0 10px;';
@ -2107,7 +2099,7 @@ if ($table_events) {
); );
} else { } else {
events_print_event_table( events_print_event_table(
'estado <> 1 '.$tags_condition, 'estado <> 1',
200, 200,
'100%', '100%',
false, false,

View File

@ -483,6 +483,13 @@ if (check_login()) {
'tagente_modulo', 'tagente_modulo',
['id_agente_modulo' => $module_id] ['id_agente_modulo' => $module_id]
); );
$made_enabled = db_get_value_filter(
'made_enabled',
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
$unit = db_get_value_filter( $unit = db_get_value_filter(
'unit', 'unit',
'tagente_modulo', 'tagente_modulo',

View File

@ -738,7 +738,7 @@ class SnmpConsole extends HTML
$sql_count = sprintf($sql_count, $whereSubquery); $sql_count = sprintf($sql_count, $whereSubquery);
$traps = db_get_all_rows_sql($sql, true); $traps = db_get_all_rows_sql($sql, true);
$total = (int) db_get_value_sql($sql_count, false, true); $total = (int) db_get_value_sql($sql_count, false, false);
if (empty($traps) === false) { if (empty($traps) === false) {
$data = $traps; $data = $traps;

View File

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

View File

@ -442,6 +442,7 @@ define('SERVER_TYPE_CORRELATION', 22);
define('SERVER_TYPE_NCM', 23); define('SERVER_TYPE_NCM', 23);
define('SERVER_TYPE_NETFLOW', 24); define('SERVER_TYPE_NETFLOW', 24);
define('SERVER_TYPE_LOG', 25); define('SERVER_TYPE_LOG', 25);
define('SERVER_TYPE_MADE', 26);
// REPORTS. // REPORTS.
define('REPORT_TOP_N_MAX', 1); define('REPORT_TOP_N_MAX', 1);

View File

@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_users.php';
function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0) function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0, $only_enabled=false)
{ {
$sql = ''; $sql = '';
$alerts = []; $alerts = [];
@ -121,6 +121,10 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
// Only enabled agent. // Only enabled agent.
$sql .= ' AND t3.disabled = 0'; $sql .= ' AND t3.disabled = 0';
if ($only_enabled === true) {
$sql .= ' AND t0.disabled = 0';
}
$row_alerts = db_get_all_rows_sql($sql); $row_alerts = db_get_all_rows_sql($sql);
if ($total) { if ($total) {

View File

@ -1572,6 +1572,10 @@ function config_update_config()
$error_update[] = __('Use data multiplier'); $error_update[] = __('Use data multiplier');
} }
if (config_update_value('disable_general_statistics', get_parameter('disable_general_statistics', 0), true) === false) {
$error_update[] = __('Hide general stats for non admin users in tactical view');
}
if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) { if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) {
$error_update[] = __('Decimal separator'); $error_update[] = __('Decimal separator');
} else { } else {
@ -3711,6 +3715,10 @@ function config_process_config()
config_update_value('use_data_multiplier', '1'); config_update_value('use_data_multiplier', '1');
} }
if (!isset($config['disable_general_statistics'])) {
config_update_value('disable_general_statistics', 0);
}
if (!isset($config['command_snapshot'])) { if (!isset($config['command_snapshot'])) {
config_update_value('command_snapshot', 1); config_update_value('command_snapshot', 1);
} }

View File

@ -2593,7 +2593,7 @@ function events_print_type_img(
switch ($type) { switch ($type) {
case 'alert_recovered': case 'alert_recovered':
$style .= ' alert_module_background_state icon_background_normal '; $icon = 'images/alert_recovered@svg.svg';
break; break;
case 'alert_manual_validation': case 'alert_manual_validation':
@ -2609,20 +2609,16 @@ function events_print_type_img(
case 'going_up_normal': case 'going_up_normal':
case 'going_down_normal': case 'going_down_normal':
// This is to be backwards compatible. // This is to be backwards compatible.
// $style .= ' event_module_background_state icon_background_normal';
$icon = 'images/module_ok.png'; $icon = 'images/module_ok.png';
break; break;
case 'going_up_warning': case 'going_up_warning':
$icon = 'images/module_warning.png'; $icon = 'images/module_warning.png';
// $style .= ' event_module_background_state icon_background_warning';
case 'going_down_warning': case 'going_down_warning':
$icon = 'images/module_warning.png'; $icon = 'images/module_warning.png';
// $style .= ' event_module_background_state icon_background_warning';
break; break;
case 'going_unknown': case 'going_unknown':
// $style .= ' event_module_background_state icon_background_unknown';
$icon = 'images/module_unknown.png'; $icon = 'images/module_unknown.png';
break; break;

View File

@ -27,6 +27,8 @@
* ============================================================================ * ============================================================================
*/ */
use Models\VisualConsole\Items\Percentile;
require_once $config['homedir'].'/include/graphs/fgraph.php'; require_once $config['homedir'].'/include/graphs/fgraph.php';
require_once $config['homedir'].'/include/functions_reporting.php'; require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
@ -2686,7 +2688,9 @@ function graph_agent_status(
$return=false, $return=false,
$show_not_init=false, $show_not_init=false,
$data_agents=false, $data_agents=false,
$donut_narrow_graph=false $donut_narrow_graph=false,
$onClick='',
$data_in_percentage=false,
) { ) {
global $config; global $config;
@ -2766,6 +2770,25 @@ function graph_agent_status(
'labels' => array_keys($data), 'labels' => array_keys($data),
]; ];
if (empty($onClick) === false) {
$options['onClick'] = $onClick;
}
if ($data_in_percentage === true) {
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
}
if ($donut_narrow_graph == true) { if ($donut_narrow_graph == true) {
$out = ring_graph( $out = ring_graph(
$data, $data,
@ -4625,9 +4648,15 @@ function graph_nodata_image($options)
return base64_encode($dataImg); return base64_encode($dataImg);
} }
$widthImage = '200px'; $style = '';
if (isset($options['nodata_image']['width']) === true) { if (isset($options['nodata_image']['width']) === true) {
$widthImage = $options['nodata_image']['width']; $style .= 'width: '.$options['nodata_image']['width'].'; ';
} else {
$style .= 'width: 200px; ';
}
if (isset($options['nodata_image']['height']) === true) {
$style .= 'height: '.$options['nodata_image']['height'].'; ';
} }
return html_print_image( return html_print_image(
@ -4635,7 +4664,7 @@ function graph_nodata_image($options)
true, true,
[ [
'title' => __('No data'), 'title' => __('No data'),
'style' => 'width: '.$widthImage.';', 'style' => $style,
] ]
); );
} }

View File

@ -5409,7 +5409,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='',
$formStyle = ' style="'.$formStyle.'"'; $formStyle = ' style="'.$formStyle.'"';
} }
$html = '<form method="POST"'.$formStyle.'>'; $html = '<form method="POST"'.$formStyle.' class="link-with-params">';
switch ($type) { switch ($type) {
case 'image': case 'image':
$html .= html_print_input_image($text, $text, $text, $style, true); $html .= html_print_input_image($text, $text, $text, $style, true);

View File

@ -4762,3 +4762,31 @@ function export_agents_module_csv($filters)
return $result; return $result;
} }
/**
* Check if modules are compatible with MADE server.
*
* @param integer $id_tipo_modulo
* @retur boolean True if compatible, false otherwise.
*/
function modules_made_compatible($id_tipo_modulo)
{
$compatible_types = [
1,
4,
5,
8,
15,
16,
22,
30,
34,
];
if (array_search($id_tipo_modulo, $compatible_types) === false) {
return false;
} else {
return true;
}
}

View File

@ -992,6 +992,19 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
$id_modulo = 0; $id_modulo = 0;
break; break;
case SERVER_TYPE_MADE:
$server['img'] = html_print_image(
'images/Anomaly-detection@svg.svg',
true,
[
'title' => __('MADE server'),
'class' => 'main_menu_icon invert_filter',
]
);
$server['type'] = 'made';
$id_modulo = 0;
break;
default: default:
$server['img'] = ''; $server['img'] = '';
$server['type'] = 'unknown'; $server['type'] = 'unknown';

View File

@ -669,6 +669,12 @@ function get_build_setup_charts($type, $options, $data)
$chart->setId($id); $chart->setId($id);
if (isset($options['onClick']) === true
&& empty($options['onClick']) === false
) {
$chart->options()->setOnClick($options['onClick']);
}
// Height is null maximum possible. // Height is null maximum possible.
if (isset($options['height']) === true if (isset($options['height']) === true
&& empty($options['height']) === false && empty($options['height']) === false

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
/* global $, load_modal, generalShowMsg, confirmDialog */ /* global $, load_modal, generalShowMsg, confirmDialog, jQuery */
function allowDrop(ev) { function allowDrop(ev) {
ev.preventDefault(); ev.preventDefault();
@ -172,3 +172,317 @@ function disabled_alert(settings) {
} }
}); });
} }
function ajax_get_integria_custom_fields(
ticket_type_id,
values,
recovery_values,
max_macro_fields
) {
values = values || [];
recovery_values = recovery_values || [];
if (
ticket_type_id === null ||
ticket_type_id === "" ||
(Array.isArray(values) &&
values.length === 0 &&
Array.isArray(recovery_values) &&
recovery_values.length === 0)
) {
for (let i = 8; i <= max_macro_fields; i++) {
$("[name=field" + i + "_value\\[\\]").val("");
$("[name=field" + i + "_recovery_value\\[\\]").val("");
}
}
// On ticket type change, hide all table rows and inputs corresponding to custom fields, regardless of what its type is.
for (let i = 8; i <= max_macro_fields; i++) {
$("[name=field" + i + "_value\\[\\]").hide();
$("[name=field" + i + "_recovery_value\\[\\]").hide();
$("#table_macros-field" + i).hide();
$("[name=field" + i + "_value_container").hide();
$("[name=field" + i + "_recovery_value_container").hide();
}
jQuery.post(
"ajax.php",
{
page: "godmode/alerts/configure_alert_action",
get_integria_ticket_custom_types: 1,
ticket_type_id: ticket_type_id
},
function(data) {
data.forEach(function(custom_field, key) {
var custom_field_key = key + 8; // Custom fields start from field 8.
if (custom_field_key > max_macro_fields) {
return;
}
// Display field row for current input.
var custom_field_row = $("#table_macros-field" + custom_field_key);
custom_field_row.show();
// Replace label text of field row for current input.
var label_html = $("#table_macros-field" + custom_field_key + " td")
.first()
.html();
var label_name = label_html.split("<br>")[0];
var new_html_content = custom_field_row
.html()
.replace(label_name, custom_field.label);
custom_field_row.html(new_html_content);
switch (custom_field.type) {
case "CHECKBOX":
var checkbox_selector = $(
'input[type="checkbox"][name=field' +
custom_field_key +
"_value\\[\\]]"
);
var checkbox_recovery_selector = $(
'input[type="checkbox"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
);
checkbox_selector.on("change", function() {
if (checkbox_selector.prop("checked")) {
checkbox_selector.attr("value", "1");
} else {
checkbox_selector.attr("value", "0");
}
});
checkbox_recovery_selector.on("change", function() {
if (checkbox_recovery_selector.prop("checked")) {
checkbox_recovery_selector.attr("value", "1");
} else {
checkbox_recovery_selector.attr("value", "0");
}
});
if (typeof values[key] !== "undefined") {
if (values[key] == 1) {
checkbox_selector.prop("checked", true);
checkbox_selector.attr("value", "1");
} else {
checkbox_selector.prop("checked", false);
checkbox_selector.attr("value", "0");
}
}
if (typeof recovery_values[key] !== "undefined") {
if (recovery_values[key] == 1) {
checkbox_recovery_selector.prop("checked", true);
checkbox_recovery_selector.attr("value", "1");
} else {
checkbox_recovery_selector.prop("checked", false);
checkbox_recovery_selector.attr("value", "0");
}
}
$("[name=field" + custom_field_key + "_value_container]").show();
$(
"[name=field" + custom_field_key + "_recovery_value_container]"
).show();
$(
'input[type="checkbox"][name=field' +
custom_field_key +
"_value\\[\\]]"
).show();
$(
'input[type="checkbox"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).show();
break;
case "COMBO":
var combo_input = $(
"select[name=field" + custom_field_key + "_value\\[\\]]"
);
var combo_input_recovery = $(
"select[name=field" + custom_field_key + "_recovery_value\\[\\]]"
);
combo_input.find("option").remove();
combo_input_recovery.find("option").remove();
var combo_values_array = custom_field.comboValue.split(",");
combo_values_array.forEach(function(value) {
combo_input.append(
$("<option>", {
value: value,
text: value
})
);
combo_input_recovery.append(
$("<option>", {
value: value,
text: value
})
);
});
if (typeof values[key] !== "undefined") {
combo_input.val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
combo_input_recovery.val(recovery_values[key]);
}
combo_input.show();
combo_input_recovery.show();
break;
case "DATE":
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).removeClass("hasDatepicker");
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).removeClass("hasDatepicker");
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).datepicker("destroy");
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).datepicker("destroy");
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).show();
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).show();
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).datepicker({ dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>" });
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).datepicker({ dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>" });
$.datepicker.setDefaults(
$.datepicker.regional["<?php echo get_user_language(); ?>"]
);
if (typeof values[key] !== "undefined") {
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$(
'input.datepicker[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).val(recovery_values[key]);
}
break;
case "NUMERIC":
if (typeof values[key] !== "undefined") {
$(
'input[type="number"][name=field' +
custom_field_key +
"_value\\[\\]]"
).val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$(
'input[type="number"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).val(recovery_values[key]);
}
$(
'input[type="number"][name=field' +
custom_field_key +
"_value\\[\\]]"
).show();
$(
'input[type="number"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).show();
break;
case "TEXT":
if (typeof values[key] !== "undefined") {
$(
'input.normal[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$(
'input.normal[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).val(recovery_values[key]);
}
$(
'input.normal[type="text"][name=field' +
custom_field_key +
"_value\\[\\]]"
).show();
$(
'input.normal[type="text"][name=field' +
custom_field_key +
"_recovery_value\\[\\]]"
).show();
break;
case "TEXTAREA":
default:
if (typeof values[key] !== "undefined") {
$("textarea[name=field" + custom_field_key + "_value\\[\\]]").val(
values[key]
);
}
if (typeof recovery_values[key] !== "undefined") {
$(
"textarea[name=field" +
custom_field_key +
"_recovery_value\\[\\]]"
).val(recovery_values[key]);
}
$(
"textarea[name=field" + custom_field_key + "_value\\[\\]]"
).show();
$(
"textarea[name=field" +
custom_field_key +
"_recovery_value\\[\\]]"
).show();
break;
}
});
},
"json"
);
}

View File

@ -73,8 +73,40 @@ $(document).ready(function() {
$("#heatmap-title").html($(title).html()); $("#heatmap-title").html($(title).html());
} }
}); });
rescaling();
$(window).on("resize", function() {
rescaling();
});
}); });
function showLabel(element, event, label) {
$(".label_heatmap").remove();
const tooltip = $(document.createElement("div"));
tooltip.html(label);
tooltip.attr("class", "label_heatmap");
$("#heatmap-group").append(tooltip);
var x = event.clientX;
var y = event.clientY;
tooltip.attr(
"style",
"position: fixed; top:" + (y + 15) + "px; left:" + (x + 20) + "px;"
);
}
function hideLabel() {
$(".label_heatmap").remove();
}
function rescaling() {
if (window.innerWidth < 1300) {
$(".trigger-100").attr("style", "width: 100%;");
$(".trigger-100").addClass("br-b");
} else {
$(".trigger-100").removeAttr("style");
$(".trigger-100").removeClass("br-b");
}
}
function autoRefresh(interval, id, method, php_class) { function autoRefresh(interval, id, method, php_class) {
setInterval(() => { setInterval(() => {
$.ajax({ $.ajax({
@ -92,3 +124,108 @@ function autoRefresh(interval, id, method, php_class) {
}); });
}, interval); }, interval);
} }
function redirectStatus(e, element) {
if (element.length > 0) {
switch (e.chart.legend.legendItems[element[0].index].text) {
case "Critical":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=1&sort_field=&sort=none&pure=`
);
break;
case "Warning":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=2&sort_field=&sort=none&pure=`
);
break;
case "Unknown":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=3&sort_field=&sort=none&pure=`
);
break;
case "Not init":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=5&sort_field=&sort=none&pure=`
);
break;
default:
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=-1&sort_field=&sort=none&pure=`
);
break;
}
}
}
function redirectHeatmap(view, id, id_agente = 0) {
switch (view) {
case "group":
window.location.assign(
`index.php?sec=view&sec2=godmode/groups/tactical&id_group=${id}`
);
break;
case "agent":
window.location.assign(
`index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=${id}`
);
break;
case "module":
if (id_agente > 0) {
window.location.assign(
`index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=${id_agente}&tab=module&id_agent_module=${id}&edit_module=1`
);
}
break;
default:
break;
}
}
function redirectAgentStatus(e, element) {
if (element.length > 0) {
switch (e.chart.legend.legendItems[element[0].index].text) {
case "No monitors":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente`
);
break;
case "CRITICAL":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=1`
);
break;
case "WARNING":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=2`
);
break;
case "UKNOWN":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=3`
);
break;
case "NORMAL":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=0`
);
break;
default:
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente`
);
break;
}
}
}

View File

@ -30,6 +30,8 @@ namespace PandoraFMS\Dashboard;
global $config; global $config;
require_once $config['homedir'].'/include/functions_inventory.php';
/** /**
* Inventory Widget. * Inventory Widget.
*/ */
@ -608,7 +610,7 @@ class InventoryWidget extends Widget
} }
} }
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid']; $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
'id' => $id_table, 'id' => $id_table,
@ -619,7 +621,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',
@ -727,7 +729,7 @@ class InventoryWidget extends Widget
} }
} }
$id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid']; $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid().'_'.$nodo['server_uid'];
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
@ -739,7 +741,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',
@ -893,7 +895,7 @@ class InventoryWidget extends Widget
} }
} }
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente']; $id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.uniqid().'_'.$row['id_agente'];
$table = ui_print_datatable( $table = ui_print_datatable(
[ [
@ -905,7 +907,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',
@ -985,7 +987,7 @@ class InventoryWidget extends Widget
array_push($data, $data_tmp); array_push($data, $data_tmp);
} }
$id_table = 'id_'.$row['id_module_inventory']; $id_table = 'id_'.$row['id_module_inventory'].'_'.uniqid();
} }
if ($count_rows > 1) { if ($count_rows > 1) {
@ -999,7 +1001,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',
@ -1035,7 +1037,7 @@ class InventoryWidget extends Widget
'no_sortable_columns' => [], 'no_sortable_columns' => [],
'data_element' => $data, 'data_element' => $data,
'searching' => true, 'searching' => true,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],
'direction' => 'asc', 'direction' => 'asc',
@ -1098,7 +1100,7 @@ class InventoryWidget extends Widget
'columns' => $columns, 'columns' => $columns,
'column_names' => $columns_names, 'column_names' => $columns_names,
'ordering' => $ordering, 'ordering' => $ordering,
'dom_elements' => 'frtilp', 'dom_elements' => 'rtilp',
'searching' => $searching, 'searching' => $searching,
'order' => [ 'order' => [
'field' => $columns[0], 'field' => $columns[0],

View File

@ -300,6 +300,10 @@ class SingleGraphWidget extends Widget
$values['period'] = SECONDS_1DAY; $values['period'] = SECONDS_1DAY;
} }
if (isset($values['period_projection']) === false) {
$values['period_projection'] = SECONDS_1DAY;
}
if (isset($values['showLegend']) === false) { if (isset($values['showLegend']) === false) {
$values['showLegend'] = 1; $values['showLegend'] = 1;
} }
@ -439,7 +443,7 @@ class SingleGraphWidget extends Widget
$trickHight = 0; $trickHight = 0;
if ($this->values['showLegend'] === 1) { if ($this->values['showLegend'] === 1) {
// Needed for legend. // Needed for legend.
$trickHight = 40; $trickHight = 60;
} }
$output = '<div class="container-center widget-mrgn-0px">'; $output = '<div class="container-center widget-mrgn-0px">';
@ -448,10 +452,16 @@ class SingleGraphWidget extends Widget
'period' => $this->values['period'], 'period' => $this->values['period'],
'date' => strtotime(date('Y-m-d H:i:s')), 'date' => strtotime(date('Y-m-d H:i:s')),
'only_image' => false, 'only_image' => false,
'homeurl' => ui_get_full_url(false, false, false, false).'/',
'height' => ((int) $size['height'] - $trickHight), 'height' => ((int) $size['height'] - $trickHight),
'landscape' => $content['landscape'], 'landscape' => $content['landscape'],
'return_img_base_64' => true, 'return_img_base_64' => true,
'show_legend' => $this->values['showLegend'],
'width' => '100%',
'height' => ((int) $size['height'] - $trickHight),
'title' => $module_name,
'unit' => $units_name,
'homeurl' => $config['homeurl'],
'menu' => false,
]; ];
$params_combined = [ $params_combined = [

View File

@ -79,11 +79,17 @@ class Element
public function __construct( public function __construct(
$ajax_controller='include/ajax/general_tactical_view.ajax' $ajax_controller='include/ajax/general_tactical_view.ajax'
) { ) {
global $config;
$this->interval = 0; $this->interval = 0;
$this->title = __('Default element'); $this->title = __('Default element');
$this->ajaxController = $ajax_controller; $this->ajaxController = $ajax_controller;
// Without ACL. // Without ACL.
$agent = db_get_row('tagente', 'nombre', 'pandora.internals', '*'); $agent_name = $config['self_monitoring_agent_name'];
if (empty($agent_name) === true) {
$agent_name = 'pandora.internals';
}
$agent = db_get_row('tagente', 'nombre', $agent_name, '*');
if (is_array($agent) === true) { if (is_array($agent) === true) {
$this->monitoringAgent = $agent; $this->monitoringAgent = $agent;
} }

View File

@ -50,6 +50,22 @@ class GeneralTacticalView
} }
/**
* Returns whether general statistics are disabled.
*
* @return boolean
*/
public function disableGeneralStatistics():bool
{
global $config;
if (users_is_admin($config['id_user']) === true) {
return false;
} else {
return (bool) $config['disable_general_statistics'];
}
}
/** /**
* Instantiate all the elements that will build the dashboard * Instantiate all the elements that will build the dashboard
* *
@ -109,6 +125,7 @@ class GeneralTacticalView
{ {
$data = []; $data = [];
$data['javascript'] = $this->javascript(); $data['javascript'] = $this->javascript();
$data['disableGeneralStatistics'] = $this->disableGeneralStatistics();
$data = array_merge($data, $this->elements); $data = array_merge($data, $this->elements);
View::render( View::render(
'tacticalView/view', 'tacticalView/view',

View File

@ -429,12 +429,29 @@ class Agents extends Element
'cutout' => 80, 'cutout' => 80,
'nodata_image' => ['width' => '80%'], 'nodata_image' => ['width' => '80%'],
'colors' => $colors, 'colors' => $colors,
'onClick' => 'redirectAgentStatus',
]; ];
// To avoid that if a value is too small it is not seen.
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
$pie = ring_graph($data, $options); $pie = ring_graph($data, $options);
$output = html_print_div( $output = html_print_div(
[ [
'content' => $pie, 'content' => $pie,
'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;', 'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;',
'class' => 'clickable',
], ],
true true
); );

View File

@ -83,7 +83,7 @@ class Alerts extends Element
*/ */
public function getActiveAlerts():string public function getActiveAlerts():string
{ {
$total = alerts_get_alerts(0, '', 'all', -1, 'AR', true); $total = alerts_get_alerts(0, '', 'all', -1, 'AR', true, 0, true);
return html_print_div( return html_print_div(
[ [
'content' => format_numeric($total, 0), 'content' => format_numeric($total, 0),

View File

@ -34,7 +34,9 @@ class Database extends Element
*/ */
public function __construct() public function __construct()
{ {
global $config;
parent::__construct(); parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
$this->title = __('Database'); $this->title = __('Database');
$this->ajaxMethods = [ $this->ajaxMethods = [
'getStatus', 'getStatus',

View File

@ -57,23 +57,13 @@ class Events extends Element
{ {
global $config; global $config;
$id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false)); $id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
if (in_array(0, $id_groups) === false) {
foreach ($id_groups as $key => $id_group) {
if ((bool) check_acl_restricted_all($config['id_user'], $id_group, 'AR') === false) {
unset($id_groups[$key]);
}
}
}
if (users_can_manage_group_all() === true) {
$id_groups[] = 0;
}
$id_groups = implode(',', $id_groups); $id_groups = implode(',', $id_groups);
$event_view_h = (int) ($config['event_view_hr'] > 24) ? 24 : $config['event_view_hr']; $event_view_h = (int) ($config['event_view_hr'] > 24) ? 24 : $config['event_view_hr'];
$time_events = ($event_view_h * 3600); $time_events = ($event_view_h * 3600);
$intervalh = (time() - $time_events); $intervalh = (time() - $time_events);
$sql = 'SELECT utimestamp from tevento WHERE utimestamp >= '.$intervalh.' ORDER BY utimestamp DESC;'; $sql = 'SELECT utimestamp
FROM tevento
WHERE utimestamp >= '.$intervalh.' AND id_grupo IN ('.$id_groups.') ORDER BY utimestamp DESC;';
$rows = db_process_sql($sql); $rows = db_process_sql($sql);
$cut_seconds = ($time_events / 24); $cut_seconds = ($time_events / 24);
$now = (time() - 300); $now = (time() - 300);
@ -377,6 +367,13 @@ class Events extends Element
$data = []; $data = [];
$colors = []; $colors = [];
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
if ($row['criticity'] != EVENT_CRIT_CRITICAL
&& $row['criticity'] != EVENT_CRIT_NORMAL
&& $row['criticity'] != EVENT_CRIT_WARNING
) {
continue;
}
switch ($row['criticity']) { switch ($row['criticity']) {
case EVENT_CRIT_CRITICAL: case EVENT_CRIT_CRITICAL:
$label = __('CRITICAL'); $label = __('CRITICAL');
@ -394,9 +391,7 @@ class Events extends Element
break; break;
default: default:
$colors[] = COL_UNKNOWN; continue;
$label = __('UNKNOWN');
break;
} }
$labels[] = $this->controlSizeText($label); $labels[] = $this->controlSizeText($label);
@ -410,6 +405,21 @@ class Events extends Element
'nodata_image' => ['width' => '100%'], 'nodata_image' => ['width' => '100%'],
'colors' => $colors, 'colors' => $colors,
]; ];
// To avoid that if a value is too small it is not seen.
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
$pie = ring_graph($data, $options); $pie = ring_graph($data, $options);
$output = html_print_div( $output = html_print_div(
[ [
@ -448,9 +458,10 @@ class Events extends Element
'style' => 'width: 90%;', 'style' => 'width: 90%;',
'ajax_url' => 'operation/events/events', 'ajax_url' => 'operation/events/events',
'ajax_data' => [ 'ajax_data' => [
'get_events' => 1, 'get_events' => 1,
'compact_date' => 1, 'compact_date' => 1,
'external_url' => 1, 'external_url' => 1,
'compact_name_event' => 1,
], ],
'order' => [ 'order' => [
'field' => 'timestamp', 'field' => 'timestamp',

View File

@ -118,7 +118,6 @@ class Groups extends Element
return graph_nodata_image(['width' => '400']); return graph_nodata_image(['width' => '400']);
} }
$groups = $modules;
// Best square. // Best square.
$high = (float) max($width, $height); $high = (float) max($width, $height);
$low = 0.0; $low = 0.0;
@ -147,13 +146,18 @@ class Groups extends Element
$x = 0; $x = 0;
$y = 0; $y = 0;
$cont = 1; $cont = 1;
foreach ($groups as $key => $value) { foreach ($modules as $key => $value) {
$module_id = $value['id_agente_modulo']; $module_id = $value['id_agente_modulo'];
$db_status = modules_get_agentmodule_status($module_id); $module_status = db_get_row(
'tagente_estado',
'id_agente_modulo',
$module_id,
);
$module_value = modules_get_last_value($module_id); $module_value = modules_get_last_value($module_id);
$status = ''; $status = '';
$title = ''; $title = '';
modules_get_status($module_id, $db_status, $module_value, $status, $title); modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
switch ($status) { switch ($status) {
case STATUS_MODULE_NO_DATA: case STATUS_MODULE_NO_DATA:
// Not init status. // Not init status.
@ -183,10 +187,16 @@ class Groups extends Element
break; break;
} }
$redirect = '';
if (check_acl($config['id_user'], 0, 'AW')) {
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
}
$heatmap .= sprintf( $heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>', '<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont, 'rect_'.$cont,
$x, $x,
$value['nombre'],
$y, $y,
$row, $row,
$column, $column,
@ -350,9 +360,10 @@ class Groups extends Element
} }
$heatmap .= sprintf( $heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>', '<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" onclick="redirectHeatmap(\'agent\', '.$value['id_agente'].')" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont, 'rect_'.$cont,
$x, $x,
$value['alias'],
$y, $y,
$row, $row,
$column, $column,
@ -490,9 +501,10 @@ class Groups extends Element
} }
$heatmap .= sprintf( $heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>', '<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" onclick="redirectHeatmap(\'group\', '.$value['_id_'].')" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont, 'rect_'.$cont,
$x, $x,
$value['_name_'],
$y, $y,
$row, $row,
$column, $column,

View File

@ -75,7 +75,10 @@ class MonitoringElements extends Element
'display' => false, 'display' => false,
], ],
'cutout' => 80, 'cutout' => 80,
'nodata_image' => ['width' => '100%'], 'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
]; ];
$pie = ring_graph($data, $options); $pie = ring_graph($data, $options);
$output = html_print_div( $output = html_print_div(
@ -139,7 +142,10 @@ class MonitoringElements extends Element
'display' => false, 'display' => false,
], ],
'cutout' => 80, 'cutout' => 80,
'nodata_image' => ['width' => '100%'], 'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
]; ];
$pie = ring_graph($data, $options); $pie = ring_graph($data, $options);
$output = html_print_div( $output = html_print_div(
@ -208,7 +214,10 @@ class MonitoringElements extends Element
'display' => false, 'display' => false,
], ],
'cutout' => 80, 'cutout' => 80,
'nodata_image' => ['width' => '100%'], 'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
]; ];
$pie = ring_graph($data, $options); $pie = ring_graph($data, $options);
$output = html_print_div( $output = html_print_div(
@ -230,11 +239,12 @@ class MonitoringElements extends Element
*/ */
public function getMonitoringStatusGraph():string public function getMonitoringStatusGraph():string
{ {
$pie = graph_agent_status(false, '', '', true, true, false, true); $pie = graph_agent_status(false, '', '', true, true, false, true, 'redirectStatus', true);
$output = html_print_div( $output = html_print_div(
[ [
'content' => $pie, 'content' => $pie,
'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;', 'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;',
'class' => 'clickable',
], ],
true true
); );

View File

@ -36,6 +36,7 @@ class Overview extends Element
{ {
global $config; global $config;
parent::__construct(); parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
if (is_ajax() === true) { if (is_ajax() === true) {
include_once $config['homedir'].'/include/functions_servers.php'; include_once $config['homedir'].'/include/functions_servers.php';
} }
@ -163,6 +164,9 @@ class Overview extends Element
if ($info['limit'] > $info['count']) { if ($info['limit'] > $info['count']) {
$used = round(($info['count'] / $info['limit']) * 100); $used = round(($info['count'] / $info['limit']) * 100);
$free = (100 - $used); $free = (100 - $used);
} else if ($info['limit'] <= $info['count']) {
$free = 0;
$used = 100;
} else { } else {
$free = 100; $free = 100;
$used = 0; $used = 0;

View File

@ -949,3 +949,7 @@ input.resize_button {
bottom: 3%; bottom: 3%;
right: 6%; right: 6%;
} }
.parent_graph > .graph {
margin-left: 10px;
}

View File

@ -470,37 +470,6 @@ div.multi-response-buttons {
margin-bottom: 5px; margin-bottom: 5px;
} }
/*
.main_menu_icon_event {
height: 20px;
}
*/
.event_module_background_state {
mask: url(../../images/modules@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/modules@svg.svg) no-repeat center / contain;
}
.alert_module_background_state {
mask: url(../../images/alert@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/alert@svg.svg) no-repeat center / contain;
}
.icon_background_critical {
background-color: #e63c52;
}
.icon_background_warning {
background-color: #fcab10;
}
.icon_background_normal {
background-color: #82b92e;
}
.icon_background_unknown {
background-color: gray;
}
.events-refr { .events-refr {
width: 300px; width: 300px;
display: flex; display: flex;

View File

@ -23,11 +23,12 @@
align-items: stretch; align-items: stretch;
} }
.col-12 { .col-12 {
width: 100%; width: 99%;
} }
.col-6, .col-6,
.col-xl-6 { .col-xl-6 {
width: 50%; width: 50%;
flex: 1;
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: column; flex-direction: column;
@ -58,6 +59,9 @@
border-radius: 10px; border-radius: 10px;
height: 100%; height: 100%;
max-width: 100%; max-width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
} }
.br-l { .br-l {
border-left: 1px solid #e5e9ed; border-left: 1px solid #e5e9ed;
@ -325,6 +329,22 @@ table.dataTable thead th {
background-color: #ec7176; background-color: #ec7176;
} }
#svg rect {
cursor: pointer;
}
.trigger-100 {
display: flex;
flex-direction: column;
}
.label_heatmap {
position: absolute;
background-color: #757575;
color: white;
padding: 2px 5px;
border-radius: 5px;
}
@media (max-width: 1636px) { @media (max-width: 1636px) {
.col-xl-6 { .col-xl-6 {
width: 100%; width: 100%;
@ -344,9 +364,7 @@ table.dataTable thead th {
.col-7 { .col-7 {
width: 56%; width: 56%;
} }
.col-5 {
width: 41%;
}
.flex-nowrap { .flex-nowrap {
flex-wrap: nowrap !important; flex-wrap: nowrap !important;
} }

View File

@ -1292,6 +1292,11 @@ p.center {
margin: 0 5px; margin: 0 5px;
} }
.loading-text {
font-size: 19px;
text-align: center;
}
/* Legacy spinner */ /* Legacy spinner */
#loading { #loading {
position: fixed; position: fixed;
@ -10323,7 +10328,7 @@ select:focus {
} }
.dataTables_length > label { .dataTables_length > label {
color: #fff; color: #000;
} }
input[type="button"], input[type="button"],
@ -12736,12 +12741,6 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
.dt-buttons {
width: auto;
position: absolute;
margin-left: 90px;
}
.title_tactical { .title_tactical {
padding: 10px 0px 10px 0px; padding: 10px 0px 10px 0px;
text-align: center; text-align: center;

View File

@ -369,8 +369,6 @@ a.pandora_pagination.current:hover {
font-size: 20px; font-size: 20px;
height: 38px; height: 38px;
width: 80px; width: 80px;
margin-left: 90px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: row; flex-direction: row;

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