Merge remote-tracking branch 'origin/develop' into ent-3770-texto-del-pandora-diag

Former-commit-id: 35f8be06ed6fff20ff930a19429a0cbcf5aff33d
This commit is contained in:
marcos.alconada 2019-05-08 14:36:04 +02:00
commit 1ffc6bd028
73 changed files with 1775 additions and 984 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
docker build --rm=true --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \ docker build --rm=true --pull --no-cache --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \
docker push pandorafms/pandorafms:7 docker push pandorafms/pandorafms:7

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.734-190429 Version: 7.0NG.734-190508
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.734-190429" pandora_version="7.0NG.734-190508"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.734'; use constant AGENT_VERSION => '7.0NG.734';
use constant AGENT_BUILD => '190429'; use constant AGENT_BUILD => '190508';
# 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;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.734" PI_VERSION="7.0NG.734"
PI_BUILD="190429" PI_BUILD="190508"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -20,7 +20,28 @@
use strict; use strict;
use constant TSTAMP_FILE => '/tmp/pandora_inventory.tstamp'; use constant TSTAMP_FILE => '/tmp/pandora_inventory.tstamp';
use Scalar::Util qw(looks_like_number);
use Data::Dumper;
# Set environment language to English
$ENV{"LANG"} = "en_US";
# Check AIX system
my $AIX=0;
my $system = `uname -a | awk '{print $1}'`;
if ($system =~ 'AIX') {
$AIX=1;
}
sub is_enabled {
my $value = shift;
if ((defined ($value)) && looks_like_number($value) && ($value > 0)){
# return true
return 1;
}
#return false
return 0;
}
# Operation mode (LSHW or HWINFO) # Operation mode (LSHW or HWINFO)
my $Mode; my $Mode;
@ -31,7 +52,7 @@ my $Separator;
sub get_module_data ($$$$) { sub get_module_data ($$$$) {
my ($name, $hwinfo, $keys, $modules) = @_; my ($name, $hwinfo, $keys, $modules) = @_;
my %module; my %module;
$Separator='\s+\*\-';
# Store keys # Store keys
foreach my $key (@{$keys}) { foreach my $key (@{$keys}) {
push (@{$module{'_keys'}}, $key); push (@{$module{'_keys'}}, $key);
@ -58,12 +79,65 @@ sub get_module_data ($$$$) {
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
} }
sub test_contain ($$) {
my ($value, $array)=@_;
if ( grep( /$value/, @{$array} ) ) {
return 1;
}
}
sub get_module_data_aix_ram_cpu ($$$$) {
my ($name, $hwinfo, $keys, $modules) = @_;
my %module;
# Store keys
foreach my $key (@{$keys}) {
push (@{$module{'_keys'}}, $key);
}
# Parse module data
foreach my $line (@{$hwinfo}) {
foreach my $key (@{$keys}) {
if ($line =~ /$key:\s+(.+)/) {
$module{$key} = $1;
$module{$key} =~ s/,/ /g;
}
}
}
# No data found
#my @data = keys (%module);
#return unless ($#data >= 0);
push (@{$modules->{$name}}, \%module);
}
sub get_module_data_aix ($$$$) {
my ($name,$hwinfo,$regex,$modules) = @_;
my %module;
foreach my $line (@{$hwinfo}) {
$line =~ s/\s{2,}/;/g;
$line =~ s/\+ //g;
$line =~ s/\* //g;
}
foreach my $line (@{$hwinfo}) {
if ($line =~ /$regex/){
my ($var1, $var2, $var3) = split /;/, $line;
my %module;
$module{'device'} = $var1;
$module{'serial'} = $var2;
$module{'description'}=$var3;
$module{'_keys'} = ['device','serial','description'];
push (@{$modules->{$name}}, \%module);
}
}
}
# Get a list of information file system in machine # Get a list of information file system in machine
sub get_file_system($$) { sub get_file_system($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my @fileSystems;
my @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns if (is_enabled $AIX){
@fileSystems = `df -gP | tail -n +2`;
} else {
@fileSystems = `df -hP | tail -n +2`; #remove the titles of columns
}
foreach my $row (@fileSystems) { foreach my $row (@fileSystems) {
next unless ($row =~ /^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+(\S+)/); next unless ($row =~ /^(\S+)\s+\S+\s+(\S+)\s+(\S+)\s+\S+\s+(\S+)/);
@ -81,26 +155,29 @@ sub get_file_system($$) {
# Get a list of services init in machine # Get a list of services init in machine
sub get_servicies_init_machine($$) { sub get_servicies_init_machine($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $runlevel = `who -r | awk '{print \$2}'`; my $runlevel;
if (is_enabled $AIX) {
$runlevel = `who -r | awk '{print \$3}'`;
} else {
$runlevel = `who -r | awk '{print \$2}'`;
}
#ini trim($runlevel) #ini trim($runlevel)
$runlevel =~ s/^\s*//; #ltrim $runlevel =~ s/^\s*//; #ltrim
$runlevel =~ s/\s*$//; #rtrim $runlevel =~ s/\s*$//; #rtrim
#end trim($runlevel) #end trim($runlevel)
my $script = ""; my $script;
if (-e "/etc/rc" . $runlevel .".d/") { if (-e "/etc/rc" . $runlevel .".d/") {
$script = "ls /etc/rc" . $runlevel .".d/ -l | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; $script = "ls -l /etc/rc" . $runlevel .".d/ | grep \"^l.*\" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\"";
} }
else { else {
$script = "ls /etc/rc.d/rc" . $runlevel .".d/ -l | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\""; $script = "ls -l /etc/rc.d/rc" . $runlevel .".d/ | grep \"^l.*\" | grep \" S.* \" | awk \"{print \\\$NF}\" | sed -e \"s/\\.\\.\\///g\" | sed -e \"s/.*init\\.d\\///g\"";
} }
my @services = `$script`; my @services = `$script`;
foreach my $row (@services) { foreach my $row (@services) {
my %module; my %module;
$row =~ s/\n//; $row =~ s/\n//;
$module{'service'} = $row; $module{'service'} = $row;
@ -112,8 +189,12 @@ sub get_servicies_init_machine($$) {
# Get a list of running processes # Get a list of running processes
sub get_processes ($$) { sub get_processes ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $script;
my $script = "ps -eo command"; if (is_enabled $AIX) {
$script = "ps -eo args | tail -n +2";
} else {
$script = "ps -eo command | tail -n +2";
}
my @services = `$script`; my @services = `$script`;
foreach my $row (@services) { foreach my $row (@services) {
@ -131,7 +212,6 @@ sub get_processes ($$) {
# Get a list of valid users in the system # Get a list of valid users in the system
sub get_users ($$) { sub get_users ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $script = "cat /etc/passwd"; my $script = "cat /etc/passwd";
my $user = ""; my $user = "";
my $estado = ""; my $estado = "";
@ -141,7 +221,15 @@ sub get_users ($$) {
my %module; my %module;
next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); next unless ($row =~ /^([A-Za-z0-9\-\_]*)/);
if (is_enabled $AIX) {
$user = $1;
$script = `lsuser $user`;
if ( $script =~ /^(\S+)\sid./){
$module{'user'} = $user;
$module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module);
}
} else {
$user = $1; $user = $1;
$script = `passwd -S $user`; $script = `passwd -S $user`;
if ( $script =~ /^(\S+)\sP./){ if ( $script =~ /^(\S+)\sP./){
@ -150,6 +238,8 @@ sub get_users ($$) {
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
} }
} }
}
} }
# Show Kernel Information # Show Kernel Information
@ -171,11 +261,13 @@ sub get_software_module_data ($$) {
# Guess the current distribution # Guess the current distribution
my $distrib_id = ""; my $distrib_id = "";
if ( -e "/etc/SuSE-release"){ if (is_enabled $AIX) {
$distrib_id = "AIX";
}elsif ( -e "/etc/SuSE-release"){
$distrib_id = "SUSE"; $distrib_id = "SUSE";
} elsif ( -e "/etc/redhat-release"){ }elsif ( -e "/etc/redhat-release"){
$distrib_id = "REDHAT"; $distrib_id = "REDHAT";
} else { }else {
$distrib_id = "DEBIAN"; $distrib_id = "DEBIAN";
} }
@ -183,7 +275,9 @@ sub get_software_module_data ($$) {
my @soft; my @soft;
if ($distrib_id eq 'DEBIAN') { if ($distrib_id eq 'DEBIAN') {
@soft = `dpkg -l | grep ii`; @soft = `dpkg -l | grep ii`;
} else { }elsif ($distrib_id eq 'AIX') {
@soft = `lslpp -Lcq | awk -F: '{print "ii "\$1" "\$3" "\$8}'`;
}else {
# Sometimes rpm return data splitted in two lines, and with dupes. Thats bad for our inventory system # Sometimes rpm return data splitted in two lines, and with dupes. Thats bad for our inventory system
@soft = `rpm -q -a --qf "ii %{NAME} %{VERSION} %{SUMMARY}\n" | grep "^ii" | sort -u`; @soft = `rpm -q -a --qf "ii %{NAME} %{VERSION} %{SUMMARY}\n" | grep "^ii" | sort -u`;
} }
@ -211,36 +305,39 @@ sub get_software_module_data ($$) {
#Get the list of interfaces with the ip assigned #Get the list of interfaces with the ip assigned
sub get_ips ($$) { sub get_ips ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my @interfaces;
my $ifconfig;
if (is_enabled $AIX) {
$ifconfig = `ifconfig -a`;
} else {
$ifconfig = `ifconfig`;
}
my $ifconfig = `ifconfig`;
my @ifconfig_array = split("\n", $ifconfig); my @ifconfig_array = split("\n", $ifconfig);
for(my $i = 0; $i<$#ifconfig_array; $i++) { foreach (@ifconfig_array){
if ($_=~/(.*)flags/){
#Check for an interface my $match;
if ($ifconfig_array[$i] =~ /Link/) { ($match)=$_=~/^(.*?)\: flags/;
my %info; $match=~s/://;
push @interfaces,$match;
my @line_split = split(" ", $ifconfig_array[$i]);
#Get interface name
$info{'interface'} = $line_split[0];
#Get IP address
my $line = $ifconfig_array[$i+1];
$line =~ s/\s+//g;
@line_split = split(":", $line);
if($line_split[1] =~ /(\d+\.\d+\.\d+\.\d+).+/) {
$info{'ip'} = $1;
} }
}
$info{'_keys'} = ['interface', 'ip']; foreach (@interfaces) {
my $ifconfig_item=`ifconfig $_`;
my $interface=$_;
my @ip_array = split("\n", $ifconfig_item);
foreach (@ip_array) {
if ($_=~/(?<=inet )(.*)(?= netmask)/){
my $ip;
($ip)=$_=~/inet (.*) netmask/;
my %info;
$info{'interface'} = $interface;
$info{'ip'} = $ip;
$info{'_keys'} = ['interface','ip'];
push (@{$modules->{$name}}, \%info); push (@{$modules->{$name}}, \%info);
}
} }
} }
} }
@ -248,9 +345,33 @@ sub get_ips ($$) {
#Get route table #Get route table
sub get_route_table ($$) { sub get_route_table ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $route_table;
my @table_split;
if (is_enabled $AIX) {
$route_table = `netstat -rn`;
@table_split = split("\n", $route_table);
my $length=scalar @table_split;
for (my $i=4; $i<=$length-4; $i++) {
my $route_table = `route`; my @split = split(" ", $table_split[$i]);
my %info;
$info{'destination'} = $split[0];
$info{'gateway'} = $split[1];
$info{'mask'} = $split[2];
$info{'flags'} = $split[3];
$info{'metric'} = $split[4];
$info{'ref'} = $split[5];
$info{'use'} = $split[6];
$info{'interface'} = $split[7];
$info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface'];
push (@{$modules->{$name}}, \%info);
}
} else {
$route_table = `route`;
my @table_split = split("\n", $route_table); my @table_split = split("\n", $route_table);
for (my $i=2; $i<=$#table_split; $i++) { for (my $i=2; $i<=$#table_split; $i++) {
@ -272,6 +393,7 @@ sub get_route_table ($$) {
push (@{$modules->{$name}}, \%info); push (@{$modules->{$name}}, \%info);
} }
}
} }
# Print module data # Print module data
sub print_module ($$) { sub print_module ($$) {
@ -311,12 +433,16 @@ $interval = $ARGV[0];
if ($#ARGV == 0){ if ($#ARGV == 0){
$enable_all = 1; $enable_all = 1;
} }
if ($interval!=/[:alpha:]/){
splice @ARGV,0,1;
}
foreach my $module (@ARGV) { foreach my $module (@ARGV) {
if ($module eq "all"){ if ($module eq "all"){
$enable_all = 1; $enable_all = 1;
} }else {
$enabled{$module} = 1; $enabled{$module} = 1;
}
} }
# Check execution interval # Check execution interval
@ -333,18 +459,49 @@ close (FILE);
# Retrieve hardware information # Retrieve hardware information
$Mode = 'LSHW'; $Mode = 'LSHW';
$Separator = '\s+\*\-'; $Separator = '\s+\*\-';
my @hwinfo = `lshw 2>/dev/null`; my @hwinfo;
if ($? != 0) { if (is_enabled $AIX) {
$Separator = '^\s*$';
@hwinfo=`prtconf 2>/dev/null`;
} else {
@hwinfo = `lshw 2>/dev/null`;
if ($? != 0) {
$Mode = 'HWINFO'; $Mode = 'HWINFO';
$Separator = 'Hardware Class:'; $Separator = 'Hardware Class:';
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; @hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`;
}
} }
# Parse hardware information
my %modules; my %modules;
while (my $line = shift (@hwinfo)) {
chomp ($line);
if (is_enabled $AIX) {
#CPU
# VIDEO
### Not avilable in AIX ###
# NIC
### Not relevant in AIX ###
if ((test_contain('ent',\@hwinfo)) && ($enable_all == 1 || $enabled{'nic'} == 1)) {
get_module_data_aix ('NIC',\@hwinfo,'^ent',\%modules);
}
if ((test_contain('hdisk',\@hwinfo)) && ($enable_all == 1 || $enabled{'hd'} == 1)) {
get_module_data_aix ('HD',\@hwinfo,'^hdisk',\%modules);
}
foreach my $line (@hwinfo) {
chomp ($line);
#CPU
if (($line =~ /^Memory Size:/) && ($enable_all == 1 || $enabled{'ram'} == 1)) {
get_module_data_aix_ram_cpu ('RAM', \@hwinfo, ['Memory Size','Good Memory Size'], \%modules);
}
if (($line =~ /^System Model/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) {
get_module_data_aix_ram_cpu ('CPU', \@hwinfo, ['System Model', 'Processor Implementation Mode', 'Number Of Processors'], \%modules);
}
}
} else {
# Parse hardware information
while (my $line= shift (@hwinfo)) {
chomp ($line);
# CPU # CPU
if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) { if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
@ -355,7 +512,7 @@ while (my $line = shift (@hwinfo)) {
} }
# RAM # RAM
if (($line =~ /\*\-bank/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { if (($line =~ /\*\-bank/ || $line =~ /\*\-memory/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules);
} else { } else {
@ -401,8 +558,8 @@ while (my $line = shift (@hwinfo)) {
get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules); get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules);
} }
} }
}
} }
# Software # Software
if ($enable_all == 1 || $enabled{'software'} == 1) { if ($enable_all == 1 || $enabled{'software'} == 1) {
get_software_module_data ('Software', \%modules); get_software_module_data ('Software', \%modules);
@ -410,12 +567,12 @@ if ($enable_all == 1 || $enabled{'software'} == 1) {
#init_services #init_services
if ($enable_all == 1 || $enabled{'init_services'} == 1) { if ($enable_all == 1 || $enabled{'init_services'} == 1) {
get_servicies_init_machine ('Init services', \%modules); get_servicies_init_machine ('Init_services', \%modules);
} }
#filesystem #filesystem
if ($enable_all == 1 || $enabled{'filesystem'} == 1) { if ($enable_all == 1 || $enabled{'filesystem'} == 1) {
get_file_system('File system', \%modules); get_file_system('Filesystem', \%modules);
} }
#processes #processes
@ -442,7 +599,6 @@ if ($enable_all == 1 || $enabled{'route'} == 1) {
if ($enable_all == 1 || $enabled{'kernel'} == 1){ if ($enable_all == 1 || $enabled{'kernel'} == 1){
get_kernel_info ('Kernel', \%modules); get_kernel_info ('Kernel', \%modules);
} }
# Print module data # Print module data
print "<inventory>\n"; print "<inventory>\n";
while (my ($name, $module) = each (%modules)) { while (my ($name, $module) = each (%modules)) {

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190429} {190508}
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.734(Build 190429)") #define PANDORA_VERSION ("7.0NG.734(Build 190508)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.734(Build 190429))" VALUE "ProductVersion", "(7.0NG.734(Build 190508))"
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.734-190429 Version: 7.0NG.734-190508
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.734-190429" pandora_version="7.0NG.734-190508"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
// Load global vars // Load global vars.
global $config; global $config;
enterprise_include('godmode/agentes/configurar_agente.php'); enterprise_include('godmode/agentes/configurar_agente.php');
@ -23,10 +23,10 @@ ui_require_javascript_file('encode_decode_base64');
check_login(); check_login();
// Get tab parameter to check ACL in each tabs // Get tab parameter to check ACL in each tabs.
$tab = get_parameter('tab', 'main'); $tab = get_parameter('tab', 'main');
// See if id_agente is set (either POST or GET, otherwise -1 // See if id_agente is set (either POST or GET, otherwise -1.
$id_agente = (int) get_parameter('id_agente'); $id_agente = (int) get_parameter('id_agente');
$group = 0; $group = 0;
$all_groups = [$group]; $all_groups = [$group];
@ -46,6 +46,7 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
break; break;
default: default:
// Default.
break; break;
} }
@ -63,11 +64,11 @@ require_once 'include/functions_modules.php';
require_once 'include/functions_alerts.php'; require_once 'include/functions_alerts.php';
require_once 'include/functions_reporting.php'; require_once 'include/functions_reporting.php';
// Get passed variables // Get passed variables.
$alerttype = get_parameter('alerttype'); $alerttype = get_parameter('alerttype');
$id_agent_module = (int) get_parameter('id_agent_module'); $id_agent_module = (int) get_parameter('id_agent_module');
// Init vars // Init vars.
$descripcion = ''; $descripcion = '';
$comentarios = ''; $comentarios = '';
$campo_1 = ''; $campo_1 = '';
@ -137,7 +138,7 @@ $alert_priority = 0;
$server_name = ''; $server_name = '';
$grupo = 0; $grupo = 0;
$id_os = 9; $id_os = 9;
// Windows // Windows.
$custom_id = ''; $custom_id = '';
$cascade_protection = 0; $cascade_protection = 0;
$cascade_protection_modules = 0; $cascade_protection_modules = 0;
@ -156,7 +157,7 @@ $cps = 0;
$create_agent = (bool) get_parameter('create_agent'); $create_agent = (bool) get_parameter('create_agent');
$module_macros = []; $module_macros = [];
// Create agent // Create agent.
if ($create_agent) { if ($create_agent) {
$mssg_warning = 0; $mssg_warning = 0;
$alias_safe_output = io_safe_output(get_parameter('alias', '')); $alias_safe_output = io_safe_output(get_parameter('alias', ''));
@ -165,14 +166,14 @@ if ($create_agent) {
$direccion_agente = (string) get_parameter_post('direccion', ''); $direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0); $unique_ip = (int) get_parameter_post('unique_ip', 0);
// safe_output only validate ip // Safe_output only validate ip.
$direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = trim(io_safe_output($direccion_agente));
if (!validate_address($direccion_agente)) { if (!validate_address($direccion_agente)) {
$mssg_warning = 1; $mssg_warning = 1;
} }
// safe-input before validate ip // Safe-input before validate ip.
$direccion_agente = io_safe_input($direccion_agente); $direccion_agente = io_safe_input($direccion_agente);
$nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $nombre_agente = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
@ -208,7 +209,7 @@ if ($create_agent) {
$field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], ''); $field_values[$field['id_field']] = (string) get_parameter_post('customvalue_'.$field['id_field'], '');
} }
// Check if agent exists (BUG WC-50518-2) // Check if agent exists (BUG WC-50518-2).
if ($alias == '') { if ($alias == '') {
$agent_creation_error = __('No agent alias specified'); $agent_creation_error = __('No agent alias specified');
$agent_created_ok = 0; $agent_created_ok = 0;
@ -256,7 +257,7 @@ if ($create_agent) {
} }
if ($id_agente !== false) { if ($id_agente !== false) {
// Create custom fields for this agent // Create custom fields for this agent.
foreach ($field_values as $key => $value) { foreach ($field_values as $key => $value) {
$update_custom = db_process_sql_insert( $update_custom = db_process_sql_insert(
'tagent_custom_data', 'tagent_custom_data',
@ -268,7 +269,7 @@ if ($create_agent) {
); );
} }
// Create address for this agent in taddress // Create address for this agent in taddress.
if ($direccion_agente != '') { if ($direccion_agente != '') {
agents_add_address($id_agente, $direccion_agente); agents_add_address($id_agente, $direccion_agente);
} }
@ -311,7 +312,7 @@ if ($create_agent) {
"Quiet":"'.(int) $quiet.'", "Quiet":"'.(int) $quiet.'",
"Cps":"'.(int) $cps.'"}'; "Cps":"'.(int) $cps.'"}';
// Create the secondary groups // Create the secondary groups.
enterprise_hook( enterprise_hook(
'agents_update_secondary_groups', 'agents_update_secondary_groups',
[ [
@ -341,14 +342,14 @@ if ($create_agent) {
} }
} }
// Show tabs // Show tabs.
$img_style = [ $img_style = [
'class' => 'top', 'class' => 'top',
'width' => 16, 'width' => 16,
]; ];
if ($id_agente) { if ($id_agente) {
// View tab // View tab.
$viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>'; $viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
if ($tab == 'view') { if ($tab == 'view') {
@ -359,7 +360,7 @@ if ($id_agente) {
$viewtab['operation'] = 1; $viewtab['operation'] = 1;
// Main tab // Main tab.
$maintab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup')]).'</a>'; $maintab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_setup.png', true, ['title' => __('Setup')]).'</a>';
if ($tab == 'main') { if ($tab == 'main') {
$maintab['active'] = true; $maintab['active'] = true;
@ -367,7 +368,7 @@ if ($id_agente) {
$maintab['active'] = false; $maintab['active'] = false;
} }
// Module tab // Module tab.
$moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_modules.png', true, ['title' => __('Modules')]).'</a>'; $moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_modules.png', true, ['title' => __('Modules')]).'</a>';
if ($tab == 'module') { if ($tab == 'module') {
@ -376,7 +377,7 @@ if ($id_agente) {
$moduletab['active'] = false; $moduletab['active'] = false;
} }
// Alert tab // Alert tab.
$alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_alerts.png', true, ['title' => __('Alerts')]).'</a>'; $alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image('images/gm_alerts.png', true, ['title' => __('Alerts')]).'</a>';
if ($tab == 'alert') { if ($tab == 'alert') {
@ -385,7 +386,7 @@ if ($id_agente) {
$alerttab['active'] = false; $alerttab['active'] = false;
} }
// Template tab // Template tab.
$templatetab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">'.html_print_image('images/templates.png', true, ['title' => __('Module templates')]).'</a>'; $templatetab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">'.html_print_image('images/templates.png', true, ['title' => __('Module templates')]).'</a>';
if ($tab == 'template') { if ($tab == 'template') {
@ -395,7 +396,7 @@ if ($id_agente) {
} }
// Inventory // Inventory.
$inventorytab = enterprise_hook('inventory_tab'); $inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1) { if ($inventorytab == -1) {
@ -412,7 +413,7 @@ if ($id_agente) {
} }
if ($has_remote_conf === true) { if ($has_remote_conf === true) {
// Plugins // Plugins.
$pluginstab = enterprise_hook('plugins_tab'); $pluginstab = enterprise_hook('plugins_tab');
if ($pluginstab == -1) { if ($pluginstab == -1) {
$pluginstab = ''; $pluginstab = '';
@ -421,21 +422,21 @@ if ($id_agente) {
$pluginstab = ''; $pluginstab = '';
} }
// Collection // Collection.
$collectiontab = enterprise_hook('collection_tab'); $collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) { if ($collectiontab == -1) {
$collectiontab = ''; $collectiontab = '';
} }
// Group tab // Group tab.
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image('images/group.png', true, [ 'title' => __('Group')]).'</a>'; $grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image('images/group.png', true, [ 'title' => __('Group')]).'</a>';
$grouptab['active'] = false; $grouptab['active'] = false;
$gistab = []; $gistab = [];
// GIS tab // GIS tab.
if ($config['activate_gis']) { if ($config['activate_gis']) {
$gistab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image('images/gm_gis.png', true, [ 'title' => __('GIS data')]).'</a>'; $gistab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image('images/gm_gis.png', true, [ 'title' => __('GIS data')]).'</a>';
@ -446,10 +447,10 @@ if ($id_agente) {
} }
} }
// Agent wizard tab // Agent wizard tab.
$agent_wizard['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image('images/wand_agent.png', true, [ 'title' => __('Agent wizard')]).'</a>'; $agent_wizard['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image('images/wand_agent.png', true, [ 'title' => __('Agent wizard')]).'</a>';
// Hidden subtab layer // Hidden subtab layer.
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu" style="display:none; float:none;">'; $agent_wizard['sub_menu'] = '<ul class="mn subsubmenu" style="display:none; float:none;">';
$agent_wizard['sub_menu'] .= '<li class="nomn tab_godmode" style="text-align: center;">'; $agent_wizard['sub_menu'] .= '<li class="nomn tab_godmode" style="text-align: center;">';
$agent_wizard['sub_menu'] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_explorer&id_agente='.$id_agente.'">'.html_print_image('images/wand_snmp.png', true, [ 'title' => __('SNMP Wizard')]).'</a>'; $agent_wizard['sub_menu'] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_explorer&id_agente='.$id_agente.'">'.html_print_image('images/wand_snmp.png', true, [ 'title' => __('SNMP Wizard')]).'</a>';
@ -471,7 +472,7 @@ if ($id_agente) {
$total_incidents = agents_get_count_incidents($id_agente); $total_incidents = agents_get_count_incidents($id_agente);
// Incident tab // Incident tab.
if ($total_incidents > 0) { if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image('images/book_edit.png', true, ['title' => __('Incidents')]).'</a>'; $incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image('images/book_edit.png', true, ['title' => __('Incidents')]).'</a>';
@ -532,7 +533,7 @@ if ($id_agente) {
]; ];
} }
// Only if the agent has incidents associated show incidents tab // Only if the agent has incidents associated show incidents tab.
if ($total_incidents) { if ($total_incidents) {
$onheader['incident'] = $incidenttab; $onheader['incident'] = $incidenttab;
} }
@ -545,7 +546,7 @@ if ($id_agente) {
]; ];
} }
// Extensions tabs // Extensions tabs.
foreach ($config['extensions'] as $extension) { foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_god_tab'])) { if (isset($extension['extension_god_tab'])) {
if (check_acl($config['id_user'], $group, $extension['extension_god_tab']['acl'])) { if (check_acl($config['id_user'], $group, $extension['extension_god_tab']['acl'])) {
@ -574,7 +575,7 @@ if ($id_agente) {
} }
$help_header = ''; $help_header = '';
// This add information to the header // This add information to the header.
switch ($tab) { switch ($tab) {
case 'main': case 'main':
$tab_description = '- '.__('Setup'); $tab_description = '- '.__('Setup');
@ -639,6 +640,10 @@ if ($id_agente) {
case 'wmi_explorer': case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard'); $tab_description = '- '.__('WMI Wizard');
break; break;
default:
// Default.
break;
} }
break; break;
@ -649,10 +654,15 @@ if ($id_agente) {
$tab_description = '- '.__('SNMP explorer'); $tab_description = '- '.__('SNMP explorer');
$help_header = 'snmp_explorer'; $help_header = 'snmp_explorer';
break; break;
default:
// Default.
break;
} }
break; break;
default: default:
// Default.
break; break;
} }
@ -668,7 +678,7 @@ if ($id_agente) {
$config['item_title_size_text'] $config['item_title_size_text']
); );
} else { } else {
// Create agent // Create agent.
ui_print_page_header( ui_print_page_header(
__('Agent manager'), __('Agent manager'),
'images/bricks.png', 'images/bricks.png',
@ -682,12 +692,12 @@ $delete_conf_file = (bool) get_parameter('delete_conf_file');
if ($delete_conf_file) { if ($delete_conf_file) {
$correct = false; $correct = false;
// Delete remote configuration // Delete remote configuration.
if (isset($config['remote_config'])) { if (isset($config['remote_config'])) {
$agent_md5 = md5(io_safe_output(agents_get_name($id_agente, 'none')), false); $agent_md5 = md5(io_safe_output(agents_get_name($id_agente, 'none')), false);
if (file_exists($config['remote_config'].'/md5/'.$agent_md5.'.md5')) { if (file_exists($config['remote_config'].'/md5/'.$agent_md5.'.md5')) {
// Agent remote configuration editor // Agent remote configuration editor.
$file_name = $config['remote_config'].'/conf/'.$agent_md5.'.conf'; $file_name = $config['remote_config'].'/conf/'.$agent_md5.'.conf';
$correct = @unlink($file_name); $correct = @unlink($file_name);
@ -703,7 +713,7 @@ if ($delete_conf_file) {
); );
} }
// Show agent creation results // Show agent creation results.
if ($create_agent) { if ($create_agent) {
if (!isset($agent_creation_error)) { if (!isset($agent_creation_error)) {
$agent_creation_error = __('Could not be created'); $agent_creation_error = __('Could not be created');
@ -720,17 +730,17 @@ if ($create_agent) {
} }
} }
// Fix / Normalize module data // Fix / Normalize module data.
if (isset($_GET['fix_module'])) { if (isset($_GET['fix_module'])) {
$id_module = get_parameter_get('fix_module', 0); $id_module = get_parameter_get('fix_module', 0);
// get info about this module // Get info about this module.
$media = reporting_get_agentmodule_data_average($id_module, 30758400); $media = reporting_get_agentmodule_data_average($id_module, 30758400);
// Get average over the year // Get average over the year.
$media *= 1.3; $media *= 1.3;
$error = ''; $error = '';
$result = true; $result = true;
// If the value of media is 0 or something went wrong, don't delete // If the value of media is 0 or something went wrong, don't delete.
if (!empty($media)) { if (!empty($media)) {
$where = [ $where = [
'datos' => '>'.$media, 'datos' => '>'.$media,
@ -759,9 +769,9 @@ if (isset($_GET['fix_module'])) {
$update_agent = (bool) get_parameter('update_agent'); $update_agent = (bool) get_parameter('update_agent');
// Update AGENT // Update AGENT.
if ($update_agent) { if ($update_agent) {
// if modified some agent paramenter // If modified some agent paramenter.
$mssg_warning = 0; $mssg_warning = 0;
$id_agente = (int) get_parameter_post('id_agente'); $id_agente = (int) get_parameter_post('id_agente');
$nombre_agente = str_replace('`', '&lsquo;', (string) get_parameter_post('agente', '')); $nombre_agente = str_replace('`', '&lsquo;', (string) get_parameter_post('agente', ''));
@ -770,14 +780,14 @@ if ($update_agent) {
$alias_as_name = (int) get_parameter_post('alias_as_name', 0); $alias_as_name = (int) get_parameter_post('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post('direccion', ''); $direccion_agente = (string) get_parameter_post('direccion', '');
$unique_ip = (int) get_parameter_post('unique_ip', 0); $unique_ip = (int) get_parameter_post('unique_ip', 0);
// safe_output only validate ip // Safe_output only validate ip.
$direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = trim(io_safe_output($direccion_agente));
if (!validate_address($direccion_agente)) { if (!validate_address($direccion_agente)) {
$mssg_warning = 1; $mssg_warning = 1;
} }
// safe-input before validate ip // Safe-input before validate ip.
$direccion_agente = io_safe_input($direccion_agente); $direccion_agente = io_safe_input($direccion_agente);
$address_list = (string) get_parameter_post('address_list', ''); $address_list = (string) get_parameter_post('address_list', '');
@ -786,10 +796,13 @@ if ($update_agent) {
&& $direccion_agente == agents_get_address($id_agente) && $direccion_agente == agents_get_address($id_agente)
&& $address_list != agents_get_address($id_agente) && $address_list != agents_get_address($id_agente)
) { ) {
// If we selected another IP in the drop down list to be 'primary': /*
// a) field is not the same as selectbox * If we selected another IP in the drop down list to be 'primary':
// b) field has not changed from current IP * a) field is not the same as selectbox
// c) selectbox is not the current IP * b) field has not changed from current IP
* c) selectbox is not the current IP.
*/
if (!empty($address_list)) { if (!empty($address_list)) {
$direccion_agente = $address_list; $direccion_agente = $address_list;
} }
@ -799,7 +812,7 @@ if ($update_agent) {
$intervalo = (int) get_parameter_post('intervalo', SECONDS_5MINUTES); $intervalo = (int) get_parameter_post('intervalo', SECONDS_5MINUTES);
$comentarios = str_replace('`', '&lsquo;', (string) get_parameter_post('comentarios', '')); $comentarios = str_replace('`', '&lsquo;', (string) get_parameter_post('comentarios', ''));
$modo = (int) get_parameter_post('modo', 0); $modo = (int) get_parameter_post('modo', 0);
// Mode: Learning, Normal or Autodisabled // Mode: Learning, Normal or Autodisabled.
$id_os = (int) get_parameter_post('id_os'); $id_os = (int) get_parameter_post('id_os');
$disabled = (bool) get_parameter_post('disabled'); $disabled = (bool) get_parameter_post('disabled');
$server_name = (string) get_parameter_post('server_name', ''); $server_name = (string) get_parameter_post('server_name', '');
@ -837,7 +850,7 @@ if ($update_agent) {
); );
if ($old_value === false) { if ($old_value === false) {
// Create custom field if not exist // Create custom field if not exist.
$update_custom = db_process_sql_insert( $update_custom = db_process_sql_insert(
'tagent_custom_data', 'tagent_custom_data',
[ [
@ -866,10 +879,10 @@ if ($update_agent) {
ui_print_warning_message(__('The ip or dns name entered cannot be resolved')); ui_print_warning_message(__('The ip or dns name entered cannot be resolved'));
} }
// Verify if there is another agent with the same name but different ID // Verify if there is another agent with the same name but different ID.
if ($alias == '') { if ($alias == '') {
ui_print_error_message(__('No agent alias specified')); ui_print_error_message(__('No agent alias specified'));
// If there is an agent with the same name, but a different ID // If there is an agent with the same name, but a different ID.
} }
if ($unique_ip && $direccion_agente != '') { if ($unique_ip && $direccion_agente != '') {
@ -882,7 +895,7 @@ if ($update_agent) {
} else if ($exists_ip) { } else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address')); ui_print_error_message(__('Duplicate main IP address'));
} else { } else {
// If different IP is specified than previous, add the IP // If different IP is specified than previous, add the IP.
if ($direccion_agente != '' if ($direccion_agente != ''
&& $direccion_agente != agents_get_address($id_agente) && $direccion_agente != agents_get_address($id_agente)
) { ) {
@ -890,7 +903,7 @@ if ($update_agent) {
} }
$action_delete_ip = (bool) get_parameter('delete_ip', false); $action_delete_ip = (bool) get_parameter('delete_ip', false);
// If IP is set for deletion, delete first // If IP is set for deletion, delete first.
if ($action_delete_ip) { if ($action_delete_ip) {
$delete_ip = get_parameter_post('address_list'); $delete_ip = get_parameter_post('address_list');
@ -939,11 +952,11 @@ if ($update_agent) {
__('There was a problem updating the agent') __('There was a problem updating the agent')
); );
} else { } else {
// Update the agent from the metaconsole cache // Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
enterprise_hook('agent_update_from_cache', [$id_agente, $values, $server_name]); enterprise_hook('agent_update_from_cache', [$id_agente, $values, $server_name]);
// Update the configuration files // Update the configuration files.
if ($old_values['intervalo'] != $intervalo) { if ($old_values['intervalo'] != $intervalo) {
enterprise_hook( enterprise_hook(
'config_agents_update_config_token', 'config_agents_update_config_token',
@ -1057,9 +1070,9 @@ if ($update_agent) {
} }
// Read agent data // Read agent data
// This should be at the end of all operation checks, to read the changes - $id_agente doesn't have to be retrieved // This should be at the end of all operation checks, to read the changes - $id_agente doesn't have to be retrieved.
if ($id_agente) { if ($id_agente) {
// This has been done in the beginning of the page, but if an agent was created, this id might change // This has been done in the beginning of the page, but if an agent was created, this id might change.
$id_grupo = agents_get_agent_group($id_agente); $id_grupo = agents_get_agent_group($id_agente);
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && !check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) { if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && !check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
db_pandora_audit('ACL Violation', 'Trying to admin an agent without access'); db_pandora_audit('ACL Violation', 'Trying to admin an agent without access');
@ -1067,15 +1080,15 @@ if ($id_agente) {
exit; exit;
} }
$agent = db_get_row('tagente', 'id_agente', $id_agente); $agent = db_get_row('tagente', 'id_agente', $id_agente, false, false);
if (empty($agent)) { if (empty($agent)) {
// Close out the page // Close out the page.
ui_print_error_message(__('There was a problem loading the agent')); ui_print_error_message(__('There was a problem loading the agent'));
return; return;
} }
$intervalo = $agent['intervalo']; $intervalo = $agent['intervalo'];
// Define interval in seconds // Define interval in seconds.
$nombre_agente = $agent['nombre']; $nombre_agente = $agent['nombre'];
if (empty($alias)) { if (empty($alias)) {
$alias = $agent['alias']; $alias = $agent['alias'];
@ -1111,11 +1124,11 @@ $create_module = (bool) get_parameter('create_module');
$delete_module = (bool) get_parameter('delete_module'); $delete_module = (bool) get_parameter('delete_module');
$enable_module = (int) get_parameter('enable_module'); $enable_module = (int) get_parameter('enable_module');
$disable_module = (int) get_parameter('disable_module'); $disable_module = (int) get_parameter('disable_module');
// It is the id_agent_module to duplicate // It is the id_agent_module to duplicate.
$duplicate_module = (int) get_parameter('duplicate_module'); $duplicate_module = (int) get_parameter('duplicate_module');
$edit_module = (bool) get_parameter('edit_module'); $edit_module = (bool) get_parameter('edit_module');
// GET DATA for MODULE UPDATE OR MODULE INSERT // GET DATA for MODULE UPDATE OR MODULE INSERT.
if ($update_module || $create_module) { if ($update_module || $create_module) {
$id_grupo = agents_get_agent_group($id_agente); $id_grupo = agents_get_agent_group($id_agente);
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo); $all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
@ -1136,9 +1149,12 @@ if ($update_module || $create_module) {
$id_module_group = (int) get_parameter('id_module_group'); $id_module_group = (int) get_parameter('id_module_group');
$flag = (bool) get_parameter('flag'); $flag = (bool) get_parameter('flag');
// Don't read as (float) because it lost it's decimals when put into MySQL /*
// where are very big and PHP uses scientific notation, p.e: * Don't read as (float) because it lost it's decimals when put into MySQL
// 1.23E-10 is 0.000000000123 * where are very big and PHP uses scientific notation, p.e:
* 1.23E-10 is 0.000000000123.
*/
$post_process = (string) get_parameter('post_process', 0.0); $post_process = (string) get_parameter('post_process', 0.0);
if (get_parameter('prediction_module')) { if (get_parameter('prediction_module')) {
$prediction_module = 1; $prediction_module = 1;
@ -1160,7 +1176,7 @@ if ($update_module || $create_module) {
$tcp_send = (string) get_parameter('tcp_send'); $tcp_send = (string) get_parameter('tcp_send');
$tcp_rcv = (string) get_parameter('tcp_rcv'); $tcp_rcv = (string) get_parameter('tcp_rcv');
$tcp_port = (int) get_parameter('tcp_port'); $tcp_port = (int) get_parameter('tcp_port');
// Correction in order to not insert 0 as port // Correction in order to not insert 0 as port.
$is_port_empty = get_parameter('tcp_port', ''); $is_port_empty = get_parameter('tcp_port', '');
if ($is_port_empty === '') { if ($is_port_empty === '') {
$tcp_port = null; $tcp_port = null;
@ -1186,7 +1202,7 @@ if ($update_module || $create_module) {
} }
if ($id_module_type == 25) { if ($id_module_type == 25) {
// web analysis, from MODULE_WUX // web analysis, from MODULE_WUX.
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default)); $custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default); $custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
} else { } else {
@ -1198,7 +1214,7 @@ if ($update_module || $create_module) {
$custom_string_3 = (string) get_parameter('custom_string_3', $custom_string_3_default); $custom_string_3 = (string) get_parameter('custom_string_3', $custom_string_3_default);
$custom_integer_2 = (int) get_parameter('custom_integer_2', 0); $custom_integer_2 = (int) get_parameter('custom_integer_2', 0);
// Get macros // Get macros.
$macros = (string) get_parameter('macros'); $macros = (string) get_parameter('macros');
if (!empty($macros)) { if (!empty($macros)) {
@ -1225,7 +1241,8 @@ if ($update_module || $create_module) {
if (preg_match('/^module_name\s*(.*)/', $line, $match)) { if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
$new_configuration_data .= 'module_name '.io_safe_output($name)."\n"; $new_configuration_data .= 'module_name '.io_safe_output($name)."\n";
} }
// We delete from conf all the module macros starting with _field
// We delete from conf all the module macros starting with _field.
else if (!preg_match('/^module_macro_field.*/', $line, $match)) { else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
$new_configuration_data .= "$line\n"; $new_configuration_data .= "$line\n";
} }
@ -1243,14 +1260,6 @@ if ($update_module || $create_module) {
$new_configuration_data = str_replace('module_end', $macros_for_data.'module_end', $new_configuration_data); $new_configuration_data = str_replace('module_end', $macros_for_data.'module_end', $new_configuration_data);
} }
/*
$macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST));
if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') {
// Add macros to configuration file
$new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data);
}
*/
$configuration_data = str_replace( $configuration_data = str_replace(
'\\', '\\',
'&#92;', '&#92;',
@ -1269,16 +1278,16 @@ if ($update_module || $create_module) {
$snmp_community = (string) get_parameter('snmp_community'); $snmp_community = (string) get_parameter('snmp_community');
$snmp_oid = (string) get_parameter('snmp_oid'); $snmp_oid = (string) get_parameter('snmp_oid');
// Change double quotes by single // Change double quotes by single.
$snmp_oid = preg_replace('/&quot;/', '&#039;', $snmp_oid); $snmp_oid = preg_replace('/&quot;/', '&#039;', $snmp_oid);
if (empty($snmp_oid)) { if (empty($snmp_oid)) {
// The user did not set any OID manually but did a SNMP walk // The user did not set any OID manually but did a SNMP walk.
$snmp_oid = (string) get_parameter('select_snmp_oid'); $snmp_oid = (string) get_parameter('select_snmp_oid');
} }
if ($id_module_type >= 15 && $id_module_type <= 18) { if ($id_module_type >= 15 && $id_module_type <= 18) {
// New support for snmp v3 // New support for snmp v3.
$tcp_send = (string) get_parameter('snmp_version'); $tcp_send = (string) get_parameter('snmp_version');
$plugin_user = (string) get_parameter('snmp3_auth_user'); $plugin_user = (string) get_parameter('snmp3_auth_user');
$plugin_pass = io_input_password((string) get_parameter('snmp3_auth_pass')); $plugin_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
@ -1410,15 +1419,25 @@ if ($update_module || $create_module) {
$module_macro_values = (array) get_parameter('module_macro_values', []); $module_macro_values = (array) get_parameter('module_macro_values', []);
$module_macros = modules_get_module_macros_json($module_macro_names, $module_macro_values); $module_macros = modules_get_module_macros_json($module_macro_names, $module_macro_values);
// Make changes in the conf file if necessary // Make changes in the conf file if necessary.
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]); $module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]); $module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
if ((!$module_in_policy && !$module_linked ) if ((!$module_in_policy && !$module_linked && $update_module)
|| ( $module_in_policy && !$module_linked ) || ( $module_in_policy && !$module_linked && $update_module)
) { ) {
enterprise_hook(
'config_agents_update_module_in_conf',
[
$id_agente,
io_safe_output($old_configuration_data),
io_safe_output($configuration_data),
$disabled,
]
);
} else {
enterprise_hook( enterprise_hook(
'config_agents_write_module_in_conf', 'config_agents_write_module_in_conf',
[ [
@ -1431,7 +1450,7 @@ if ($update_module || $create_module) {
} }
} }
// MODULE UPDATE // MODULE UPDATE.
if ($update_module) { if ($update_module) {
$id_agent_module = (int) get_parameter('id_agent_module'); $id_agent_module = (int) get_parameter('id_agent_module');
@ -1517,7 +1536,7 @@ if ($update_module) {
} }
} }
// In local modules, the interval is updated by agent // In local modules, the interval is updated by agent.
$module_kind = (int) get_parameter('moduletype'); $module_kind = (int) get_parameter('moduletype');
if ($module_kind == MODULE_DATA) { if ($module_kind == MODULE_DATA) {
unset($values['module_interval']); unset($values['module_interval']);
@ -1586,7 +1605,7 @@ if ($update_module) {
); );
} }
// Update the module interval // Update the module interval.
cron_update_module_interval($id_agent_module, $cron_interval); cron_update_module_interval($id_agent_module, $cron_interval);
ui_print_success_message(__('Module successfully updated')); ui_print_success_message(__('Module successfully updated'));
@ -1605,8 +1624,7 @@ if ($update_module) {
} }
} }
// MODULE INSERT // MODULE INSERT.
// =================
if ($create_module) { if ($create_module) {
if (isset($_POST['combo_snmp_oid'])) { if (isset($_POST['combo_snmp_oid'])) {
$combo_snmp_oid = get_parameter_post('combo_snmp_oid'); $combo_snmp_oid = get_parameter_post('combo_snmp_oid');
@ -1630,6 +1648,10 @@ if ($create_module) {
$description = ' '; $description = ' ';
} }
break; break;
default:
// Default.
break;
} }
$values = [ $values = [
@ -1755,7 +1777,7 @@ if ($create_module) {
enterprise_hook('modules_create_synthetic_operations', [$id_agent_module, $serialize_ops]); enterprise_hook('modules_create_synthetic_operations', [$id_agent_module, $serialize_ops]);
} }
// Update the module interval // Update the module interval.
cron_update_module_interval($id_agent_module, $cron_interval); cron_update_module_interval($id_agent_module, $cron_interval);
ui_print_success_message(__('Module added successfully')); ui_print_success_message(__('Module added successfully'));
@ -1776,7 +1798,7 @@ if ($create_module) {
} }
// MODULE DELETION // MODULE DELETION
// ================= // =================.
if ($delete_module) { if ($delete_module) {
// DELETE agent module ! // DELETE agent module !
$id_borrar_modulo = (int) get_parameter_get('delete_module', 0); $id_borrar_modulo = (int) get_parameter_get('delete_module', 0);
@ -1812,7 +1834,7 @@ if ($delete_module) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_borrar_modulo), modules_get_agentmodule_name($id_borrar_modulo)]); enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_borrar_modulo), modules_get_agentmodule_name($id_borrar_modulo)]);
// Init transaction // Init transaction.
$error = 0; $error = 0;
// First delete from tagente_modulo -> if not successful, increment // First delete from tagente_modulo -> if not successful, increment
@ -1831,7 +1853,7 @@ if ($delete_module) {
if ($result === false) { if ($result === false) {
$error++; $error++;
} else { } else {
// Set flag to update module status count // Set flag to update module status count.
db_process_sql( db_process_sql(
'UPDATE tagente 'UPDATE tagente
SET update_module_count = 1, update_alert_count = 1 SET update_module_count = 1, update_alert_count = 1
@ -1873,7 +1895,7 @@ if ($delete_module) {
} }
// Trick to detect if we are deleting a synthetic module (avg or arithmetic) // Trick to detect if we are deleting a synthetic module (avg or arithmetic)
// If result is empty then module doesn't have this type of submodules // If result is empty then module doesn't have this type of submodules.
$ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_borrar_modulo]); $ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_borrar_modulo]);
$result_ops_synthetic = json_decode($ops_json); $result_ops_synthetic = json_decode($ops_json);
if (!empty($result_ops_synthetic)) { if (!empty($result_ops_synthetic)) {
@ -1881,18 +1903,17 @@ if ($delete_module) {
if ($result === false) { if ($result === false) {
$error++; $error++;
} }
} //end if } else {
else {
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_borrar_modulo]); $result_components = enterprise_hook('modules_get_synthetic_components', [$id_borrar_modulo]);
$count_components = 1; $count_components = 1;
if (!empty($result_components)) { if (!empty($result_components)) {
// Get number of components pending to delete to know when it's needed to update orders // Get number of components pending to delete to know when it's needed to update orders.
$num_components = count($result_components); $num_components = count($result_components);
$last_target_module = 0; $last_target_module = 0;
foreach ($result_components as $id_target_module) { foreach ($result_components as $id_target_module) {
// Detects change of component or last component to update orders // Detects change of component or last component to update orders.
if (($count_components == $num_components) if (($count_components == $num_components)
or ($last_target_module != $id_target_module) || ($last_target_module != $id_target_module)
) { ) {
$update_orders = true; $update_orders = true;
} else { } else {
@ -1911,7 +1932,7 @@ if ($delete_module) {
} }
} }
// Check for errors // Check for errors.
if ($error != 0) { if ($error != 0) {
ui_print_error_message(__('There was a problem deleting the module')); ui_print_error_message(__('There was a problem deleting the module'));
} else { } else {
@ -1929,7 +1950,7 @@ if ($delete_module) {
} }
// MODULE DUPLICATION // MODULE DUPLICATION
// ================== // ==================.
if (!empty($duplicate_module)) { if (!empty($duplicate_module)) {
// DUPLICATE agent module ! // DUPLICATE agent module !
$id_duplicate_module = $duplicate_module; $id_duplicate_module = $duplicate_module;
@ -1976,7 +1997,7 @@ if (!empty($duplicate_module)) {
} }
// MODULE ENABLE/DISABLE // MODULE ENABLE/DISABLE
// ===================== // =====================.
if ($enable_module) { if ($enable_module) {
$result = modules_change_disabled($enable_module, 0); $result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.''); $modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
@ -2016,7 +2037,7 @@ if ($disable_module) {
} }
// UPDATE GIS // UPDATE GIS
// ========== // ==========.
$updateGIS = get_parameter('update_gis', 0); $updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) { if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data'); $updateGisData = get_parameter('update_gis_data');
@ -2104,9 +2125,8 @@ switch ($tab) {
break; break;
case 'alert': case 'alert':
/* // Because $id_agente is set, it will show only agent alerts.
Because $id_agente is set, it will show only agent alerts */ // This var is for not display create button on alert list.
// This var is for not display create button on alert list
$dont_display_alert_create_bttn = true; $dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php'; include 'godmode/alerts/alert_list.php';
break; break;
@ -2155,7 +2175,7 @@ switch ($tab) {
default: default:
if (enterprise_hook('switch_agent_tab', [$tab])) { if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some // This will make sure that blank pages will have at least some
// debug info in them - do not translate debug // debug info in them - do not translate debug.
ui_print_error_message(__('Invalid tab specified')); ui_print_error_message(__('Invalid tab specified'));
} }
break; break;

View File

@ -243,7 +243,9 @@ $url = ui_get_url_refresh(
'offset' => false, 'offset' => false,
'search_string' => $search_string, 'search_string' => $search_string,
'search_type' => $search_type, 'search_type' => $search_type,
] ],
true,
false
); );
$table = new stdClass(); $table = new stdClass();

View File

@ -200,8 +200,8 @@ if ($config['history_db_enabled'] == 1) {
); );
$time_pandora_db_history = false; $time_pandora_db_history = false;
if ($history_connect !== false) { if ($history_connect) {
if ($config['history_db_connection'] !== false) { if ($config['history_db_connection']) {
$time_pandora_db_history = mysql_db_process_sql( $time_pandora_db_history = mysql_db_process_sql(
$sql, $sql,
'insert_id', 'insert_id',
@ -405,6 +405,8 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$config_history = false;
if ($config['history_db_connection']) {
$history_connect = @mysql_db_process_sql( $history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig', 'SELECT 1 FROM tconfig',
'affected_rows', 'affected_rows',
@ -412,9 +414,7 @@ if ($config['history_db_enabled'] == 1) {
false false
); );
$config_history = false;
if ($history_connect !== false) { if ($history_connect !== false) {
if ($config['history_db_connection'] != false) {
$config_history_array = mysql_db_process_sql( $config_history_array = mysql_db_process_sql(
'SELECT * FROM tconfig', 'SELECT * FROM tconfig',
'affected_rows', 'affected_rows',
@ -427,12 +427,12 @@ if ($config['history_db_enabled'] == 1) {
$config_history[$value['token']] = $value['value']; $config_history[$value['token']] = $value['value'];
} }
} }
}
} else { } else {
echo ui_print_error_message( echo ui_print_error_message(
__('The tconfig table does not exist in the historical database') __('The tconfig table does not exist in the historical database')
); );
} }
}
if ($config_history === false) { if ($config_history === false) {
$config_history = []; $config_history = [];

View File

@ -140,6 +140,162 @@
} }
#box_online { #box_online {
background-color: #e6e6e6; background-image: url("../../images/update_manager_background.jpg");
padding: 10px; background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-color: #fff;
padding: 40px 50px;
border: 1px solid #f3f3f3;
border-radius: 5px;
min-height: 600px;
}
div#box_online * {
font-size: 16pt;
font-family: "Open Sans", sans-serif;
}
#box_online .content {
max-width: 60%;
}
.update_popup {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 10px;
padding-right: 10px;
}
.update_icon {
padding-left: 20px;
}
.update_text h3 {
font-weight: bold;
font-size: 12pt;
}
.update_text p {
font-size: 11pt;
}
.update_text a {
font-size: 11pt;
color: #82b92e !important;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: left !important;
padding-left: 19px;
padding-bottom: 5px;
}
.ui-dialog-buttonset > button.ui-button.ui-corner-all.ui-widget {
background-color: #cecece !important;
border: none !important;
border-radius: 2px !important;
text-transform: uppercase !important;
font-weight: bold !important;
}
.ui-dialog-buttonset > button.success_button.ui-button.ui-corner-all.ui-widget,
.update_manager_button {
background-color: #82b92e !important;
color: #fff !important;
border-radius: 2px !important;
text-transform: uppercase !important;
font-weight: bold !important;
}
a.update_manager_button {
padding: 10px 12px;
margin-top: 10px;
display: inline-flex;
align-items: center;
font-size: 16px !important;
border-radius: 4px !important;
text-decoration: none;
font-family: "Open Sans", sans-serif;
}
a.update_manager_button:after {
content: url(../../images/update_manager_button.png);
padding-left: 10px;
}
.progressbar {
margin-top: 15px;
}
.ui-draggable,
.ui-draggable .ui-dialog-titlebar {
cursor: default !important;
}
#box_online #pkg_version {
color: #82b92e;
font-size: 75pt;
font-weight: bold;
}
/* METACONSOLE */
.box_online_meta {
background: none !important;
min-height: 400px !important;
text-align: center;
border: none !important;
}
div#box_online.box_online_meta * {
font-size: 14pt;
}
#box_online.box_online_meta .content {
max-width: 100%;
}
#box_online.box_online_meta #pkg_version {
font-size: 60pt;
}
/* COMMUNITY */
.update_manager_open {
max-width: 50%;
font-size: 10pt;
margin-top: 40px;
padding: 20px;
border: 1px solid #eaeaea;
border-radius: 5px;
}
.update_manager_warning {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.update_manager_warning p {
font-size: 10pt !important;
}
.update_manager_warning img {
padding-right: 20px;
width: 90px;
}
a.update_manager_button_open {
padding: 5px 10px;
font-size: 16px !important;
border-radius: 4px !important;
text-decoration: none;
border: 1px solid #82b92e;
color: #82b92e;
border-radius: 2px;
}
a.update_manager_button_open:hover {
color: #fff;
background-color: #82b92e;
} }

View File

@ -1,16 +1,22 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== Pandora FMS - http://pandorafms.com
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas * ==================================================
// Please see http://pandorafms.org for full contribution list * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
// This program is free software; you can redistribute it and/or * Please see http://pandorafms.org for full contribution list
// modify it under the terms of the GNU General Public License * This program is free software; you can redistribute it and/or
// as published by the Free Software Foundation; version 2 * modify it under the terms of the GNU General Public License
// This program is distributed in the hope that it will be useful, * as published by the Free Software Foundation; version 2
// but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @package category
* @subpackage category
*/
global $config; global $config;
check_login(); check_login();
@ -61,7 +67,7 @@ if ($memory_limit < 100) {
); );
} }
// Translators: Do not translade Update Manager, it's the name of the program // Translators: Do not translade Update Manager, it's the name of the program.
if (is_metaconsole()) { if (is_metaconsole()) {
echo "<style type='text/css' media='screen'> echo "<style type='text/css' media='screen'>
@import 'styles/meta_pandora.css'; @import 'styles/meta_pandora.css';
@ -69,23 +75,29 @@ if (is_metaconsole()) {
} }
if (is_metaconsole()) { if (is_metaconsole()) {
echo "<div id='box_online' style='float:right;padding-right:400px;padding-top:40px;padding-bottom:40px;' class='cargatextodialogo'>"; $baseurl = ui_get_full_url(false, false, false, false);
echo ' <link rel="stylesheet" type="text/css" href="'.$baseurl.'/godmode/update_manager/update_manager.css">';
echo "<div id='box_online' class='box_online_meta'>";
} else { } else {
echo "<div id='box_online' style='padding-top:40px;padding-bottom:40px;' class='cargatextodialogo'>"; echo "<div id='box_online'>";
} }
echo "<span class='loading' style='font-size:18pt;'>"; echo "<span class='loading' style='font-size:18pt;'>";
echo "<img src='images/wait.gif' />"; echo "<img src='images/wait.gif' />";
echo '</span><br><br>'; echo '</span>';
echo '<div><b>'.__('The latest version of package installed is:').'</b></div><br>'; echo '<p style="font-weight: 600;">'.__('The latest version of package installed is:').'</p>';
echo "<div id='pkg_version' style='color:#82b92e;font-size:40pt;font-weight:bold;'>".$current_package.'</div>'; if ($open) {
echo '<div id="pkg_version" style="font-size:40pt;">'.$build_version.'</div>';
} else {
echo '<div id="pkg_version">'.$current_package.'</div>';
}
echo "<div class='checking_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>"; echo "<div class='checking_package' style='font-size:18pt;width:100%; display: none;'>";
echo __('Checking for the newest package.'); echo __('Checking for the newest package.');
echo '</div>'; echo '</div>';
echo "<div class='downloading_package' style='font-size:18pt;width:100%; text-align: center; display: none;'>"; echo "<div class='downloading_package' style='font-size:18pt;width:100%; display: none;'>";
echo __('Downloading for the newest package.'); echo __('Downloading for the newest package.');
echo '</div>'; echo '</div>';
@ -119,22 +131,26 @@ echo "<div id='pkg_version' style='color:#82b92e;font-size:40pt;font-weight:bold
let you know this does not reflect any change in our opensource mentality of let you know this does not reflect any change in our opensource mentality of
does the last 14 years. does the last 14 years.
------------------------------------------------------------------------- */ -------------------------------------------------------------------------
*/
if ($open) { if ($open) {
echo " echo "<div class='update_manager_open'>
<br><br> <div class='update_manager_warning'>
<div id='updatemodal' class='publienterprisehide' title='Community version' style=''> <div><img src='images/icono_info.png'></div>
<img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/icono_exclamacion_2.png'> <div><p>".__('WARNING: You are just one click away from an automated update. This may result in a damaged system, including loss of data and operativity. Check you have a recent backup. OpenSource updates are automatically created packages, and there is no WARRANTY or SUPPORT. If you need professional support and warranty, please upgrade to Enterprise Version.')."</p></div>
</div> </div>
<br>"; <div style='text-align:center; margin-top:10px;'>
<a class='update_manager_button_open' href='https://pandorafms.com/pandora-fms-enterprise/' target='_blank'>About Enterprise</a>
</div>
</div>";
} }
$enterprise = enterprise_hook('update_manager_enterprise_main'); $enterprise = enterprise_hook('update_manager_enterprise_main');
if ($enterprise == ENTERPRISE_NOT_HOOK) { if ($enterprise == ENTERPRISE_NOT_HOOK) {
// Open view // Open view.
update_manager_main(); update_manager_main();
} }
?> ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

View File

@ -1,17 +1,33 @@
<?php <?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Custom fields View
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
if (check_login()) { if (check_login()) {
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_agents.php';
@ -21,9 +37,18 @@ if (check_login()) {
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
$get_custom_fields_data = (bool) get_parameter('get_custom_fields_data', 0); $get_custom_fields_data = (bool) get_parameter('get_custom_fields_data', 0);
$build_table_custom_fields = (bool) get_parameter('build_table_custom_fields', 0); $build_table_custom_fields = (bool) get_parameter(
$build_table_child_custom_fields = (bool) get_parameter('build_table_child_custom_fields', 0); 'build_table_custom_fields',
$build_table_save_filter = (bool) get_parameter('build_table_save_filter', 0); 0
);
$build_table_child_custom_fields = (bool) get_parameter(
'build_table_child_custom_fields',
0
);
$build_table_save_filter = (bool) get_parameter(
'build_table_save_filter',
0
);
$append_tab_filter = (bool) get_parameter('append_tab_filter', 0); $append_tab_filter = (bool) get_parameter('append_tab_filter', 0);
$create_filter_cf = (bool) get_parameter('create_filter_cf', 0); $create_filter_cf = (bool) get_parameter('create_filter_cf', 0);
$update_filter_cf = (bool) get_parameter('update_filter_cf', 0); $update_filter_cf = (bool) get_parameter('update_filter_cf', 0);
@ -43,9 +68,16 @@ if (check_login()) {
$start = get_parameter('start', 0); $start = get_parameter('start', 0);
$draw = get_parameter('draw', 0); $draw = get_parameter('draw', 0);
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$indexed_descriptions = json_decode(io_safe_output(get_parameter('indexed_descriptions', '')), true); $indexed_descriptions = json_decode(
io_safe_output(
get_parameter('indexed_descriptions', '')
),
true
);
$module_status = get_parameter('module_status');
$id_status = get_parameter('id_status');
// order query // Order query.
$order_column = $order[0]['column']; $order_column = $order[0]['column'];
$type_order = $order[0]['dir']; $type_order = $order[0]['dir'];
switch ($order_column) { switch ($order_column) {
@ -66,27 +98,34 @@ if (check_login()) {
break; break;
} }
// table temporary for save array in table by order and search custom_field data // Table temporary for save array in table
// by order and search custom_field data.
$table_temporary = 'CREATE TEMPORARY TABLE temp_custom_fields ( $table_temporary = 'CREATE TEMPORARY TABLE temp_custom_fields (
id_server int(10), id_server int(10),
id_agent int(10), id_agent int(10),
name_custom_fields varchar(2048), name_custom_fields varchar(2048),
critical_count int,
warning_count int,
unknown_count int,
notinit_count int,
normal_count int,
total_count int,
`status` int(2), `status` int(2),
KEY `data_index_temp_1` (`id_server`, `id_agent`) KEY `data_index_temp_1` (`id_server`, `id_agent`)
)'; )';
db_process_sql($table_temporary); db_process_sql($table_temporary);
// insert values array in table temporary // Insert values array in table temporary.
$values_insert = []; $values_insert = [];
foreach ($indexed_descriptions as $key => $value) { foreach ($indexed_descriptions as $key => $value) {
$values_insert[] = '('.$value['id_server'].', '.$value['id_agente'].", '".$value['description']."', ".$value['status'].')'; $values_insert[] = '('.$value['id_server'].', '.$value['id_agente'].", '".$value['description']."', '".$value['critical_count']."', '".$value['warning_count']."', '".$value['unknown_count']."', '".$value['notinit_count']."', '".$value['normal_count']."', '".$value['total_count']."', ".$value['status'].')';
} }
$values_insert_implode = implode(',', $values_insert); $values_insert_implode = implode(',', $values_insert);
$query_insert = 'INSERT INTO temp_custom_fields VALUES '.$values_insert_implode; $query_insert = 'INSERT INTO temp_custom_fields VALUES '.$values_insert_implode;
db_process_sql($query_insert); db_process_sql($query_insert);
// search table for alias, custom field data, server_name, direction // Search table for alias, custom field data, server_name, direction.
$search_query = ''; $search_query = '';
if ($search['value'] != '') { if ($search['value'] != '') {
$search_query = ' AND (tma.alias LIKE "%'.$search['value'].'%"'; $search_query = ' AND (tma.alias LIKE "%'.$search['value'].'%"';
@ -95,7 +134,61 @@ if (check_login()) {
$search_query .= ' OR temp.name_custom_fields LIKE "%'.$search['value'].'%" ) '; $search_query .= ' OR temp.name_custom_fields LIKE "%'.$search['value'].'%" ) ';
} }
// query all fields result // Search for status module.
$status_agent_search = '';
if (isset($id_status) === true && is_array($id_status) === true) {
if (in_array(-1, $id_status) === false) {
if (in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $id_status) === false) {
$status_agent_search = ' AND temp.status IN ('.implode(',', $id_status).')';
} else {
// Not normal statuses.
$status_agent_search = ' AND temp.status IN (1,2,3,4,5)';
}
}
}
// Search for status module.
$status_module_search = '';
if (isset($module_status) === true && is_array($module_status) === true) {
if (in_array(-1, $module_status) === false) {
if (in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $module_status) === false) {
if (count($module_status) > 0) {
$status_module_search = ' AND ( ';
foreach ($module_status as $key => $value) {
$status_module_search .= ($key != 0) ? ' OR (' : ' (';
switch ($value) {
default:
case AGENT_STATUS_NORMAL:
$status_module_search .= ' temp.normal_count > 0) ';
break;
case AGENT_STATUS_CRITICAL:
$status_module_search .= ' temp.critical_count > 0) ';
break;
case AGENT_STATUS_WARNING:
$status_module_search .= ' temp.warning_count > 0) ';
break;
case AGENT_STATUS_UNKNOWN:
$status_module_search .= ' temp.unknown_count > 0) ';
break;
case AGENT_STATUS_NOT_INIT:
$status_module_search .= ' temp.notinit_count > 0) ';
break;
}
}
$status_module_search .= ' ) ';
}
} else {
// Not normal.
$status_module_search = ' AND ( temp.critical_count > 0 OR temp.warning_count > 0 OR temp.unknown_count > 0 AND temp.notinit_count > 0 )';
}
}
}
// Query all fields result.
$query = sprintf( $query = sprintf(
'SELECT 'SELECT
tma.id_agente, tma.id_agente,
@ -113,9 +206,13 @@ if (check_login()) {
WHERE tma.disabled = 0 WHERE tma.disabled = 0
%s %s
%s %s
%s
%s
LIMIT %d OFFSET %d LIMIT %d OFFSET %d
', ',
$search_query, $search_query,
$status_agent_search,
$status_module_search,
$order_by, $order_by,
$length, $length,
$start $start
@ -123,7 +220,7 @@ if (check_login()) {
$result = db_get_all_rows_sql($query); $result = db_get_all_rows_sql($query);
// query count // Query count.
$query_count = sprintf( $query_count = sprintf(
'SELECT 'SELECT
COUNT(tma.id_agente) AS `count` COUNT(tma.id_agente) AS `count`
@ -133,13 +230,17 @@ if (check_login()) {
AND temp.id_server = tma.id_tmetaconsole_setup AND temp.id_server = tma.id_tmetaconsole_setup
WHERE tma.disabled = 0 WHERE tma.disabled = 0
%s %s
%s
%s
', ',
$search_query $search_query,
$status_agent_search,
$status_module_search
); );
$count = db_get_sql($query_count); $count = db_get_sql($query_count);
// for link nodes. // For link nodes.
$array_nodes = metaconsole_get_connections(); $array_nodes = metaconsole_get_connections();
if (isset($array_nodes) && is_array($array_nodes)) { if (isset($array_nodes) && is_array($array_nodes)) {
$hash_array_nodes = []; $hash_array_nodes = [];
@ -158,20 +259,20 @@ if (check_login()) {
$user_rot13 = str_rot13($config['id_user']); $user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd; $hashdata = $user.$pwd;
$hashdata = md5($hashdata); $hashdata = md5($hashdata);
$url_hash = '&amp;'.'loginhash=auto&amp;'.'loginhash_data='.$hashdata.'&amp;'.'loginhash_user='.$user_rot13; $url_hash = '&amp;loginhash=auto&amp;loginhash_data='.$hashdata.'&amp;loginhash_user='.$user_rot13;
$hash_array_nodes[$server['id']]['hashurl'] = $url_hash; $hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
$hash_array_nodes[$server['id']]['server_url'] = $server['server_url']; $hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
} }
} }
// prepare rows for table dinamic // Prepare rows for table dinamic.
$data = []; $data = [];
foreach ($result as $values) { foreach ($result as $values) {
$image_status = agents_get_image_status($values['status']); $image_status = agents_get_image_status($values['status']);
// link nodes // Link nodes.
$agent_link = '<a href="'.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/'.'index.php?'.'sec=estado&amp;'.'sec2=operation/agentes/ver_agente&amp;'.'id_agente='.$values['id_tagente'].$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'].'">'; $agent_link = '<a href="'.$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$values['id_tagente'].$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'].'">';
$agent_alias = ui_print_truncate_text( $agent_alias = ui_print_truncate_text(
$values['alias'], $values['alias'],
@ -225,7 +326,7 @@ if (check_login()) {
$name_where = " AND tam.nombre LIKE '%".$module_search."%'"; $name_where = " AND tam.nombre LIKE '%".$module_search."%'";
} }
// filter by status module // Filter by status module.
$and_module_status = ''; $and_module_status = '';
if (is_array($module_status)) { if (is_array($module_status)) {
if (!in_array(-1, $module_status)) { if (!in_array(-1, $module_status)) {
@ -260,7 +361,7 @@ if (check_login()) {
$and_module_status .= ' ) '; $and_module_status .= ' ) ';
} }
} else { } else {
// not normal // Not normal.
$and_module_status = 'AND tae.estado <> 0 AND tae.estado <> 300 '; $and_module_status = 'AND tae.estado <> 0 AND tae.estado <> 300 ';
} }
} }
@ -314,7 +415,12 @@ if (check_login()) {
&& $value['id_tipo_modulo'] != 23 && $value['id_tipo_modulo'] != 23
&& $value['id_tipo_modulo'] != 33 && $value['id_tipo_modulo'] != 33
) { ) {
$table_modules->data[$key][1] = remove_right_zeros(number_format($value['datos'], $config['graph_precision'])); $table_modules->data[$key][1] = remove_right_zeros(
number_format(
$value['datos'],
$config['graph_precision']
)
);
} else { } else {
$table_modules->data[$key][1] = $value['datos']; $table_modules->data[$key][1] = $value['datos'];
} }
@ -329,7 +435,10 @@ if (check_login()) {
); );
$table_modules->data[$key][3] = $value['current_interval']; $table_modules->data[$key][3] = $value['current_interval'];
$table_modules->data[$key][4] = ui_print_timestamp($value['utimestamp'], true); $table_modules->data[$key][4] = ui_print_timestamp(
$value['utimestamp'],
true
);
switch ($value['estado']) { switch ($value['estado']) {
case 0: case 0:
case 300: case 300:
@ -398,7 +507,7 @@ if (check_login()) {
} }
} }
// status agents from tagente // Status agents from tagente.
$sql_info_agents = 'SELECT * fROM tagente WHERE id_agente ='.$id_agent; $sql_info_agents = 'SELECT * fROM tagente WHERE id_agente ='.$id_agent;
$info_agents = db_get_row_sql($sql_info_agents); $info_agents = db_get_row_sql($sql_info_agents);
$status_agent = agents_get_status_from_counts($info_agents); $status_agent = agents_get_status_from_counts($info_agents);
@ -463,7 +572,13 @@ if (check_login()) {
false false
); );
$table->data[0][3] = html_print_submit_button(__('Load filter'), 'load_filter', false, 'class="sub upd"', true); $table->data[0][3] = html_print_submit_button(
__('Load filter'),
'load_filter',
false,
'class="sub upd"',
true
);
echo "<form action='' method='post'>"; echo "<form action='' method='post'>";
html_print_table($table); html_print_table($table);
@ -474,7 +589,12 @@ if (check_login()) {
} }
if ($append_tab_filter) { if ($append_tab_filter) {
$filters = json_decode(io_safe_output(get_parameter('filters', '')), true); $filters = json_decode(
io_safe_output(
get_parameter('filters', '')
),
true
);
$table = new StdClass; $table = new StdClass;
$table->id = 'save_filter_form'; $table->id = 'save_filter_form';
@ -485,7 +605,14 @@ if (check_login()) {
if ($filters['id'] == 'extended_create_filter') { if ($filters['id'] == 'extended_create_filter') {
echo "<div id='msg_error_create'></div>"; echo "<div id='msg_error_create'></div>";
$table->data[0][0] = __('Filter name'); $table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true); $table->data[0][1] = html_print_input_text(
'id_name',
'',
'',
15,
255,
true
);
$table->data[1][0] = __('Group'); $table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = html_print_select_groups(
@ -510,7 +637,13 @@ if (check_login()) {
); );
$table->rowspan[0][2] = 2; $table->rowspan[0][2] = 2;
$table->data[0][2] = html_print_submit_button(__('Create filter'), 'create_filter', false, 'class="sub upd"', true); $table->data[0][2] = html_print_submit_button(
__('Create filter'),
'create_filter',
false,
'class="sub upd"',
true
);
} else { } else {
echo "<div id='msg_error_update'></div>"; echo "<div id='msg_error_update'></div>";
echo "<div id='msg_error_delete'></div>"; echo "<div id='msg_error_delete'></div>";
@ -552,8 +685,20 @@ if (check_login()) {
false false
); );
$table->data[0][2] = html_print_submit_button(__('Delete filter'), 'delete_filter', false, 'class="sub upd"', true); $table->data[0][2] = html_print_submit_button(
$table->data[1][2] = html_print_submit_button(__('Update filter'), 'update_filter', false, 'class="sub upd"', true); __('Delete filter'),
'delete_filter',
false,
'class="sub upd"',
true
);
$table->data[1][2] = html_print_submit_button(
__('Update filter'),
'update_filter',
false,
'class="sub upd"',
true
);
} }
html_print_table($table); html_print_table($table);
@ -561,17 +706,20 @@ if (check_login()) {
} }
if ($create_filter_cf) { if ($create_filter_cf) {
// initialize result // Initialize result.
$result_array = []; $result_array = [];
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ''; $result_array['msg'] = '';
// initialize vars // Initialize vars.
$filters = json_decode(io_safe_output(get_parameter('filters', '')), true); $filters = json_decode(
io_safe_output(get_parameter('filters', '')),
true
);
$name_filter = get_parameter('name_filter', ''); $name_filter = get_parameter('name_filter', '');
$group_search = get_parameter('group_search', 0); $group_search = get_parameter('group_search', 0);
// check that the name is not empty // Check that the name is not empty.
if ($name_filter == '') { if ($name_filter == '') {
$result_array['error'] = 1; $result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message( $result_array['msg'] = ui_print_error_message(
@ -596,7 +744,7 @@ if (check_login()) {
return; return;
} }
// check custom field is not empty // Check custom field is not empty.
if ($filters['id_custom_fields'] == '') { if ($filters['id_custom_fields'] == '') {
$result_array['error'] = 1; $result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message( $result_array['msg'] = ui_print_error_message(
@ -608,13 +756,15 @@ if (check_login()) {
return; return;
} }
// insert // Insert.
$values = []; $values = [];
$values['name'] = $name_filter; $values['name'] = $name_filter;
$values['group_search'] = $group_search; $values['group_search'] = $group_search;
$values['id_group'] = $filters['group']; $values['id_group'] = $filters['group'];
$values['id_custom_field'] = $filters['id_custom_fields']; $values['id_custom_field'] = $filters['id_custom_fields'];
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']); $values['id_custom_fields_data'] = json_encode(
$filters['id_custom_fields_data']
);
$values['id_status'] = json_encode($filters['id_status']); $values['id_status'] = json_encode($filters['id_status']);
$values['module_search'] = $filters['module_search']; $values['module_search'] = $filters['module_search'];
$values['module_status'] = json_encode($filters['module_status']); $values['module_status'] = json_encode($filters['module_status']);
@ -622,7 +772,7 @@ if (check_login()) {
$insert = db_process_sql_insert('tagent_custom_fields_filter', $values); $insert = db_process_sql_insert('tagent_custom_fields_filter', $values);
// check error insert // Check error insert.
if ($insert) { if ($insert) {
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message( $result_array['msg'] = ui_print_success_message(
@ -644,17 +794,17 @@ if (check_login()) {
} }
if ($update_filter_cf) { if ($update_filter_cf) {
// initialize result // Initialize result.
$result_array = []; $result_array = [];
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ''; $result_array['msg'] = '';
// initialize vars // Initialize vars.
$filters = json_decode(io_safe_output(get_parameter('filters', '')), true); $filters = json_decode(io_safe_output(get_parameter('filters', '')), true);
$id_filter = get_parameter('id_filter', ''); $id_filter = get_parameter('id_filter', '');
$group_search = get_parameter('group_search', 0); $group_search = get_parameter('group_search', 0);
// check selected filter // Check selected filter.
if ($id_filter == -1) { if ($id_filter == -1) {
$result_array['error'] = 1; $result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message( $result_array['msg'] = ui_print_error_message(
@ -666,11 +816,11 @@ if (check_login()) {
return; return;
} }
// array condition update // Array condition update.
$condition = []; $condition = [];
$condition['id'] = $id_filter; $condition['id'] = $id_filter;
// check selected custom fields // Check selected custom fields.
if ($filters['id_custom_fields'] == '') { if ($filters['id_custom_fields'] == '') {
$result_array['error'] = 1; $result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message( $result_array['msg'] = ui_print_error_message(
@ -682,7 +832,7 @@ if (check_login()) {
return; return;
} }
// array values update // Array values update.
$values = []; $values = [];
$values['id_group'] = $filters['group']; $values['id_group'] = $filters['group'];
$values['group_search'] = $group_search; $values['group_search'] = $group_search;
@ -693,10 +843,10 @@ if (check_login()) {
$values['module_status'] = json_encode($filters['module_status']); $values['module_status'] = json_encode($filters['module_status']);
$values['recursion'] = $filters['recursion']; $values['recursion'] = $filters['recursion'];
// update // Update.
$update = db_process_sql_update('tagent_custom_fields_filter', $values, $condition); $update = db_process_sql_update('tagent_custom_fields_filter', $values, $condition);
// check error insert // Check error insert.
if ($update) { if ($update) {
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message( $result_array['msg'] = ui_print_success_message(
@ -718,16 +868,16 @@ if (check_login()) {
} }
if ($delete_filter_cf) { if ($delete_filter_cf) {
// Initialize result // Initialize result.
$result_array = []; $result_array = [];
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ''; $result_array['msg'] = '';
// Initialize vars // Initialize vars.
$filters = json_decode(io_safe_output(get_parameter('filters', '')), true); $filters = json_decode(io_safe_output(get_parameter('filters', '')), true);
$id_filter = get_parameter('id_filter', ''); $id_filter = get_parameter('id_filter', '');
// Check selected filter // Check selected filter.
if ($id_filter == -1) { if ($id_filter == -1) {
$result_array['error'] = 1; $result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message( $result_array['msg'] = ui_print_error_message(
@ -739,14 +889,14 @@ if (check_login()) {
return; return;
} }
// Array condition update // Array condition update.
$condition = []; $condition = [];
$condition['id'] = $id_filter; $condition['id'] = $id_filter;
// Delete // Delete.
$delete = db_process_sql_delete('tagent_custom_fields_filter', $condition); $delete = db_process_sql_delete('tagent_custom_fields_filter', $condition);
// Check error insert // Check error insert.
if ($delete) { if ($delete) {
$result_array['error'] = 0; $result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message( $result_array['msg'] = ui_print_success_message(

View File

@ -1684,7 +1684,12 @@ class NetworkMap
$node[$k] = $v; $node[$k] = $v;
} }
$node['style']['label'] = $node['label']; if (!empty($node['text'])) {
$node['style']['label'] = $node['text'];
} else {
$node['style']['label'] = $node['name'];
}
$node['style']['shape'] = 'circle'; $node['style']['shape'] = 'circle';
if (isset($source_data['color'])) { if (isset($source_data['color'])) {
$item['color'] = $source_data['color']; $item['color'] = $source_data['color'];

View File

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

View File

@ -205,7 +205,7 @@ function mysql_db_get_value($field, $table, $field_search=1, $condition=1, $sear
* *
* @return mixed The first row of a database query or false. * @return mixed The first row of a database query or false.
*/ */
function mysql_db_get_row($table, $field_search, $condition, $fields=false) function mysql_db_get_row($table, $field_search, $condition, $fields=false, $cache=true)
{ {
if (empty($fields)) { if (empty($fields)) {
$fields = '*'; $fields = '*';
@ -243,7 +243,7 @@ function mysql_db_get_row($table, $field_search, $condition, $fields=false)
); );
} }
$result = db_get_all_rows_sql($sql); $result = db_get_all_rows_sql($sql, false, $cache);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -4584,7 +4584,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2)
return; return;
} }
$id = network_components_create_network_component($id, $other['data'][0], $other['data'][25], $values); $id = network_components_create_network_component($id, $other['data'][0], $other['data'][26], $values);
if (!$id) { if (!$id) {
returnError('error_set_new_snmp_component', 'Error creating SNMP component.'); returnError('error_set_new_snmp_component', 'Error creating SNMP component.');

View File

@ -2420,7 +2420,7 @@ function config_process_config()
} }
if (!isset($config['legacy_vc'])) { if (!isset($config['legacy_vc'])) {
config_update_value('legacy_vc', 0); config_update_value('legacy_vc', 1);
} }
if (!isset($config['vc_refr'])) { if (!isset($config['vc_refr'])) {

View File

@ -1,16 +1,31 @@
<?php <?php
/**
// Pandora FMS - http://pandorafms.com * Extension to manage a list of gateways and the node address where they should
// ================================================== * point to.
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Custom fields View
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU Lesser General Public License * @subpackage Community
// as published by the Free Software Foundation; version 2 * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// but WITHOUT ANY WARRANTY; without even the implied warranty of *
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * ______ ___ _______ _______ ________
// GNU General Public License for more details. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
/** /**
@ -56,14 +71,14 @@ function get_custom_fields($custom_field_id=false, $select=true, $display_on_fro
} }
} else { } else {
$metaconsole_connections = metaconsole_get_connection_names(); $metaconsole_connections = metaconsole_get_connection_names();
// For all nodes // For all nodes.
if (isset($metaconsole_connections) && is_array($metaconsole_connections)) { if (isset($metaconsole_connections) && is_array($metaconsole_connections)) {
$result_meta = []; $result_meta = [];
foreach ($metaconsole_connections as $metaconsole) { foreach ($metaconsole_connections as $metaconsole) {
// Get server connection data // Get server connection data.
$server_data = metaconsole_get_connection($metaconsole); $server_data = metaconsole_get_connection($metaconsole);
// Establishes connection // Establishes connection.
if (metaconsole_load_external_db($server_data) !== NOERR) { if (metaconsole_load_external_db($server_data) !== NOERR) {
continue; continue;
} }
@ -82,7 +97,7 @@ function get_custom_fields($custom_field_id=false, $select=true, $display_on_fro
$result[] = db_get_all_rows_sql($sql); $result[] = db_get_all_rows_sql($sql);
// Restore connection to root node // Restore connection to root node.
metaconsole_restore_db(); metaconsole_restore_db();
if (isset($result) && is_array($result)) { if (isset($result) && is_array($result)) {
@ -109,7 +124,7 @@ function get_custom_fields($custom_field_id=false, $select=true, $display_on_fro
/** /**
* Returns custom field data. * Returns custom field data.
* *
* @param integer custom_field_id id. * @param integer $custom_field_name Custom_field_id id.
* *
* @return array custom fields data. * @return array custom fields data.
*/ */
@ -141,14 +156,14 @@ function get_custom_fields_data($custom_field_name)
} }
} else { } else {
$metaconsole_connections = metaconsole_get_connection_names(); $metaconsole_connections = metaconsole_get_connection_names();
// For all nodes // For all nodes.
if (isset($metaconsole_connections) && is_array($metaconsole_connections)) { if (isset($metaconsole_connections) && is_array($metaconsole_connections)) {
$result_meta = []; $result_meta = [];
foreach ($metaconsole_connections as $metaconsole) { foreach ($metaconsole_connections as $metaconsole) {
// Get server connection data // Get server connection data.
$server_data = metaconsole_get_connection($metaconsole); $server_data = metaconsole_get_connection($metaconsole);
// Establishes connection // Establishes connection.
if (metaconsole_load_external_db($server_data) !== NOERR) { if (metaconsole_load_external_db($server_data) !== NOERR) {
continue; continue;
} }
@ -168,7 +183,7 @@ function get_custom_fields_data($custom_field_name)
$result_meta[] = db_get_all_rows_sql($sql); $result_meta[] = db_get_all_rows_sql($sql);
// Restore connection to root node // Restore connection to root node.
metaconsole_restore_db(); metaconsole_restore_db();
} }
@ -189,9 +204,15 @@ function get_custom_fields_data($custom_field_name)
} }
/**
* Function for custom field view return all conter for agents
*
* @param array $filters Params for search.
* @return void False or array.
*/
function agent_counters_custom_fields($filters) function agent_counters_custom_fields($filters)
{ {
// filter by status agent // Filter by status agent.
$and_status = ''; $and_status = '';
$agent_state_normal = 0; $agent_state_normal = 0;
@ -262,7 +283,7 @@ function agent_counters_custom_fields($filters)
} }
} }
// filter by status module // Filter by status module.
$empty_agents_count = "UNION ALL $empty_agents_count = "UNION ALL
SELECT ta.id_agente, SELECT ta.id_agente,
0 AS c_m_total, 0 AS c_m_total,
@ -314,20 +335,20 @@ function agent_counters_custom_fields($filters)
$and_module_status .= ' ) '; $and_module_status .= ' ) ';
} }
} else { } else {
// not normal // Not normal.
$and_module_status = 'AND tae.estado <> 0 AND tae.estado <> 300 '; $and_module_status = 'AND tae.estado <> 0 AND tae.estado <> 300 ';
$empty_agents_count = ''; $empty_agents_count = '';
} }
} }
} }
// filters module // Filters module.
if ($filters['module_search']) { if ($filters['module_search']) {
$and_module_search = 'AND tam.nombre LIKE "%'.$filters['module_search'].'%"'; $and_module_search = 'AND tam.nombre LIKE "%'.$filters['module_search'].'%"';
$empty_agents_count = ''; $empty_agents_count = '';
} }
// filter group and check ACL groups // Filter group and check ACL groups.
$groups_and = ''; $groups_and = '';
if (!users_can_manage_group_all('AR')) { if (!users_can_manage_group_all('AR')) {
if ($filters['group']) { if ($filters['group']) {
@ -338,7 +359,7 @@ function agent_counters_custom_fields($filters)
} }
if ($filters['group']) { if ($filters['group']) {
// recursion check acl // Recursion check acl.
if ($filters['recursion']) { if ($filters['recursion']) {
$recursion_groups = groups_get_id_recursive($filters['group'], true); $recursion_groups = groups_get_id_recursive($filters['group'], true);
if (!users_can_manage_group_all('AR')) { if (!users_can_manage_group_all('AR')) {
@ -362,26 +383,26 @@ function agent_counters_custom_fields($filters)
} }
} }
// filter custom data // Filter custom data.
$custom_data_and = ''; $custom_data_and = '';
if (!in_array(-1, $filters['id_custom_fields_data'])) { if (!in_array(-1, $filters['id_custom_fields_data'])) {
$custom_data_array = implode("', '", $filters['id_custom_fields_data']); $custom_data_array = implode("', '", $filters['id_custom_fields_data']);
$custom_data_and = "AND tcd.description IN ('".$custom_data_array."')"; $custom_data_and = "AND tcd.description IN ('".$custom_data_array."')";
} }
// filter custom name // Filter custom name.
$custom_field_name = $filters['id_custom_fields']; $custom_field_name = $filters['id_custom_fields'];
if (is_metaconsole()) { if (is_metaconsole()) {
$metaconsole_connections = metaconsole_get_connection_names(); $metaconsole_connections = metaconsole_get_connection_names();
// For all nodes // For all nodes.
if (isset($metaconsole_connections) && is_array($metaconsole_connections)) { if (isset($metaconsole_connections) && is_array($metaconsole_connections)) {
$result_meta = []; $result_meta = [];
$data = []; $data = [];
foreach ($metaconsole_connections as $metaconsole) { foreach ($metaconsole_connections as $metaconsole) {
// Get server connection data // Get server connection data.
$server_data = metaconsole_get_connection($metaconsole); $server_data = metaconsole_get_connection($metaconsole);
// Establishes connection // Establishes connection.
if (metaconsole_load_external_db($server_data) !== NOERR) { if (metaconsole_load_external_db($server_data) !== NOERR) {
continue; continue;
} }
@ -470,7 +491,13 @@ function agent_counters_custom_fields($filters)
WHEN ta.total_count = ta.notinit_count WHEN ta.total_count = ta.notinit_count
THEN 5 THEN 5
ELSE 0 ELSE 0
END) AS `status` END) AS `status`,
ta.critical_count,
ta.warning_count,
ta.unknown_count,
ta.notinit_count,
ta.normal_count,
ta.total_count
FROM tagente ta FROM tagente ta
LEFT JOIN tagent_secondary_group tasg LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent ON ta.id_agente = tasg.id_agent
@ -510,7 +537,7 @@ function agent_counters_custom_fields($filters)
} }
$data = array_merge($data, $node_result); $data = array_merge($data, $node_result);
// Restore connection to root node // Restore connection to root node.
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
@ -519,7 +546,7 @@ function agent_counters_custom_fields($filters)
$array_data = []; $array_data = [];
if (isset($result_meta) && is_array($result_meta)) { if (isset($result_meta) && is_array($result_meta)) {
// initialize counters // Initialize counters.
$final_result['counters_total'] = [ $final_result['counters_total'] = [
't_m_normal' => 0, 't_m_normal' => 0,
't_m_critical' => 0, 't_m_critical' => 0,
@ -538,7 +565,7 @@ function agent_counters_custom_fields($filters)
foreach ($result_meta as $k => $nodo) { foreach ($result_meta as $k => $nodo) {
if (isset($nodo) && is_array($nodo)) { if (isset($nodo) && is_array($nodo)) {
foreach ($nodo as $key => $value) { foreach ($nodo as $key => $value) {
// Sum counters total // Sum counters total.
$final_result['counters_total']['t_m_normal'] += $value['m_normal']; $final_result['counters_total']['t_m_normal'] += $value['m_normal'];
$final_result['counters_total']['t_m_critical'] += $value['m_critical']; $final_result['counters_total']['t_m_critical'] += $value['m_critical'];
$final_result['counters_total']['t_m_warning'] += $value['m_warning']; $final_result['counters_total']['t_m_warning'] += $value['m_warning'];
@ -553,7 +580,7 @@ function agent_counters_custom_fields($filters)
$final_result['counters_total']['t_a_not_init'] += $value['a_not_init']; $final_result['counters_total']['t_a_not_init'] += $value['a_not_init'];
$final_result['counters_total']['t_a_agents'] += $value['a_agents']; $final_result['counters_total']['t_a_agents'] += $value['a_agents'];
// Sum counters for data // Sum counters for data.
$array_data[$value['name_data']]['m_normal'] += $value['m_normal']; $array_data[$value['name_data']]['m_normal'] += $value['m_normal'];
$array_data[$value['name_data']]['m_critical'] += $value['m_critical']; $array_data[$value['name_data']]['m_critical'] += $value['m_critical'];
$array_data[$value['name_data']]['m_warning'] += $value['m_warning']; $array_data[$value['name_data']]['m_warning'] += $value['m_warning'];
@ -576,7 +603,7 @@ function agent_counters_custom_fields($filters)
$final_result['indexed_descriptions'] = $data; $final_result['indexed_descriptions'] = $data;
} else { } else {
// TODO // TODO.
$final_result = false; $final_result = false;
} }
@ -586,7 +613,7 @@ function agent_counters_custom_fields($filters)
function get_filters_custom_fields_view($id=0, $for_select=false, $name='') function get_filters_custom_fields_view($id=0, $for_select=false, $name='')
{ {
// filter group and check ACL groups // Filter group and check ACL groups.
$groups_and = ''; $groups_and = '';
if (!users_can_manage_group_all()) { if (!users_can_manage_group_all()) {
$user_groups = array_keys(users_get_groups(false, 'AR', false)); $user_groups = array_keys(users_get_groups(false, 'AR', false));
@ -631,3 +658,38 @@ function get_group_filter_custom_field_view($id)
return false; return false;
} }
/**
* Function for print counters agents or modules.
*
* @param array $status_array Array need value, image, title, color, counter.
* @param string $id_form Id form default value ''.
* @param string $id_input Id input default value ''.
*
* @return array Return html print div container counters.
*/
function print_counters_cfv(
array $status_array,
string $id_form='',
string $id_input=''
) {
$html_result = '<form class = "cfv_status_agent" id="'.$id_form.'">';
foreach ($status_array as $key => $value) {
$checked = ($value['checked'] === 1) ? 'checked=true' : '';
$disabled = ($value['counter'] === 0) ? 'disabled=true' : '';
$html_result .= '<input id="lists_'.$id_input.'['.$key.']" '.$checked.' '.$disabled.' type="checkbox" name="lists_'.$id_input.'['.$key.']" />';
$html_result .= '<label for="lists_'.$id_input.'['.$key.']" style="background-color:'.$value['color'].';">';
$html_result .= html_print_image(
$value['image'],
true,
['title' => $value['title']]
);
$html_result .= $value['counter'];
$html_result .= '</label>';
}
$html_result .= '</form>';
return $html_result;
}

View File

@ -421,13 +421,13 @@ function db_get_row_sql($sql, $search_history_db=false)
* *
* @return mixed The first row of a database query or false. * @return mixed The first row of a database query or false.
*/ */
function db_get_row($table, $field_search, $condition, $fields=false) function db_get_row($table, $field_search, $condition, $fields=false, $cache=true)
{ {
global $config; global $config;
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
return mysql_db_get_row($table, $field_search, $condition, $fields); return mysql_db_get_row($table, $field_search, $condition, $fields, $cache);
break; break;
case 'postgresql': case 'postgresql':

View File

@ -3258,6 +3258,18 @@ function events_page_general($event)
$data[1] .= groups_get_name($event['id_grupo']); $data[1] .= groups_get_name($event['id_grupo']);
$table_general->data[] = $data; $table_general->data[] = $data;
$data = [];
$data[0] = __('Contact');
$data[1] = '';
$contact = db_get_value('contact', 'tgrupo', 'id_grupo', $event['id_grupo']);
if (empty($contact)) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$data[1] = $contact;
}
$table_general->data[] = $data;
$data = []; $data = [];
$data[0] = __('Tags'); $data[0] = __('Tags');

View File

@ -9340,15 +9340,34 @@ function reporting_get_agent_module_info($id_agent)
$return = []; $return = [];
$return['last_contact'] = 0; $return['last_contact'] = 0;
// Last agent contact // Last agent contact.
$return['status'] = STATUS_AGENT_NO_DATA; $return['status'] = STATUS_AGENT_NO_DATA;
$return['status_img'] = ui_print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true); $return['status_img'] = ui_print_status_image(
STATUS_AGENT_NO_DATA,
__('Agent without data'),
true
);
$return['alert_status'] = 'notfired'; $return['alert_status'] = 'notfired';
$return['alert_value'] = STATUS_ALERT_NOT_FIRED; $return['alert_value'] = STATUS_ALERT_NOT_FIRED;
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true); $return['alert_img'] = ui_print_status_image(
$return['agent_group'] = agents_get_agent_group($id_agent); STATUS_ALERT_NOT_FIRED,
__('Alert not fired'),
true
);
if (!check_acl($config['id_user'], $return['agent_group'], 'AR')) { $return['agent_group'] = '';
// Important agents_get_all_groups_agent check secondary groups.
$id_all_groups = agents_get_all_groups_agent($id_agent);
if (isset($id_all_groups) && is_array($id_all_groups)) {
foreach ($id_all_groups as $value) {
if (check_acl($config['id_user'], $value, 'AR')) {
$return['agent_group'] = $value;
}
}
}
// If $return['agent_group'] is empty no access.
if ($return['agent_group'] == '') {
return $return; return $return;
} }
@ -9361,7 +9380,7 @@ function reporting_get_agent_module_info($id_agent)
$now = get_system_time(); $now = get_system_time();
// Get modules status for this agent // Get modules status for this agent.
$agent = db_get_row('tagente', 'id_agente', $id_agent); $agent = db_get_row('tagente', 'id_agente', $id_agent);
$return['total_count'] = $agent['total_count']; $return['total_count'] = $agent['total_count'];
@ -9375,28 +9394,52 @@ function reporting_get_agent_module_info($id_agent)
if ($return['total_count'] > 0) { if ($return['total_count'] > 0) {
if ($return['critical_count'] > 0) { if ($return['critical_count'] > 0) {
$return['status'] = STATUS_AGENT_CRITICAL; $return['status'] = STATUS_AGENT_CRITICAL;
$return['status_img'] = ui_print_status_image(STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true); $return['status_img'] = ui_print_status_image(
STATUS_AGENT_CRITICAL,
__('At least one module in CRITICAL status'),
true
);
} else if ($return['warning_count'] > 0) { } else if ($return['warning_count'] > 0) {
$return['status'] = STATUS_AGENT_WARNING; $return['status'] = STATUS_AGENT_WARNING;
$return['status_img'] = ui_print_status_image(STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true); $return['status_img'] = ui_print_status_image(
STATUS_AGENT_WARNING,
__('At least one module in WARNING status'),
true
);
} else if ($return['unknown_count'] > 0) { } else if ($return['unknown_count'] > 0) {
$return['status'] = STATUS_AGENT_DOWN; $return['status'] = STATUS_AGENT_DOWN;
$return['status_img'] = ui_print_status_image(STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true); $return['status_img'] = ui_print_status_image(
STATUS_AGENT_DOWN,
__('At least one module is in UKNOWN status'),
true
);
} else { } else {
$return['status'] = STATUS_AGENT_OK; $return['status'] = STATUS_AGENT_OK;
$return['status_img'] = ui_print_status_image(STATUS_AGENT_OK, __('All Monitors OK'), true); $return['status_img'] = ui_print_status_image(
STATUS_AGENT_OK,
__('All Monitors OK'),
true
);
} }
} }
// Alert not fired is by default // Alert not fired is by default.
if ($return['fired_count'] > 0) { if ($return['fired_count'] > 0) {
$return['alert_status'] = 'fired'; $return['alert_status'] = 'fired';
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_FIRED, __('Alert fired'), true); $return['alert_img'] = ui_print_status_image(
STATUS_ALERT_FIRED,
__('Alert fired'),
true
);
$return['alert_value'] = STATUS_ALERT_FIRED; $return['alert_value'] = STATUS_ALERT_FIRED;
} else if (groups_give_disabled_group($return['agent_group'])) { } else if (groups_give_disabled_group($return['agent_group'])) {
$return['alert_status'] = 'disabled'; $return['alert_status'] = 'disabled';
$return['alert_value'] = STATUS_ALERT_DISABLED; $return['alert_value'] = STATUS_ALERT_DISABLED;
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled'), true); $return['alert_img'] = ui_print_status_image(
STATUS_ALERT_DISABLED,
__('Alert disabled'),
true
);
} }
return $return; return $return;

View File

@ -61,10 +61,14 @@ function tags_search_tag($tag_name_description=false, $filter=false, $only_names
$filter[] = '(UPPER(name) LIKE UPPER (\'%'.$tag_name_description.'%\') OR $filter[] = '(UPPER(name) LIKE UPPER (\'%'.$tag_name_description.'%\') OR
UPPER(dbms_lob.substr(description, 4000, 1)) LIKE UPPER (\'%'.$tag_name_description.'%\'))'; UPPER(dbms_lob.substr(description, 4000, 1)) LIKE UPPER (\'%'.$tag_name_description.'%\'))';
break; break;
default:
// Default.
break;
} }
} }
// Default order // Default order.
set_unless_defined($filter['order'], 'name'); set_unless_defined($filter['order'], 'name');
$fields = '*'; $fields = '*';
@ -75,7 +79,7 @@ function tags_search_tag($tag_name_description=false, $filter=false, $only_names
]; ];
} }
// It will return the count // It will return the count.
if ($count) { if ($count) {
unset($filter['order']); unset($filter['order']);
unset($filter['limit']); unset($filter['limit']);
@ -120,7 +124,7 @@ function tags_create_tag($values)
return false; return false;
} }
// No create tag if the tag exists // No create tag if the tag exists.
if (tags_get_id($values['name'])) { if (tags_get_id($values['name'])) {
return false; return false;
} }
@ -365,7 +369,7 @@ function tags_insert_module_tag($id_agent_module, $tags)
} }
foreach ($tags as $tag) { foreach ($tags as $tag) {
// Protect against default insert // Protect against default insert.
if (empty($tag)) { if (empty($tag)) {
continue; continue;
} }
@ -396,7 +400,7 @@ function tags_insert_policy_module_tag($id_agent_module, $tags)
$values = []; $values = [];
foreach ($tags as $tag) { foreach ($tags as $tag) {
// Protect against default insert // Protect against default insert.
if (empty($tag)) { if (empty($tag)) {
continue; continue;
} }
@ -439,7 +443,7 @@ function tags_update_module_tag(
} }
if ($update_policy_tags) { if ($update_policy_tags) {
// First delete module tag entries // First delete module tag entries.
$result_tag = db_process_sql_delete( $result_tag = db_process_sql_delete(
'ttag_module', 'ttag_module',
['id_agente_modulo' => $id_agent_module] ['id_agente_modulo' => $id_agent_module]
@ -456,7 +460,7 @@ function tags_update_module_tag(
$values = []; $values = [];
foreach ($tags as $tag) { foreach ($tags as $tag) {
// Protect against default insert // Protect against default insert.
if (empty($tag)) { if (empty($tag)) {
continue; continue;
} }
@ -494,7 +498,7 @@ function tags_update_policy_module_tag($id_policy_module, $tags, $autocommit=fal
$values = []; $values = [];
foreach ($tags as $tag) { foreach ($tags as $tag) {
// Protect against default insert // Protect against default insert.
if (empty($tag)) { if (empty($tag)) {
continue; continue;
} }
@ -759,11 +763,14 @@ function tags_get_acl_tags(
return ''; return '';
break; break;
default:
// Default.
break;
} }
} }
if ($id_group == 0) { if ($id_group == 0) {
// Don't filter // Don't filter.
$id_group = []; $id_group = [];
} else if (empty($id_group)) { } else if (empty($id_group)) {
return ERR_WRONG_PARAMETERS; return ERR_WRONG_PARAMETERS;
@ -789,12 +796,12 @@ function tags_get_acl_tags(
switch ($return_mode) { switch ($return_mode) {
case 'data': case 'data':
// Stop here and return the array // Stop here and return the array.
return $acltags; return $acltags;
break; break;
case 'module_condition': case 'module_condition':
// Return the condition of the tags for tagente_modulo table // Return the condition of the tags for tagente_modulo table.
$condition = tags_get_acl_tags_module_condition( $condition = tags_get_acl_tags_module_condition(
$acltags, $acltags,
$query_table, $query_table,
@ -806,13 +813,17 @@ function tags_get_acl_tags(
break; break;
case 'event_condition': case 'event_condition':
// Return the condition of the tags for tevento table // Return the condition of the tags for tevento table.
$condition = tags_get_acl_tags_event_condition($acltags, $meta, $force_group_and_tag); $condition = tags_get_acl_tags_event_condition($acltags, $meta, $force_group_and_tag);
if (!empty($condition)) { if (!empty($condition)) {
return " $query_prefix ".'('.$condition.')'; return " $query_prefix ".'('.$condition.')';
} }
break; break;
default:
// Default.
break;
} }
return ''; return '';
@ -847,7 +858,7 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table='', $force_
} }
} }
if (!empty($group_tags)) { if (!empty($group_tags) && !empty($force_tags)) {
$group_tags = array_intersect($force_tags, $group_tags); $group_tags = array_intersect($force_tags, $group_tags);
} }
@ -899,27 +910,27 @@ function tags_get_acl_tags_event_condition($acltags, $meta=false, $force_group_a
global $config; global $config;
$condition = []; $condition = [];
// Get all tags of the system // Get all tags of the system.
$all_tags = tags_get_all_tags(false); $all_tags = tags_get_all_tags(false);
$without_tags = []; $without_tags = [];
foreach ($acltags as $group_id => $group_tags) { foreach ($acltags as $group_id => $group_tags) {
// NO check if there is not tag associated with groups // NO check if there is not tag associated with groups.
if (empty($group_tags)) { if (empty($group_tags)) {
$without_tags[] = $group_id; $without_tags[] = $group_id;
continue; continue;
} }
// Group condition (The module belongs to an agent of the group X) // Group condition (The module belongs to an agent of the group X)
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true)))); // $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
$group_condition = "(id_grupo = $group_id OR id_group = $group_id)"; $group_condition = "(id_grupo = $group_id OR id_group = $group_id)";
// Tags condition (The module has at least one of the restricted tags) // Tags condition (The module has at least one of the restricted tags).
$tags_condition = ''; $tags_condition = '';
$tags_condition_array = []; $tags_condition_array = [];
foreach ($group_tags as $tag) { foreach ($group_tags as $tag) {
// If the tag ID doesnt exist, ignore // If the tag ID doesnt exist, ignore.
if (!isset($all_tags[$tag])) { if (!isset($all_tags[$tag])) {
continue; continue;
} }
@ -927,7 +938,7 @@ function tags_get_acl_tags_event_condition($acltags, $meta=false, $force_group_a
$tags_condition_array[] = $force_equal ? sprintf('tags = "%s"', io_safe_input($all_tags[$tag])) : "tags LIKE '%".io_safe_input($all_tags[$tag])."%'"; $tags_condition_array[] = $force_equal ? sprintf('tags = "%s"', io_safe_input($all_tags[$tag])) : "tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
} }
// If there is not tag currently in Pandora, block the group info // If there is not tag currently in Pandora, block the group info.
if (empty($tags_condition_array)) { if (empty($tags_condition_array)) {
$tags_condition_array[] = '1=0'; $tags_condition_array[] = '1=0';
} }
@ -1000,16 +1011,16 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
{ {
global $config; global $config;
// users_is_strict_acl // users_is_strict_acl.
if ($id_user === false) { if ($id_user === false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
// Get all tags to have the name of all of them // Get all tags to have the name of all of them.
$all_tags = tags_get_all_tags(); $all_tags = tags_get_all_tags();
// If at least one of the profiles of this access flag hasent // If at least one of the profiles of this access flag hasent
// tags restrictions, the user can see all tags // tags restrictions, the user can see all tags.
$acl_column = get_acl_column($access); $acl_column = get_acl_column($access);
if (empty($acl_column)) { if (empty($acl_column)) {
@ -1045,6 +1056,10 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
$acl_column $acl_column
); );
break; break;
default:
// Default.
break;
} }
$profiles_without_tags = db_get_value_sql($query); $profiles_without_tags = db_get_value_sql($query);
@ -1068,14 +1083,14 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
} }
} }
// Get the tags of the required access flag for each group // Get the tags of the required access flag for each group.
$tags = tags_get_acl_tags($id_user, 0, $access, 'data'); $tags = tags_get_acl_tags($id_user, 0, $access, 'data');
// If there are wrong parameters or fail ACL check, return false // If there are wrong parameters or fail ACL check, return false.
if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) { if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
return []; return [];
} }
// Merge the tags to get an array with all of them // Merge the tags to get an array with all of them.
$user_tags_id = []; $user_tags_id = [];
foreach ($tags as $t) { foreach ($tags as $t) {
@ -1086,7 +1101,7 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
} }
} }
// Set the format id=>name to tags // Set the format id=>name to tags.
$user_tags = []; $user_tags = [];
foreach ($user_tags_id as $id) { foreach ($user_tags_id as $id) {
if (!isset($all_tags[$id])) { if (!isset($all_tags[$id])) {
@ -1104,16 +1119,16 @@ function tags_get_tags_for_module_search($id_user=false, $access='AR')
{ {
global $config; global $config;
// users_is_strict_acl // users_is_strict_acl.
if ($id_user === false) { if ($id_user === false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
// Get all tags to have the name of all of them // Get all tags to have the name of all of them.
$all_tags = tags_get_all_tags(); $all_tags = tags_get_all_tags();
// If at least one of the profiles of this access flag hasent // If at least one of the profiles of this access flag hasent
// tags restrictions, the user can see all tags // tags restrictions, the user can see all tags.
$acl_column = get_acl_column($access); $acl_column = get_acl_column($access);
if (empty($acl_column)) { if (empty($acl_column)) {
@ -1149,6 +1164,10 @@ function tags_get_tags_for_module_search($id_user=false, $access='AR')
$acl_column $acl_column
); );
break; break;
default:
// Default.
break;
} }
$profiles_without_tags = db_get_value_sql($query); $profiles_without_tags = db_get_value_sql($query);
@ -1164,14 +1183,14 @@ function tags_get_tags_for_module_search($id_user=false, $access='AR')
return false; return false;
} }
// Get the tags of the required access flag for each group // Get the tags of the required access flag for each group.
$tags = tags_get_acl_tags($id_user, 0, $access, 'data'); $tags = tags_get_acl_tags($id_user, 0, $access, 'data');
// If there are wrong parameters or fail ACL check, return false // If there are wrong parameters or fail ACL check, return false.
if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) { if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
return []; return [];
} }
// Merge the tags to get an array with all of them // Merge the tags to get an array with all of them.
$user_tags_id = []; $user_tags_id = [];
foreach ($tags as $t) { foreach ($tags as $t) {
@ -1182,7 +1201,7 @@ function tags_get_tags_for_module_search($id_user=false, $access='AR')
} }
} }
// Set the format id=>name to tags // Set the format id=>name to tags.
$user_tags = []; $user_tags = [];
foreach ($user_tags_id as $id) { foreach ($user_tags_id as $id) {
if (!isset($all_tags[$id])) { if (!isset($all_tags[$id])) {
@ -1217,12 +1236,12 @@ function tags_check_acl_by_module(
$acl_column = get_acl_column($access); $acl_column = get_acl_column($access);
foreach ($groups as $group) { foreach ($groups as $group) {
// If user has not permission for this group,go to next group // If user has not permission for this group,go to next group.
if (!isset($user_groups[$group])) { if (!isset($user_groups[$group])) {
continue; continue;
} }
// No tags means user can see all tags for this group // No tags means user can see all tags for this group.
if (empty($user_groups[$group]['tags'][$acl_column])) { if (empty($user_groups[$group]['tags'][$acl_column])) {
return true; return true;
} }
@ -1238,7 +1257,7 @@ function tags_check_acl_by_module(
} }
// This function checks event ACLs // This function checks event ACLs.
function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $childrens_ids=[]) function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $childrens_ids=[])
{ {
global $config; global $config;
@ -1252,12 +1271,12 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
} }
$tags_user = tags_get_acl_tags($id_user, $id_group, $access, 'data', '', '', true, $childrens_ids, true); $tags_user = tags_get_acl_tags($id_user, $id_group, $access, 'data', '', '', true, $childrens_ids, true);
// If there are wrong parameters or fail ACL check, return false // If there are wrong parameters or fail ACL check, return false.
if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) { if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
return false; return false;
} }
// check user without tags // check user without tags.
$sql = "SELECT id_usuario FROM tusuario_perfil $sql = "SELECT id_usuario FROM tusuario_perfil
WHERE id_usuario = '".$config['id_user']."' AND tags = '' WHERE id_usuario = '".$config['id_user']."' AND tags = ''
AND id_perfil IN ( AND id_perfil IN (
@ -1362,7 +1381,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
*/ */
function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Avoid mysql error // Avoid mysql error.
if (empty($id_tag)) { if (empty($id_tag)) {
return false; return false;
} }
@ -1392,12 +1411,12 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$agent_name_filter = ''; $agent_name_filter = '';
$agent_status = AGENT_STATUS_ALL; $agent_status = AGENT_STATUS_ALL;
if (!empty($agent_filter)) { if (!empty($agent_filter)) {
// Name // Name.
if (isset($agent_filter['name']) && !empty($agent_filter['name'])) { if (isset($agent_filter['name']) && !empty($agent_filter['name'])) {
$agent_name_filter = "AND ta.nombre LIKE '%".$agent_filter['name']."%'"; $agent_name_filter = "AND ta.nombre LIKE '%".$agent_filter['name']."%'";
} }
// Status // Status.
if (isset($agent_filter['status'])) { if (isset($agent_filter['status'])) {
if (is_array($agent_filter['status'])) { if (is_array($agent_filter['status'])) {
$agent_status = array_unique($agent_filter['status']); $agent_status = array_unique($agent_filter['status']);
@ -1411,15 +1430,15 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$module_status_filter = ''; $module_status_filter = '';
$module_status_array = []; $module_status_array = [];
if (!empty($module_filter)) { if (!empty($module_filter)) {
// IMPORTANT: The module filters will force the realtime search // IMPORTANT: The module filters will force the realtime search.
$realtime = true; $realtime = true;
// Name // Name.
if (isset($module_filter['name']) && !empty($module_filter['name'])) { if (isset($module_filter['name']) && !empty($module_filter['name'])) {
$module_name_filter = "AND tam.nombre LIKE '%".$module_filter['name']."%'"; $module_name_filter = "AND tam.nombre LIKE '%".$module_filter['name']."%'";
} }
// Status // Status.
if (isset($module_filter['status'])) { if (isset($module_filter['status'])) {
$module_status = $module_filter['status']; $module_status = $module_filter['status'];
if (is_array($module_status)) { if (is_array($module_status)) {
@ -1469,6 +1488,10 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$module_status_array[] = AGENT_MODULE_STATUS_NORMAL_ALERT; $module_status_array[] = AGENT_MODULE_STATUS_NORMAL_ALERT;
$module_status_array[] = AGENT_MODULE_STATUS_NORMAL; $module_status_array[] = AGENT_MODULE_STATUS_NORMAL;
break; break;
default:
// Default.
break;
} }
} }
@ -1517,7 +1540,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$unknown = 0; $unknown = 0;
$not_init = 0; $not_init = 0;
$normal = 0; $normal = 0;
// Without module filter // Without module filter.
if (empty($module_status_array)) { if (empty($module_status_array)) {
$total = (int) tags_get_total_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter); $total = (int) tags_get_total_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter);
$critical = (int) tags_get_critical_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter); $critical = (int) tags_get_critical_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter);
@ -1526,7 +1549,8 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$not_init = (int) tags_get_not_init_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter); $not_init = (int) tags_get_not_init_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter);
$normal = (int) tags_get_normal_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter); $normal = (int) tags_get_normal_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
// With module filter
// With module filter.
else { else {
foreach ($module_status_array as $status) { foreach ($module_status_array as $status) {
switch ($status) { switch ($status) {
@ -1553,6 +1577,10 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
case AGENT_MODULE_STATUS_NORMAL: case AGENT_MODULE_STATUS_NORMAL:
$normal = (int) tags_get_normal_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter); $normal = (int) tags_get_normal_monitors($id_tag, $groups_and_tags, $agent_filter, $module_filter);
break; break;
default:
// Default.
break;
} }
} }
@ -1592,7 +1620,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
break; break;
default: default:
// The status doesn't exist // The status doesn't exist.
return 0; return 0;
} }
} else { } else {
@ -1617,7 +1645,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
$count ++; $count ++;
} }
} }
// Invalid status // Invalid status.
else { else {
return 0; return 0;
} }
@ -1625,12 +1653,12 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
} }
} else { } else {
$status_filter = ''; $status_filter = '';
// Transform the element into a one element array // Transform the element into a one element array.
if (!is_array($agent_status)) { if (!is_array($agent_status)) {
$agent_status = [$agent_status]; $agent_status = [$agent_status];
} }
// Support for multiple status. It counts the agents for each status and sum the result // Support for multiple status. It counts the agents for each status and sum the result.
foreach ($agent_status as $status) { foreach ($agent_status as $status) {
switch ($agent_status) { switch ($agent_status) {
case AGENT_STATUS_ALL: case AGENT_STATUS_ALL:
@ -1666,7 +1694,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
break; break;
default: default:
// The type doesn't exist // The type doesn't exist.
return 0; return 0;
} }
@ -1711,7 +1739,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
*/ */
function tags_get_total_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_total_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_ALL; $agent_filter['status'] = AGENT_STATUS_ALL;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1735,7 +1763,7 @@ function tags_get_total_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $
*/ */
function tags_get_normal_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_normal_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_NORMAL; $agent_filter['status'] = AGENT_STATUS_NORMAL;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1759,7 +1787,7 @@ function tags_get_normal_agents($id_tag, $groups_and_tags=[], $agent_filter=[],
*/ */
function tags_get_warning_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_warning_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_WARNING; $agent_filter['status'] = AGENT_STATUS_WARNING;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1783,7 +1811,7 @@ function tags_get_warning_agents($id_tag, $groups_and_tags=[], $agent_filter=[],
*/ */
function tags_get_critical_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_critical_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_CRITICAL; $agent_filter['status'] = AGENT_STATUS_CRITICAL;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1807,7 +1835,7 @@ function tags_get_critical_agents($id_tag, $groups_and_tags=[], $agent_filter=[]
*/ */
function tags_get_unknown_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_unknown_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_UNKNOWN; $agent_filter['status'] = AGENT_STATUS_UNKNOWN;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1831,7 +1859,7 @@ function tags_get_unknown_agents($id_tag, $groups_and_tags=[], $agent_filter=[],
*/ */
function tags_get_not_init_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true) function tags_get_not_init_agents($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[], $realtime=true)
{ {
// Always modify the agent status filter // Always modify the agent status filter.
$agent_filter['status'] = AGENT_STATUS_NOT_INIT; $agent_filter['status'] = AGENT_STATUS_NOT_INIT;
return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime); return tags_get_agents_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter, $realtime);
} }
@ -1855,7 +1883,7 @@ function tags_get_not_init_agents($id_tag, $groups_and_tags=[], $agent_filter=[]
*/ */
function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Avoid mysql error // Avoid mysql error.
if (empty($id_tag)) { if (empty($id_tag)) {
return false; return false;
} }
@ -1885,12 +1913,12 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
$agent_name_filter = ''; $agent_name_filter = '';
$agents_clause = ''; $agents_clause = '';
if (!empty($agent_filter)) { if (!empty($agent_filter)) {
// Name // Name.
if (isset($agent_filter['name']) && !empty($agent_filter['name'])) { if (isset($agent_filter['name']) && !empty($agent_filter['name'])) {
$agent_name_filter = "AND ta.nombre LIKE '%".$agent_filter['name']."%'"; $agent_name_filter = "AND ta.nombre LIKE '%".$agent_filter['name']."%'";
} }
// ID // ID.
if (isset($agent_filter['id'])) { if (isset($agent_filter['id'])) {
if (is_array($agent_filter['id'])) { if (is_array($agent_filter['id'])) {
$agents = array_unique($agent_filter['id']); $agents = array_unique($agent_filter['id']);
@ -1907,12 +1935,12 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
$module_status_array = ''; $module_status_array = '';
$modules_clause = ''; $modules_clause = '';
if (!empty($module_filter)) { if (!empty($module_filter)) {
// Name // Name.
if (isset($module_filter['name']) && !empty($module_filter['name'])) { if (isset($module_filter['name']) && !empty($module_filter['name'])) {
$module_name_filter = "AND tam.nombre LIKE '%".$module_filter['name']."%'"; $module_name_filter = "AND tam.nombre LIKE '%".$module_filter['name']."%'";
} }
// Status // Status.
if (isset($module_filter['status'])) { if (isset($module_filter['status'])) {
$module_status = $module_filter['status']; $module_status = $module_filter['status'];
if (is_array($module_status)) { if (is_array($module_status)) {
@ -1965,7 +1993,7 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
break; break;
default: default:
// The status doesn't exist // The status doesn't exist.
return false; return false;
} }
} }
@ -2019,7 +2047,7 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
*/ */
function tags_get_total_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_total_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_ALL; $module_filter['status'] = AGENT_MODULE_STATUS_ALL;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2042,7 +2070,7 @@ function tags_get_total_monitors($id_tag, $groups_and_tags=[], $agent_filter=[],
*/ */
function tags_get_normal_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_normal_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_NORMAL; $module_filter['status'] = AGENT_MODULE_STATUS_NORMAL;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2065,7 +2093,7 @@ function tags_get_normal_monitors($id_tag, $groups_and_tags=[], $agent_filter=[]
*/ */
function tags_get_critical_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_critical_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_CRITICAL_BAD; $module_filter['status'] = AGENT_MODULE_STATUS_CRITICAL_BAD;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2088,7 +2116,7 @@ function tags_get_critical_monitors($id_tag, $groups_and_tags=[], $agent_filter=
*/ */
function tags_get_warning_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_warning_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_WARNING; $module_filter['status'] = AGENT_MODULE_STATUS_WARNING;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2111,7 +2139,7 @@ function tags_get_warning_monitors($id_tag, $groups_and_tags=[], $agent_filter=[
*/ */
function tags_get_not_init_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_not_init_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_NOT_INIT; $module_filter['status'] = AGENT_MODULE_STATUS_NOT_INIT;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2134,7 +2162,7 @@ function tags_get_not_init_monitors($id_tag, $groups_and_tags=[], $agent_filter=
*/ */
function tags_get_unknown_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[]) function tags_get_unknown_monitors($id_tag, $groups_and_tags=[], $agent_filter=[], $module_filter=[])
{ {
// Always modify the module status filter // Always modify the module status filter.
$module_filter['status'] = AGENT_MODULE_STATUS_UNKNOWN; $module_filter['status'] = AGENT_MODULE_STATUS_UNKNOWN;
return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter); return tags_get_monitors_counter($id_tag, $groups_and_tags, $agent_filter, $module_filter);
} }
@ -2151,7 +2179,7 @@ function tags_get_unknown_monitors($id_tag, $groups_and_tags=[], $agent_filter=[
*/ */
function tags_monitors_fired_alerts($id_tag, $groups_and_tags=[], $id_agente=false) function tags_monitors_fired_alerts($id_tag, $groups_and_tags=[], $id_agente=false)
{ {
// Avoid mysql error // Avoid mysql error.
if (empty($id_tag)) { if (empty($id_tag)) {
return; return;
} }
@ -2215,7 +2243,7 @@ function tags_monitors_fired_alerts($id_tag, $groups_and_tags=[], $id_agente=fal
*/ */
function tags_get_monitors_alerts($id_tag, $groups_and_tags=[], $id_agente=false) function tags_get_monitors_alerts($id_tag, $groups_and_tags=[], $id_agente=false)
{ {
// Avoid mysql error // Avoid mysql error.
if (empty($id_tag)) { if (empty($id_tag)) {
return; return;
} }
@ -2270,20 +2298,20 @@ function tags_get_monitors_alerts($id_tag, $groups_and_tags=[], $id_agente=false
function __add_acltags(&$acltags, $group_id, $tags_str) function __add_acltags(&$acltags, $group_id, $tags_str)
{ {
if (!isset($acltags[$group_id])) { if (!isset($acltags[$group_id])) {
// Add the new element // Add the new element.
$acltags[$group_id] = $tags_str; $acltags[$group_id] = $tags_str;
} else { } else {
// Add the tags. The empty tags have priority cause mean more permissions // Add the tags. The empty tags have priority cause mean more permissions.
$existing_tags = $acltags[$group_id]; $existing_tags = $acltags[$group_id];
if (!empty($existing_tags)) { if (!empty($existing_tags)) {
$existing_tags_array = explode(',', $existing_tags); $existing_tags_array = explode(',', $existing_tags);
// Store the empty tags // Store the empty tags.
if (empty($tags_str)) { if (empty($tags_str)) {
$acltags[$group_id] = ''; $acltags[$group_id] = '';
} }
// Merge the old and new tabs // Merge the old and new tabs.
else { else {
$new_tags_array = explode(',', $tags_str); $new_tags_array = explode(',', $tags_str);
@ -2297,7 +2325,7 @@ function __add_acltags(&$acltags, $group_id, $tags_str)
} }
} }
// Propagation // Propagation.
$propagate = (bool) db_get_value('propagate', 'tgrupo', 'id_grupo', $group_id); $propagate = (bool) db_get_value('propagate', 'tgrupo', 'id_grupo', $group_id);
if ($propagate) { if ($propagate) {
$sql = "SELECT id_grupo FROM tgrupo WHERE parent = $group_id"; $sql = "SELECT id_grupo FROM tgrupo WHERE parent = $group_id";
@ -2308,14 +2336,14 @@ function __add_acltags(&$acltags, $group_id, $tags_str)
} }
foreach ($children as $children_group) { foreach ($children as $children_group) {
// Add the tags to the children (recursive) // Add the tags to the children (recursive).
__add_acltags($acltags, $children_group['id_grupo'], $tags_str); __add_acltags($acltags, $children_group['id_grupo'], $tags_str);
} }
} }
} }
// Return array with groups and their tags // Return array with groups and their tags.
function tags_get_user_groups_and_tags($id_user=false, $access='AR', $strict_user=false) function tags_get_user_groups_and_tags($id_user=false, $access='AR', $strict_user=false)
{ {
global $config; global $config;
@ -2499,7 +2527,7 @@ function tags_get_agent_modules($id_agent, $id_tag=false, $groups_and_tags=[], $
{ {
global $config; global $config;
// Avoid mysql error // Avoid mysql error.
if (empty($id_agent)) { if (empty($id_agent)) {
return false; return false;
} }

View File

@ -397,7 +397,7 @@ function update_manager_check_online_free_packages($is_ajax=true)
<?php <?php
$baseurl = ui_get_full_url(false, false, false, false); $baseurl = ui_get_full_url(false, false, false, false);
echo '<p><b>There is a new version:</b> '.$result[0]['version'].'</p>'; echo '<p><b>There is a new version:</b> '.$result[0]['version'].'</p>';
echo "<a href='javascript: update_last_package(\"".base64_encode($result[0]['file_name']).'", "'.$result[0]['version'].'", "'.$baseurl."\");'>".__('Update to the last version').'</a>'; echo "<a class='update_manager_button' href='javascript: update_last_package(\"".base64_encode($result[0]['file_name']).'", "'.$result[0]['version'].'", "'.$baseurl."\");'>".__('Update').'</a>';
} else { } else {
echo __('There is no update available.'); echo __('There is no update available.');
} }

View File

@ -4094,10 +4094,8 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
); );
} else if (!empty($layout_item_data['id_agent'])) { } else if (!empty($layout_item_data['id_agent'])) {
// Agent. // Agent.
$agent_status = agents_get_status( $agent = db_get_row('tagente', 'id_agente', $layout_item_data['id_agent']);
$layout_item_data['id_agent'], $agent_status = agents_get_status_from_counts($agent);
true
);
$status = visual_map_translate_agent_status( $status = visual_map_translate_agent_status(
$agent_status $agent_status
); );

View File

@ -1394,6 +1394,9 @@ function visual_map_editor_print_hack_translate_strings()
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$("#map_linked").change(function () { $("#map_linked").change(function () {
$("option[value=" + this.value + "]", this)
.attr("selected", true).siblings()
.removeAttr("selected")
$("#text-agent").val(""); $("#text-agent").val("");
$("input[name=id_agent]").val(0); $("input[name=id_agent]").val(0);
$("#module").empty(); $("#module").empty();

View File

@ -98,7 +98,7 @@ function createVisualConsole(
e.data.linkedLayoutId > 0 && e.data.linkedLayoutId > 0 &&
e.data.link != null && e.data.link != null &&
e.data.link.length > 0 && e.data.link.length > 0 &&
(e.data.metaconsoleId == null || e.data.metaconsoleId === 0) (e.data.linkedLayoutAgentId == null || e.data.linkedLayoutAgentId === 0)
) { ) {
// Stop the current link behavior. // Stop the current link behavior.
e.nativeEvent.preventDefault(); e.nativeEvent.preventDefault();

View File

@ -326,20 +326,20 @@ function install_package(package, homeurl) {
}); });
var dialog_accept_package_mr_fail_text = var dialog_accept_package_mr_fail_text =
"<div>"; "<div class='update_popup'>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_not_accepted_code_yes + mr_not_accepted_code_yes +
"</p></div>"; "</p></div>";
dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"</div>"; "</div>";
@ -397,20 +397,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_success_pkg_text = "<div>"; var dialog_success_pkg_text =
"<div class='update_popup'>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
home_url +
"images/icono_exito_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>"; "<p>" +
dialog_success_pkg_text =
dialog_success_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_success + package_success +
"</p></div>"; "</p></div>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_success_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + "</div>"; dialog_success_pkg_text + "</div>";
@ -456,20 +457,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text =
"<div class='update_popup'>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_error + package_error +
"</p></div>"; "</p></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + "</div>"; dialog_error_pkg_text + "</div>";
@ -533,20 +535,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_cancel_pkg_text = "<div>"; var dialog_cancel_pkg_text =
"<div class='update_popup'>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_cancel + package_cancel +
"</p></div>"; "</p></div>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "</div>"; dialog_cancel_pkg_text + "</div>";
@ -571,20 +574,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_bad_message_text = "<div>"; var dialog_bad_message_text =
"<div class='update_popup'>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + dialog_bad_message_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + dialog_bad_message_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_bad_message_text =
dialog_bad_message_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
bad_mr_file + bad_mr_file +
"</p></div>"; "</p></div>";
dialog_bad_message_text =
dialog_bad_message_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + "</div>"; dialog_bad_message_text + "</div>";
@ -616,20 +620,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_success_mr_text = "<div>"; var dialog_success_mr_text =
"<div class='update_popup'>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + dialog_success_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
home_url +
"images/icono_exito_mr.png'></div>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + dialog_success_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>"; "<p>" +
dialog_success_mr_text =
dialog_success_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_success + mr_success +
"</p></div>"; "</p></div>";
dialog_success_mr_text =
dialog_success_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_success_mr.png'></div>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + "</div>"; dialog_success_mr_text + "</div>";
@ -684,20 +689,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_success_pkg_text = "<div>"; var dialog_success_pkg_text =
"<div class='update_popup'>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
home_url +
"images/icono_exito_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>"; "<p>" +
dialog_success_pkg_text =
dialog_success_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_success + package_success +
"</p></div>"; "</p></div>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_success_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + "</div>"; dialog_success_pkg_text + "</div>";
@ -743,20 +749,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text =
"<div class='update_popup'>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_error + package_error +
"</p></div>"; "</p></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + "</div>"; dialog_error_pkg_text + "</div>";
@ -814,20 +821,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_error_mr_text = "<div>"; var dialog_error_mr_text =
"<div class='update_popup'>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + dialog_error_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + dialog_error_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_error_mr_text =
dialog_error_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_error + mr_error +
"</p></div>"; "</p></div>";
dialog_error_mr_text =
dialog_error_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + "</div>"; dialog_error_mr_text + "</div>";
@ -874,20 +882,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_cancel_mr_text = "<div>"; var dialog_cancel_mr_text =
"<div class='update_popup'>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + dialog_cancel_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + dialog_cancel_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_cancel_mr_text =
dialog_cancel_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_cancel + mr_cancel +
"</p></div>"; "</p></div>";
dialog_cancel_mr_text =
dialog_cancel_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + "</div>"; dialog_cancel_mr_text + "</div>";
@ -910,34 +919,33 @@ function install_package(package, homeurl) {
] ]
}); });
$("button:contains(Apply MR)").attr("id", "apply_rr_button"); $("button:contains(Apply MR)")
.attr("id", "apply_rr_button")
.addClass("success_button");
$("button:contains(Cancel)").attr("id", "cancel_rr_button"); $("button:contains(Cancel)").attr("id", "cancel_rr_button");
var dialog_have_mr_text = "<div>"; var dialog_have_mr_text = "<div class='update_popup'>";
dialog_have_mr_text = dialog_have_mr_text =
dialog_have_mr_text + dialog_have_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>" +
home_url +
"images/icono_warning_mr.png'></div>";
dialog_have_mr_text =
dialog_have_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>" +
mr_available_header + mr_available_header +
"</strong></h3>"; "</h3>";
dialog_have_mr_text =
dialog_have_mr_text + "<p>" + text1_mr_file + "</p>";
dialog_have_mr_text = dialog_have_mr_text =
dialog_have_mr_text + dialog_have_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" + "<p>" +
text1_mr_file +
"</p>";
dialog_have_mr_text =
dialog_have_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
text2_mr_file + text2_mr_file +
"<a style='font-family:Verdana bold; font-size:12pt; color:#82B92E'href=\"index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">" + '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list">' +
text3_mr_file + text3_mr_file +
"</a>" + "</a>" +
text4_mr_file + text4_mr_file +
"</p></div>"; "</p></div>";
dialog_have_mr_text =
dialog_have_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_warning_db.png'></div>";
dialog_have_mr_text = dialog_have_mr_text + "</div>"; dialog_have_mr_text = dialog_have_mr_text + "</div>";
$("#mr_dialog2").html(dialog_have_mr_text); $("#mr_dialog2").html(dialog_have_mr_text);
@ -992,20 +1000,21 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_success_pkg_text = "<div>"; var dialog_success_pkg_text =
"<div class='update_popup'>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
home_url +
"images/icono_exito_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>"; "<p>" +
dialog_success_pkg_text =
dialog_success_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_success + package_success +
"</p></div>"; "</p></div>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_success_mr.png'></div>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + "</div>"; dialog_success_pkg_text + "</div>";
@ -1047,20 +1056,20 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text = "<div class='update_popup'>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_error + package_error +
"</p></div>"; "</p></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_error_pkg_text = dialog_error_pkg_text + "</div>"; dialog_error_pkg_text = dialog_error_pkg_text + "</div>";
$("#error_pkg").html(dialog_error_pkg_text); $("#error_pkg").html(dialog_error_pkg_text);
@ -1124,20 +1133,16 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_cancel_pkg_text = "<div>"; var dialog_cancel_pkg_text = "<div class='update_popup'>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "<div class='update_text'><h3>INFO</h3>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "<p>" + package_cancel + "</p></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_info_mr.png'></div>"; "images/icon_info_mr.png'></div>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_cancel +
"</p></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text + "</div>"; dialog_cancel_pkg_text = dialog_cancel_pkg_text + "</div>";
$("#cancel_pkg").html(dialog_cancel_pkg_text); $("#cancel_pkg").html(dialog_cancel_pkg_text);
@ -1214,22 +1219,18 @@ function install_package(package, homeurl) {
] ]
}); });
var dialog_text = "<div>"; var dialog_text = "<div class='update_popup'>";
dialog_text = dialog_text =
dialog_text + dialog_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>" +
home_url +
"images/icono_info_mr.png'></div>";
dialog_text =
dialog_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>" +
text1_package_file + text1_package_file +
"</strong></h3>"; "</h3>";
dialog_text = dialog_text + "<p>" + text2_package_file + "</p></div>";
dialog_text = dialog_text =
dialog_text + dialog_text +
"<p style='font-family:Verdana; font-size:12pt;'>" + "<div class='update_icon'><img src='" +
text2_package_file + home_url +
"</p></div>"; "images/icon_info_mr.png'></div>";
dialog_text = dialog_text + "</div>"; dialog_text = dialog_text + "</div>";
$("#pkg_apply_dialog").html(dialog_text); $("#pkg_apply_dialog").html(dialog_text);
@ -1522,20 +1523,20 @@ function install_free_package_prev_step(package, version, homeurl) {
}); });
var dialog_accept_package_mr_fail_text = var dialog_accept_package_mr_fail_text =
"<div>"; "<div class='update_popup'>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_not_accepted_code_yes + mr_not_accepted_code_yes +
"</p></div>"; "</p></div>";
dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_accept_package_mr_fail_text = dialog_accept_package_mr_fail_text =
dialog_accept_package_mr_fail_text + dialog_accept_package_mr_fail_text +
"</div>"; "</div>";
@ -1616,20 +1617,21 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_cancel_pkg_text = "<div>"; var dialog_cancel_pkg_text =
"<div class='update_popup'>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_cancel + package_cancel +
"</p></div>"; "</p></div>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "</div>"; dialog_cancel_pkg_text + "</div>";
@ -1646,20 +1648,21 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_bad_message_text = "<div>"; var dialog_bad_message_text =
"<div class='update_popup'>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + dialog_bad_message_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + dialog_bad_message_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_bad_message_text =
dialog_bad_message_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
bad_mr_file + bad_mr_file +
"</p></div>"; "</p></div>";
dialog_bad_message_text =
dialog_bad_message_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_bad_message_text = dialog_bad_message_text =
dialog_bad_message_text + "</div>"; dialog_bad_message_text + "</div>";
@ -1691,20 +1694,21 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_success_mr_text = "<div>"; var dialog_success_mr_text =
"<div class='update_popup'>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + dialog_success_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
home_url +
"images/icono_exito_mr.png'></div>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + dialog_success_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>"; "<p>" +
dialog_success_mr_text =
dialog_success_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_success + mr_success +
"</p></div>"; "</p></div>";
dialog_success_mr_text =
dialog_success_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_success_mr.png'></div>";
dialog_success_mr_text = dialog_success_mr_text =
dialog_success_mr_text + "</div>"; dialog_success_mr_text + "</div>";
@ -1774,20 +1778,21 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_error_mr_text = "<div>"; var dialog_error_mr_text =
"<div class='update_popup'>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + dialog_error_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>ERROR</h3>";
home_url +
"images/icono_error_mr.png'></div>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + dialog_error_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>"; "<p>" +
dialog_error_mr_text =
dialog_error_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_error + mr_error +
"</p></div>"; "</p></div>";
dialog_error_mr_text =
dialog_error_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_error_mr.png'></div>";
dialog_error_mr_text = dialog_error_mr_text =
dialog_error_mr_text + "</div>"; dialog_error_mr_text + "</div>";
@ -1827,20 +1832,21 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_cancel_mr_text = "<div>"; var dialog_cancel_mr_text =
"<div class='update_popup'>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + dialog_cancel_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>INFO</h3>";
home_url +
"images/icono_info_mr.png'></div>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + dialog_cancel_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>"; "<p>" +
dialog_cancel_mr_text =
dialog_cancel_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
mr_cancel + mr_cancel +
"</p></div>"; "</p></div>";
dialog_cancel_mr_text =
dialog_cancel_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_info_mr.png'></div>";
dialog_cancel_mr_text = dialog_cancel_mr_text =
dialog_cancel_mr_text + "</div>"; dialog_cancel_mr_text + "</div>";
@ -1855,34 +1861,33 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
$("button:contains(Apply MR)").attr("id", "apply_rr_button"); $("button:contains(Apply MR)")
.attr("id", "apply_rr_button")
.addClass("success_button");
$("button:contains(Cancel)").attr("id", "cancel_rr_button"); $("button:contains(Cancel)").attr("id", "cancel_rr_button");
var dialog_have_mr_text = "<div>"; var dialog_have_mr_text = "<div class='update_popup'>";
dialog_have_mr_text = dialog_have_mr_text =
dialog_have_mr_text + dialog_have_mr_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>" +
home_url +
"images/icono_warning_mr.png'></div>";
dialog_have_mr_text =
dialog_have_mr_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>" +
mr_available_header + mr_available_header +
"</strong></h3>"; "</h3>";
dialog_have_mr_text =
dialog_have_mr_text + "<p>" + text1_mr_file + "</p>";
dialog_have_mr_text = dialog_have_mr_text =
dialog_have_mr_text + dialog_have_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" + "<p>" +
text1_mr_file +
"</p>";
dialog_have_mr_text =
dialog_have_mr_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
text2_mr_file + text2_mr_file +
"<a style='font-family:Verdana bold; font-size:12pt; color:#82B92E'href=\"index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list\">" + '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list">' +
text3_mr_file + text3_mr_file +
"</a>" + "</a>" +
text4_mr_file + text4_mr_file +
"</p></div>"; "</p></div>";
dialog_have_mr_text =
dialog_have_mr_text +
"<div class='update_icon'><img src='" +
home_url +
"images/icon_warning_db.png'></div>";
dialog_have_mr_text = dialog_have_mr_text + "</div>"; dialog_have_mr_text = dialog_have_mr_text + "</div>";
$("#mr_dialog2").html(dialog_have_mr_text); $("#mr_dialog2").html(dialog_have_mr_text);
@ -1950,20 +1955,16 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_cancel_pkg_text = "<div>"; var dialog_cancel_pkg_text = "<div class='update_popup'>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "<div class='update_text'><h3>INFO</h3>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text + "<p>" + package_cancel + "</p></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text =
dialog_cancel_pkg_text + dialog_cancel_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_info_mr.png'></div>"; "images/icon_info_mr.png'></div>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>INFO</strong></h3>";
dialog_cancel_pkg_text =
dialog_cancel_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
package_cancel +
"</p></div>";
dialog_cancel_pkg_text = dialog_cancel_pkg_text + "</div>"; dialog_cancel_pkg_text = dialog_cancel_pkg_text + "</div>";
$("#cancel_pkg").html(dialog_cancel_pkg_text); $("#cancel_pkg").html(dialog_cancel_pkg_text);
@ -1977,22 +1978,18 @@ function install_free_package_prev_step(package, version, homeurl) {
] ]
}); });
var dialog_text = "<div>"; var dialog_text = "<div class='update_popup'>";
dialog_text = dialog_text =
dialog_text + dialog_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>" +
home_url +
"images/icono_info_mr.png'></div>";
dialog_text =
dialog_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>" +
text1_package_file + text1_package_file +
"</strong></h3>"; "</h3>";
dialog_text = dialog_text + "<p>" + text2_package_file + "</p></div>";
dialog_text = dialog_text =
dialog_text + dialog_text +
"<p style='font-family:Verdana; font-size:12pt;'>" + "<div class='update_icon'><img src='" +
text2_package_file + home_url +
"</p></div>"; "images/icon_info_mr.png'></div>";
dialog_text = dialog_text + "</div>"; dialog_text = dialog_text + "</div>";
$("#pkg_apply_dialog").html(dialog_text); $("#pkg_apply_dialog").html(dialog_text);
@ -2039,20 +2036,16 @@ function install_free_package(package, version, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text = "<div class='update_popup'>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<div class='update_text'><h3>ERROR</h3>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<p>" + data["message"] + "</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_error_mr.png'></div>"; "images/icon_error_mr.png'></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
data["message"] +
"</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text + "</div>"; dialog_error_pkg_text = dialog_error_pkg_text + "</div>";
$("#error_pkg").html(dialog_error_pkg_text); $("#error_pkg").html(dialog_error_pkg_text);
@ -2092,20 +2085,17 @@ function install_free_package(package, version, homeurl) {
] ]
}); });
var dialog_success_pkg_text = "<div>"; var dialog_success_pkg_text = "<div class='update_popup'>";
dialog_success_pkg_text = dialog_success_pkg_text =
dialog_success_pkg_text + dialog_success_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_text'><h3>SUCCESS</h3>";
dialog_success_pkg_text =
dialog_success_pkg_text + "<p>" + data["message"] + "</p></div>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_exito_mr.png'></div>"; "images/icon_success_mr.png'></div>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>SUCCESS</strong></h3>";
dialog_success_pkg_text =
dialog_success_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
data["message"] +
"</p></div>";
dialog_success_pkg_text = dialog_success_pkg_text + "</div>"; dialog_success_pkg_text = dialog_success_pkg_text + "</div>";
$("#success_pkg").html(dialog_success_pkg_text); $("#success_pkg").html(dialog_success_pkg_text);
@ -2142,20 +2132,16 @@ function install_free_package(package, version, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text = "<div class='update_popup'>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<div class='update_text'><h3>ERROR</h3>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<p>" + data["message"] + "</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_error_mr.png'></div>"; "images/icon_error_mr.png'></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
data["message"] +
"</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text + "</div>"; dialog_error_pkg_text = dialog_error_pkg_text + "</div>";
$("#error_pkg").html(dialog_error_pkg_text); $("#error_pkg").html(dialog_error_pkg_text);
@ -2193,20 +2179,16 @@ function install_free_package(package, version, homeurl) {
] ]
}); });
var dialog_error_pkg_text = "<div>"; var dialog_error_pkg_text = "<div class='update_popup'>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<div class='update_text'><h3>ERROR</h3>";
dialog_error_pkg_text =
dialog_error_pkg_text + "<p>" + data["message"] + "</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text =
dialog_error_pkg_text + dialog_error_pkg_text +
"<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='" + "<div class='update_icon'><img src='" +
home_url + home_url +
"images/icono_error_mr.png'></div>"; "images/icon_error_mr.png'></div>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
dialog_error_pkg_text =
dialog_error_pkg_text +
"<p style='font-family:Verdana; font-size:12pt;'>" +
data["message"] +
"</p></div>";
dialog_error_pkg_text = dialog_error_pkg_text + "</div>"; dialog_error_pkg_text = dialog_error_pkg_text + "</div>";
$("#error_pkg").html(dialog_error_pkg_text); $("#error_pkg").html(dialog_error_pkg_text);
@ -2246,13 +2228,7 @@ function apply_minor_release(n_mr, pkg, ent, off, homeurl) {
$("#mr_dialog2").html(data); $("#mr_dialog2").html(data);
error["error"] = true; error["error"] = true;
} else { } else {
$("#mr_dialog2").append( $("#mr_dialog2").append("<p>- " + applying_mr + " #" + mr + "</p>");
"<p style='font-family:Verdana; font-size:12pt;'>- " +
applying_mr +
" #" +
mr +
"</p>"
);
} }
} }
}); });

View File

@ -223,32 +223,12 @@ final class Container extends Model
$backgroundImage = static::extractBackgroundImage($row); $backgroundImage = static::extractBackgroundImage($row);
if ($backgroundUrl === null && $backgroundImage !== null) { if ($backgroundUrl === null && $backgroundImage !== null) {
$backgroundPath = 'images/console/background/'.$backgroundImage;
$width = (int) $row['width'];
$height = (int) $row['height'];
if ($width > 0 && $height > 0) {
$q = [
'getFile' => 1,
'thumb' => 1,
'thumb_size' => $width.'x'.$height,
'file' => '../../'.$backgroundPath,
];
$row['backgroundURL'] = ui_get_full_url( $row['backgroundURL'] = ui_get_full_url(
'include/Image/image_functions.php?'.http_build_query($q), 'images/console/background/'.$backgroundImage,
false, false,
false, false,
false false
); );
} else {
$row['backgroundURL'] = ui_get_full_url(
$backgroundPath,
false,
false,
false
);
}
} }
return \io_safe_output($row); return \io_safe_output($row);

View File

@ -880,6 +880,7 @@ class Item extends Model
global $config; global $config;
// Load side libraries. // Load side libraries.
include_once $config['homedir'].'/include/functions_ui.php';
if (\is_metaconsole()) { if (\is_metaconsole()) {
\enterprise_include_once('include/functions_metaconsole.php'); \enterprise_include_once('include/functions_metaconsole.php');
\enterprise_include_once('meta/include/functions_ui_meta.php'); \enterprise_include_once('meta/include/functions_ui_meta.php');
@ -889,7 +890,7 @@ class Item extends Model
$linkedModule = static::extractLinkedModule($data); $linkedModule = static::extractLinkedModule($data);
$linkedAgent = static::extractLinkedAgent($data); $linkedAgent = static::extractLinkedAgent($data);
$baseUrl = $config['homeurl'].'index.php'; $baseUrl = \ui_get_full_url('index.php');
// TODO: There's a feature to get the link from the label. // TODO: There's a feature to get the link from the label.
if (static::$useLinkedVisualConsole === true if (static::$useLinkedVisualConsole === true
@ -899,9 +900,9 @@ class Item extends Model
// Linked Visual Console. // Linked Visual Console.
$vcId = $linkedVisualConsole['linkedLayoutId']; $vcId = $linkedVisualConsole['linkedLayoutId'];
// The layout can be from another node. // The layout can be from another node.
$metaconsoleId = $linkedVisualConsole['metaconsoleId']; $linkedLayoutAgentId = $linkedVisualConsole['linkedLayoutAgentId'];
if (empty($metaconsoleId) === true && \is_metaconsole()) { if (empty($linkedLayoutAgentId) === true && \is_metaconsole()) {
/* /*
* A Visual Console from this console. * A Visual Console from this console.
* We are in a metaconsole. * We are in a metaconsole.
@ -916,7 +917,9 @@ class Item extends Model
'pure' => (int) $config['pure'], 'pure' => (int) $config['pure'],
] ]
); );
} else if (empty($metaconsoleId) === true && !\is_metaconsole()) { } else if (empty($linkedLayoutAgentId) === true
&& !\is_metaconsole()
) {
/* /*
* A Visual Console from this console. * A Visual Console from this console.
* We are in a regular console. * We are in a regular console.
@ -938,7 +941,7 @@ class Item extends Model
try { try {
$node = \metaconsole_get_connection_by_id( $node = \metaconsole_get_connection_by_id(
$metaconsoleId $linkedLayoutAgentId
); );
return \ui_meta_get_node_url( return \ui_meta_get_node_url(
$node, $node,
@ -1052,7 +1055,8 @@ class Item extends Model
return null; return null;
} }
} }
} else if (static::$useLinkedAgent === true } else if ((static::$useLinkedAgent === true
|| static::$useLinkedModule === true)
&& $linkedAgent['agentId'] !== null && $linkedAgent['agentId'] !== null
&& $linkedAgent['agentId'] > 0 && $linkedAgent['agentId'] > 0
) { ) {

View File

@ -68,20 +68,20 @@ final class ModuleGraph extends Item
* *
* @param array $data Unknown input data structure. * @param array $data Unknown input data structure.
* *
* @return string 'none', 'white' or 'black'. 'none' by default. * @return string 'transparent', 'white' or 'black'. 'transparent' by default.
*/ */
private static function extractBackgroundType(array $data): string private static function extractBackgroundType(array $data): string
{ {
$value = static::issetInArray($data, ['backgroundType', 'image']); $value = static::issetInArray($data, ['backgroundType', 'image']);
switch ($value) { switch ($value) {
case 'none': case 'transparent':
case 'white': case 'white':
case 'black': case 'black':
return $value; return $value;
default: default:
return 'none'; return 'transparent';
} }
} }
@ -193,6 +193,18 @@ final class ModuleGraph extends Item
} }
} }
/*
* About the 30 substraction to the graph height:
* The function which generates the graph doesn't respect the
* required height. It uses it for the canvas (the graph itself and
* their axes), but then it adds the legend. One item of the legend
* (one dataset) is about 30px, so we need to substract that height
* from the canvas to try to fit the element's height.
*
* PD: The custom graphs can have more datasets, but we only substract
* the height of one of it to replicate the legacy functionality.
*/
// Custom graph. // Custom graph.
if (empty($customGraphId) === false) { if (empty($customGraphId) === false) {
$customGraph = \db_get_row_filter( $customGraph = \db_get_row_filter(
@ -204,7 +216,7 @@ final class ModuleGraph extends Item
$params = [ $params = [
'period' => $period, 'period' => $period,
'width' => $data['width'], 'width' => $data['width'],
'height' => $data['height'], 'height' => ($data['height'] - 30),
'title' => '', 'title' => '',
'unit_name' => null, 'unit_name' => null,
'show_alerts' => false, 'show_alerts' => false,
@ -215,10 +227,10 @@ final class ModuleGraph extends Item
$paramsCombined = [ $paramsCombined = [
'id_graph' => $customGraphId, 'id_graph' => $customGraphId,
'stacked' => $graph['stacked'], 'stacked' => $customGraph['stacked'],
'summatory' => $graph['summatory_series'], 'summatory' => $customGraph['summatory_series'],
'average' => $graph['average_series'], 'average' => $customGraph['average_series'],
'modules_series' => $graph['modules_series'], 'modules_series' => $customGraph['modules_series'],
]; ];
$data['html'] = \graphic_combined_module( $data['html'] = \graphic_combined_module(
@ -237,7 +249,7 @@ final class ModuleGraph extends Item
'period' => $period, 'period' => $period,
'show_events' => false, 'show_events' => false,
'width' => $data['width'], 'width' => $data['width'],
'height' => $data['height'], 'height' => ($data['height'] - 30),
'title' => \modules_get_agentmodule_name($moduleId), 'title' => \modules_get_agentmodule_name($moduleId),
'unit' => \modules_get_unit($moduleId), 'unit' => \modules_get_unit($moduleId),
'only_image' => $imageOnly, 'only_image' => $imageOnly,

View File

@ -2,7 +2,8 @@
margin: 0px auto; margin: 0px auto;
position: relative; position: relative;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain; background-size: 100% 100%;
background-position: center;
} }
.visual-console-item { .visual-console-item {

View File

@ -1 +1 @@
{"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,wBAAwB;AAC1B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;ACdA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n margin: 0px auto;\n position: relative;\n background-repeat: no-repeat;\n background-size: contain;\n}\n\n.visual-console-item {\n position: absolute;\n display: flex;\n flex-direction: initial;\n justify-items: center;\n align-items: center;\n user-select: text;\n}\n","@font-face {\n font-family: Alarm Clock;\n src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n align-content: center;\n align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n font-size: 50px;\n\n /* To improve legibility */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock .hour-hand {\n animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""} {"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,0BAA0B;EAC1B,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;ACfA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n margin: 0px auto;\n position: relative;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n background-position: center;\n}\n\n.visual-console-item {\n position: absolute;\n display: flex;\n flex-direction: initial;\n justify-items: center;\n align-items: center;\n user-select: text;\n}\n","@font-face {\n font-family: Alarm Clock;\n src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n align-content: center;\n align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n font-size: 50px;\n\n /* To improve legibility */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock .hour-hand {\n animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.734'; $version = '7.0NG.734';
$build = '190429'; $build = '190508';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -285,8 +285,38 @@ if (!$meta) {
} }
} }
$id_filter = db_get_value(
'id_filter',
'tusuario',
'id_user',
$config['id_user']
);
// If user has event filter retrieve filter values.
if (!empty($id_filter)) {
$apply_filter = true;
$event_filter = events_get_event_filter($id_filter);
$event_filter['search'] = io_safe_output($event_filter['search']);
$event_filter['id_name'] = io_safe_output($event_filter['id_name']);
$event_filter['tag_with'] = base64_encode(
io_safe_output($event_filter['tag_with'])
);
$event_filter['tag_without'] = base64_encode(
io_safe_output($event_filter['tag_without'])
);
}
$is_filtered = get_parameter('is_filtered', false);
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
if ($event_filter['id_group'] == '') {
$event_filter['id_group'] = 0;
}
$id_group = (int) get_parameter('id_group', 0); $id_group = (int) get_parameter('id_group', 0);
// 0 all // 0 all
// ********************************************************************** // **********************************************************************
// TODO // TODO
@ -297,38 +327,59 @@ $id_group = (int) get_parameter('id_group', 0);
// ********************************************************************** // **********************************************************************
$recursion = (bool) get_parameter('recursion', true); $recursion = (bool) get_parameter('recursion', true);
// Flag show in child groups. // Flag show in child groups.
$event_type = get_parameter('event_type', ''); if (empty($event_filter['event_type'])) {
$event_filter['event_type'] = '';
}
$event_type = ($apply_filter === true && $is_filtered === false) ? $event_filter['event_type'] : get_parameter('event_type', '');
// 0 all. // 0 all.
$severity = (int) get_parameter('severity', -1); $severity = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['severity'] : (int) get_parameter('severity', -1);
// -1 all. // -1 all.
$status = (int) get_parameter('status', 3); if ($event_filter['status'] == -1) {
$event_filter['status'] = 3;
}
$status = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['status'] : (int) get_parameter('status', 3);
// -1 all, 0 only new, 1 only validated, // -1 all, 0 only new, 1 only validated,
// 2 only in process, 3 only not validated. // 2 only in process, 3 only not validated.
$id_agent = (int) get_parameter('id_agent', 0); $id_agent = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['id_agent'] : (int) get_parameter('id_agent', 0);
$pagination = (int) get_parameter('pagination', $config['block_size']); $pagination = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['pagination'] : (int) get_parameter('pagination', $config['block_size']);
$event_view_hr = (int) get_parameter(
if (empty($event_filter['event_view_hr'])) {
$event_filter['event_view_hr'] = ($history) ? 0 : $config['event_view_hr'];
}
$event_view_hr = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['event_view_hr'] : (int) get_parameter(
'event_view_hr', 'event_view_hr',
($history) ? 0 : $config['event_view_hr'] ($history) ? 0 : $config['event_view_hr']
); );
$id_user_ack = get_parameter('id_user_ack', 0);
$group_rep = (int) get_parameter('group_rep', 1);
$id_user_ack = ($apply_filter === true && $is_filtered === false) ? $event_filter['id_user_ack'] : get_parameter('id_user_ack', 0);
$group_rep = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['group_rep'] : (int) get_parameter('group_rep', 1);
$delete = (bool) get_parameter('delete'); $delete = (bool) get_parameter('delete');
$validate = (bool) get_parameter('validate', 0); $validate = (bool) get_parameter('validate', 0);
$section = (string) get_parameter('section', 'list'); $section = (string) get_parameter('section', 'list');
$filter_only_alert = (int) get_parameter('filter_only_alert', -1); $filter_only_alert = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['filter_only_alert'] : (int) get_parameter('filter_only_alert', -1);
$filter_id = (int) get_parameter('filter_id', 0); $filter_id = (int) get_parameter('filter_id', 0);
$id_name = (string) get_parameter('id_name', '');
if (empty($event_filter['id_name'])) {
$event_filter['id_name'] = '';
}
$id_name = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['id_name'] : (string) get_parameter('id_name', '');
$open_filter = (int) get_parameter('open_filter', 0); $open_filter = (int) get_parameter('open_filter', 0);
$date_from = (string) get_parameter('date_from', ''); $date_from = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['date_from'] : (string) get_parameter('date_from', '');
$date_to = (string) get_parameter('date_to', ''); $date_to = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['date_to'] : (string) get_parameter('date_to', '');
$time_from = (string) get_parameter('time_from', ''); $time_from = (string) get_parameter('time_from', '');
$time_to = (string) get_parameter('time_to', ''); $time_to = (string) get_parameter('time_to', '');
$server_id = (int) get_parameter('server_id', 0); $server_id = (int) get_parameter('server_id', 0);
$text_agent = (string) get_parameter('text_agent'); $text_agent = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['text_agent'] : (string) get_parameter('text_agent');
$refr = (int) get_parameter('refresh'); $refr = (int) get_parameter('refresh');
$id_extra = (string) get_parameter('id_extra'); $id_extra = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['id_extra'] : (string) get_parameter('id_extra');
$user_comment = (string) get_parameter('user_comment'); $user_comment = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['user_comment'] : (string) get_parameter('user_comment');
$source = (string) get_parameter('source'); $source = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['source'] : (string) get_parameter('source');
if ($id_agent != 0) { if ($id_agent != 0) {
$text_agent = agents_get_alias($id_agent); $text_agent = agents_get_alias($id_agent);
@ -343,7 +394,7 @@ if ($id_agent != 0) {
} }
$text_module = (string) get_parameter('module_search', ''); $text_module = (string) get_parameter('module_search', '');
$id_agent_module = get_parameter( $id_agent_module = ($apply_filter === true && $is_filtered === false) ? $event_filter['id_agent_module'] : get_parameter(
'module_search_hidden', 'module_search_hidden',
get_parameter('id_agent_module', 0) get_parameter('id_agent_module', 0)
); );
@ -363,7 +414,7 @@ if ($id_agent_module != 0) {
$tag_with_json = base64_decode(get_parameter('tag_with', '')); $tag_with_json = ($apply_filter === true && $is_filtered === false) ? base64_decode($event_filter['tag_with']) : base64_decode(get_parameter('tag_with', ''));
$tag_with_json_clean = io_safe_output($tag_with_json); $tag_with_json_clean = io_safe_output($tag_with_json);
$tag_with_base64 = base64_encode($tag_with_json_clean); $tag_with_base64 = base64_encode($tag_with_json_clean);
$tag_with = json_decode($tag_with_json_clean, true); $tag_with = json_decode($tag_with_json_clean, true);
@ -373,7 +424,7 @@ if (empty($tag_with)) {
$tag_with = array_diff($tag_with, [0 => 0]); $tag_with = array_diff($tag_with, [0 => 0]);
$tag_without_json = base64_decode(get_parameter('tag_without', '')); $tag_without_json = ($apply_filter === true && $is_filtered === false) ? base64_decode($event_filter['tag_without']) : base64_decode(get_parameter('tag_without', ''));
$tag_without_json_clean = io_safe_output($tag_without_json); $tag_without_json_clean = io_safe_output($tag_without_json);
$tag_without_base64 = base64_encode($tag_without_json_clean); $tag_without_base64 = base64_encode($tag_without_json_clean);
$tag_without = json_decode($tag_without_json_clean, true); $tag_without = json_decode($tag_without_json_clean, true);
@ -886,11 +937,11 @@ $(document).ready( function() {
// Remove delete link (if event is not grouped and there is more than one event) // Remove delete link (if event is not grouped and there is more than one event)
if ($("#group_rep").val() == 1) { if ($("#group_rep").val() == 1) {
if (parseInt($("#count_event_group_"+id).text()) <= 1) { if (parseInt($("#count_event_group_"+id).text()) <= 1) {
$("#delete-"+id).replaceWith('<img alt="' + <?php echo "'".__('Is not allowed delete events in process')."'"; ?> + '" title="' + <?php echo "'".__('Is not allowed delete events in process')."'"; ?> + '" src="images/cross.disabled.png">'); $("#delete-"+id).replaceWith('<img alt=" <?php echo addslashes(__('Is not allowed delete events in process')); ?>" title="<?php echo addslashes(__('Is not allowed delete events in process')); ?>" src="images/cross.disabled.png">');
} }
} }
else { // Remove delete link (if event is not grouped) else { // Remove delete link (if event is not grouped)
$("#delete-"+id).replaceWith('<img alt="' + <?php echo "'".__('Is not allowed delete events in process')."'"; ?> + '" title="' + <?php echo "'".__('Is not allowed delete events in process')."'"; ?> + '" src="images/cross.disabled.png">'); $("#delete-"+id).replaceWith('<img alt="<?php echo addslashes(__('Is not allowed delete events in process')); ?> " title="<?php echo addslashes(__('Is not allowed delete events in process')); ?>" src="images/cross.disabled.png">');
} }
// Change state image // Change state image
@ -1091,8 +1142,8 @@ function validate_event_advanced(id, new_status) {
$("#in-progress-"+id).remove(); $("#in-progress-"+id).remove();
// Format the new disabled delete icon. // Format the new disabled delete icon.
$("#validate-"+id).parent().append("<img id='delete-" + id + "' src='" + cross_disabled_image + "' />"); $("#validate-"+id).parent().append("<img id='delete-" + id + "' src='" + cross_disabled_image + "' />");
$("#delete-"+id).attr ("data-title", <?php echo "'".__('Is not allowed delete events in process')."'"; ?>); $("#delete-"+id).attr ("data-title", "<?php echo addslashes(__('Is not allowed delete events in process')); ?>");
$("#delete-"+id).attr ("alt", <?php echo "'".__('Is not allowed delete events in process')."'"; ?>); $("#delete-"+id).attr ("alt"," <?php echo addslashes(__('Is not allowed delete events in process')); ?>");
$("#delete-"+id).attr ("data-use_title_for_force_title", 1); $("#delete-"+id).attr ("data-use_title_for_force_title", 1);
$("#delete-"+id).attr ("class", "forced_title"); $("#delete-"+id).attr ("class", "forced_title");

View File

@ -232,6 +232,7 @@ if ($user_filter != 0 && empty($id_name) && !$update_from_filter_table) {
); );
$user_default_filter = $user_default_filter[0]; $user_default_filter = $user_default_filter[0];
if (!empty($user_default_filter)) {
// FORM. // FORM.
$id_name = $user_default_filter['id_name']; $id_name = $user_default_filter['id_name'];
$id_group = $user_default_filter['id_group']; $id_group = $user_default_filter['id_group'];
@ -295,6 +296,7 @@ if ($user_filter != 0 && empty($id_name) && !$update_from_filter_table) {
$tag_without_clear = io_safe_output($tag_without); $tag_without_clear = io_safe_output($tag_without);
$tag_without = json_decode($tag_without_clear, true); $tag_without = json_decode($tag_without_clear, true);
} }
}
} }
// Build the condition of the events query. // Build the condition of the events query.
@ -706,6 +708,9 @@ if (is_metaconsole()) {
// Hidden field with the loaded filter name. // Hidden field with the loaded filter name.
$events_filter .= html_print_input_hidden('id_name', $id_name, true); $events_filter .= html_print_input_hidden('id_name', $id_name, true);
// Hidden field that signals filter has been applied.
$events_filter .= html_print_input_hidden('is_filtered', 'true', true);
// Hidden open filter flag // Hidden open filter flag
// If autoupdate is in use collapse filter. // If autoupdate is in use collapse filter.
if ($open_filter) { if ($open_filter) {
@ -1039,6 +1044,20 @@ $events_filter .= $botom_update;
$events_filter .= '</form>'; $events_filter .= '</form>';
// This is the filter div. // This is the filter div.
$user_filter = db_get_value(
'default_event_filter',
'tusuario',
'id_user',
$config['id_user']
);
$user_default_filter = db_get_all_rows_filter(
'tevent_filter',
['id_filter' => $user_filter]
);
$user_default_filter = $user_default_filter[0];
$id_name = $user_default_filter['id_name'];
$filter_resume['title'] = empty($id_name) ? __('No filter loaded') : __('Filter loaded').': '.$id_name; $filter_resume['title'] = empty($id_name) ? __('No filter loaded') : __('Filter loaded').': '.$id_name;
if (is_metaconsole()) { if (is_metaconsole()) {
@ -1321,8 +1340,6 @@ $(document).ready( function() {
// Update the info with the loaded filter // Update the info with the loaded filter
$('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + $("#hidden-id_name").val()); $('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + $("#hidden-id_name").val());
// Update the view with the loaded filter
$('#submit-update').trigger('click');
}, },
"json" "json"
); );

View File

@ -182,7 +182,8 @@ if ($searchAgents) {
} }
$sql = " $sql = "
FROM tagente t1 FROM tagente t1 LEFT JOIN tagent_secondary_group tasg
ON t1.id_agente = tasg.id_agent
INNER JOIN tgrupo t2 INNER JOIN tgrupo t2
ON t2.id_grupo = t1.id_grupo ON t2.id_grupo = t1.id_grupo
WHERE ( WHERE (
@ -191,9 +192,11 @@ if ($searchAgents) {
FROM tusuario FROM tusuario
WHERE id_user = '".$config['id_user']."' WHERE id_user = '".$config['id_user']."'
) )
OR t1.id_grupo IN ( OR (
".implode(',', $id_userGroups)." t1.id_grupo IN (".implode(',', $id_userGroups).')
) OR 0 IN ( OR tasg.id_group IN ('.implode(',', $id_userGroups).")
)
OR 0 IN (
SELECT id_grupo SELECT id_grupo
FROM tusuario_perfil FROM tusuario_perfil
WHERE id_usuario = '".$config['id_user']."' WHERE id_usuario = '".$config['id_user']."'
@ -208,7 +211,7 @@ if ($searchAgents) {
) )
'; ';
$select = 'SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet'; $select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet';
if ($only_count) { if ($only_count) {
$limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0'; $limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0';
} else { } else {

View File

@ -108,6 +108,12 @@ if (!$modules || !$searchModules) {
__('WARNING').': '.modules_get_last_value($module['id_agente_modulo']), __('WARNING').': '.modules_get_last_value($module['id_agente_modulo']),
true true
); );
} else if ($status_sql['estado'] == 3) {
$statusCell = ui_print_status_image(
STATUS_MODULE_UNKNOWN,
__('UNKNOWN').': '.modules_get_last_value($module['id_agente_modulo']),
true
);
} else { } else {
$last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']); $last_status = modules_get_agentmodule_last_status($module['id_agente_modulo']);
switch ($last_status) { switch ($last_status) {

View File

@ -92,6 +92,16 @@ echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
echo '</a>'; echo '</a>';
echo '</li>'; echo '</li>';
// Countdown.
echo '<li class="nomn">';
echo '<div class="vc-refr">';
echo '<div id="vc-refr-form">';
echo __('Refresh').':';
echo html_print_select(get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false);
echo '</div>';
echo '</div>';
echo '</li>';
// Console name. // Console name.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-title">'.$visualConsoleName.'</div>'; echo '<div class="vc-title">'.$visualConsoleName.'</div>';
@ -113,6 +123,7 @@ if (!users_can_manage_group_all('AR')) {
$aclUserGroups = array_keys(users_get_groups(false, 'AR')); $aclUserGroups = array_keys(users_get_groups(false, 'AR'));
} }
$ignored_params['refr'] = '';
ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('pandora_visual_console');
include_javascript_d3(); include_javascript_d3();
visual_map_load_client_resources(); visual_map_load_client_resources();
@ -159,7 +170,7 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
// Change the links. // Change the links.
if (prevProps && prevProps.id !== newProps.id) { if (prevProps && prevProps.id !== newProps.id) {
var regex = /(id=|id_visual_console=|id_layout=)\d+(&?)/gi; var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
var replacement = '$1' + newProps.id + '$2'; var replacement = '$1' + newProps.id + '$2';
// Tab links. // Tab links.
@ -186,8 +197,13 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
handleUpdate handleUpdate
); );
$(document).ready(function () { $(document).ready (function () {
var controls = document.getElementById('vc-controls'); var refr = <?php echo (int) $refr; ?>;
if (controls) autoHideElement(controls, 1000); var href = "<?php echo ui_get_url_refresh($ignored_params); ?>";
$('select#refr').change(function (event) {
url = js_html_entity_decode( href ) + $('select#refr').val();
$(document).attr ("location", url);
});
}); });
</script> </script>

View File

@ -133,7 +133,7 @@ $options['view']['active'] = true;
if (!is_metaconsole()) { if (!is_metaconsole()) {
if (!$config['pure']) { if (!$config['pure']) {
$options['pure']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1">'.html_print_image( $options['pure']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1&refr='.$refr.'">'.html_print_image(
'images/full_screen.png', 'images/full_screen.png',
true, true,
['title' => __('Full screen mode')] ['title' => __('Full screen mode')]
@ -172,6 +172,16 @@ if ($pure === true) {
echo '</a>'; echo '</a>';
echo '</li>'; echo '</li>';
// Countdown.
echo '<li class="nomn">';
echo '<div class="vc-refr">';
echo '<div id="vc-refr-form">';
echo __('Refresh').':';
echo html_print_select(get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false);
echo '</div>';
echo '</div>';
echo '</li>';
// Console name. // Console name.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-title">'.$visualConsoleName.'</div>'; echo '<div class="vc-title">'.$visualConsoleName.'</div>';
@ -207,6 +217,7 @@ if (!users_can_manage_group_all('AR')) {
$aclUserGroups = array_keys(users_get_groups(false, 'AR')); $aclUserGroups = array_keys(users_get_groups(false, 'AR'));
} }
$ignored_params['refr'] = '';
ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('pandora_visual_console');
include_javascript_d3(); include_javascript_d3();
visual_map_load_client_resources(); visual_map_load_client_resources();
@ -261,7 +272,7 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
// Change the links. // Change the links.
if (prevProps && prevProps.id !== newProps.id) { if (prevProps && prevProps.id !== newProps.id) {
var regex = /(id=|id_visual_console=|id_layout=)\d+(&?)/gi; var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
var replacement = '$1' + newProps.id + '$2'; var replacement = '$1' + newProps.id + '$2';
// Tab links. // Tab links.
@ -294,8 +305,16 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
handleUpdate handleUpdate
); );
$(document).ready(function () { $(document).ready (function () {
var controls = document.getElementById('vc-controls'); var refr = <?php echo (int) $refr; ?>;
if (controls) autoHideElement(controls, 1000); var pure = <?php echo (int) $config['pure']; ?>;
var href = "<?php echo ui_get_url_refresh($ignored_params); ?>";
if (pure) {
$('select#refr').change(function (event) {
url = js_html_entity_decode( href ) + $('select#refr').val();
$(document).attr ("location", url);
});
}
}); });
</script> </script>

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

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

View File

@ -1421,6 +1421,18 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`hide_no_data` tinyint(1) default 0, `hide_no_data` tinyint(1) default 0,
`recursion` tinyint(1) default NULL, `recursion` tinyint(1) default NULL,
`show_extended_events` tinyint(1) default '0', `show_extended_events` tinyint(1) default '0',
`total_time` TINYINT(1) DEFAULT '1',
`time_failed` TINYINT(1) DEFAULT '1',
`time_in_ok_status` TINYINT(1) DEFAULT '1',
`time_in_unknown_status` TINYINT(1) DEFAULT '1',
`time_of_not_initialized_module` TINYINT(1) DEFAULT '1',
`time_of_downtime` TINYINT(1) DEFAULT '1',
`total_checks` TINYINT(1) DEFAULT '1',
`checks_failed` TINYINT(1) DEFAULT '1',
`checks_in_ok_status` TINYINT(1) DEFAULT '1',
`unknown_checks` TINYINT(1) DEFAULT '1',
`agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1',
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
@ -2948,6 +2960,18 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`lapse` int(11) UNSIGNED NOT NULL default '300', `lapse` int(11) UNSIGNED NOT NULL default '300',
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0', `visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
`hide_no_data` tinyint(1) default 0, `hide_no_data` tinyint(1) default 0,
`total_time` TINYINT(1) DEFAULT '1',
`time_failed` TINYINT(1) DEFAULT '1',
`time_in_ok_status` TINYINT(1) DEFAULT '1',
`time_in_unknown_status` TINYINT(1) DEFAULT '1',
`time_of_not_initialized_module` TINYINT(1) DEFAULT '1',
`time_of_downtime` TINYINT(1) DEFAULT '1',
`total_checks` TINYINT(1) DEFAULT '1',
`checks_failed` TINYINT(1) DEFAULT '1',
`checks_in_ok_status` TINYINT(1) DEFAULT '1',
`unknown_checks` TINYINT(1) DEFAULT '1',
`agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1',
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.734-190429 Version: 7.0NG.734-190508
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.734-190429" pandora_version="7.0NG.734-190508"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.734"; my $pandora_version = "7.0NG.734";
my $pandora_build = "190429"; my $pandora_build = "190508";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

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

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190429 %define release 190508
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.734 PS190429"; my $version = "7.0NG.734 PS190508";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.734 PS190429"; my $version = "7.0NG.734 PS190508";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -155,6 +155,7 @@ sub help_screen{
help_screen_line('--update_module', '<module_name> <agent_name> <field_to_change> <new_value>', 'Update a module field'); help_screen_line('--update_module', '<module_name> <agent_name> <field_to_change> <new_value>', 'Update a module field');
help_screen_line('--get_agents_module_current_data', '<module_name>', "Get the agent and current data \n\t of all the modules with a given name"); help_screen_line('--get_agents_module_current_data', '<module_name>', "Get the agent and current data \n\t of all the modules with a given name");
help_screen_line('--create_network_module_from_component', '<agent_name> <component_name>', "Create a new network \n\t module from a network component"); help_screen_line('--create_network_module_from_component', '<agent_name> <component_name>', "Create a new network \n\t module from a network component");
help_screen_line('--create_network_component', "<network_component_name> <network_component_group> <network_component_type> \n\t [<description> <module_interval> <max_value> <min_value> \n\t <snmp_community> <id_module_group> <max_timeout> \n\t <history_data> <min_warning> <max_warning> \n\t <str_warning> <min_critical> <max_critical> \n\t <str_critical> <min_ff_event> <post_process> \n\t <disabled_types_event> <each_ff> <min_ff_event_normal> \n\t <min_ff_event_warning> <min_ff_event_critical>]", "Create a new network component");
help_screen_line('--create_synthetic', "<module_name> <synthetic_type> <agent_name> <source_agent1>,<operation>,<source_module1>|<source_agent1>,<source_module1> \n\t [ <operation>,<fixed_value> | <source agent2>,<operation>,<source_module2> ]", "Create a new Synthetic module"); help_screen_line('--create_synthetic', "<module_name> <synthetic_type> <agent_name> <source_agent1>,<operation>,<source_module1>|<source_agent1>,<source_module1> \n\t [ <operation>,<fixed_value> | <source agent2>,<operation>,<source_module2> ]", "Create a new Synthetic module");
print "\nALERTS:\n\n" unless $param ne ''; print "\nALERTS:\n\n" unless $param ne '';
help_screen_line('--create_template_module', '<template_name> <module_name> <agent_name>', 'Add alert template to module'); help_screen_line('--create_template_module', '<template_name> <module_name> <agent_name>', 'Add alert template to module');
@ -1685,6 +1686,23 @@ sub cli_create_network_module_from_component() {
pandora_create_module_from_network_component ($conf, $component, $agent_id, $dbh); pandora_create_module_from_network_component ($conf, $component, $agent_id, $dbh);
} }
##############################################################################
# Create a network component.
# Related option: --create_network_component
##############################################################################
sub cli_create_network_component() {
my ($c_name, $c_group, $c_type) = @ARGV[2..4];
my @todo = @ARGV[5..20];
my $other = join('|', @todo);
my @todo2 = @ARGV[22..26];
my $other2 = join('|', @todo2);
# Call the API.
my $result = api_call( $conf, 'set', 'new_network_component', $c_name, undef, "$c_type|$other|$c_group|$other2");
print "$result \n\n ";
}
############################################################################## ##############################################################################
# Create netflow filter # Create netflow filter
# Related option: --create_netflow_filter # Related option: --create_netflow_filter
@ -6204,6 +6222,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 2); param_check($ltotal, 2);
cli_create_network_module_from_component(); cli_create_network_module_from_component();
} }
elsif ($param eq '--create_network_component') {
param_check($ltotal, 24, 21);
cli_create_network_component();
}
elsif ($param eq '--create_netflow_filter') { elsif ($param eq '--create_netflow_filter') {
param_check($ltotal, 5); param_check($ltotal, 5);
cli_create_netflow_filter(); cli_create_netflow_filter();

View File

@ -361,8 +361,16 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
(this.props.isLinkEnabled && prevProps.link !== this.props.link)) (this.props.isLinkEnabled && prevProps.link !== this.props.link))
) { ) {
const container = this.createContainerDomElement(); const container = this.createContainerDomElement();
// Add the children of the old element.
container.innerHTML = this.elementRef.innerHTML; container.innerHTML = this.elementRef.innerHTML;
// Copy the attributes.
const attrs = this.elementRef.attributes;
for (let i = 0; i < attrs.length; i++) {
if (attrs[i].nodeName !== "id") {
container.setAttributeNode(attrs[i]);
}
}
// Replace the reference.
if (this.elementRef.parentNode !== null) { if (this.elementRef.parentNode !== null) {
this.elementRef.parentNode.replaceChild(container, this.elementRef); this.elementRef.parentNode.replaceChild(container, this.elementRef);
} }

View File

@ -248,7 +248,7 @@ export default class VisualConsole {
if (a.isOnTop && !b.isOnTop) return 1; if (a.isOnTop && !b.isOnTop) return 1;
else if (!a.isOnTop && b.isOnTop) return -1; else if (!a.isOnTop && b.isOnTop) return -1;
else if (a.id < b.id) return 1; else if (a.id > b.id) return 1;
else return -1; else return -1;
}); });

View File

@ -251,10 +251,10 @@ export default class Percentile extends Item<PercentileProps> {
private getProgress(): number { private getProgress(): number {
const minValue = this.props.minValue || 0; const minValue = this.props.minValue || 0;
const maxValue = this.props.maxValue || 100; const maxValue = this.props.maxValue || 100;
const value = this.props.value || 100; const value = this.props.value == null ? 0 : this.props.value;
if (value <= minValue) return 0; if (value <= minValue) return 0;
else if (value >= maxValue) return 100; else if (value >= maxValue) return 100;
else return ((value - minValue) / (maxValue - minValue)) * 100; else return Math.trunc(((value - minValue) / (maxValue - minValue)) * 100);
} }
} }

View File

@ -2,7 +2,8 @@
margin: 0px auto; margin: 0px auto;
position: relative; position: relative;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain; background-size: 100% 100%;
background-position: center;
} }
.visual-console-item { .visual-console-item {