Merge remote-tracking branch 'origin/develop' into ent-3782-module-visualization-bug

This commit is contained in:
Luis Calvo 2019-05-07 16:08:29 +02:00
commit 3221bcf55a
397 changed files with 30607 additions and 321173 deletions

26
extras/build_rpm_rhel7.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
source build_vars.sh
if [ ! -d $RPMHOME/RPMS ]; then
mkdir -p $RPMHOME/RPMS || exit 1
fi
echo "Creating RPM packages in $RPMHOME/RPMS"
# Console
rpmbuild -ba $CODEHOME/pandora_console/pandora_console.rhel7.spec || exit 1
# Server
#rpmbuild -ba $CODEHOME/pandora_server/pandora_server.rhel7.spec || exit 1
# Unix agent
#rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.rhel7.spec || exit 1
# Enterprise console
rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec || exit 1
# Enterprise server
#rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.rhel7.spec || exit 1
exit 0

View File

@ -26,9 +26,11 @@ $CODEHOME/pandora_server/pandora_server.spec \
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \
$CODEHOME/pandora_console/pandora_console.redhat.spec \ $CODEHOME/pandora_console/pandora_console.redhat.spec \
$CODEHOME/pandora_console/pandora_console.rhel7.spec \
$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \
$CODEHOME/pandora_server/pandora_server.redhat.spec \ $CODEHOME/pandora_server/pandora_server.redhat.spec \
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \ $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \
$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.rhel7.spec \
$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec" $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec"
DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \ DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \
$CODEHOME/pandora_server/DEBIAN \ $CODEHOME/pandora_server/DEBIAN \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.733 # Version 7.0NG.734
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.733'; use constant AGENT_VERSION => '7.0NG.734';
use constant AGENT_BUILD => '190328'; use constant AGENT_BUILD => '190507';
# 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;
@ -662,6 +662,8 @@ sub parse_conf_modules($) {
$module->{'ff_timeout'} = $1; $module->{'ff_timeout'} = $1;
} elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) { } elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) {
$module->{'each_ff'} = $1; $module->{'each_ff'} = $1;
} elsif ($line =~ /^\s*module_ff_type\s+(\d+)\s*$/) {
$module->{'ff_type'} = $1;
# Macros # Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2; $module->{'macros'}{$1} = $2;
@ -1073,6 +1075,10 @@ sub send_buffered_xml_files ($;$) {
unlink ("$temporal_file/$xml_file"); unlink ("$temporal_file/$xml_file");
} }
} }
# Do not get stuck trying to send buffered XML files to a secondary server.
elsif ($flag_always == 2) {
last;
}
} }
if (defined($flag_always) && ($flag_always == 2)){ if (defined($flag_always) && ($flag_always == 2)){
swap_servers (); swap_servers ();
@ -2101,45 +2107,28 @@ sub cron_next_execution {
} }
# Get day of the week and month from cron config # Get day of the week and month from cron config
my ($mday, $wday) = (split (/\s/, $cron))[2, 4]; my ($wday) = (split (/\s/, $cron))[4];
# Check the wday values to avoid infinite loop
my ($wday_down, $wday_up) = cron_get_interval($wday);
if ($wday_down ne "*" && ($wday_down > 6 || (defined($wday_up) && $wday_up > 6))) {
log_message('setup', "Invalid cron configuration $cron. Day of the week is out of limits.");
$wday = "*";
}
# Get current time and day of the week # Get current time and day of the week
my $cur_time = time(); my $cur_time = time();
my $cur_wday = (localtime ($cur_time))[6]; my $cur_wday = (localtime ($cur_time))[6];
# Any day of the week my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval);
if ($wday eq '*') {
my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval); # Check the day
return $nex_time - time(); while (!cron_check_interval($wday, (localtime ($nex_time))[6])) {
} # If it does not acomplish the day of the week, go to the next day.
# A range? $nex_time += 86400;
else { $nex_time = cron_next_execution_date ($cron, $nex_time, 0);
$wday = cron_get_closest_in_range ($cur_wday, $wday);
} }
# A specific day of the week return $nex_time - time();
my $count = 0;
my $nex_time = $cur_time;
do {
$nex_time = cron_next_execution_date ($cron, $nex_time, $interval);
my $nex_time_wd = $nex_time;
my ($nex_mon, $nex_wday) = (localtime ($nex_time_wd))[4, 6];
my $nex_mon_wd;
do {
# Check the day of the week
if ($nex_wday == $wday) {
return $nex_time_wd - time();
}
# Move to the next day of the month
$nex_time_wd += 86400;
($nex_mon_wd, $nex_wday) = (localtime ($nex_time_wd))[4, 6];
} while ($mday eq '*' && $nex_mon_wd == $nex_mon);
$count++;
} while ($count < 60);
# Something went wrong, default to 5 minutes
return $interval;
} }
############################################################################### ###############################################################################
@ -2151,7 +2140,30 @@ sub cron_check_syntax ($) {
return 0 if !defined ($cron); return 0 if !defined ($cron);
return ($cron =~ m/^(\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+$/); return ($cron =~ m/^(\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+ (\d|\*|-)+$/);
} }
###############################################################################
# Check if a value is inside an interval.
###############################################################################
sub cron_check_interval {
my ($elem_cron, $elem_curr_time) = @_;
# Return 1 if wildcard.
return 1 if ($elem_cron eq "*");
my ($down, $up) = cron_get_interval($elem_cron);
# Check if it is not a range
if (!defined($up)) {
return ($down == $elem_curr_time) ? 1 : 0;
}
# Check if it is on the range
if ($down < $up) {
return 0 if ($elem_curr_time < $down || $elem_curr_time > $up);
} else {
return 0 if ($elem_curr_time > $down || $elem_curr_time < $up);
}
return 1;
}
############################################################################### ###############################################################################
# Get the next execution date for the given cron entry in seconds since epoch. # Get the next execution date for the given cron entry in seconds since epoch.
############################################################################### ###############################################################################
@ -2189,8 +2201,7 @@ sub cron_next_execution_date {
my @nex_time_array = @curr_time_array; my @nex_time_array = @curr_time_array;
# Update minutes # Update minutes
my ($min_down, undef) = cron_get_interval ($min); $nex_time_array[0] = cron_get_next_time_element($min);
$nex_time_array[0] = ($min_down eq '*') ? 0 : $min_down;
$nex_time = cron_valid_date(@nex_time_array, $cur_year); $nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time >= $cur_time) { if ($nex_time >= $cur_time) {
@ -2224,8 +2235,7 @@ sub cron_next_execution_date {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
#Update the hour if fails #Update the hour if fails
my ($hour_down, undef) = cron_get_interval ($hour); $nex_time_array[1] = cron_get_next_time_element($hour);
$nex_time_array[1] = ($hour_down eq '*') ? 0 : $hour_down;
# When an overflow is passed check the hour update again # When an overflow is passed check the hour update again
$nex_time = cron_valid_date(@nex_time_array, $cur_year); $nex_time = cron_valid_date(@nex_time_array, $cur_year);
@ -2253,10 +2263,9 @@ sub cron_next_execution_date {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
#Update the day if fails #Update the day if fails
my ($mday_down, undef) = cron_get_interval ($mday); $nex_time_array[2] = cron_get_next_time_element($mday, 1);
$nex_time_array[2] = ($mday_down eq '*') ? 1 : $mday_down;
# When an overflow is passed check the day update in the next execution # When an overflow is passed check the hour update in the next execution
$nex_time = cron_valid_date(@nex_time_array, $cur_year); $nex_time = cron_valid_date(@nex_time_array, $cur_year);
if ($nex_time >= $cur_time) { if ($nex_time >= $cur_time) {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
@ -2276,8 +2285,7 @@ sub cron_next_execution_date {
return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array); return $nex_time if cron_is_in_cron(\@cron_array, \@nex_time_array);
#Update the month if fails #Update the month if fails
my ($mon_down, undef) = cron_get_interval ($mon); $nex_time_array[3] = cron_get_next_time_element($mon);
$nex_time_array[3] = ($mon_down eq '*') ? 0 : $mon_down;
# When an overflow is passed check the month update in the next execution # When an overflow is passed check the month update in the next execution
$nex_time = cron_valid_date(@nex_time_array, $cur_year); $nex_time = cron_valid_date(@nex_time_array, $cur_year);
@ -2308,23 +2316,30 @@ sub cron_is_in_cron {
#If there is no elements means that is in cron #If there is no elements means that is in cron
return 1 unless (defined($elem_cron) || defined($elem_curr_time)); return 1 unless (defined($elem_cron) || defined($elem_curr_time));
# Go to last element if current is a wild card # Check the element interval
if ($elem_cron ne '*') { return 0 unless (cron_check_interval($elem_cron, $elem_curr_time));
my ($down, $up) = cron_get_interval($elem_cron);
# Check if there is no a range
return 0 if (!defined($up) && ($down != $elem_curr_time));
# Check if there is on the range
if (defined($up)) {
if ($down < $up) {
return 0 if ($elem_curr_time < $down || $elem_curr_time > $up);
} else {
return 0 if ($elem_curr_time > $down || $elem_curr_time < $up);
}
}
}
return cron_is_in_cron(\@deref_elems_cron, \@deref_elems_curr_time); return cron_is_in_cron(\@deref_elems_cron, \@deref_elems_curr_time);
} }
################################################################################
#Get the next tentative time for a cron value or interval in case of overflow.
#Floor data is the minimum localtime data for a position. Ex:
#Ex:
# * should returns floor data.
# 5 should returns 5.
# 10-55 should returns 10.
# 55-10 should retunrs floor data.
################################################################################
sub cron_get_next_time_element {
# Default floor data is 0
my ($curr_element, $floor_data) = @_;
$floor_data = 0 unless defined($floor_data);
my ($elem_down, $elem_up) = cron_get_interval ($curr_element);
return ($elem_down eq '*' || (defined($elem_up) && $elem_down > $elem_up))
? $floor_data
: $elem_down;
}
############################################################################### ###############################################################################
# Returns the interval of a cron element. If there is not a range, # Returns the interval of a cron element. If there is not a range,
# returns an array with the first element in the first place of array # returns an array with the first element in the first place of array
@ -2416,12 +2431,11 @@ sub check_module_cron {
return 1 unless ($is_first); return 1 unless ($is_first);
# Check if current timestamp is a valid cron date # Check if current timestamp is a valid cron date
my $next_execution = cron_next_execution_date( my $next_execution = cron_next_execution(
$module->{'cron'}, $module->{'cron'},
$now - $interval, 0
$interval
); );
return 1 if ($next_execution == $now); return 1 if (time() + $next_execution == $now);
return 0; return 0;
} }
@ -2532,6 +2546,7 @@ sub write_module_xml ($@) {
$Xml .= " <min_ff_event_critical>" . $module->{'min_ff_event_critical'} . "</min_ff_event_critical>\n" if (defined ($module->{'min_ff_event_critical'})); $Xml .= " <min_ff_event_critical>" . $module->{'min_ff_event_critical'} . "</min_ff_event_critical>\n" if (defined ($module->{'min_ff_event_critical'}));
$Xml .= " <ff_timeout>" . $module->{'ff_timeout'} . "</ff_timeout>\n" if (defined ($module->{'ff_timeout'})); $Xml .= " <ff_timeout>" . $module->{'ff_timeout'} . "</ff_timeout>\n" if (defined ($module->{'ff_timeout'}));
$Xml .= " <each_ff>" . $module->{'each_ff'} . "</each_ff>\n" if (defined ($module->{'each_ff'})); $Xml .= " <each_ff>" . $module->{'each_ff'} . "</each_ff>\n" if (defined ($module->{'each_ff'}));
$Xml .= " <ff_type>" . $module->{'ff_type'} . "</ff_type>\n" if (defined ($module->{'ff_type'}));
# Data list # Data list
if ($#data > 0) { if ($#data > 0) {

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.733 %define version 7.0NG.734
%define release 190328 %define release 190507
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.733 %define version 7.0NG.734
%define release 190328 %define release 190507
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -4,23 +4,44 @@
# Copyright (c) 2009 Artica Soluciones Tecnologicas S.L. # Copyright (c) 2009 Artica Soluciones Tecnologicas S.L.
# #
# inventory Generate a hardware/software inventory. # inventory Generate a hardware/software inventory.
# #
# Sample usage: ./inventory <interval in days> [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [process] [users] # Sample usage: ./inventory <interval in days> [cpu] [ram] [video] [nic] [hd] [cdrom] [software] [init_services] [filesystem] [process] [users]
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# 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.
# #
############################################################################### ###############################################################################
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,12 +52,12 @@ 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);
} }
# Parse module data # Parse module data
while (my $line = shift (@{$hwinfo})) { while (my $line = shift (@{$hwinfo})) {
if ($line =~ /$Separator/) { if ($line =~ /$Separator/) {
@ -46,7 +67,7 @@ sub get_module_data ($$$$) {
foreach my $key (@{$keys}) { foreach my $key (@{$keys}) {
if ($line =~ /$key:\s+(.+)/) { if ($line =~ /$key:\s+(.+)/) {
$module{$key} = $1; $module{$key} = $1;
# Replace semicolon by comma to avoid parse errors # Replace semicolon by comma to avoid parse errors
$module{$key} =~ s/;/,/g; $module{$key} =~ s/;/,/g;
} }
} }
@ -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+)/);
@ -73,94 +147,110 @@ sub get_file_system($$) {
$module{'used'} = $2; $module{'used'} = $2;
$module{'avail'} = $3; $module{'avail'} = $3;
$module{'mount'} = $4; $module{'mount'} = $4;
$module{'_keys'} = ['filesystem', 'used','avail', 'mount']; $module{'_keys'} = ['filesystem', 'used','avail', 'mount'];
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
} }
} }
# 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;
$module{'_keys'} = ['service']; $module{'_keys'} = ['service'];
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
} }
} }
# 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;
if (is_enabled $AIX) {
$script = "ps -eo args | tail -n +2";
} else {
$script = "ps -eo command | tail -n +2";
}
my $script = "ps -eo command"; my @services = `$script`;
foreach my $row (@services) {
my @services = `$script`; my %module;
foreach my $row (@services) { # Remove carriage returns
my %module; $row =~ s/[\n\l\f]//g;
# Remove carriage returns # Replace semicolon by comma to avoid parse errors
$row =~ s/[\n\l\f]//g; $row =~ s/;/,/g;
# Replace semicolon by comma to avoid parse errors $module{'service'} = $row;
$row =~ s/;/,/g; $module{'_keys'} = ['service'];
$module{'service'} = $row; push (@{$modules->{$name}}, \%module);
$module{'_keys'} = ['service']; }
push (@{$modules->{$name}}, \%module);
}
} }
# 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 = "";
my @services = `$script`; my @services = `$script`;
foreach my $row (@services) { foreach my $row (@services) {
my %module; my %module;
next unless ($row =~ /^([A-Za-z0-9\-\_]*)/); next unless ($row =~ /^([A-Za-z0-9\-\_]*)/);
if (is_enabled $AIX) {
$user = $1; $user = $1;
$script = `passwd -S $user`; $script = `lsuser $user`;
if ( $script =~ /^(\S+)\sP./){ if ( $script =~ /^(\S+)\sid./){
$module{'user'} = $user; $module{'user'} = $user;
$module{'_keys'} = ['user']; $module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
}
} else {
$user = $1;
$script = `passwd -S $user`;
if ( $script =~ /^(\S+)\sP./){
$module{'user'} = $user;
$module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module);
} }
} }
}
} }
# Show Kernel Information # Show Kernel Information
sub get_kernel_info ($$) { sub get_kernel_info ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $script = `uname -a | tr -d \";\"`; my $script = `uname -a | tr -d \";\"`;
my %module; my %module;
$module{'Kernel'} = $script; $module{'Kernel'} = $script;
$module{'_keys'} = ['Kernel']; $module{'_keys'} = ['Kernel'];
push (@{$modules->{$name}}, \%module); push (@{$modules->{$name}}, \%module);
} }
@ -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`;
} }
@ -197,7 +291,7 @@ sub get_software_module_data ($$) {
$module{'program'} = $1; $module{'program'} = $1;
$module{'version'} = $2; $module{'version'} = $2;
$module{'description'} = $3; $module{'description'} = $3;
# Replace semicolon by comma to avoid parse errors # Replace semicolon by comma to avoid parse errors
$module{'program'} =~ s/;/,/g; $module{'program'} =~ s/;/,/g;
$module{'version'} =~ s/;/,/g; $module{'version'} =~ s/;/,/g;
$module{'description'} =~ s/;/,/g; $module{'description'} =~ s/;/,/g;
@ -211,67 +305,95 @@ 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);
for(my $i = 0; $i<$#ifconfig_array; $i++) {
#Check for an interface
if ($ifconfig_array[$i] =~ /Link/) {
my %info;
my @line_split = split(" ", $ifconfig_array[$i]);
#Get interface name
$info{'interface'} = $line_split[0];
#Get IP address my @ifconfig_array = split("\n", $ifconfig);
my $line = $ifconfig_array[$i+1];
$line =~ s/\s+//g;
@line_split = split(":", $line); foreach (@ifconfig_array){
if ($_=~/(.*)flags/){
if($line_split[1] =~ /(\d+\.\d+\.\d+\.\d+).+/) { my $match;
$info{'ip'} = $1; ($match)=$_=~/^(.*?)\: flags/;
} $match=~s/://;
push @interfaces,$match;
$info{'_keys'} = ['interface', 'ip']; }
push (@{$modules->{$name}}, \%info); }
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);
}
}
} }
} }
#Get route table #Get route table
sub get_route_table ($$) { sub get_route_table ($$) {
my ($name, $modules) = @_; my ($name, $modules) = @_;
my $route_table;
my $route_table = `route`; my @table_split;
if (is_enabled $AIX) {
my @table_split = split("\n", $route_table); $route_table = `netstat -rn`;
@table_split = split("\n", $route_table);
for (my $i=2; $i<=$#table_split; $i++) { my $length=scalar @table_split;
for (my $i=4; $i<=$length-4; $i++) {
my @split = split(" ", $table_split[$i]);
my @split = split(" ", $table_split[$i]);
my %info;
my %info;
$info{'destination'} = $split[0];
$info{'gateway'} = $split[1]; $info{'destination'} = $split[0];
$info{'mask'} = $split[2]; $info{'gateway'} = $split[1];
$info{'flags'} = $split[3]; $info{'mask'} = $split[2];
$info{'metric'} = $split[4]; $info{'flags'} = $split[3];
$info{'ref'} = $split[5]; $info{'metric'} = $split[4];
$info{'use'} = $split[6]; $info{'ref'} = $split[5];
$info{'interface'} = $split[7]; $info{'use'} = $split[6];
$info{'interface'} = $split[7];
$info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface'];
$info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface'];
push (@{$modules->{$name}}, \%info);
} push (@{$modules->{$name}}, \%info);
}
} else {
$route_table = `route`;
my @table_split = split("\n", $route_table);
for (my $i=2; $i<=$#table_split; $i++) {
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);
}
}
} }
# Print module data # Print module data
sub print_module ($$) { sub print_module ($$) {
@ -309,14 +431,18 @@ my $enable_all = 0;
$interval = $ARGV[0]; $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,76 +459,107 @@ 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) {
$Mode = 'HWINFO'; $Separator = '^\s*$';
$Separator = 'Hardware Class:'; @hwinfo=`prtconf 2>/dev/null`;
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`; } else {
@hwinfo = `lshw 2>/dev/null`;
if ($? != 0) {
$Mode = 'HWINFO';
$Separator = 'Hardware Class:';
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`;
}
} }
# Parse hardware information
my %modules; my %modules;
while (my $line = shift (@hwinfo)) {
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); chomp ($line);
# CPU
if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules);
} else {
get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules);
}
}
# CPU # RAM
if (($line =~ /\*\-cpu/ || $line =~ /Hardware Class: cpu/) && ($enable_all == 1 || $enabled{'cpu'} == 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 ('CPU', \@hwinfo, ['product', 'vendor', 'capacity'], \%modules); get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules);
} else { } else {
get_module_data ('CPU', \@hwinfo, ['Model', 'Vendor', 'Clock'], \%modules); get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules);
} }
} }
# RAM # VIDEO
if (($line =~ /\*\-bank/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) { if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules); get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules);
} else { } else {
get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules); # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
} get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules);
} }
}
# VIDEO # NIC
if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) { if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules); get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules);
} else { } else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules); get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules);
} }
} }
# NIC # CDROM
if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) { if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules); get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules);
} else { } else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor # Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules); get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules);
} }
} }
# CDROM
if (($line =~ /\*\-cdrom/ || $line =~ /Hardware Class: cdrom/) && ($enable_all == 1 || $enabled{'cdrom'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('CDROM', \@hwinfo, ['product', 'description', 'vendor'], \%modules);
} else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('CDROM', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules);
}
}
# HD # HD
if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) { if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) {
if ($Mode eq 'LSHW') { if ($Mode eq 'LSHW') {
get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules); get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules);
} else { } else {
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

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.733 # Version 7.0NG.734
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software
@ -44,6 +44,8 @@ remote_config 0
#agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs" #agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs"
agent_name_cmd __rand__ agent_name_cmd __rand__
# Agent alias. Name should be unique rather than alias. Hostname by default
# agent_alias $Alias$
#Parent agent_name #Parent agent_name
#parent_agent_name caprica #parent_agent_name caprica

View File

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

View File

@ -214,7 +214,7 @@ int Cron::getResetValue (int position) {
int default_value = 0; int default_value = 0;
// Days start in 1 // Days start in 1
if (position == 2) default_value = 1; if (position == 2) default_value = 1;
return isWildCard(position) return (isWildCard(position) || !isNormalInterval(position))
? default_value ? default_value
: this->params[position][CRDOWN]; : this->params[position][CRDOWN];
} }

View File

@ -78,6 +78,7 @@ Pandora_Module::Pandora_Module (string name) {
this->warning_inverse = ""; this->warning_inverse = "";
this->quiet = ""; this->quiet = "";
this->module_ff_interval = ""; this->module_ff_interval = "";
this->module_ff_type = "";
this->module_alert_template = ""; this->module_alert_template = "";
this->module_crontab = ""; this->module_crontab = "";
} }
@ -733,6 +734,13 @@ Pandora_Module::getXml () {
module_xml += this->module_ff_interval; module_xml += this->module_ff_interval;
module_xml += "</module_ff_interval>\n"; module_xml += "</module_ff_interval>\n";
} }
/* Module FF type */
if (this->module_ff_type != "") {
module_xml += "\t<ff_type>";
module_xml += this->module_ff_type;
module_xml += "</ff_type>\n";
}
/* Module Alert template */ /* Module Alert template */
if (this->module_alert_template != "") { if (this->module_alert_template != "") {
@ -1028,6 +1036,16 @@ Pandora_Module::setModuleFFInterval (string value) {
this->module_ff_interval = value; this->module_ff_interval = value;
} }
/**
* Set the module FF type for the module.
*
* @param value module FF type value to set.
*/
void
Pandora_Module::setModuleFFType (string value) {
this->module_ff_type = value;
}
/** /**
* Set the module Alert template for the module. * Set the module Alert template for the module.
* *

View File

@ -176,6 +176,7 @@ namespace Pandora_Modules {
string unit, custom_id, str_warning, str_critical; string unit, custom_id, str_warning, str_critical;
string module_group, warning_inverse, critical_inverse, quiet; string module_group, warning_inverse, critical_inverse, quiet;
string module_ff_interval, module_alert_template, module_crontab; string module_ff_interval, module_alert_template, module_crontab;
string module_ff_type;
string critical_instructions, warning_instructions, unknown_instructions, tags; string critical_instructions, warning_instructions, unknown_instructions, tags;
protected: protected:
@ -277,6 +278,7 @@ namespace Pandora_Modules {
void setWarningInverse (string value); void setWarningInverse (string value);
void setQuiet (string value); void setQuiet (string value);
void setModuleFFInterval (string value); void setModuleFFInterval (string value);
void setModuleFFType (string value);
void setModuleAlertTemplate (string value); void setModuleAlertTemplate (string value);
void setModuleCrontab (string value); void setModuleCrontab (string value);

View File

@ -119,6 +119,7 @@ using namespace Pandora_Strutils;
#define TOKEN_WARNING_INVERSE ("module_warning_inverse ") #define TOKEN_WARNING_INVERSE ("module_warning_inverse ")
#define TOKEN_QUIET ("module_quiet ") #define TOKEN_QUIET ("module_quiet ")
#define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ") #define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ")
#define TOKEN_MODULE_FF_TYPE ("module_ff_type ")
#define TOKEN_MACRO ("module_macro") #define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template") #define TOKEN_ALERT_TEMPLATE ("module_alert_template")
@ -176,7 +177,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical; string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical;
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding, module_alert_template; string module_native_encoding, module_alert_template, module_ff_type;
string macro; string macro;
Pandora_Module *module; Pandora_Module *module;
bool numeric; bool numeric;
@ -254,6 +255,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_warning_inverse = ""; module_warning_inverse = "";
module_quiet = ""; module_quiet = "";
module_ff_interval = ""; module_ff_interval = "";
module_ff_type = "";
module_native_encoding = ""; module_native_encoding = "";
module_alert_template = ""; module_alert_template = "";
module_user_session = ""; module_user_session = "";
@ -507,6 +509,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_ff_interval == "") { if (module_ff_interval == "") {
module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL); module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL);
} }
if (module_ff_type == "") {
module_ff_type = parseLine (line, TOKEN_MODULE_FF_TYPE);
}
if (module_alert_template == "") { if (module_alert_template == "") {
module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE);
@ -1087,6 +1093,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
} }
} }
if (module_ff_type != "") {
pos_macro = module_ff_type.find(macro_name);
if (pos_macro != string::npos){
module_ff_type.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_alert_template != "") { if (module_alert_template != "") {
pos_macro = module_alert_template.find(macro_name); pos_macro = module_alert_template.find(macro_name);
if (pos_macro != string::npos){ if (pos_macro != string::npos){
@ -1447,6 +1460,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_ff_interval != "") { if (module_ff_interval != "") {
module->setModuleFFInterval (module_ff_interval); module->setModuleFFInterval (module_ff_interval);
} }
if (module_ff_type != "") {
module->setModuleFFType (module_ff_type);
}
if (module_alert_template != "") { if (module_alert_template != "") {
module->setModuleAlertTemplate (module_alert_template); module->setModuleAlertTemplate (module_alert_template);

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.733(Build 190328)") #define PANDORA_VERSION ("7.0NG.734(Build 190507)")
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.733(Build 190328))" VALUE "ProductVersion", "(7.0NG.734(Build 190507))"
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.733-190328 Version: 7.0NG.734-190507
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.733-190328" pandora_version="7.0NG.734-190507"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -10,5 +10,16 @@
"require": { "require": {
"mpdf/mpdf": "^7.1", "mpdf/mpdf": "^7.1",
"swiftmailer/swiftmailer": "^6.0" "swiftmailer/swiftmailer": "^6.0"
},
"autoload": {
"psr-4": {
"Models\\": "include/rest-api/models",
"Enterprise\\Models\\": "enterprise/include/rest-api/models"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
} }
} }

View File

@ -378,7 +378,8 @@ function mainAgentsAlerts()
'alerts_agents' 'alerts_agents'
); );
echo '<table class="databox data" cellpadding="0" cellspacing="0" border="0" width=100%>'; echo '<table class="info_table" cellpadding="0" cellspacing="0" border="0" width=100%>';
echo '<thead><tr>';
echo "<th width='140px' >".__('Agents').' / '.__('Alert templates').'</th>'; echo "<th width='140px' >".__('Agents').' / '.__('Alert templates').'</th>';
if ($hor_offset > 0) { if ($hor_offset > 0) {
@ -421,9 +422,10 @@ function mainAgentsAlerts()
continue; continue;
} }
echo '<th width="20px" >'.io_safe_output($tname).html_print_image('images/information_alerts.png', true, ['title' => io_safe_output($tname), 'style' => 'margin-left:5px' ]).'</th>'; echo '<th width="20px" >'.io_safe_output($tname).'</th>';
} }
echo '</tr></thead>';
if (($hor_offset + $block) < $ntemplates) { if (($hor_offset + $block) < $ntemplates) {
$new_hor_offset = ($hor_offset + $block); $new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'> echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
@ -455,7 +457,7 @@ function mainAgentsAlerts()
$cellstyle = 'background:'.COL_ALERTFIRED.';'; $cellstyle = 'background:'.COL_ALERTFIRED.';';
} }
echo '<td style=";'.$cellstyle.'"> '; echo '<td style=";'.$cellstyle.'" class="action_buttons"> ';
$uniqid = uniqid(); $uniqid = uniqid();
echo '<div>'; echo '<div>';
@ -478,6 +480,23 @@ function mainAgentsAlerts()
} }
echo '</table>'; echo '</table>';
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'pagination-bottom',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
} }
} }
@ -487,7 +506,7 @@ function mainAgentsAlerts()
function print_alerts_summary_modal_window($id, $alerts) function print_alerts_summary_modal_window($id, $alerts)
{ {
$table->width = '98%'; $table->width = '98%';
$table->class = 'databox'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head[0] = __('Module'); $table->head[0] = __('Module');

View File

@ -148,7 +148,7 @@ function dbmgr_extension_main()
echo "<div style='overflow: auto;'>"; echo "<div style='overflow: auto;'>";
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = array_keys($result[0]); $table->head = array_keys($result[0]);
$table->data = $result; $table->data = $result;

View File

@ -45,11 +45,9 @@ if (!empty($files)) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->style = []; $table->style = [];
$table->style[1] = 'max-width: 200px;'; $table->style[1] = 'max-width: 200px;';
$table->style[2] = 'text-align: center;';
$table->style[3] = 'text-align: center;';
$table->style[4] = 'text-align: center;'; $table->style[4] = 'text-align: center;';
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = __('Name');
@ -81,6 +79,7 @@ if (!empty($files)) {
// Last modification // Last modification
// Public URL // Public URL
$data[4] = ''; $data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (!empty($file['hash'])) { if (!empty($file['hash'])) {
$public_url = ui_get_full_url(EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']); $public_url = ui_get_full_url(EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash']);
$message = __('Copy to clipboard').': Ctrl+C -> Enter'; $message = __('Copy to clipboard').': Ctrl+C -> Enter';
@ -92,7 +91,7 @@ if (!empty($files)) {
} }
$data[4] .= "<a href=\"$url\" target=\"_blank\">"; $data[4] .= "<a href=\"$url\" target=\"_blank\">";
$data[4] .= html_print_image('images/download.png', true, ['title' => __('Download')]); $data[4] .= html_print_image('images/download.png', true, ['title' => __('Download'), 'style' => 'padding:3px' ]);
// Download image // Download image
$data[4] .= '</a>'; $data[4] .= '</a>';

View File

@ -66,10 +66,10 @@ function users_extension_main_god($god=true)
$rows = []; $rows = [];
echo "<div class='nf'>".__('No other users connected').'</div>'; echo "<div class='nf'>".__('No other users connected').'</div>';
} else { } else {
$table->cellpadding = 4; $table->cellpadding = 0;
$table->cellspacing = 4; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->size = []; $table->size = [];
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];

View File

@ -0,0 +1,54 @@
START TRANSACTION;
ALTER TABLE `tnetflow_filter` DROP COLUMN `output`;
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
ALTER TABLE `tagente_estado` ADD COLUMN `ff_normal` int(4) unsigned default '0';
ALTER TABLE `tagente_estado` ADD COLUMN `ff_warning` int(4) unsigned default '0';
ALTER TABLE `tagente_estado` ADD COLUMN `ff_critical` int(4) unsigned default '0';
UPDATE tuser_task SET parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `trecon_script` ADD COLUMN `type` int NOT NULL default 0;
ALTER TABLE `trecon_task` ADD COLUMN `type` int NOT NULL default 0;
UPDATE `trecon_script` SET `type` = 1 WHERE `name`="Discovery.Application.VMware";
UPDATE `trecon_script` SET `type` = 2 WHERE `name`="Discovery.Cloud";
UPDATE `trecon_script` SET `type` = 3 WHERE `name` LIKE "IPAM%Recon";
UPDATE `trecon_script` SET `type` = 4 WHERE `name` LIKE "IPMI%Recon";
UPDATE `trecon_task` SET `type`=3 WHERE `description`="Discovery.Application.VMware";
UPDATE `trecon_task` SET `type`=2 WHERE `description`="Discovery.Cloud";
UPDATE `trecon_task` SET `type`=7 WHERE `description`="Discovery.Cloud.RDS";
COMMIT;

View File

@ -139,7 +139,7 @@ function get_logs_size($file)
function get_status_logs($path) function get_status_logs($path)
{ {
$status_server_log = ''; $status_server_log = '';
$size_server_log = number_format(get_logs_size($path)); $size_server_log = get_logs_size($path);
if ($size_server_log <= 1048576) { if ($size_server_log <= 1048576) {
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>"; $status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>";
} else { } else {
@ -157,9 +157,9 @@ function percentage_modules_per_agent()
$total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo'); $total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
$average_modules_per_agent = ($total_modules / $total_agents); $average_modules_per_agent = ($total_modules / $total_agents);
if ($average_modules_per_agent <= 40) { if ($average_modules_per_agent <= 40) {
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The average of modules per agent is less than 40 percent</a>"; $status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The average of modules per agent is less than 40</a>";
} else { } else {
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbspThe average of modules per agent is more than 40 percent. You can have performance problems</a>"; $status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbspThe average of modules per agent is more than 40. You can have performance problems</a>";
} }
return $status_average_modules; return $status_average_modules;
@ -202,9 +202,9 @@ function interval_average_of_network_modules()
$average_time = ((int) $total_module_interval_time / $total_network_modules); $average_time = ((int) $total_module_interval_time / $total_network_modules);
if ($average_time < 180) { if ($average_time < 180) {
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has a lot of load and a very fine configuration is required</a>"; $status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has a lot of load (average time $average_time) and a very fine configuration is required</a>";
} else { } else {
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has an acceptable charge</a>"; $status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp The system has an acceptable charge (average time $average_time) </a>";
} }
if ($average_time == 0) { if ($average_time == 0) {
@ -274,6 +274,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
} }
$path_server_logs = '/log/pandora/pandora_server.log'; $path_server_logs = '/log/pandora/pandora_server.log';
$path_err_logs = '/log/pandora/pandora_server.error';
$path_console_logs = '/www/html/pandora_console/pandora_console.log'; $path_console_logs = '/www/html/pandora_console/pandora_console.log';
$innodb_log_file_size_min_rec_value = '64M'; $innodb_log_file_size_min_rec_value = '64M';
$innodb_log_buffer_size_min_rec_value = '16M'; $innodb_log_buffer_size_min_rec_value = '16M';
@ -710,6 +711,8 @@ render_info_data(
render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)'); render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)');
render_row(get_status_logs($path_server_logs), 'Status server logs'); render_row(get_status_logs($path_server_logs), 'Status server logs');
render_row(number_format((get_logs_size($path_err_logs) / 1048576), 3).'M', 'Size error logs (current value)');
render_row(get_status_logs($path_err_logs), 'Status error logs');
render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)'); render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)');
render_row(get_status_logs($path_console_logs), 'Status console logs'); render_row(get_status_logs($path_console_logs), 'Status console logs');

View File

@ -58,6 +58,7 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `tpolicy_modules` -- Table `tpolicy_modules`
@ -136,6 +137,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tpolicies` -- Table `tpolicies`
@ -764,6 +766,18 @@ ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0'; ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0'; ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE `treport_content_template` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
@ -1150,6 +1164,9 @@ ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0; ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0; ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0; ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
ALTER TABLE `tagente_estado` ADD COLUMN `ff_normal` int(4) unsigned default '0';
ALTER TABLE `tagente_estado` ADD COLUMN `ff_warning` int(4) unsigned default '0';
ALTER TABLE `tagente_estado` ADD COLUMN `ff_critical` int(4) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `talert_actions` -- Table `talert_actions`
@ -1199,13 +1216,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 26); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 27);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '733'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '734');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1260,6 +1277,10 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0; ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0; ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_datos` -- Table `tagente_datos`
@ -1279,6 +1300,7 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_max` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_min` int(4) default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente` -- Table `tagente`
@ -1379,6 +1401,18 @@ ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL; ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0';
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
ALTER TABLE `treport_content` ADD COLUMN `total_time` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_in_unknown_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_of_not_initialized_module` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `time_of_downtime` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `total_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `checks_failed` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
@ -2058,3 +2092,14 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di
-- Add column in table `tagent_custom_fields` -- Add column in table `tagent_custom_fields`
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ''; ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
-- ----------------------------------------------------------------------
-- Add column in table `tnetflow_filter`
-- ----------------------------------------------------------------------
ALTER TABLE `tnetflow_filter` DROP COLUMN `output`;
-- ----------------------------------------------------------------------
-- Update table `tuser_task`
-- ----------------------------------------------------------------------
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";

View File

@ -284,7 +284,7 @@ if ($config['menu_type'] == 'classic') {
$header_support .= '</a></div>'; $header_support .= '</a></div>';
// Documentation. // Documentation.
$header_docu = '<div id="header_support">'; $header_docu = '<div id="header_docu">';
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">'; $header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']); $header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
$header_docu .= '</a></div>'; $header_docu .= '</a></div>';
@ -591,9 +591,7 @@ if ($config['menu_type'] == 'classic') {
if (fixed_header) { if (fixed_header) {
$('div#head').addClass('fixed_header'); $('div#head').addClass('fixed_header');
$('div#page') $('div#main').css('padding-top', $('div#head').innerHeight() + 'px');
.css('padding-top', $('div#head').innerHeight() + 'px')
.css('position', 'relative');
} }
check_new_chats_icon('icon_new_messages_chat'); check_new_chats_icon('icon_new_messages_chat');

View File

@ -272,7 +272,9 @@ if (!empty($all_data)) {
echo '<div id="activity">'; echo '<div id="activity">';
$table = new stdClass(); $table = new stdClass();
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
// Don't specify px. // Don't specify px.
$table->data = []; $table->data = [];

View File

@ -4,29 +4,35 @@
<style> <style>
#alert_messages_na{ #alert_messages_na{
-moz-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
z-index:2; z-index:2;
position:fixed; position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
width:650px; width:650px;
height: 400px;
background:white; background:white;
background-image:url('images/imagen-no-acceso.jpg');
background-repeat:no-repeat;
justify-content: center;
display: flex;
flex-direction: column;
box-shadow:4px 5px 10px 3px rgba(0, 0, 0, 0.4);
} }
.modalheade{ .modalheade{
text-align:center; text-align:center;
width:100%; width:100%;
height:37px; position:absolute;
left:0px; top:0;
background-color:#82b92e;
} }
.modalheadertex{ .modalheadertex{
color:white; color:#000;
position:relative;
font-family:Nunito; font-family:Nunito;
font-size:13pt; line-height: 40px;
top:8px; font-size: 23pt;
margin-bottom:30px;
} }
.modalclose{ .modalclose{
cursor:pointer; cursor:pointer;
@ -37,50 +43,59 @@
} }
.modalconten{ .modalconten{
color:black; color:black;
background:white; width:300px;
} margin-left: 30px;
.modalcontentim{
float:left;
margin-left:30px;
margin-top:30px;
margin-bottom:30px;
} }
.modalcontenttex{ .modalcontenttex{
float:left; text-align:left;
text-align:justify;
color:black; color:black;
font-size: 9.5pt; font-size: 11pt;
line-height:13pt; line-height:13pt;
margin-top:30px; margin-bottom:30px;
width:430px;
margin-left:30px;
} }
.modalokbutto{ .modalokbutto{
cursor:pointer; cursor:pointer;
text-align:center; text-align:center;
margin-right:45px; display: inline-block;
float:right; padding: 6px 45px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
margin-bottom:30px; border-radius: 3px;
border-radius: 3px;width:90px;height:30px;background-color:white;border: 1px solid #82b92e; background-color:white;
border: 1px solid #82b92e;
} }
.modalokbuttontex{ .modalokbuttontex{
color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px; color:#82b92e;
font-family:Nunito;
font-size:13pt;
} }
.modalgobutto{ .modalgobutto{
cursor:pointer;text-align:center;margin-right:15px;margin-bottom:30px;float:right;-moz-border-radius: 3px; cursor:pointer;
-webkit-border-radius: 3px;border-radius: 3px;width:240px;height:30px;background-color:white;border: 1px solid #82b92e; text-align:center;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
} }
.modalgobuttontex{ .modalgobuttontex{
color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px; color:#82b92e;
font-family:Nunito;
font-size:10pt;
} }
#opacida{ #opacidad{
position:absolute;background:black;opacity:0.6;z-index:-1;left:0px;top:0px;width:100%;height:100%; position:fixed;
background:black;
opacity:0.6;
z-index:-1;
left:0px;
top:0px;
width:100%;
height:100%;
} }
/*
.textodialog{ .textodialog{
margin-left: 0px; margin-left: 0px;
color:#333; color:#333;
@ -100,53 +115,50 @@ position:absolute;background:black;opacity:0.6;z-index:-1;left:0px;top:0px;width
} }
.cargatextodialog p, .cargatextodialog b, .cargatextodialog a{ .cargatextodialog p, .cargatextodialog b, .cargatextodialog a{
font-size:18pt; font-size:18pt;
} }
*/
</style> </style>
</head> </head>
<body> <body>
<div id="alert_messages_na"> <div id="alert_messages_na">
<div class='modalheade'> <div class='modalheade'>
<span class='modalheadertex'> <img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/input_cross.png'>
<?php echo __("You don't have access to this page"); ?> </div>
</span>
<img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/icono_cerrar.png'> <div class='modalconten'>
<div class='modalheadertex'>
<?php echo __("You don't have access to this page"); ?>
</div>
<div class='modalcontenttex'>
<?php
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
?>
</div>
<div class='modalokbutto cerrar'>
<span class='modalokbuttontex'>OK</span>
</div>
</div>
</div> </div>
<div class='modalconten'> <div id="opacidad"></div>
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>images/access_denied.png'>
<div class='modalcontenttex'>
<?php
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
echo '<br/> <br/>';
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
?>
</div>
</div>
<div class='modalokbutto cerrar'>
<span class='modalokbuttontex'>OK</span>
</div>
</div>
<div id="opacida" style="position:fixed;background:black;opacity:0.6;z-index:-1;left:0px;top:0px;width:100%;height:100%;"></div>
</body> </body>
</html> </html>
<script> <script>
$(".cerrar").click(function(){ $(".cerrar").click(function(){
window.location="."; window.location=".";
}); });
$('div#page').css('background-color','#d3d3d3');
</script> </script>

View File

@ -183,10 +183,10 @@ if (empty($result)) {
} }
$table = new stdClass(); $table = new stdClass();
$table->cellpadding = 4; $table->cellpadding = 0;
$table->cellspacing = 4; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->size = []; $table->size = [];
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
@ -246,7 +246,18 @@ foreach ($result as $row) {
} }
} }
foreach ($table->rowclass as $key => $value) {
if (strpos($value, 'limit_scroll') !== false) {
$table->colspan[$key] = [7];
} else {
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$table->cellclass[$key][6] = 'action_buttons';
}
}
}
html_print_table($table); html_print_table($table);
ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
enterprise_hook('enterpriseAuditFooter'); enterprise_hook('enterpriseAuditFooter');

View File

@ -106,6 +106,7 @@ if (isset($_POST['template_id'])) {
'min_ff_event_normal' => $row2['min_ff_event_normal'], 'min_ff_event_normal' => $row2['min_ff_event_normal'],
'min_ff_event_warning' => $row2['min_ff_event_warning'], 'min_ff_event_warning' => $row2['min_ff_event_warning'],
'min_ff_event_critical' => $row2['min_ff_event_critical'], 'min_ff_event_critical' => $row2['min_ff_event_critical'],
'ff_type' => $row2['ff_type'],
]; ];
$name = $row2['name']; $name = $row2['name'];
@ -224,7 +225,7 @@ if ($result === false) {
$table->width = '100%'; $table->width = '100%';
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->data = []; $table->data = [];
$table->align = []; $table->align = [];
@ -252,9 +253,9 @@ foreach ($result as $row) {
$data[2] = mb_substr($row['descripcion'], 0, 60); $data[2] = mb_substr($row['descripcion'], 0, 60);
$data[3] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'].'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'</a>&nbsp;&nbsp;'; $table->cellclass[][3] = 'action_buttons';
$data[3] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'].'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).'</a>';
$data[3] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'].'">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).'</a>'; $data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'].'">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Update')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

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,23 +157,23 @@ $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', ''));
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output))); $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
$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);
$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,25 +769,25 @@ 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', ''));
$alias_safe_output = io_safe_output(get_parameter('alias', '')); $alias_safe_output = io_safe_output(get_parameter('alias', ''));
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output))); $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $alias_safe_output)));
$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');
@ -1069,13 +1082,13 @@ if ($id_agente) {
$agent = db_get_row('tagente', 'id_agente', $id_agente); $agent = db_get_row('tagente', 'id_agente', $id_agente);
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'));
@ -1320,6 +1329,7 @@ if ($update_module || $create_module) {
$ff_event_normal = (int) get_parameter('ff_event_normal'); $ff_event_normal = (int) get_parameter('ff_event_normal');
$ff_event_warning = (int) get_parameter('ff_event_warning'); $ff_event_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical'); $ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff'); $each_ff = (int) get_parameter('each_ff');
$ff_timeout = (int) get_parameter('ff_timeout'); $ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit_select'); $unit = (string) get_parameter('unit_select');
@ -1409,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',
[ [
@ -1430,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');
@ -1482,6 +1502,7 @@ if ($update_module) {
'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout, 'ff_timeout' => $ff_timeout,
'unit' => io_safe_output($unit), 'unit' => io_safe_output($unit),
@ -1515,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']);
@ -1584,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'));
@ -1603,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');
@ -1628,6 +1648,10 @@ if ($create_module) {
$description = ' '; $description = ' ';
} }
break; break;
default:
// Default.
break;
} }
$values = [ $values = [
@ -1677,6 +1701,7 @@ if ($create_module) {
'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout, 'ff_timeout' => $ff_timeout,
'unit' => io_safe_output($unit), 'unit' => io_safe_output($unit),
@ -1752,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'));
@ -1773,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);
@ -1809,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
@ -1828,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
@ -1870,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)) {
@ -1878,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 {
@ -1908,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 {
@ -1926,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;
@ -1973,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.'');
@ -2013,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');
@ -2101,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;
@ -2152,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

@ -97,11 +97,22 @@ if ($delete_field) {
} }
} }
$fields = db_get_all_fields_in_table('tagent_custom_fields'); // Prepare pagination.
$offset = (int) get_parameter('offset');
$limit = $config['block_size'];
$count_fields = db_get_value('count(*)', 'tagent_custom_fields');
$fields = db_get_all_rows_filter(
'tagent_custom_fields',
[
'limit' => $limit,
'offset' => $offset,
]
);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
if ($fields) { if ($fields) {
$table->head = []; $table->head = [];
$table->head[0] = __('ID'); $table->head[0] = __('ID');
@ -135,14 +146,17 @@ foreach ($fields as $field) {
$data[2] = html_print_image('images/icono_stop.png', true, ['style' => 'width:21px;height:21px;']); $data[2] = html_print_image('images/icono_stop.png', true, ['style' => 'width:21px;height:21px;']);
} }
$table->cellclass[][3] = 'action_buttons';
$data[3] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'].'">'.html_print_image('images/config.png', true, ['alt' => __('Edit'), 'title' => __('Edit'), 'border' => '0']).'</a>'; $data[3] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configure_field&id_field='.$field['id_field'].'">'.html_print_image('images/config.png', true, ['alt' => __('Edit'), 'title' => __('Edit'), 'border' => '0']).'</a>';
$data[3] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0']).'</a>'; $data[3] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/fields_manager&delete_field=1&id_field='.$field['id_field'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'border' => '0']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }
if ($fields) { if ($fields) {
ui_pagination($count_fields, false, $offset);
html_print_table($table); html_print_table($table);
ui_pagination($count_fields, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
} }
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">'; echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configure_field">';

View File

@ -224,13 +224,13 @@ switch ($config['dbtype']) {
break; break;
} }
$selected = 'border: 1px solid black;'; $selected = true;
$selectNameUp = ''; $selectNameUp = false;
$selectNameDown = ''; $selectNameDown = false;
$selectOsUp = ''; $selectOsUp = false;
$selectOsDown = ''; $selectOsDown = false;
$selectGroupUp = ''; $selectGroupUp = false;
$selectGroupDown = ''; $selectGroupDown = false;
switch ($sortField) { switch ($sortField) {
case 'remote': case 'remote':
switch ($sort) { switch ($sort) {
@ -441,18 +441,27 @@ if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
if ($agents !== false) { if ($agents !== false) {
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='100%' class='databox data'>"; // Urls to sort the table.
echo '<th>'.__('Agent name').' '.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>'; $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
echo '</th>'; $url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled';
echo "<th title='".__('Remote agent configuration')."'>".__('R').' '.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">'.html_print_image('images/sort_up.png', true, ['style' => $selectRemoteUp]).'</a>'.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">'.html_print_image('images/sort_down.png', true, ['style' => $selectRemoteDown]).'</a>'; $url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled';
echo '</th>'; $url_down_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled';
echo '<th>'.__('OS').' '.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">'.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).'</a>'.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">'.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).'</a>'; $url_up_os = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled';
echo '</th>'; $url_down_os = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled';
$url_up_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled';
$url_down_group = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled';
echo "<table cellpadding='0' id='agent_list' cellspacing='0' width='100%' class='info_table'>";
echo '<thead><tr>';
echo '<th>'.__('Agent name').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown).'</th>';
echo "<th title='".__('Remote agent configuration')."'>".__('R').ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown).'</th>';
echo '<th>'.__('OS').ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown).'</th>';
echo '<th>'.__('Type').'</th>'; echo '<th>'.__('Type').'</th>';
echo '<th>'.__('Group').' '.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=up&disabled=$disabled">'.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).'</a>'.'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=group&sort=down&disabled=$disabled">'.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).'</a>'; echo '<th>'.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).'</th>';
echo '</th>';
echo '<th>'.__('Description').'</th>'; echo '<th>'.__('Description').'</th>';
echo "<th style='text-align:left'>".__('Actions').'</th>'; echo "<th style='text-align:left'>".__('Actions').'</th>';
echo '</tr></thead>';
$color = 1; $color = 1;
$rowPair = true; $rowPair = true;
@ -628,7 +637,7 @@ if ($agents !== false) {
$offsetArg = $offset; $offsetArg = $offset;
} }
echo "<td class='$tdcolor' align='left' style='width:7%' valign='middle'>"; echo "<td class='$tdcolor action_buttons' align='left' style='width:7%' valign='middle'>";
if ($agent['disabled']) { if ($agent['disabled']) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
@ -654,7 +663,7 @@ if ($agents !== false) {
} }
if ($check_aw) { if ($check_aw) {
echo "&nbsp;&nbsp;<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente& echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'"; borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
if ($agent['id_os'] != 100) { if ($agent['id_os'] != 100) {
@ -670,7 +679,7 @@ if ($agents !== false) {
} }
echo '</table>'; echo '</table>';
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom');
echo "<table width='100%'><tr><td align='right'>"; echo "<table width='100%'><tr><td align='right'>";
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);

View File

@ -358,17 +358,17 @@ if ($multiple_delete) {
// TABLE LIST MODULES // TABLE LIST MODULES
// ================== // ==================
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente; $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente;
$selectNameUp = ''; $selectNameUp = false;
$selectNameDown = ''; $selectNameDown = false;
$selectServerUp = ''; $selectServerUp = false;
$selectServerDown = ''; $selectServerDown = false;
$selectTypeUp = ''; $selectTypeUp = false;
$selectTypeDown = ''; $selectTypeDown = false;
$selectIntervalUp = ''; $selectIntervalUp = false;
$selectIntervalDown = ''; $selectIntervalDown = false;
$sortField = get_parameter('sort_field'); $sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none'); $sort = get_parameter('sort', 'none');
$selected = ''; $selected = true;
$order[] = [ $order[] = [
'field' => 'tmodule_group.name', 'field' => 'tmodule_group.name',
@ -482,13 +482,13 @@ switch ($sortField) {
default: default:
$selectNameUp = $selected; $selectNameUp = $selected;
$selectNameDown = ''; $selectNameDown = false;
$selectServerUp = ''; $selectServerUp = false;
$selectServerDown = ''; $selectServerDown = false;
$selectTypeUp = ''; $selectTypeUp = false;
$selectTypeDown = ''; $selectTypeDown = false;
$selectIntervalUp = ''; $selectIntervalUp = false;
$selectIntervalDown = ''; $selectIntervalDown = false;
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
@ -626,32 +626,39 @@ if ($paginate_module) {
ui_pagination($total_modules, $url); ui_pagination($total_modules, $url);
} }
$url_name = $url.'&sort_field=name&sort=';
$url_server = $url.'&sort_field=server&sort=';
$url_type = $url.'&sort_field=type&sort=';
$url_interval = $url.'&sort_field=interval&sort=';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = __('Name').' '.'<a href="'.$url.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="'.$url.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>'; $table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name').ui_get_sorting_arrows($url_name.'up', $url_name.'down', $selectNameUp, $selectNameDown);
// The access to the policy is granted only with AW permission // The access to the policy is granted only with AW permission
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
$table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>'; $table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>';
} }
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.' '.'<a href="'.$url.'&sort_field=server&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectServerUp]).'</a>'.'<a href="'.$url.'&sort_field=server&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectServerDown]).'</a>'; $table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown);
$table->head[3] = __('Type').' '.'<a href="'.$url.'&sort_field=type&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectTypeUp]).'</a>'.'<a href="'.$url.'&sort_field=type&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectTypeDown]).'</a>'; $table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown);
$table->head[4] = __('Interval').' '.'<a href="'.$url.'&sort_field=interval&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).'</a>'.'<a href="'.$url.'&sort_field=interval&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).'</a>'; $table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown);
$table->head[5] = __('Description'); $table->head[5] = __('Description');
$table->head[6] = __('Status'); $table->head[6] = __('Status');
$table->head[7] = __('Warn'); $table->head[7] = __('Warn');
$table->head[8] = __('Action'); $table->head[8] = __('Action');
$table->head[9] = '<span title="'.__('Delete').'">'.__('Del.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false); $table->head[9] = '<span title="'.__('Delete').'">'.__('Del.').'</span>';
$table->rowstyle = []; $table->rowstyle = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->size = []; $table->size = [];
$table->size['checkbox'] = '20px';
$table->size[2] = '70px'; $table->size[2] = '70px';
$table->align = []; $table->align = [];
$table->align[2] = 'left'; $table->align[2] = 'left';
@ -706,15 +713,19 @@ foreach ($modules as $module) {
$table->rowstyle[($i - 1)] = 'text-align: center'; $table->rowstyle[($i - 1)] = 'text-align: center';
$table->rowclass[($i - 1)] = 'datos3'; $table->rowclass[($i - 1)] = 'datos3';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->colspan[($i - 1)][0] = 10; $table->colspan[($i - 1)][0] = 11;
} else { } else {
$table->colspan[($i - 1)][0] = 9; $table->colspan[($i - 1)][0] = 10;
} }
$data = []; $data = [];
} }
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$data['checkbox'] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
}
$data[0] = ''; $data[0] = '';
if (isset($module['deep']) && ($module['deep'] != 0)) { if (isset($module['deep']) && ($module['deep'] != 0)) {
@ -858,7 +869,7 @@ foreach ($modules as $module) {
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && $module['id_tipo_modulo'] != 25) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && $module['id_tipo_modulo'] != 25) {
$data[8] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'" $data[8] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/copy.png', 'images/copy.png',
@ -870,7 +881,7 @@ foreach ($modules as $module) {
// Make a data normalization // Make a data normalization
if (isset($numericModules[$type])) { if (isset($numericModules[$type])) {
if ($numericModules[$type] === true) { if ($numericModules[$type] === true) {
$data[8] .= '&nbsp;<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; $data[8] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/chart_curve.png', 'images/chart_curve.png',
true, true,
@ -879,18 +890,19 @@ foreach ($modules as $module) {
$data[8] .= '</a>'; $data[8] .= '</a>';
} }
} else { } else {
$data[8] .= '&nbsp;'.html_print_image( $data[8] .= html_print_image(
'images/chart_curve.disabled.png', 'images/chart_curve.disabled.png',
true, true,
['title' => __('Normalize (Disabled)')] ['title' => __('Normalize (Disabled)')]
); );
$data[8] .= '&nbsp;&nbsp;';
} }
// create network component action // create network component action
if ((is_user_admin($config['id_user'])) if ((is_user_admin($config['id_user']))
&& ($module['id_modulo'] == MODULE_NETWORK) && ($module['id_modulo'] == MODULE_NETWORK)
) { ) {
$data[8] .= '&nbsp;<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'" $data[8] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/network.png', 'images/network.png',
@ -899,11 +911,12 @@ foreach ($modules as $module) {
); );
$data[8] .= '</a> '; $data[8] .= '</a> ';
} else { } else {
$data[8] .= '&nbsp;'.html_print_image( $data[8] .= html_print_image(
'images/network.disabled.png', 'images/network.disabled.png',
true, true,
['title' => __('Create network component (Disabled)')] ['title' => __('Create network component (Disabled)')]
); );
$data[8] .= '&nbsp;&nbsp;';
} }
} }
@ -917,10 +930,17 @@ foreach ($modules as $module) {
['title' => __('Delete')] ['title' => __('Delete')]
); );
$data[9] .= '</a> '; $data[9] .= '</a> ';
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
} }
$table->cellclass[] = [
8 => 'action_buttons',
9 => 'action_buttons',
];
array_push($table->data, $data); array_push($table->data, $data);
$table->cellclass[] = [
8 => 'action_buttons',
9 => 'action_buttons',
];
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {

View File

@ -249,6 +249,7 @@ if ($id_agent_module) {
$ff_event_normal = $module['min_ff_event_normal']; $ff_event_normal = $module['min_ff_event_normal'];
$ff_event_warning = $module['min_ff_event_warning']; $ff_event_warning = $module['min_ff_event_warning'];
$ff_event_critical = $module['min_ff_event_critical']; $ff_event_critical = $module['min_ff_event_critical'];
$ff_type = $module['ff_type'];
$each_ff = $module['each_ff']; $each_ff = $module['each_ff'];
$ff_timeout = $module['ff_timeout']; $ff_timeout = $module['ff_timeout'];
// Select tag info. // Select tag info.
@ -393,6 +394,7 @@ if ($id_agent_module) {
$ff_event_normal = ''; $ff_event_normal = '';
$ff_event_warning = ''; $ff_event_warning = '';
$ff_event_critical = ''; $ff_event_critical = '';
$ff_type = 0;
$id_category = 0; $id_category = 0;

View File

@ -496,10 +496,28 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>'; $table_simple->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); $table_simple->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
// FF stands for Flip-flop // FF stands for Flip-flop.
$table_simple->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); $table_simple->data[6][0] = __('FF threshold').' ';
$table_simple->data[6][0] .= ui_print_help_icon('ff_threshold', true);
$table_simple->data[6][1] = html_print_radio_button('each_ff', 0, '', $each_ff, true, $disabledBecauseInPolicy).' '.__('All state changing').' : '; $table_simple->data[6][1] .= __('Keep counters');
$table_simple->data[6][1] .= html_print_checkbox(
'ff_type',
1,
$ff_type,
true,
$disabledBecauseInPolicy
).'<br />';
$table_simple->data[6][1] .= html_print_radio_button(
'each_ff',
0,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_simple->data[6][1] .= ' '.__('All state changing').' : ';
$table_simple->data[6][1] .= html_print_input_text( $table_simple->data[6][1] .= html_print_input_text(
'ff_event', 'ff_event',
$ff_event, $ff_event,
@ -512,7 +530,16 @@ $table_simple->data[6][1] .= html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
).'<br />'; ).'<br />';
$table_simple->data[6][1] .= html_print_radio_button('each_ff', 1, '', $each_ff, true, $disabledBecauseInPolicy).' '.__('Each state changing').' : '; $table_simple->data[6][1] .= html_print_radio_button(
'each_ff',
1,
'',
$each_ff,
true,
$disabledBecauseInPolicy
);
$table_simple->data[6][1] .= ' '.__('Each state changing').' : ';
$table_simple->data[6][1] .= __('To normal'); $table_simple->data[6][1] .= __('To normal');
$table_simple->data[6][1] .= html_print_input_text( $table_simple->data[6][1] .= html_print_input_text(
'ff_event_normal', 'ff_event_normal',
@ -526,6 +553,7 @@ $table_simple->data[6][1] .= html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
).' '; ).' ';
$table_simple->data[6][1] .= __('To warning'); $table_simple->data[6][1] .= __('To warning');
$table_simple->data[6][1] .= html_print_input_text( $table_simple->data[6][1] .= html_print_input_text(
'ff_event_warning', 'ff_event_warning',
@ -539,6 +567,7 @@ $table_simple->data[6][1] .= html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
).' '; ).' ';
$table_simple->data[6][1] .= __('To critical'); $table_simple->data[6][1] .= __('To critical');
$table_simple->data[6][1] .= html_print_input_text( $table_simple->data[6][1] .= html_print_input_text(
'ff_event_critical', 'ff_event_critical',
@ -552,16 +581,31 @@ $table_simple->data[6][1] .= html_print_input_text(
'', '',
$classdisabledBecauseInPolicy $classdisabledBecauseInPolicy
); );
$table_simple->data[7][0] = __('Historical data'); $table_simple->data[7][0] = __('Historical data');
if ($disabledBecauseInPolicy) { if ($disabledBecauseInPolicy) {
// If is disabled, we send a hidden in his place and print a false checkbox because HTML dont send disabled fields and could be disabled by error // If is disabled, we send a hidden in his place and print a false
$table_simple->data[7][1] = html_print_checkbox('history_data_fake', 1, $history_data, true, $disabledBecauseInPolicy); // checkbox because HTML dont send disabled fields
// and could be disabled by error.
$table_simple->data[7][1] = html_print_checkbox(
'history_data_fake',
1,
$history_data,
true,
$disabledBecauseInPolicy
);
$table_simple->data[7][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">'; $table_simple->data[7][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">';
} else { } else {
$table_simple->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true, $disabledBecauseInPolicy); $table_simple->data[7][1] = html_print_checkbox(
'history_data',
1,
$history_data,
true,
$disabledBecauseInPolicy
);
} }
// Advanced form part // Advanced form part.
$table_advanced = new stdClass(); $table_advanced = new stdClass();
$table_advanced->id = 'advanced'; $table_advanced->id = 'advanced';
$table_advanced->width = '100%'; $table_advanced->width = '100%';

View File

@ -393,7 +393,7 @@ else {
// View available downtimes present in database (if any of them) // View available downtimes present in database (if any of them)
$table = new StdClass(); $table = new StdClass();
$table->class = 'databox data'; $table->class = 'info_table';
$table->width = '100%'; $table->width = '100%';
$table->cellstyle = []; $table->cellstyle = [];
@ -518,9 +518,9 @@ else {
} }
html_print_table($table); html_print_table($table);
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<br>';
// CSV export button // CSV export button
echo '<div style="display: inline;">'; echo '<div style="display: inline;">';
html_print_button( html_print_button(

View File

@ -221,7 +221,7 @@ if ($delete_action) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = __('Name');
@ -281,6 +281,10 @@ foreach ($actions as $action) {
} }
if (check_acl($config['id_user'], $action['id_group'], 'LM')) { if (check_acl($config['id_user'], $action['id_group'], 'LM')) {
$table->cellclass[] = [
2 => 'action_buttons',
3 => 'action_buttons',
];
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'" $data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>'; onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&delete_action=1&id='.$action['id'].'&pure='.$pure.'" $data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&delete_action=1&id='.$action['id'].'&pure='.$pure.'"

View File

@ -388,7 +388,7 @@ if ($copy_command) {
} }
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
@ -431,6 +431,7 @@ foreach ($commands as $command) {
io_safe_output($command['description']) io_safe_output($command['description'])
); );
$data['action'] = ''; $data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons';
if (! $command['internal']) { if (! $command['internal']) {
$data['action'] = '<span style="display: inline-flex">'; $data['action'] = '<span style="display: inline-flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'" $data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"

View File

@ -226,17 +226,18 @@ $order = null;
$sortField = get_parameter('sort_field'); $sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none'); $sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;'; $selected = true;
// 'border: 1px solid black;';
$selectDisabledUp = ''; $selectDisabledUp = '';
$selectDisabledDown = ''; $selectDisabledDown = '';
$selectStandbyUp = ''; $selectStandbyUp = '';
$selectStandbyDown = ''; $selectStandbyDown = '';
$selectAgentUp = ''; $selectAgentUp = false;
$selectAgentDown = ''; $selectAgentDown = false;
$selectModuleUp = ''; $selectModuleUp = false;
$selectModuleDown = ''; $selectModuleDown = false;
$selectTemplateUp = ''; $selectTemplateUp = false;
$selectTemplateDown = ''; $selectTemplateDown = false;
switch ($sortField) { switch ($sortField) {
case 'disabled': case 'disabled':
@ -346,11 +347,11 @@ switch ($sortField) {
$selectStandbyUp = ''; $selectStandbyUp = '';
$selectStandbyDown = ''; $selectStandbyDown = '';
$selectAgentUp = $selected; $selectAgentUp = $selected;
$selectAgentDown = ''; $selectAgentDown = false;
$selectModuleUp = ''; $selectModuleUp = false;
$selectModuleDown = ''; $selectModuleDown = false;
$selectTemplateUp = ''; $selectTemplateUp = false;
$selectTemplateDown = ''; $selectTemplateDown = false;
$order = [ $order = [
'field' => 'agent_name', 'field' => 'agent_name',
'order' => 'ASC', 'order' => 'ASC',
@ -360,12 +361,12 @@ switch ($sortField) {
$selectDisabledDown = ''; $selectDisabledDown = '';
$selectStandbyUp = ''; $selectStandbyUp = '';
$selectStandbyDown = ''; $selectStandbyDown = '';
$selectAgentUp = ''; $selectAgentUp = false;
$selectAgentDown = ''; $selectAgentDown = false;
$selectModuleUp = $selected; $selectModuleUp = $selected;
$selectModuleDown = ''; $selectModuleDown = false;
$selectTemplateUp = ''; $selectTemplateUp = false;
$selectTemplateDown = ''; $selectTemplateDown = false;
$order = [ $order = [
'field' => 'agent_module_name', 'field' => 'agent_module_name',
'order' => 'ASC', 'order' => 'ASC',
@ -402,12 +403,21 @@ if (!$id_agente) {
$url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params; $url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente='.$id_agente.'&offset='.$offset.$form_params;
} }
// Urls to sort the table.
$url_up_agente = $url.'&sort_field=agent&sort=up&pure='.$pure;
$url_down_agente = $url.'&sort_field=agent&sort=down&pure='.$pure;
$url_up_module = $url.'&sort_field=module&sort=up&pure='.$pure;
$url_down_module = $url.'&sort_field=module&sort=down&pure='.$pure;
$url_up_template = $url.'&sort_field=template&sort=up&pure='.$pure;
$url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure;
$table = new stdClass(); $table = new stdClass();
if (is_metaconsole()) { if (is_metaconsole()) {
$table->class = 'alert_list databox'; $table->class = 'alert_list databox';
} else { } else {
$table->class = 'databox data'; $table->class = 'info_table';
} }
$table->width = '100%'; $table->width = '100%';
@ -427,7 +437,7 @@ $table->head = [];
if (! $id_agente) { if (! $id_agente) {
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold;'; $table->style[0] = 'font-weight: bold;';
$table->head[0] = __('Agent').'&nbsp;'.'<a href="'.$url.'&sort_field=agent&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectAgentUp]).'</a>'.'<a href="'.$url.'&sort_field=agent&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectAgentDown]).'</a>'; $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
$table->size[0] = '4%'; $table->size[0] = '4%';
$table->size[1] = '8%'; $table->size[1] = '8%';
$table->size[2] = '8%'; $table->size[2] = '8%';
@ -439,7 +449,7 @@ if (! $id_agente) {
$table->size[4] = '8%'; $table->size[4] = '8%';
}*/ }*/
} else { } else {
$table->head[0] = __('Module').'&nbsp;'.'<a href="'.$url.'&sort_field=module&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectModuleUp]).'</a>'.'<a href="'.$url.'&sort_field=module&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectModuleDown]).'</a>'; $table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
// Different sizes or the layout screws up // Different sizes or the layout screws up
$table->size[0] = '0%'; $table->size[0] = '0%';
$table->size[1] = '10%'; $table->size[1] = '10%';
@ -452,7 +462,7 @@ if (! $id_agente) {
$table->size[4] = '1%'; $table->size[4] = '1%';
} }
$table->head[1] = __('Template').'&nbsp;'.'<a href="'.$url.'&sort_field=template&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectTemplateUp]).'</a>'.'<a href="'.$url.'&sort_field=template&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectTemplateDown]).'</a>'; $table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[2] = __('Actions'); $table->head[2] = __('Actions');
$table->head[3] = __('Status'); $table->head[3] = __('Status');
$table->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>'; $table->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
@ -728,6 +738,10 @@ foreach ($simple_alerts as $alert) {
$data[3] = ui_print_status_image($status, $title, true); $data[3] = ui_print_status_image($status, $title, true);
$table->cellclass[] = [
3 => 'action_buttons',
4 => 'action_buttons',
];
$data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">'; $data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">';
if ($alert['disabled']) { if ($alert['disabled']) {
$data[4] .= html_print_input_image('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true); $data[4] .= html_print_input_image('enable', 'images/lightbulb_off.png', 1, 'padding:0px', true);
@ -742,7 +756,7 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group // To manage alert is necessary LW permissions in the agent group
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) {
$data[4] .= '&nbsp;&nbsp;<form class="standby_alert_form" action="'.$url.'" method="post" style="display: inline;">'; $data[4] .= '<form class="standby_alert_form" action="'.$url.'" method="post" style="display: inline;">';
if (!$alert['standby']) { if (!$alert['standby']) {
$data[4] .= html_print_input_image('standby_off', 'images/bell.png', 1, 'padding:0px;', true); $data[4] .= html_print_input_image('standby_off', 'images/bell.png', 1, 'padding:0px;', true);
$data[4] .= html_print_input_hidden('standbyon_alert', 1, true); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true);
@ -771,7 +785,7 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group // To manage alert is necessary LW permissions in the agent group
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) {
$data[4] .= '&nbsp;&nbsp;<form class="delete_alert_form" action="'.$url.'" method="post" style="display: inline;">'; $data[4] .= '<form class="delete_alert_form" action="'.$url.'" method="post" style="display: inline;">';
$is_cluster = (bool) get_parameter('id_cluster'); $is_cluster = (bool) get_parameter('id_cluster');
if (!$is_cluster) { if (!$is_cluster) {
if ($alert['disabled']) { if ($alert['disabled']) {
@ -815,6 +829,11 @@ foreach ($simple_alerts as $alert) {
if (isset($data)) { if (isset($data)) {
html_print_table($table); html_print_table($table);
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
} else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
}
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]);
} }

View File

@ -339,7 +339,7 @@ if ($templates === false) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = __('Name');
@ -375,6 +375,7 @@ foreach ($templates as $template) {
$data[3] = alerts_get_alert_templates_type_name($template['type']); $data[3] = alerts_get_alert_templates_type_name($template['type']);
if (check_acl($config['id_user'], $template['id_group'], 'LM')) { if (check_acl($config['id_user'], $template['id_group'], 'LM')) {
$table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">'; $data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
$data[4] .= html_print_input_hidden('duplicate_template', 1, true); $data[4] .= html_print_input_hidden('duplicate_template', 1, true);
$data[4] .= html_print_input_hidden('source_id', $template['id'], true); $data[4] .= html_print_input_hidden('source_id', $template['id'], true);
@ -396,6 +397,7 @@ foreach ($templates as $template) {
ui_pagination($total_templates, $url); ui_pagination($total_templates, $url);
if (isset($data)) { if (isset($data)) {
html_print_table($table); html_print_table($table);
ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]);
} }

View File

@ -82,7 +82,13 @@ $filter['limit'] = (int) $config['block_size'];
// Search action: This will filter the display category view // Search action: This will filter the display category view
$result = false; $result = false;
$result = categories_get_all_categories(); $result = db_get_all_rows_filter(
'tcategory',
[
'limit' => $filter['limit'],
'offset' => $filter['offset'],
]
);
// Display categories previously filtered or not // Display categories previously filtered or not
$rowPair = true; $rowPair = true;
@ -94,7 +100,7 @@ if (!empty($result)) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
@ -123,7 +129,8 @@ if (!empty($result)) {
$data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>'; $data[1] .= '<a href="index.php?sec=advanced&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>';
} else { } else {
$data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>'; $data[0] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".$category['name'].'</a>';
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image('images/config.png', true, ['title' => 'Edit']).'</a>&nbsp;&nbsp;'; $table->cellclass[][1] = 'action_buttons';
$data[1] = "<a href='index.php?sec=gmodules&sec2=godmode/category/edit_category&action=update&id_category=".$category['id'].'&pure='.(int) $config['pure']."'>".html_print_image('images/config.png', true, ['title' => 'Edit']).'</a>';
$data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>'; $data[1] .= '<a href="index.php?sec=gmodules&sec2=godmode/category/category&delete_category='.$category['id'].'&pure='.(int) $config['pure'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>';
} }
@ -131,6 +138,7 @@ if (!empty($result)) {
} }
html_print_table($table); html_print_table($table);
ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
// No categories available or selected // No categories available or selected
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]); ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);

View File

@ -113,31 +113,33 @@ if ($filters === false) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[1] = __('Group'); $table->head[1] = __('Name');
$table->head[2] = __('Event type'); $table->head[2] = __('Group');
$table->head[3] = __('Event status'); $table->head[3] = __('Event type');
$table->head[4] = __('Severity'); $table->head[4] = __('Event status');
$table->head[5] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[5] = __('Severity');
$table->head[6] = __('Action');
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[1] = 'font-weight: bold';
$table->align = []; $table->align = [];
$table->align[1] = 'left';
$table->align[2] = 'left'; $table->align[2] = 'left';
$table->align[3] = 'left'; $table->align[3] = 'left';
$table->align[4] = 'left'; $table->align[4] = 'left';
$table->align[5] = 'left'; $table->align[5] = 'left';
$table->align[6] = 'left';
$table->size = []; $table->size = [];
$table->size[0] = '50%'; $table->size[0] = '20px';
$table->size[1] = '5px'; $table->size[1] = '50%';
$table->size[2] = '80px'; $table->size[2] = '5px';
$table->size[3] = '80px'; $table->size[3] = '80px';
$table->size[4] = '80px'; $table->size[4] = '80px';
$table->size[5] = '40px'; $table->size[5] = '80px';
$table->size[6] = '40px';
$table->data = []; $table->data = [];
$total_filters = db_get_all_rows_filter('tevent_filter', false, 'COUNT(*) AS total'); $total_filters = db_get_all_rows_filter('tevent_filter', false, 'COUNT(*) AS total');
@ -147,13 +149,14 @@ $total_filters = $total_filters[0]['total'];
foreach ($filters as $filter) { foreach ($filters as $filter) {
$data = []; $data = [];
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&id='.$filter['id_filter'].'&pure='.$config['pure'].'">'.$filter['id_name'].'</a>'; $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true);
$data[1] = ui_print_group_icon($filter['id_group_filter'], true); $data[1] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&id='.$filter['id_filter'].'&pure='.$config['pure'].'">'.$filter['id_name'].'</a>';
$data[2] = events_get_event_types($filter['event_type']); $data[2] = ui_print_group_icon($filter['id_group_filter'], true);
$data[3] = events_get_status($filter['status']); $data[3] = events_get_event_types($filter['event_type']);
$data[4] = events_get_severity_types($filter['severity']); $data[4] = events_get_status($filter['status']);
$data[5] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;' $data[5] = events_get_severity_types($filter['severity']);
href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true); $table->cellclass[][6] = 'action_buttons';
$data[6] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter'].'&offset=0&pure='.$config['pure']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }
@ -188,8 +191,6 @@ echo '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$("input[name=all_delete]").css("margin-left", "32px");
$( document ).ready(function() { $( document ).ready(function() {

View File

@ -36,7 +36,9 @@ if (empty($event_responses)) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = []; $table->size = [];
$table->size[0] = '200px'; $table->size[0] = '200px';
@ -57,8 +59,9 @@ foreach ($event_responses as $response) {
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>'; $data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description']; $data[1] = $response['description'];
$data[2] = ui_print_group_icon($response['id_group'], true); $data[2] = ui_print_group_icon($response['id_group'], true);
$table->cellclass[][3] = 'action_buttons';
$data[3] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&action=delete_response&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'; $data[3] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&action=delete_response&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
$data[3] .= '&nbsp;<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit')]).'</a>'; $data[3] .= '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit')]).'</a>';
$table->data[] = $data; $table->data[] = $data;
} }

View File

@ -149,7 +149,7 @@ $table->head[] = __('Operation');
$table->width[] = '30%'; $table->width[] = '30%';
*/ */
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->align = []; $table->align = [];
$table->align[] = 'left'; $table->align[] = 'left';
@ -254,6 +254,7 @@ foreach ($extensions as $file => $extension) {
// Avoid to delete or disabled update_manager // Avoid to delete or disabled update_manager
if ($file != 'update_manager.php') { if ($file != 'update_manager.php') {
$table->cellclass[][10] = 'action_buttons';
if (!$extension['enabled']) { if (!$extension['enabled']) {
$data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.disabled.png', true).'</a>'.' <a title="'.__('Enable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file.'" class="mn">'.html_print_image('images/lightbulb_off.png', true).'</a>'; $data[] = '<a title="'.__('Delete').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file.'" class="mn">'.html_print_image('images/cross.disabled.png', true).'</a>'.' <a title="'.__('Enable').'" href="index.php?sec=godmode/extensions&amp;sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file.'" class="mn">'.html_print_image('images/lightbulb_off.png', true).'</a>';
} else { } else {

View File

@ -515,7 +515,7 @@ if ($tab == 'tree') {
$table = new StdClass(); $table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = __('ID'); $table->head[0] = __('ID');
$table->head[1] = __('Name'); $table->head[1] = __('Name');
@ -559,6 +559,7 @@ if ($tab == 'tree') {
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled'); $table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name']; $table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description']; $table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = "<a href='$url'>".html_print_image( $table->data[$key][6] = "<a href='$url'>".html_print_image(
'images/config.png', 'images/config.png',
true, true,
@ -574,7 +575,7 @@ if ($tab == 'tree') {
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message; $confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
} }
$table->data[$key][6] .= '&nbsp;&nbsp;'.'<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image( $table->data[$key][6] .= '<a href="'.$url_delete.'" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">'.html_print_image(
'images/cross.png', 'images/cross.png',
true, true,
[ [
@ -592,7 +593,7 @@ if ($tab == 'tree') {
$block_size, $block_size,
true, true,
'offset', 'offset',
false true
); );
html_print_table($table); html_print_table($table);
echo ui_pagination( echo ui_pagination(
@ -602,7 +603,8 @@ if ($tab == 'tree') {
$block_size, $block_size,
true, true,
'offset', 'offset',
true true,
'pagination-bottom'
); );
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);

View File

@ -212,14 +212,11 @@ if ($delete_group) {
} }
} }
// Prepare pagination.
$total_groups = db_get_num_rows('SELECT * FROM tmodule_group'); $total_groups = db_get_num_rows('SELECT * FROM tmodule_group');
$url = ui_get_url_refresh(['offset' => false]); $url = ui_get_url_refresh(['offset' => false]);
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
ui_pagination($total_groups, $url, $offset);
$sql = 'SELECT * $sql = 'SELECT *
FROM tmodule_group FROM tmodule_group
@ -230,7 +227,7 @@ $groups = db_get_all_rows_sql($sql);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
if (!empty($groups)) { if (!empty($groups)) {
$table->head = []; $table->head = [];
@ -251,13 +248,16 @@ if (!empty($groups)) {
if (is_metaconsole()) { if (is_metaconsole()) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else { } else {
$table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} }
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_groups, $url, $offset);
html_print_table($table); html_print_table($table);
ui_pagination($total_groups, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
ui_print_info_message( ui_print_info_message(
[ [

View File

@ -844,20 +844,122 @@ $table->data['edit1'][1] = '<table width="100%">';
$table->data['edit6'][3] = html_print_extended_select_for_unit('unit', '-1', '', '', '0', '15', true, false, false, false, 1); $table->data['edit6'][3] = html_print_extended_select_for_unit('unit', '-1', '', '', '0', '15', true, false, false, false, 1);
// FF stands for Flip-flop // FF stands for Flip-flop.
$table->data['edit7'][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); $table->data['edit7'][0] = __('FF threshold').' ';
$table->data['edit7'][0] .= ui_print_help_icon(
'ff_threshold',
true
);
$table->colspan['edit7'][1] = 3; $table->colspan['edit7'][1] = 3;
$table->data['edit7'][1] = __('Mode').' '.html_print_select(['' => __('No change'), '1' => __('Each state changing'), '0' => __('All state changing')], 'each_ff', '', '', '', '', true).'<br />'; $table->data['edit7'][1] = __('Mode').' ';
$table->data['edit7'][1] .= __('All state changing').' : '.html_print_input_text('min_ff_event', '', '', 5, 15, true).'<br />'; $table->data['edit7'][1] .= html_print_select(
[
'' => __('No change'),
'1' => __('Each state changing'),
'0' => __('All state changing'),
],
'each_ff',
'',
'',
'',
'',
true,
false,
true,
'',
false,
'width: 400px;'
).'<br />';
$table->data['edit7'][1] .= __('All state changing').' : ';
$table->data['edit7'][1] .= html_print_input_text(
'min_ff_event',
'',
'',
5,
15,
true
).'<br />';
$table->data['edit7'][1] .= __('Each state changing').' : '; $table->data['edit7'][1] .= __('Each state changing').' : ';
$table->data['edit7'][1] .= __('To normal').html_print_input_text('min_ff_event_normal', '', '', 5, 15, true).' '; $table->data['edit7'][1] .= __('To normal').' ';
$table->data['edit7'][1] .= __('To warning').html_print_input_text('min_ff_event_warning', '', '', 5, 15, true).' '; $table->data['edit7'][1] .= html_print_input_text(
$table->data['edit7'][1] .= __('To critical').html_print_input_text('min_ff_event_critical', '', '', 5, 15, true).' '; 'min_ff_event_normal',
'',
'',
5,
15,
true
).' ';
$table->data['edit7'][1] .= __('To warning').' ';
$table->data['edit7'][1] .= html_print_input_text(
'min_ff_event_warning',
'',
'',
5,
15,
true
).' ';
$table->data['edit7'][1] .= __('To critical').' ';
$table->data['edit7'][1] .= html_print_input_text(
'min_ff_event_critical',
'',
'',
5,
15,
true
).'<br>';
$table->data['edit7'][1] .= __('Keep counters').' ';
$table->data['edit7'][1] .= html_print_select(
[
'' => __('No change'),
'1' => __('Active Counters'),
'0' => __('Inactive Counters'),
],
'ff_type',
'',
'',
'',
'',
true,
false,
true,
'',
false,
'width: 400px;'
);
$table->data['edit8'][0] = __('FF interval'); $table->data['edit8'][0] = __('FF interval');
$table->data['edit8'][1] = html_print_input_text('module_ff_interval', '', '', 5, 10, true).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true); $table->data['edit8'][1] = html_print_input_text(
'module_ff_interval',
'',
'',
5,
10,
true
);
$table->data['edit8'][1] .= ui_print_help_tip(
__('Module execution flip flop time interval (in secs).'),
true
);
$table->data['edit8'][2] = __('FF timeout'); $table->data['edit8'][2] = __('FF timeout');
$table->data['edit8'][3] = html_print_input_text('ff_timeout', '', '', 5, 10, true).ui_print_help_tip(__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true); $table->data['edit8'][3] = html_print_input_text(
'ff_timeout',
'',
'',
5,
10,
true
);
$table->data['edit8'][3] .= ui_print_help_tip(
__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'),
true
);
$table->data['edit9'][0] = __('Historical data'); $table->data['edit9'][0] = __('Historical data');
$table->data['edit9'][1] = html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true); $table->data['edit9'][1] = html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true);
@ -1685,7 +1787,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
$agents_select = [$agents_select]; $agents_select = [$agents_select];
} }
// List of fields which can be updated // List of fields which can be updated.
$fields = [ $fields = [
'dynamic_interval', 'dynamic_interval',
'dynamic_max', 'dynamic_max',
@ -1730,6 +1832,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
'min_ff_event_normal', 'min_ff_event_normal',
'min_ff_event_warning', 'min_ff_event_warning',
'min_ff_event_critical', 'min_ff_event_critical',
'ff_type',
'each_ff', 'each_ff',
'module_ff_interval', 'module_ff_interval',
'ff_timeout', 'ff_timeout',

View File

@ -219,17 +219,19 @@ $groups = component_groups_get_groups_tree_recursive($groups_clean, 0, 0);
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name'); $table->head[0] = __('Name');
$table->head[1] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[1] = __('Action');
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->align = []; $table->align = [];
$table->align[1] = 'left'; $table->align[1] = 'left';
$table->size = []; $table->size = [];
$table->size[0] = '80%'; $table->size['checkbox'] = '20px';
$table->size[1] = '10%'; // $table->size[0] = '80%';
$table->size[1] = '60px';
$table->data = []; $table->data = [];
$total_groups = db_get_all_rows_filter('tnetwork_component_group', false, 'COUNT(*) AS total'); $total_groups = db_get_all_rows_filter('tnetwork_component_group', false, 'COUNT(*) AS total');
@ -239,6 +241,9 @@ $total_groups = $total_groups[0]['total'];
foreach ($groups as $group) { foreach ($groups as $group) {
$data = []; $data = [];
$data['checkbox'] = html_print_checkbox_extended('delete_multiple[]', $group['id_sg'], false, false, '', 'class="check_delete"', true);
$tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']); $tabulation = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $group['deep']);
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$data[0] = $tabulation.'<a href="index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>'; $data[0] = $tabulation.'<a href="index.php?sec=advanced&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
@ -246,8 +251,9 @@ foreach ($groups as $group) {
$data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>'; $data[0] = $tabulation.'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&id='.$group['id_sg'].'">'.$group['name'].'</a>';
} }
$table->cellclass[][1] = 'action_buttons';
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;' $data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $group['id_sg'], false, false, '', 'class="check_delete"', true); href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -124,6 +124,7 @@ $pure = get_parameter('pure', 0);
$ff_event_normal = (int) get_parameter('ff_event_normal'); $ff_event_normal = (int) get_parameter('ff_event_normal');
$ff_event_warning = (int) get_parameter('ff_event_warning'); $ff_event_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical'); $ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff'); $each_ff = (int) get_parameter('each_ff');
if (count($id_tag_selected) == 1 && empty($id_tag_selected[0])) { if (count($id_tag_selected) == 1 && empty($id_tag_selected[0])) {
@ -261,6 +262,7 @@ if ($create_component) {
'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
] ]
); );
@ -355,6 +357,7 @@ if ($update_component) {
'min_ff_event_normal' => $ff_event_normal, 'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning, 'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical, 'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff, 'each_ff' => $each_ff,
] ]
); );
@ -496,6 +499,7 @@ $url = ui_get_url_refresh(
'ff_event_warning' => false, 'ff_event_warning' => false,
'ff_event_critical' => false, 'ff_event_critical' => false,
'each_ff' => false, 'each_ff' => false,
'ff_type' => false,
] ]
); );
@ -634,14 +638,16 @@ unset($table);
$table->width = '100%'; $table->width = '100%';
$table->head = []; $table->head = [];
$table->class = 'databox data'; $table->class = 'info_table';
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Module name'); $table->head[0] = __('Module name');
$table->head[1] = __('Type'); $table->head[1] = __('Type');
$table->head[3] = __('Description'); $table->head[3] = __('Description');
$table->head[4] = __('Group'); $table->head[4] = __('Group');
$table->head[5] = __('Max/Min'); $table->head[5] = __('Max/Min');
$table->head[6] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[6] = __('Action');
$table->size = []; $table->size = [];
$table->size['checkbox'] = '20px';
$table->size[1] = '75px'; $table->size[1] = '75px';
$table->size[6] = '80px'; $table->size[6] = '80px';
$table->align[6] = 'left'; $table->align[6] = 'left';
@ -654,6 +660,8 @@ foreach ($components as $component) {
$component['max'] = $component['min'] = __('N/A'); $component['max'] = $component['min'] = __('N/A');
} }
$data['checkbox'] = html_print_checkbox_extended('delete_multiple[]', $component['id_nc'], false, false, '', 'class="check_delete"', true);
$data[0] = '<a href="index.php?sec='.$sec.'&'.'sec2=godmode/modules/manage_network_components&'.'id='.$component['id_nc'].'&pure='.$pure.'">'; $data[0] = '<a href="index.php?sec='.$sec.'&'.'sec2=godmode/modules/manage_network_components&'.'id='.$component['id_nc'].'&pure='.$pure.'">';
$data[0] .= io_safe_output($component['name']); $data[0] .= io_safe_output($component['name']);
$data[0] .= '</a>'; $data[0] .= '</a>';
@ -688,8 +696,9 @@ foreach ($components as $component) {
$data[4] = network_components_get_group_name($component['id_group']); $data[4] = network_components_get_group_name($component['id_group']);
$data[5] = $component['max'].' / '.$component['min']; $data[5] = $component['max'].' / '.$component['min'];
$table->cellclass[][6] = 'action_buttons';
$data[6] = '<a style="display: inline; float: left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate')]).'</a>'; $data[6] = '<a style="display: inline; float: left" href="'.$url.'&search_id_group='.$search_id_group.'search_string='.$search_string.'&duplicate_network_component=1&source_id='.$component['id_nc'].'">'.html_print_image('images/copy.png', true, ['alt' => __('Duplicate'), 'title' => __('Duplicate')]).'</a>';
$data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $component['id_nc'], false, false, '', 'class="check_delete"', true); $data[6] .= '<a href="'.$url.'&delete_component=1&id='.$component['id_nc'].'&search_id_group='.$search_id_group.'search_string='.$search_string.'" onclick="if (! confirm (\''.__('Are you sure?').'\')) return false" >'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }
@ -698,6 +707,7 @@ if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>"; echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_table($table); html_print_table($table);
ui_pagination($total_components, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right; margin-left: 5px;'>"; echo "<div style='float: right; margin-left: 5px;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>'; echo '</div>';

View File

@ -76,6 +76,7 @@ if ($create_network_from_module) {
$ff_event_normal = $data_module['min_ff_event_normal']; $ff_event_normal = $data_module['min_ff_event_normal'];
$ff_event_warning = $data_module['min_ff_event_warning']; $ff_event_warning = $data_module['min_ff_event_warning'];
$ff_event_critical = $data_module['min_ff_event_critical']; $ff_event_critical = $data_module['min_ff_event_critical'];
$ff_type = $data_module['ff_type'];
$each_ff = $data_module['each_ff']; $each_ff = $data_module['each_ff'];
} }
@ -134,6 +135,7 @@ if (isset($id)) {
$ff_event_normal = $component['min_ff_event_normal']; $ff_event_normal = $component['min_ff_event_normal'];
$ff_event_warning = $component['min_ff_event_warning']; $ff_event_warning = $component['min_ff_event_warning'];
$ff_event_critical = $component['min_ff_event_critical']; $ff_event_critical = $component['min_ff_event_critical'];
$ff_type = $component['ff_type'];
$each_ff = $component['each_ff']; $each_ff = $component['each_ff'];
if ($type >= 15 && $type <= 18) { if ($type >= 15 && $type <= 18) {
@ -192,6 +194,7 @@ if (isset($id)) {
$ff_event_normal = 0; $ff_event_normal = 0;
$ff_event_warning = 0; $ff_event_warning = 0;
$ff_event_critical = 0; $ff_event_critical = 0;
$ff_type = 0;
$each_ff = 0; $each_ff = 0;
$snmp_version = 1; $snmp_version = 1;

View File

@ -233,7 +233,23 @@ $table->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critical_inver
$table->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); $table->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true);
$table->colspan[6][1] = 3; $table->colspan[6][1] = 3;
$table->data[6][1] = html_print_radio_button('each_ff', 0, '', $each_ff, true).' '.__('All state changing').' : ';
$table->data[6][1] = __('Keep counters');
$table->data[6][1] .= html_print_checkbox(
'ff_type',
1,
$ff_type,
true
).'<br />';
$table->data[6][1] .= html_print_radio_button(
'each_ff',
0,
'',
$each_ff,
true
).' '.__('All state changing').' : ';
$table->data[6][1] .= html_print_input_text( $table->data[6][1] .= html_print_input_text(
'ff_event', 'ff_event',
$ff_event, $ff_event,
@ -242,13 +258,40 @@ $table->data[6][1] .= html_print_input_text(
15, 15,
true true
).'<br />'; ).'<br />';
$table->data[6][1] .= html_print_radio_button('each_ff', 1, '', $each_ff, true).' '.__('Each state changing').' : '; $table->data[6][1] .= html_print_radio_button(
'each_ff',
1,
'',
$each_ff,
true
).' '.__('Each state changing').' : ';
$table->data[6][1] .= __('To normal'); $table->data[6][1] .= __('To normal');
$table->data[6][1] .= html_print_input_text('ff_event_normal', $ff_event_normal, '', 5, 15, true).' '; $table->data[6][1] .= html_print_input_text(
'ff_event_normal',
$ff_event_normal,
'',
5,
15,
true
).' ';
$table->data[6][1] .= __('To warning'); $table->data[6][1] .= __('To warning');
$table->data[6][1] .= html_print_input_text('ff_event_warning', $ff_event_warning, '', 5, 15, true).' '; $table->data[6][1] .= html_print_input_text(
'ff_event_warning',
$ff_event_warning,
'',
5,
15,
true
).' ';
$table->data[6][1] .= __('To critical'); $table->data[6][1] .= __('To critical');
$table->data[6][1] .= html_print_input_text('ff_event_critical', $ff_event_critical, '', 5, 15, true); $table->data[6][1] .= html_print_input_text(
'ff_event_critical',
$ff_event_critical,
'',
5,
15,
true
);
$table->data[7][0] = __('Historical data'); $table->data[7][0] = __('Historical data');
$table->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true); $table->data[7][1] = html_print_checkbox('history_data', 1, $history_data, true);

View File

@ -189,7 +189,20 @@ if ($export_profile) {
exit; exit;
} }
$result = db_get_all_rows_in_table('tnetwork_profile', 'name'); // Prepare pagination.
$offset = (int) get_parameter('offset');
$limit = $config['block_size'];
$count_network_templates = db_get_value('count(*)', 'tnetwork_profile');
$result = db_get_all_rows_filter(
'tnetwork_profile',
[
'order' => 'name',
'limit' => $limit,
'offset' => $offset,
]
);
if ($result === false) { if ($result === false) {
$result = []; $result = [];
} }
@ -197,26 +210,31 @@ if ($result === false) {
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[1] = __('Description'); ;
$table->head[2] = '<span style="margin-right:7%;">'.__('Action').'</span>'.html_print_checkbox('all_delete', 0, false, true, false); $table->head[1] = __('Name');
$table->head[2] = __('Description');
$table->head[3] = '<span style="margin-right:7%;">'.__('Action').'</span>';
$table->size = []; $table->size = [];
$table->size[1] = '65%'; $table->size[0] = '20px';
$table->size[2] = '15%'; $table->size[2] = '65%';
$table->size[3] = '15%';
$table->align = []; $table->align = [];
$table->align[2] = 'left'; $table->align[3] = 'left';
$table->data = []; $table->data = [];
foreach ($result as $row) { foreach ($result as $row) {
$data = []; $data = [];
$data[0] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row['id_np'].'">'.io_safe_output($row['name']).'</a>'; $data[0] = html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true);
$data[1] = ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[&hellip;]'); $data[1] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row['id_np'].'">'.io_safe_output($row['name']).'</a>';
$data[2] = html_print_input_image( $data[2] = ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[&hellip;]');
$table->cellclass[][3] = 'action_buttons';
$data[3] = html_print_input_image(
'delete_profile', 'delete_profile',
'images/cross.png', 'images/cross.png',
$row['id_np'], $row['id_np'],
@ -224,7 +242,7 @@ foreach ($result as $row) {
true, true,
['onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;'] ['onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;']
); );
$data[2] .= html_print_input_image( $data[3] .= html_print_input_image(
'export_profile', 'export_profile',
'images/csv.png', 'images/csv.png',
$row['id_np'], $row['id_np'],
@ -232,8 +250,8 @@ foreach ($result as $row) {
true, true,
['title' => 'Export to CSV'] ['title' => 'Export to CSV']
); );
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'; $data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
$data[2] .= '&nbsp;&nbsp;<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true); $data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }
@ -241,7 +259,9 @@ foreach ($result as $row) {
if (!empty($table->data)) { if (!empty($table->data)) {
echo '<form method="post" action="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates">'; echo '<form method="post" action="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates">';
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
ui_pagination($count_network_templates, false, $offset);
html_print_table($table); html_print_table($table);
ui_pagination($count_network_templates, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='padding-left: 5px; float: right; '>"; echo "<div style='padding-left: 5px; float: right; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>'; echo '</div>';

View File

@ -52,11 +52,13 @@ if ($update_module) {
} }
echo "<table cellpadding='4' cellspacing='4' width='100%' class='databox data'>"; echo "<table cellpadding='0' cellspacing='0' width='100%' class='info_table'>";
echo '<thead>';
echo '<th>'.__('Icon').'</th>'; echo '<th>'.__('Icon').'</th>';
echo '<th>'.__('ID').'</th>'; echo '<th>'.__('ID').'</th>';
echo '<th>'.__('Name').'</th>'; echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Description').'</th>'; echo '<th>'.__('Description').'</th>';
echo '</thead';
$rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre'); $rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre');
if ($rows === false) { if ($rows === false) {

View File

@ -133,20 +133,22 @@ if ($filters === false) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = __('Name'); $table->head[0] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[1] = __('Group'); $table->head[1] = __('Name');
$table->head[2] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[2] = __('Group');
$table->head[3] = __('Action');
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[1] = 'font-weight: bold';
$table->align = []; $table->align = [];
$table->size = []; $table->size = [];
$table->size[0] = '60%'; $table->size[0] = '10px';
$table->size[1] = '30%'; $table->size[1] = '60%';
$table->size[2] = '80px'; $table->size[2] = '30%';
$table->size[3] = '80px';
$table->data = []; $table->data = [];
$total_filters = db_get_all_rows_filter('tnetflow_filter', false, 'COUNT(*) AS total'); $total_filters = db_get_all_rows_filter('tnetflow_filter', false, 'COUNT(*) AS total');
@ -156,10 +158,12 @@ $total_filters = $total_filters[0]['total'];
foreach ($filters as $filter) { foreach ($filters as $filter) {
$data = []; $data = [];
$data[0] = '<a href="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&id='.$filter['id_sg'].'&pure='.$pure.'">'.$filter['id_name'].'</a>'; $data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
$data[1] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE')); $data[1] = '<a href="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&id='.$filter['id_sg'].'&pure='.$pure.'">'.$filter['id_name'].'</a>';
$data[2] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;' $data[2] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE'));
href='".$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit&delete=1&id='.$filter['id_sg']."&offset=0&pure=$pure'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true); $table->cellclass[][3] = 'action_buttons';
$data[3] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='".$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit&delete=1&id='.$filter['id_sg']."&offset=0&pure=$pure'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -159,9 +159,17 @@ ui_pagination(count($graphs));
if (!empty($graphs)) { if (!empty($graphs)) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->align = []; $table->align = [];
$table->head = []; $table->head = [];
if ($report_w || $report_m) {
$table->align[5] = 'left';
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
$table->size[5] = '20px';
}
$table->head[0] = __('Graph name'); $table->head[0] = __('Graph name');
$table->head[1] = __('Description'); $table->head[1] = __('Description');
$table->head[2] = __('Number of Graphs'); $table->head[2] = __('Number of Graphs');
@ -175,7 +183,7 @@ if (!empty($graphs)) {
if ($report_w || $report_m) { if ($report_w || $report_m) {
$op_column = true; $op_column = true;
$table->align[4] = 'left'; $table->align[4] = 'left';
$table->head[4] = __('Op.').html_print_checkbox('all_delete', 0, false, true, false); $table->head[4] = __('Op.');
$table->size[4] = '90px'; $table->size[4] = '90px';
} }
@ -186,6 +194,10 @@ if (!empty($graphs)) {
foreach ($result_graphs as $graph) { foreach ($result_graphs as $graph) {
$data = []; $data = [];
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>'; $data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70); $data[1] = ui_print_truncate_text($graph['description'], 70);
@ -194,15 +206,14 @@ if (!empty($graphs)) {
$data[3] = ui_print_group_icon($graph['id_group'], true); $data[3] = ui_print_group_icon($graph['id_group'], true);
$data[4] = ''; $data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (($report_w || $report_m)) { if (($report_w || $report_m)) {
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image('images/config.png', true).'</a>'; $data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image('images/config.png', true).'</a>';
} }
$data[4] .= '&nbsp;';
if ($report_m) { if ($report_m) {
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) $data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>'.html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true); return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
} }
array_push($table->data, $data); array_push($table->data, $data);
@ -213,6 +224,7 @@ if (!empty($graphs)) {
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>"; echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1); html_print_input_hidden('multiple_delete', 1);
html_print_table($table); html_print_table($table);
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right;'>"; echo "<div style='float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>'; echo '</div>';
@ -228,7 +240,6 @@ if (!empty($graphs)) {
} }
echo '</div>'; echo '</div>';
ui_pagination(count($graphs));
} else { } else {
include_once $config['homedir'].'/general/firts_task/custom_graphs.php'; include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
} }
@ -237,8 +248,6 @@ if (!empty($graphs)) {
<script type="text/javascript"> <script type="text/javascript">
$("input[name=all_delete]").css("margin-left", "32px");
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){ $('[id^=checkbox-delete_multiple]').change(function(){

View File

@ -327,7 +327,9 @@ echo '</tr></table>';
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
$table->head[0] = __('Map name'); $table->head[0] = __('Map name');
@ -447,6 +449,10 @@ if (!$maps && !is_metaconsole()) {
// Fix: IW was the old ACL for report editing, now is RW // Fix: IW was the old ACL for report editing, now is RW
if ($vconsoles_write || $vconsoles_manage) { if ($vconsoles_write || $vconsoles_manage) {
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->cellclass[] = [
3 => 'action_buttons',
4 => 'action_buttons',
];
$data[3] = '<a class="copy_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>'; $data[3] = '<a class="copy_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>';
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image('images/cross.png', true).'</a>'; $data[4] = '<a class="delete_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image('images/cross.png', true).'</a>';
} else { } else {
@ -462,6 +468,7 @@ if (!$maps && !is_metaconsole()) {
} }
html_print_table($table); html_print_table($table);
ui_pagination($total_maps, $url, $offset, $pagination, false, 'offset', true, 'pagination-bottom');
} }
if ($maps) { if ($maps) {

View File

@ -119,6 +119,20 @@ $visual_format = 0;
// Others // Others
$filter_search = ''; $filter_search = '';
// Added for select fields.
$total_time = true;
$time_failed = true;
$time_in_ok_status = true;
$time_in_unknown_status = true;
$time_of_not_initialized_module = true;
$time_of_downtime = true;
$total_checks = true;
$checks_failed = true;
$checks_in_ok_status = true;
$unknown_checks = true;
$agent_max_value = true;
$agent_min_value = true;
switch ($action) { switch ($action) {
case 'new': case 'new':
$actionParameter = 'save'; $actionParameter = 'save';
@ -501,6 +515,18 @@ switch ($action) {
$sunday = $item['sunday']; $sunday = $item['sunday'];
$time_from = $item['time_from']; $time_from = $item['time_from'];
$time_to = $item['time_to']; $time_to = $item['time_to'];
$total_time = $item['total_time'];
$time_failed = $item['time_failed'];
$time_in_ok_status = $item['time_in_ok_status'];
$time_in_unknown_status = $item['time_in_unknown_status'];
$time_of_not_initialized_module = $item['time_of_not_initialized_module'];
$time_of_downtime = $item['time_of_downtime'];
$total_checks = $item['total_checks'];
$checks_failed = $item['checks_failed'];
$checks_in_ok_status = $item['checks_in_ok_status'];
$unknown_checks = $item['unknown_checks'];
$agent_max_value = $item['agent_max_value'];
$agent_min_value = $item['agent_min_value'];
break; break;
case 'group_report': case 'group_report':
@ -1597,20 +1623,6 @@ $class = 'databox filters';
REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK'), REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK'),
]; ];
html_print_select($list_exception_condition, 'exception_condition', $exception_condition); html_print_select($list_exception_condition, 'exception_condition', $exception_condition);
/*
echo ;
html_print_radio_button ('radiobutton_exception_condition', 0, '', $exception_condition);
echo __('>=');
html_print_radio_button ('radiobutton_exception_condition', 1, '', $exception_condition);
echo __('<');
html_print_radio_button ('radiobutton_exception_condition', 2, '', $exception_condition);
echo __('OK');
html_print_radio_button ('radiobutton_exception_condition', 3, '', $exception_condition);
echo __('Not OK');
html_print_radio_button ('radiobutton_exception_condition', 4, '', $exception_condition);
*/
?> ?>
</td> </td>
</tr> </tr>
@ -1620,6 +1632,65 @@ $class = 'databox filters';
<td><?php html_print_select($show_graph_options, 'combo_graph_options', $show_graph); ?></td> <td><?php html_print_select($show_graph_options, 'combo_graph_options', $show_graph); ?></td>
</tr> </tr>
<tr id="row_select_fields" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;">
<?php
echo __('Select fields to show');
?>
</td>
<td>
<table border="0">
<td>
<p style="margin-right:30px;">
<?php
echo __('Total time');
html_print_checkbox('total_time', 1, $total_time);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Time failed');
html_print_checkbox('time_failed', 1, $time_failed);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Time in OK status');
html_print_checkbox('time_in_ok_status', 1, $time_in_ok_status);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Time in unknown status');
html_print_checkbox('time_in_unknown_status', 1, $time_in_unknown_status);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Time of not initialized module');
html_print_checkbox('time_of_not_initialized_module', 1, $time_of_not_initialized_module);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Time of downtime');
html_print_checkbox('time_of_downtime', 1, $time_of_downtime);
?>
</p>
</td>
</table>
</td>
</tr>
<tr id="row_show_address_agent" style="" class="datos"> <tr id="row_show_address_agent" style="" class="datos">
<td style="font-weight:bold;"> <td style="font-weight:bold;">
@ -1629,7 +1700,7 @@ $class = 'databox filters';
</td> </td>
<td> <td>
<?php <?php
html_print_checkbox( html_print_checkbox_switch(
'checkbox_show_address_agent', 'checkbox_show_address_agent',
1, 1,
$show_address_agent $show_address_agent
@ -1637,12 +1708,13 @@ $class = 'databox filters';
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_show_resume" style="" class="datos"> <tr id="row_show_resume" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Show resume').ui_print_help_tip(__('Show a summary chart with max, min and average number of total modules at the end of the report and Checks.'), true); ?></td> <td style="font-weight:bold;"><?php echo __('Show resume').ui_print_help_tip(__('Show a summary chart with max, min and average number of total modules at the end of the report and Checks.'), true); ?></td>
<td> <td>
<?php <?php
html_print_checkbox( html_print_checkbox_switch(
'checkbox_show_resume', 'checkbox_show_resume',
1, 1,
$show_resume $show_resume
@ -1650,6 +1722,78 @@ $class = 'databox filters';
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_select_fields2" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;">
<?php
echo __('<p style= "margin-left:15px;">Select fields to show</p>');
?>
</td>
<td>
<table border="0">
<td>
<p style="margin-right:30px;">
<?php
echo __('Total checks');
html_print_checkbox('total_checks', 1, $total_checks);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Checks failed');
html_print_checkbox('checks_failed', 1, $checks_failed);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Checks in OK status');
html_print_checkbox('checks_in_ok_status', 1, $checks_in_ok_status);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Unknown checks');
html_print_checkbox('unknown_checks', 1, $unknown_checks);
?>
</p>
</td>
<td>
</table>
</td>
</tr>
<tr id="row_select_fields3" style="" class="datos">
<td style="font-weight:bold;margin-right:150px;">
<?php
echo __('<p style= "margin-left:15px;">Select fields to show</p>');
?>
</td>
<td>
<table border="0">
<td>
<p style="margin-right:30px;">
<?php
echo __('Agent max value');
html_print_checkbox('agent_max_value', 1, $agent_max_value);
?>
</p>
</td>
<td>
<p style="margin-right:30px;">
<?php
echo __('Agent min values');
html_print_checkbox('agent_min_value', 1, $agent_min_value);
?>
</p>
</td>
<td>
</table>
</td>
</tr>
<tr id="row_show_summary_group" style="" class="datos"> <tr id="row_show_summary_group" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Show Summary group'); ?></td> <td style="font-weight:bold;"><?php echo __('Show Summary group'); ?></td>
@ -2625,6 +2769,17 @@ $(document).ready (function () {
} }
}); });
$("#checkbox-checkbox_show_resume").change(function(){
if($(this).is(":checked")){
$("#row_select_fields2").show();
$("#row_select_fields3").show();
}
else{
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
}
});
}); });
@ -3139,6 +3294,9 @@ function chooseType() {
$("#row_event_type").hide(); $("#row_event_type").hide();
$("#row_event_status").hide(); $("#row_event_status").hide();
$("#row_source").hide(); $("#row_source").hide();
$('#row_select_fields').hide();
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
// SLA list default state // SLA list default state
$("#sla_list").hide(); $("#sla_list").hide();
@ -3547,6 +3705,15 @@ function chooseType() {
$("#row_show_resume").show(); $("#row_show_resume").show();
$("#row_working_time").show(); $("#row_working_time").show();
$('#row_hide_notinit_agents').show(); $('#row_hide_notinit_agents').show();
$('#row_select_fields').show();
if($("#checkbox-checkbox_show_resume").is(":checked")){
$("#row_select_fields2").show();
$("#row_select_fields3").show();
}
else{
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
}
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;

View File

@ -330,6 +330,12 @@ if ($items) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$arrow_up = 'images/sort_up.png';
$arrow_down = 'images/sort_down.png';
} else {
$table->class = 'info_table';
$arrow_up = 'images/sort_up_black.png';
$arrow_down = 'images/sort_down_black.png';
} }
$table->size = []; $table->size = [];
@ -342,18 +348,18 @@ if ($items) {
$table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>'; $table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';
$table->head[1] = __('Type'); $table->head[1] = __('Type');
if (!$filterEnable) { if (!$filterEnable) {
$table->head[1] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_up.png', true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_down.png', true, ['title' => __('Descent')]).'</a>'; $table->head[1] .= ' <span class="sort_arrow"><a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_down, true, ['title' => __('Descent')]).'</a></span>';
} }
$table->head[2] = __('Agent'); $table->head[2] = __('Agent');
if (!$filterEnable) { if (!$filterEnable) {
$table->head[2] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_up.png', true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_down.png', true, ['title' => __('Descent')]).'</a>'; $table->head[2] .= ' <span class="sort_arrow"><a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_down, true, ['title' => __('Descent')]).'</a></span>';
} }
$table->head[3] = __('Module'); $table->head[3] = __('Module');
if (!$filterEnable) { if (!$filterEnable) {
$table->head[3] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_up.png', true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image('images/sort_down.png', true, ['title' => __('Descent')]).'</a>'; $table->head[3] .= ' <span class="sort_arrow"><a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_up, true, ['title' => __('Ascendent')]).'</a>'.'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report='.$idReport.$urlFilter.'&pure='.$config['pure'].'">'.html_print_image($arrow_down, true, ['title' => __('Descent')]).'</a></span>';
} }
$table->head[4] = __('Time lapse'); $table->head[4] = __('Time lapse');
@ -493,6 +499,7 @@ foreach ($items as $item) {
$row[6] = ''; $row[6] = '';
if (check_acl($config['id_user'], $item['id_group'], 'RM')) { if (check_acl($config['id_user'], $item['id_group'], 'RM')) {
$table->cellclass[][6] = 'action_buttons';
$row[6] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report='.$idReport.'&id_item='.$item['id_rc'].'">'.html_print_image('images/wrench_orange.png', true, ['title' => __('Edit')]).'</a>'; $row[6] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report='.$idReport.'&id_item='.$item['id_rc'].'">'.html_print_image('images/wrench_orange.png', true, ['title' => __('Edit')]).'</a>';
$row[6] .= '&nbsp;'; $row[6] .= '&nbsp;';
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false;" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report='.$idReport.'&id_item='.$item['id_rc'].$urlFilter.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>'; $row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false;" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report='.$idReport.'&id_item='.$item['id_rc'].$urlFilter.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';

View File

@ -70,7 +70,7 @@ global $config;
// IMPORTANT NOTE: All reporting pages are used also for metaconsole reporting functionality // IMPORTANT NOTE: All reporting pages are used also for metaconsole reporting functionality
// So, it's very important to specify full url and paths to resources because metaconsole has a different // So, it's very important to specify full url and paths to resources because metaconsole has a different
// entry point: enterprise/meta/index.php than normal console !!! // entry point: enterprise/meta/index.php than normal console !!!
// Login check // Login check.
check_login(); check_login();
enterprise_hook('open_meta_frame'); enterprise_hook('open_meta_frame');
@ -89,7 +89,7 @@ if (!$report_r && !$report_w && !$report_m) {
require_once $config['homedir'].'/include/functions_reports.php'; require_once $config['homedir'].'/include/functions_reports.php';
// Load enterprise extensions // Load enterprise extensions.
enterprise_include('operation/reporting/custom_reporting.php'); enterprise_include('operation/reporting/custom_reporting.php');
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
@ -98,7 +98,7 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO
$enterpriseEnable = true; $enterpriseEnable = true;
} }
// Constant with fonts directory // Constant with fonts directory.
define('_MPDF_TTFONTPATH', 'include/fonts/'); define('_MPDF_TTFONTPATH', 'include/fonts/');
$activeTab = get_parameter('tab', 'main'); $activeTab = get_parameter('tab', 'main');
@ -117,10 +117,10 @@ if ($schedule_report != '') {
$date = date(DATE_FORMAT); $date = date(DATE_FORMAT);
$time = date(TIME_FORMAT); $time = date(TIME_FORMAT);
$parameters[0] = get_parameter('id_schedule_report'); $parameters[0] = get_parameter('id_schedule_report');
// $parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_report);
$parameters[1] = get_parameter('schedule_email_address'); $parameters[1] = get_parameter('schedule_email_address');
$parameters[2] = get_parameter('schedule_subject', ''); $parameters[2] = get_parameter('schedule_subject', '');
$parameters[3] = get_parameter('schedule_email', ''); $parameters[3] = get_parameter('schedule_email', '');
$parameters[4] = get_parameter('report_type', '');
$parameters['first_execution'] = strtotime($date.' '.$time); $parameters['first_execution'] = strtotime($date.' '.$time);
$values = [ $values = [
@ -141,7 +141,7 @@ if ($schedule_report != '') {
echo '<br>'; echo '<br>';
} }
// Other Checks for the edit the reports // Other Checks for the edit the reports.
if ($idReport != 0) { if ($idReport != 0) {
$report = db_get_row_filter('treport', ['id_report' => $idReport]); $report = db_get_row_filter('treport', ['id_report' => $idReport]);
$type_access_selected = reports_get_type_access($report); $type_access_selected = reports_get_type_access($report);
@ -162,6 +162,10 @@ if ($idReport != 0) {
$edit = true; $edit = true;
} }
break; break;
default:
// Default.
break;
} }
if (! $edit) { if (! $edit) {
@ -227,6 +231,10 @@ switch ($action) {
ORDER BY "order"' ORDER BY "order"'
); );
break; break;
default:
// Default.
break;
} }
if ($items === false) { if ($items === false) {
@ -234,7 +242,7 @@ switch ($action) {
} }
// Clean the repeated order values // Clean the repeated order values.
$order_temp = 1; $order_temp = 1;
foreach ($items as $item) { foreach ($items as $item) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
@ -254,6 +262,10 @@ switch ($action) {
['id_rc' => $item['id_rc']] ['id_rc' => $item['id_rc']]
); );
break; break;
default:
// Default.
break;
} }
$order_temp++; $order_temp++;
@ -281,6 +293,10 @@ switch ($action) {
ORDER BY "order"' ORDER BY "order"'
); );
break; break;
default:
// Default.
break;
} }
if ($items === false) { if ($items === false) {
@ -293,7 +309,7 @@ switch ($action) {
$temp = []; $temp = [];
foreach ($items as $item) { foreach ($items as $item) {
// Remove the contents from the block to sort // Remove the contents from the block to sort.
if (array_search($item['id_rc'], $ids) === false) { if (array_search($item['id_rc'], $ids) === false) {
$temp[$item['order']] = $item['id_rc']; $temp[$item['order']] = $item['id_rc'];
} }
@ -344,6 +360,10 @@ switch ($action) {
['id_rc' => $id] ['id_rc' => $id]
); );
break; break;
default:
// Default.
break;
} }
} }
@ -415,6 +435,10 @@ switch ($action) {
} }
} }
break; break;
default:
// Default.
break;
} }
} }
break; break;
@ -444,9 +468,9 @@ switch ($action) {
break; break;
} }
// Page header for metaconsole // Page header for metaconsole.
if ($enterpriseEnable and defined('METACONSOLE')) { if ($enterpriseEnable && defined('METACONSOLE')) {
// Bread crumbs // Bread crumbs.
ui_meta_add_breadcrumb( ui_meta_add_breadcrumb(
[ [
'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure,
@ -456,10 +480,11 @@ switch ($action) {
ui_meta_print_page_header($nav_bar); ui_meta_print_page_header($nav_bar);
// Print header // Print header.
ui_meta_print_header(__('Reporting'), '', $buttons); ui_meta_print_header(__('Reporting'), '', $buttons);
} }
// Page header for normal console
// Page header for normal console.
else { else {
ui_print_page_header(__('Custom reporting'), 'images/op_reporting.png', false, '', false, $buttons, false, '', 60); ui_print_page_header(__('Custom reporting'), 'images/op_reporting.png', false, '', false, $buttons, false, '', 60);
} }
@ -471,7 +496,7 @@ switch ($action) {
case 'group_view': case 'group_view':
if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) { if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) {
$delete = true; $delete = true;
// owner can delete // Owner can delete.
} else { } else {
$delete = check_acl( $delete = check_acl(
$config['id_user'], $config['id_user'],
@ -484,7 +509,7 @@ switch ($action) {
case 'group_edit': case 'group_edit':
if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) { if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) {
$delete = true; $delete = true;
// owner can delete // Owner can delete.
} else { } else {
$delete = check_acl( $delete = check_acl(
$config['id_user'], $config['id_user'],
@ -501,6 +526,10 @@ switch ($action) {
$delete = true; $delete = true;
} }
break; break;
default:
// Default.
break;
} }
if (! $delete) { if (! $delete) {
@ -571,7 +600,7 @@ switch ($action) {
ui_require_jquery_file('bgiframe'); ui_require_jquery_file('bgiframe');
ui_require_jquery_file('autocomplete'); ui_require_jquery_file('autocomplete');
// Show only selected groups // Show only selected groups.
if ($id_group > 0) { if ($id_group > 0) {
$group = ["$id_group" => $id_group]; $group = ["$id_group" => $id_group];
} else { } else {
@ -595,7 +624,7 @@ switch ($action) {
} }
// Fix : group filter was not working // Fix : group filter was not working
// Show only selected groups // Show only selected groups.
if ($id_group > 0) { if ($id_group > 0) {
$group = ["$id_group" => $id_group]; $group = ["$id_group" => $id_group];
$filter['id_group'] = $id_group; $filter['id_group'] = $id_group;
@ -603,8 +632,8 @@ switch ($action) {
$group = false; $group = false;
} }
// Filter normal and metaconsole reports // Filter normal and metaconsole reports.
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) { if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$filter['metaconsole'] = 1; $filter['metaconsole'] = 1;
} else { } else {
$filter['metaconsole'] = 0; $filter['metaconsole'] = 0;
@ -646,7 +675,7 @@ switch ($action) {
$table = new stdClass(); $table = new stdClass();
$table->id = 'report_list'; $table->id = 'report_list';
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
@ -670,12 +699,12 @@ switch ($action) {
$table->size['csv'] = '5%'; $table->size['csv'] = '5%';
$next = 4; $next = 4;
// Calculate dinamically the number of the column // Calculate dinamically the number of the column.
if (enterprise_hook('load_custom_reporting_1') !== ENTERPRISE_NOT_HOOK) { if (enterprise_hook('load_custom_reporting_1') !== ENTERPRISE_NOT_HOOK) {
$next = 7; $next = 7;
} }
// Admin options only for RM flag // Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[$next] = __('Private'); $table->head[$next] = __('Private');
$table->size[$next] = '2%'; $table->size[$next] = '2%';
@ -743,7 +772,7 @@ switch ($action) {
$data[1] = ui_print_truncate_text($report['description'], 70); $data[1] = ui_print_truncate_text($report['description'], 70);
// Remove html and xml button if items are larger than limit // Remove html and xml button if items are larger than limit.
$item_count = db_get_num_rows('SELECT * FROM treport_content WHERE id_report='.$report['id_report']); $item_count = db_get_num_rows('SELECT * FROM treport_content WHERE id_report='.$report['id_report']);
$report['overload'] = $item_count >= $config['report_limit']; $report['overload'] = $item_count >= $config['report_limit'];
if ($report['overload']) { if ($report['overload']) {
@ -752,7 +781,7 @@ switch ($action) {
} else if (!$report['non_interactive']) { } else if (!$report['non_interactive']) {
$data[2] = '<a href="'.$config['homeurl'].'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'&pure='.$pure.'">'.html_print_image('images/html.png', true, ['title' => __('HTML view')]).'</a>'; $data[2] = '<a href="'.$config['homeurl'].'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'&pure='.$pure.'">'.html_print_image('images/html.png', true, ['title' => __('HTML view')]).'</a>';
$data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">'.html_print_image('images/xml.png', true, ['title' => __('Export to XML')]).'</a>'; $data[3] = '<a href="'.ui_get_full_url(false, false, false, false).'ajax.php?page='.$config['homedir'].'/operation/reporting/reporting_xml&id='.$report['id_report'].'">'.html_print_image('images/xml.png', true, ['title' => __('Export to XML')]).'</a>';
// I chose ajax.php because it's supposed to give XML anyway // I chose ajax.php because it's supposed to give XML anyway.
} else { } else {
$data[2] = html_print_image( $data[2] = html_print_image(
'images/html_disabled.png', 'images/html_disabled.png',
@ -765,14 +794,14 @@ switch ($action) {
} }
// Calculate dinamically the number of the column // Calculate dinamically the number of the column.
$next = 4; $next = 4;
if (enterprise_hook('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) { if (enterprise_hook('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) {
$next = 7; $next = 7;
} }
// Admin options only for RM flag // Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RM')) {
if ($report['private'] == 1) { if ($report['private'] == 1) {
$data[$next] = __('Yes'); $data[$next] = __('Yes');
@ -820,10 +849,16 @@ switch ($action) {
$delete = true; $delete = true;
} }
break; break;
default:
// Default.
break;
} }
if ($edit || $delete) { if ($edit || $delete) {
$columnview = true; $columnview = true;
$table->cellclass[][$next] = 'action_buttons';
if (!isset($table->head[$next])) { if (!isset($table->head[$next])) {
$table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false); $table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false);
$table->size = []; $table->size = [];
@ -833,11 +868,6 @@ switch ($action) {
if ($edit) { if ($edit) {
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&pure='.$pure.'" style="display:inline">'; $data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&pure='.$pure.'" style="display:inline">';
$data[$next] .= html_print_input_hidden(
'id_report',
$report['id_report'],
true
);
$data[$next] .= html_print_input_image( $data[$next] .= html_print_input_image(
'edit', 'edit',
'images/config.png', 'images/config.png',
@ -846,13 +876,16 @@ switch ($action) {
true, true,
['title' => __('Edit')] ['title' => __('Edit')]
); );
$data[$next] .= html_print_input_hidden(
'id_report',
$report['id_report'],
true
);
$data[$next] .= '</form>'; $data[$next] .= '</form>';
} }
if ($delete) { if ($delete) {
$data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">'; $data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[$next] .= html_print_input_hidden('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_hidden('action', 'delete_report', true);
$data[$next] .= html_print_input_image( $data[$next] .= html_print_input_image(
'delete', 'delete',
'images/cross.png', 'images/cross.png',
@ -861,6 +894,8 @@ switch ($action) {
true, true,
['title' => __('Delete')] ['title' => __('Delete')]
); );
$data[$next] .= html_print_input_hidden('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_hidden('action', 'delete_report', true);
$data[$next] .= html_print_checkbox_extended('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true); $data[$next] .= html_print_checkbox_extended('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true);
@ -887,6 +922,7 @@ switch ($action) {
} }
html_print_table($table); html_print_table($table);
ui_pagination($total_reports, $url, $offset, $pagination, false, 'offset', true, 'pagination-bottom');
} else { } else {
ui_print_info_message([ 'no_close' => true, 'message' => __('No data found.') ]); ui_print_info_message([ 'no_close' => true, 'message' => __('No data found.') ]);
} }
@ -915,7 +951,6 @@ switch ($action) {
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
return; return;
break; break;
@ -943,6 +978,10 @@ switch ($action) {
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
$description = $report['description']; $description = $report['description'];
break; break;
default:
// Default.
break;
} }
break; break;
@ -976,6 +1015,10 @@ switch ($action) {
$id_group_edit = 0; $id_group_edit = 0;
$private = 1; $private = 1;
break; break;
default:
// Default.
break;
} }
if ($action == 'update') { if ($action == 'update') {
@ -1026,10 +1069,10 @@ switch ($action) {
$action = 'edit'; $action = 'edit';
} else if ($action == 'save') { } else if ($action == 'save') {
if ($reportName != '' && $idGroupReport != '') { if ($reportName != '' && $idGroupReport != '') {
// This flag allow to differentiate between normal console and metaconsole reports // This flag allow to differentiate between normal console and metaconsole reports.
$metaconsole_report = (int) is_metaconsole(); $metaconsole_report = (int) is_metaconsole();
// Juanma (07/05/2014) New feature: Custom front page for reports // Juanma (07/05/2014) New feature: Custom front page for reports.
if ($config['custom_report_front']) { if ($config['custom_report_front']) {
$custom_font = $config['custom_report_front_font']; $custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo']; $logo = $config['custom_report_front_logo'];
@ -1098,7 +1141,6 @@ switch ($action) {
$good_format = false; $good_format = false;
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = []; $values = [];
$values['id_report'] = $idReport; $values['id_report'] = $idReport;
// --------------------------------------------------- // ---------------------------------------------------
@ -1132,7 +1174,6 @@ switch ($action) {
break; break;
case 'event_report_log': case 'event_report_log':
$agents_to_report = get_parameter('id_agents3'); $agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', ''); $source = get_parameter('source', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
@ -1154,7 +1195,7 @@ switch ($action) {
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$interval_max = get_parameter('max_interval'); $interval_max = get_parameter('max_interval');
$interval_min = get_parameter('min_interval'); $interval_min = get_parameter('min_interval');
// Checks intervals fields // Checks intervals fields.
if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) { if (preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_max) and preg_match('/^(\-)*[0-9]*\.?[0-9]+$/', $interval_min)) {
$good_format = true; $good_format = true;
} }
@ -1221,9 +1262,21 @@ switch ($action) {
case 'availability': case 'availability':
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
// Show interfaces instead the modules // Show interfaces instead the modules.
$values['show_graph'] = get_parameter('checkbox_show_address_agent'); $values['show_graph'] = get_parameter('checkbox_show_address_agent');
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['total_time'] = get_parameter('total_time');
$values['time_failed'] = get_parameter('time_failed');
$values['time_in_ok_status'] = get_parameter('time_in_ok_status');
$values['time_in_unknown_status'] = get_parameter('time_in_unknown_status');
$values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module');
$values['time_of_downtime'] = get_parameter('time_of_downtime');
$values['total_checks'] = get_parameter('total_checks');
$values['checks_failed'] = get_parameter('checks_failed');
$values['checks_in_ok_status'] = get_parameter('checks_in_ok_status');
$values['unknown_checks'] = get_parameter('unknown_checks');
$values['agent_max_value'] = get_parameter('agent_max_value');
$values['agent_min_value'] = get_parameter('agent_min_value');
$good_format = true; $good_format = true;
break; break;
@ -1258,6 +1311,7 @@ switch ($action) {
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options'); $values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
break;
} }
$values['id_agent'] = get_parameter('id_agent'); $values['id_agent'] = get_parameter('id_agent');
@ -1282,6 +1336,19 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0); $values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0); $values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0); $values['sunday'] = get_parameter('sunday', 0);
$values['total_time'] = get_parameter('total_time', 0);
$values['time_failed'] = get_parameter('time_failed', 0);
$values['time_in_ok_status'] = get_parameter('time_in_ok_status', 0);
$values['time_in_unknown_status'] = get_parameter('time_in_unknown_status', 0);
$values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module', 0);
$values['time_of_downtime'] = get_parameter('time_of_downtime', 0);
$values['total_checks'] = get_parameter('total_checks', 0);
$values['checks_failed'] = get_parameter('checks_failed', 0);
$values['checks_in_ok_status'] = get_parameter('checks_in_ok_status', 0);
$values['unknown_checks'] = get_parameter('unknown_checks', 0);
$values['agent_max_value'] = get_parameter('agent_max_value', 0);
$values['agent_min_value'] = get_parameter('agent_min_value', 0);
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
@ -1293,6 +1360,10 @@ switch ($action) {
$values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')'; $values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
$values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')'; $values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
break; break;
default:
// Default.
break;
} }
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent'); $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
@ -1302,7 +1373,6 @@ switch ($action) {
$values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter('combo_group'); $values['id_group'] = get_parameter('combo_group');
$values['show_extended_events'] = get_parameter('include_extended_events');
$values['server_name'] = get_parameter('server_name'); $values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id'); $server_id = (int) get_parameter('server_id');
if ($server_id != 0) { if ($server_id != 0) {
@ -1314,7 +1384,7 @@ switch ($action) {
$values['server_name'] = get_parameter('combo_server'); $values['server_name'] = get_parameter('combo_server');
} }
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { if ((($values['type'] == 'custom_graph') || ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
$resultOperationDB = false; $resultOperationDB = false;
break; break;
} }
@ -1331,7 +1401,7 @@ switch ($action) {
$event_filter_search = get_parameter('filter_search', ''); $event_filter_search = get_parameter('filter_search', '');
// If metaconsole is activated // If metaconsole is activated.
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) { if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
$id_gs = substr($values['id_gs'], 0, strpos($values['id_gs'], '|')); $id_gs = substr($values['id_gs'], 0, strpos($values['id_gs'], '|'));
@ -1342,7 +1412,7 @@ switch ($action) {
} }
} }
// Get agent and server name // Get agent and server name.
$agent_name_server = io_safe_output(get_parameter('agent')); $agent_name_server = io_safe_output(get_parameter('agent'));
if (isset($agent_name_server)) { if (isset($agent_name_server)) {
@ -1352,7 +1422,7 @@ switch ($action) {
$server_name = substr($agent_name_server, $separator_pos); $server_name = substr($agent_name_server, $separator_pos);
$server_name = str_replace('(', '', $server_name); $server_name = str_replace('(', '', $server_name);
$server_name = str_replace(')', '', $server_name); $server_name = str_replace(')', '', $server_name);
// Will update server_name variable // Will update server_name variable.
$values['server_name'] = trim($server_name); $values['server_name'] = trim($server_name);
$agent_name = substr($agent_name_server, 0, $separator_pos); $agent_name = substr($agent_name_server, 0, $separator_pos);
} }
@ -1448,6 +1518,10 @@ switch ($action) {
$style['label'] = ''; $style['label'] = '';
} }
break; break;
default:
// Default.
break;
} }
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
@ -1462,6 +1536,10 @@ switch ($action) {
unset($values['type']); unset($values['type']);
} }
break; break;
default:
// Default.
break;
} }
$resultOperationDB = db_process_sql_update( $resultOperationDB = db_process_sql_update(
@ -1483,7 +1561,7 @@ switch ($action) {
$values['description'] = get_parameter('description'); $values['description'] = get_parameter('description');
$label = get_parameter('label', ''); $label = get_parameter('label', '');
// Add macros name // Add macros name.
$items_label = []; $items_label = [];
$items_label['type'] = get_parameter('type'); $items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent'); $items_label['id_agent'] = get_parameter('id_agent');
@ -1493,7 +1571,7 @@ switch ($action) {
$values['name'] = reporting_label_macro($items_label, $name_it); $values['name'] = reporting_label_macro($items_label, $name_it);
// Support for projection graph, prediction date and SLA reports // Support for projection graph, prediction date and SLA reports
// 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report // 'top_n_value', 'top_n' and 'text' fields will be reused for these types of report.
switch ($values['type']) { switch ($values['type']) {
case 'projection_graph': case 'projection_graph':
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
@ -1595,7 +1673,7 @@ switch ($action) {
case 'availability': case 'availability':
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
// Show interfaces instead the modules // Show interfaces instead the modules.
$values['show_graph'] = get_parameter('checkbox_show_address_agent'); $values['show_graph'] = get_parameter('checkbox_show_address_agent');
$good_format = true; $good_format = true;
break; break;
@ -1670,6 +1748,10 @@ switch ($action) {
$values['only_display_wrong'] = $only_display_wrong_tmp; $values['only_display_wrong'] = $only_display_wrong_tmp;
} }
break; break;
default:
// Default.
break;
} }
$values['monday'] = get_parameter('monday', 0); $values['monday'] = get_parameter('monday', 0);
@ -1679,6 +1761,18 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0); $values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0); $values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0); $values['sunday'] = get_parameter('sunday', 0);
$values['total_time'] = get_parameter('total_time', 0);
$values['time_failed'] = get_parameter('time_failed', 0);
$values['time_in_ok_status'] = get_parameter('time_in_ok_status', 0);
$values['time_in_unknown_status'] = get_parameter('time_in_unknown_status', 0);
$values['time_of_not_initialized_module'] = get_parameter('time_of_not_initialized_module', 0);
$values['time_of_downtime'] = get_parameter('time_of_downtime', 0);
$values['total_checks'] = get_parameter('total_checks', 0);
$values['checks_failed'] = get_parameter('checks_failed', 0);
$values['checks_in_ok_status'] = get_parameter('checks_in_ok_status', 0);
$values['unknown_checks'] = get_parameter('unknown_checks', 0);
$values['agent_max_value'] = get_parameter('agent_max_value', 0);
$values['agent_min_value'] = get_parameter('agent_min_value', 0);
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
@ -1690,6 +1784,10 @@ switch ($action) {
$values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')'; $values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
$values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')'; $values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
break; break;
default:
// Default.
break;
} }
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent', 0); $values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent', 0);
@ -1699,7 +1797,6 @@ switch ($action) {
$values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter('combo_group'); $values['id_group'] = get_parameter('combo_group');
$values['show_extended_events'] = get_parameter('include_extended_events');
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) { if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
@ -1718,8 +1815,8 @@ switch ($action) {
} }
} }
if (($values['type'] == 'sql') or ($values['type'] == 'sql_graph_hbar') if (($values['type'] == 'sql') || ($values['type'] == 'sql_graph_hbar')
or ($values['type'] == 'sql_graph_vbar') or ($values['type'] == 'sql_graph_pie') || ($values['type'] == 'sql_graph_vbar') || ($values['type'] == 'sql_graph_pie')
) { ) {
$values['treport_custom_sql_id'] = get_parameter('id_custom'); $values['treport_custom_sql_id'] = get_parameter('id_custom');
if ($values['treport_custom_sql_id'] == 0) { if ($values['treport_custom_sql_id'] == 0) {
@ -1761,7 +1858,7 @@ switch ($action) {
$event_filter_search = get_parameter('filter_search', ''); $event_filter_search = get_parameter('filter_search', '');
// Added for events items // Added for events items.
$style['show_summary_group'] = $show_summary_group; $style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode($filter_event_severity); $style['filter_event_severity'] = json_encode($filter_event_severity);
$style['filter_event_type'] = json_encode($filter_event_type); $style['filter_event_type'] = json_encode($filter_event_type);
@ -1783,6 +1880,10 @@ switch ($action) {
$style['label'] = ''; $style['label'] = '';
} }
break; break;
default:
// Default.
break;
} }
break; break;
@ -1827,6 +1928,10 @@ switch ($action) {
$style['label'] = ''; $style['label'] = '';
} }
break; break;
default:
// Default.
break;
} }
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
@ -1841,6 +1946,10 @@ switch ($action) {
unset($values['type']); unset($values['type']);
} }
break; break;
default:
// Default.
break;
} }
$result = db_process_sql_insert( $result = db_process_sql_insert(
@ -1870,6 +1979,10 @@ switch ($action) {
WHERE id_report = '.$idReport WHERE id_report = '.$idReport
); );
break; break;
default:
// Default.
break;
} }
if ($max === false) { if ($max === false) {
@ -1895,6 +2008,10 @@ switch ($action) {
['id_rc' => $idItem] ['id_rc' => $idItem]
); );
break; break;
default:
// Default.
break;
} }
$resultOperationDB = true; $resultOperationDB = true;
@ -1902,7 +2019,8 @@ switch ($action) {
break; break;
} }
// If fields dont have good format
// If fields dont have good format.
else { else {
$resultOperationDB = false; $resultOperationDB = false;
} }
@ -1910,7 +2028,7 @@ switch ($action) {
break; break;
default: default:
if ($enterpriseEnable and $activeTab != 'advanced') { if ($enterpriseEnable && $activeTab != 'advanced') {
$resultOperationDB = reporting_enterprise_update_action(); $resultOperationDB = reporting_enterprise_update_action();
} }
break; break;
@ -1968,7 +2086,7 @@ switch ($action) {
case 'agent': case 'agent':
case 'type': case 'type':
// Sort functionality for normal console // Sort functionality for normal console.
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
switch ($field) { switch ($field) {
case 'module': case 'module':
@ -2002,6 +2120,10 @@ switch ($action) {
case 'type': case 'type':
$sql = 'SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s'; $sql = 'SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s';
break; break;
default:
// Default.
break;
} }
$sql = sprintf($sql, 'id_report = '.$idReport, '%s'); $sql = sprintf($sql, 'id_report = '.$idReport, '%s');
@ -2013,11 +2135,15 @@ switch ($action) {
case 'down': case 'down':
$sql = sprintf($sql, 'DESC'); $sql = sprintf($sql, 'DESC');
break; break;
default:
// Default.
break;
} }
$ids = db_get_all_rows_sql($sql); $ids = db_get_all_rows_sql($sql);
} }
// Sort functionality for metaconsole // Sort functionality for metaconsole.
else if ($config['metaconsole'] == 1) { else if ($config['metaconsole'] == 1) {
switch ($field) { switch ($field) {
case 'agent': case 'agent':
@ -2035,14 +2161,14 @@ switch ($action) {
foreach ($report_items as $report_item) { foreach ($report_items as $report_item) {
$connection = metaconsole_get_connection($report_item['server_name']); $connection = metaconsole_get_connection($report_item['server_name']);
if (metaconsole_load_external_db($connection) != NOERR) { if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name); // ui_print_error_message ("Error connecting to ".$server_name);.
} }
switch ($field) { switch ($field) {
case 'agent': case 'agent':
$agents_name = agents_get_agents(['id_agente' => $report_item['id_agent']], 'nombre'); $agents_name = agents_get_agents(['id_agente' => $report_item['id_agent']], 'nombre');
// Item without agent // Item without agent.
if (!$agents_name) { if (!$agents_name) {
$element_name = ''; $element_name = '';
} else { } else {
@ -2054,13 +2180,17 @@ switch ($action) {
case 'module': case 'module':
$module_name = modules_get_agentmodule_name($report_item['id_agent_module']); $module_name = modules_get_agentmodule_name($report_item['id_agent_module']);
// Item without module // Item without module.
if (!$module_name) { if (!$module_name) {
$element_name = ''; $element_name = '';
} else { } else {
$element_name = $module_name; $element_name = $module_name;
} }
break; break;
default:
// Default.
break;
} }
metaconsole_restore_db(); metaconsole_restore_db();
@ -2068,7 +2198,7 @@ switch ($action) {
$temp_sort[$report_item['id_rc']] = $element_name; $temp_sort[$report_item['id_rc']] = $element_name;
} }
// Performes sorting // Performes sorting.
switch ($dir) { switch ($dir) {
case 'up': case 'up':
asort($temp_sort); asort($temp_sort);
@ -2077,6 +2207,10 @@ switch ($action) {
case 'down': case 'down':
arsort($temp_sort); arsort($temp_sort);
break; break;
default:
// Default.
break;
} }
foreach ($temp_sort as $temp_element_key => $temp_element_val) { foreach ($temp_sort as $temp_element_key => $temp_element_val) {
@ -2085,13 +2219,13 @@ switch ($action) {
$i++; $i++;
} }
// Free resources // Free resources.
unset($temp_sort); unset($temp_sort);
unset($report_items); unset($report_items);
} }
break; break;
// Type case only depends of local database // Type case only depends of local database.
case 'type': case 'type':
$sql = 'SELECT id_rc $sql = 'SELECT id_rc
FROM treport_content FROM treport_content
@ -2110,10 +2244,13 @@ switch ($action) {
case 'down': case 'down':
$sql = sprintf($sql, 'DESC'); $sql = sprintf($sql, 'DESC');
break; break;
default:
// Default.
break;
} }
$ids = db_get_all_rows_sql($sql); $ids = db_get_all_rows_sql($sql);
break; break;
} }
} }
@ -2152,6 +2289,10 @@ switch ($action) {
WHERE id_rc = '.$idItem WHERE id_rc = '.$idItem
); );
break; break;
default:
// Default.
break;
} }
// db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem)); // db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem));
@ -2163,6 +2304,10 @@ switch ($action) {
case 'down': case 'down':
$newOrder = ($oldOrder + 1); $newOrder = ($oldOrder + 1);
break; break;
default:
// Default.
break;
} }
switch ($config['dbtype']) { switch ($config['dbtype']) {
@ -2200,6 +2345,10 @@ switch ($action) {
false false
); );
break; break;
default:
// Default.
break;
} }
if ($resultOperationDB !== false) { if ($resultOperationDB !== false) {
@ -2229,13 +2378,17 @@ switch ($action) {
false false
); );
break; break;
default:
// Default.
break;
} }
} }
break; break;
} }
break; break;
// Added for report templates // Added for report templates.
default: default:
if ($enterpriseEnable) { if ($enterpriseEnable) {
$buttons = [ $buttons = [
@ -2259,7 +2412,7 @@ switch ($action) {
break; break;
} }
// Page header for metaconsole // Page header for metaconsole.
if ($enterpriseEnable and defined('METACONSOLE')) { if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs // Bread crumbs
ui_meta_add_breadcrumb( ui_meta_add_breadcrumb(
@ -2271,10 +2424,10 @@ switch ($action) {
ui_meta_print_page_header($nav_bar); ui_meta_print_page_header($nav_bar);
// Print header // Print header.
ui_meta_print_header(__('Reporting'), '', $buttons); ui_meta_print_header(__('Reporting'), '', $buttons);
} }
// Page header for normal console // Page header for normal console.
else { else {
ui_print_page_header($subsection, 'images/op_reporting.png', false, '', false, $buttons, false, '', 60); ui_print_page_header($subsection, 'images/op_reporting.png', false, '', false, $buttons, false, '', 60);
} }
@ -2337,9 +2490,9 @@ if ($idReport != 0) {
$textReportName = __('Create Custom Report'); $textReportName = __('Create Custom Report');
} }
// Page header for metaconsole // Page header for metaconsole.
if ($enterpriseEnable and defined('METACONSOLE')) { if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs // Bread crumbs.
ui_meta_add_breadcrumb( ui_meta_add_breadcrumb(
[ [
'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure,
@ -2349,7 +2502,7 @@ if ($enterpriseEnable and defined('METACONSOLE')) {
ui_meta_print_page_header($nav_bar); ui_meta_print_page_header($nav_bar);
// Print header // Print header.
ui_meta_print_header(__('Reporting').$textReportName, '', $buttons); ui_meta_print_header(__('Reporting').$textReportName, '', $buttons);
} else { } else {
ui_print_page_header( ui_print_page_header(

View File

@ -1090,10 +1090,11 @@ function readFields() {
var text = tinymce.get("text-label").getContent(); var text = tinymce.get("text-label").getContent();
values["label"] = text; values["label"] = text;
values["percentile_label_color"] = $(
"input[name=percentile_label_color]"
).val();
if ($("input[name=percentile_label]").val().length > 0) { if ($("input[name=percentile_label]").val().length > 0) {
values["percentile_label_color"] = $(
"input[name=percentile_label_color]"
).val();
values["label"] = values["label"] =
"<span style='color:" + "<span style='color:" +
values["percentile_label_color"] + values["percentile_label_color"] +

View File

@ -954,9 +954,10 @@ if (($create != '') || ($view != '')) {
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">'; echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
} else { } else {
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">'; echo '<table width="100%" cellspacing="4" cellpadding="4" class="info_table">';
} }
echo '<thead><tr>';
echo '<th>'.__('Name').'</th>'; echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Type').'</th>'; echo '<th>'.__('Type').'</th>';
echo '<th>'.__('Command').'</th>'; echo '<th>'.__('Command').'</th>';
@ -964,6 +965,8 @@ if (($create != '') || ($view != '')) {
echo "<th style='width: 120px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>'; echo "<th style='width: 120px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
} }
echo '</tr></thead>';
$color = 0; $color = 0;
foreach ($rows as $row) { foreach ($rows as $row) {
@ -1202,4 +1205,6 @@ ui_require_javascript_file('pandora_modules');
$('.command_macro').click(macros_click_locked_event); $('.command_macro').click(macros_click_locked_event);
} }
</script> </script>

View File

@ -40,7 +40,9 @@ if ($servers === false) {
$table = new StdClass(); $table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = []; $table->size = [];
$table->style = []; $table->style = [];
@ -80,7 +82,11 @@ $names_servers = [];
foreach ($servers as $server) { foreach ($servers as $server) {
$data = []; $data = [];
$table->cellclass[][3] = 'progress_bar'; // $table->cellclass[][3] = 'progress_bar';
$table->cellclass[] = [
3 => 'progress_bar',
8 => 'action_buttons',
];
$data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>'; $data[0] = '<span title="'.$server['version'].'">'.strip_tags($server['name']).'</span>';
// Status // Status
@ -155,7 +161,7 @@ foreach ($servers as $server) {
'style' => 'width:21px;height:21px;', 'style' => 'width:21px;height:21px;',
] ]
); );
$data[8] .= '</a>&nbsp;&nbsp;'; $data[8] .= '</a>';
} }
if ($server['type'] == 'data') { if ($server['type'] == 'data') {
@ -165,7 +171,7 @@ foreach ($servers as $server) {
true, true,
['title' => __('Reset module status and fired alert counts')] ['title' => __('Reset module status and fired alert counts')]
); );
$data[8] .= '</a>&nbsp;&nbsp;'; $data[8] .= '</a>';
} else if ($server['type'] == 'enterprise snmp') { } else if ($server['type'] == 'enterprise snmp') {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">'; $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
@ -173,7 +179,7 @@ foreach ($servers as $server) {
true, true,
['title' => __('Claim back SNMP modules')] ['title' => __('Claim back SNMP modules')]
); );
$data[8] .= '</a>&nbsp;&nbsp;'; $data[8] .= '</a>';
} }
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">'; $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">';
@ -195,7 +201,7 @@ foreach ($servers as $server) {
$names_servers[$safe_server_name] = false; $names_servers[$safe_server_name] = false;
} }
$data[8] .= '&nbsp;&nbsp;<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">'; $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">';
$data[8] .= html_print_image( $data[8] .= html_print_image(
'images/cross.png', 'images/cross.png',
true, true,

View File

@ -63,14 +63,15 @@ switch ($action) {
break; break;
} }
$table->class = 'info_table';
$table->width = '98%'; $table->width = '98%';
$table->head[0] = __('Map connection name'); $table->head[0] = __('Map connection name');
$table->head[1] = __('Group'); $table->head[1] = __('Group');
$table->head[3] = __('Delete'); $table->head[3] = __('Delete');
$table->align[1] = 'center'; $table->align[1] = 'left';
$table->align[2] = 'center'; $table->align[2] = 'left';
$table->align[3] = 'center'; $table->align[3] = 'left';
$mapsConnections = db_get_all_rows_in_table('tgis_map_connection', 'conection_name'); $mapsConnections = db_get_all_rows_in_table('tgis_map_connection', 'conection_name');
@ -84,6 +85,7 @@ if ($mapsConnections !== false) {
'<a href="index.php?sec=gsetup&sec2=godmode/setup/gis&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'&amp;action=delete_connection" '<a href="index.php?sec=gsetup&sec2=godmode/setup/gis&amp;id_connection_map='.$mapsConnection['id_tmap_connection'].'&amp;action=delete_connection"
onClick="javascript: if (!confirm(\''.__('Do you wan delete this connection?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>', onClick="javascript: if (!confirm(\''.__('Do you wan delete this connection?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>',
]; ];
$table->cellclass[][2] = 'action_buttons';
} }
} }

View File

@ -137,9 +137,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
if (empty($rows)) { if (empty($rows)) {
ui_print_info_message(['no_close' => true, 'message' => __("There isn't links") ]); ui_print_info_message(['no_close' => true, 'message' => __("There isn't links") ]);
} else { } else {
echo "<table cellpadding='4' cellspacing='4' class='databox data' style='width:100%'>"; echo "<table cellpadding='0' cellspacing='0' class='info_table' style='width:100%'>";
echo '<thead><tr>';
echo "<th width='180px'>".__('Link name').'</th>'; echo "<th width='180px'>".__('Link name').'</th>';
echo "<th width='10px'>".__('Delete').'</th>'; echo "<th width='10px'>".__('Delete').'</th>';
echo '</tr></thead>';
$color = 1; $color = 1;
foreach ($rows as $row) { foreach ($rows as $row) {
@ -152,7 +154,7 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
} }
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/links&form_edit=1&id_link=".$row['id_link']."'>".$row['name'].'</a></b></td>'; echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/links&form_edit=1&id_link=".$row['id_link']."'>".$row['name'].'</a></b></td>';
echo '<td class="'.$tdcolor.'"><a href="index.php?sec=gsetup&sec2=godmode/setup/links&id_link='.$row['id_link'].'&borrar='.$row['id_link'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a></td></tr>'; echo '<td class="'.$tdcolor.' action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/links&id_link='.$row['id_link'].'&borrar='.$row['id_link'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a></td></tr>';
} }
echo '</table>'; echo '</table>';

View File

@ -231,14 +231,15 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined news') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined news') ]);
} else { } else {
// Main list view for Links editor // Main list view for Links editor
echo "<table cellpadding='4' cellspacing='4' class='databox data' width=100%>"; echo "<table cellpadding='0' cellspacing='0' class='info_table' width=100%>";
echo '<thead><tr>';
echo '<th>'.__('Subject').'</th>'; echo '<th>'.__('Subject').'</th>';
echo '<th>'.__('Type').'</th>'; echo '<th>'.__('Type').'</th>';
echo '<th>'.__('Author').'</th>'; echo '<th>'.__('Author').'</th>';
echo '<th>'.__('Timestamp').'</th>'; echo '<th>'.__('Timestamp').'</th>';
echo '<th>'.__('Expiration').'</th>'; echo '<th>'.__('Expiration').'</th>';
echo '<th>'.__('Delete').'</th>'; echo '<th>'.__('Delete').'</th>';
echo '</tr></thead>';
$color = 1; $color = 1;
@ -276,7 +277,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
echo "<td class='$tdcolor'>".__('No').'</b></td>'; echo "<td class='$tdcolor'>".__('No').'</b></td>';
} }
echo '<td class="'.$tdcolor.'"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a></td></tr>'; echo '<td class="'.$tdcolor.' action_buttons"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row['id_news'].'&borrar='.$row['id_news'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a></td></tr>';
} }
echo '</table>'; echo '</table>';

View File

@ -25,7 +25,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head[0] = ''; $table->head[0] = '';
$table->head[1] = __('ID'); $table->head[1] = __('ID');
@ -37,7 +37,19 @@ $table->align[4] = 'center';
$table->size[0] = '20px'; $table->size[0] = '20px';
$table->size[4] = '20px'; $table->size[4] = '20px';
$osList = db_get_all_rows_in_table('tconfig_os'); // Prepare pagination.
$offset = (int) get_parameter('offset');
$limit = $config['block_size'];
$count_osList = db_get_value('count(*)', 'tconfig_os');
$osList = db_get_all_rows_filter(
'tconfig_os',
[
'offset' => $offset,
'limit' => $limit,
]
);
if ($osList === false) { if ($osList === false) {
$osList = []; $osList = [];
} }
@ -54,6 +66,8 @@ foreach ($osList as $os) {
} }
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true); $data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true);
$table->cellclass[][4] = 'action_buttons';
if ($os['id_os'] > 16) { if ($os['id_os'] > 16) {
if (is_metaconsole()) { if (is_metaconsole()) {
$data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>'; $data[] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'].'">'.html_print_image('images/cross.png', true).'</a>';
@ -69,7 +83,9 @@ foreach ($osList as $os) {
} }
if (isset($data)) { if (isset($data)) {
ui_pagination($count_osList, false, $offset);
html_print_table($table); html_print_table($table);
ui_pagination($count_osList, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
} }

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,16 +405,16 @@ if ($config['history_db_enabled'] == 1) {
); );
} }
$history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
$config_history = false; $config_history = false;
if ($history_connect !== false) { if ($config['history_db_connection']) {
if ($config['history_db_connection'] != false) { $history_connect = @mysql_db_process_sql(
'SELECT 1 FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if ($history_connect !== 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,11 +427,11 @@ if ($config['history_db_enabled'] == 1) {
$config_history[$value['token']] = $value['value']; $config_history[$value['token']] = $value['value'];
} }
} }
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the historical database')
);
} }
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the historical database')
);
} }
if ($config_history === false) { if ($config_history === false) {

View File

@ -70,10 +70,6 @@ $values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES); $values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES); $values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
$table_behaviour->data[$row][0] = __('Default interval for refresh on Visual Console').ui_print_help_tip(__('This interval will affect to Visual Console pages'), true);
$table_behaviour->data[$row][1] = html_print_select($values, 'vc_refr', $config['vc_refr'], '', 'N/A', 0, true, false, false);
$row++;
$table_behaviour->data[$row][0] = __('Paginated module view'); $table_behaviour->data[$row][0] = __('Paginated module view');
$table_behaviour->data[$row][1] = html_print_checkbox_switch( $table_behaviour->data[$row][1] = html_print_checkbox_switch(
'paginate_module', 'paginate_module',
@ -908,6 +904,24 @@ $row++;
$table_vc->size[0] = '50%'; $table_vc->size[0] = '50%';
$table_vc->data = []; $table_vc->data = [];
// Remove when the new view reaches rock solid stability.
$table_vc->data[$row][0] = __('Legacy Visual Console View');
$table_vc->data[$row][0] .= ui_print_help_tip(
__('To use the old view when using the Visual Console visor'),
true
);
$table_vc->data[$row][1] = html_print_checkbox_switch(
'legacy_vc',
1,
(bool) $config['legacy_vc'],
true
);
$row++;
$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console').ui_print_help_tip(__('This interval will affect to Visual Console pages'), true);
$table_vc->data[$row][1] = html_print_select($values, 'vc_refr', (int) $config['vc_refr'], '', 'N/A', 0, true, false, false);
$row++;
$vc_favourite_view_array[0] = __('Classic view'); $vc_favourite_view_array[0] = __('Classic view');
$vc_favourite_view_array[1] = __('View of favorites'); $vc_favourite_view_array[1] = __('View of favorites');
$table_vc->data[$row][0] = __('Type of view of visual consoles').ui_print_help_tip(__('Allows you to directly display the list of favorite visual consoles'), true); $table_vc->data[$row][0] = __('Type of view of visual consoles').ui_print_help_tip(__('Allows you to directly display the list of favorite visual consoles'), true);
@ -918,12 +932,8 @@ $row++;
$table_vc->data[$row][1] = "<input type ='number' value=".$config['vc_menu_items']." size='5' name='vc_menu_items' min='0' max='25'>"; $table_vc->data[$row][1] = "<input type ='number' value=".$config['vc_menu_items']." size='5' name='vc_menu_items' min='0' max='25'>";
$row++; $row++;
if (empty($config['vc_line_thickness'])) {
$config['vc_line_thickness'] = 2;
}
$table_vc->data[$row][0] = __('Default line thickness for the Visual Console').ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true); $table_vc->data[$row][0] = __('Default line thickness for the Visual Console').ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
$table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', $config['vc_line_thickness'], '', 5, 5, true); $table_vc->data[$row][1] = html_print_input_text('vc_line_thickness', (int) $config['vc_line_thickness'], '', 5, 5, true);
echo '<fieldset>'; echo '<fieldset>';

View File

@ -226,13 +226,13 @@ if ($edit_filter > -2) {
$table->cellpadding = 4; $table->cellpadding = 4;
$table->cellspacing = 4; $table->cellspacing = 4;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->align = []; $table->align = [];
$table->head[0] = __('Description'); $table->head[0] = __('Description');
$table->head[1] = __('Filter'); $table->head[1] = __('Filter');
$table->head[2] = __('Action'); $table->head[2] = __('Action');
$table->size[2] = '50px'; $table->size[2] = '65px';
$table->align[2] = 'center'; $table->align[2] = 'center';
foreach ($aglomerate_result as $ind => $row) { foreach ($aglomerate_result as $ind => $row) {
@ -263,6 +263,7 @@ if ($edit_filter > -2) {
$data[0] = $compose_id; $data[0] = $compose_id;
$data[1] = implode(' AND ', $compose_filter); $data[1] = implode(' AND ', $compose_filter);
$data[2] = $compose_action; $data[2] = $compose_action;
$table->cellclass[][2] = 'action_buttons';
array_push($table->data, $data); array_push($table->data, $data);
} }
} }

View File

@ -191,7 +191,7 @@ if (!empty($result)) {
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->data = []; $table->data = [];
$table->head = []; $table->head = [];
@ -278,12 +278,14 @@ if (!empty($result)) {
$data[5] = $output; $data[5] = $output;
$data[6] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>".html_print_image('images/config.png', true, ['title' => 'Edit']).'</a>&nbsp;&nbsp;'; $table->cellclass[][6] = 'action_buttons';
$data[6] = "<a href='index.php?sec=".$sec.'&sec2=godmode/tag/edit_tag&action=update&id_tag='.$tag['id_tag']."'>".html_print_image('images/config.png', true, ['title' => 'Edit']).'</a>';
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>'; $data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag['id_tag'].'"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">'.html_print_image('images/cross.png', true, ['title' => 'Delete']).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }
html_print_table($table); html_print_table($table);
ui_pagination($total_tags, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else { } else {
if (is_metaconsole()) { if (is_metaconsole()) {
ui_toggle($filter_form, __('Show Options')); ui_toggle($filter_form, __('Show Options'));

View File

@ -258,7 +258,7 @@ if ($create_profile) {
$table = new stdClass(); $table = new stdClass();
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->class = 'databox profile_list data'; $table->class = 'info_table profile_list';
$table->width = '100%'; $table->width = '100%';
$table->head = []; $table->head = [];
@ -353,8 +353,9 @@ foreach ($profiles as $profile) {
$data['VW'] = ($profile['vconsole_edit'] ? $img : ''); $data['VW'] = ($profile['vconsole_edit'] ? $img : '');
$data['VM'] = ($profile['vconsole_management'] ? $img : ''); $data['VM'] = ($profile['vconsole_management'] ? $img : '');
$data['PM'] = ($profile['pandora_management'] ? $img : ''); $data['PM'] = ($profile['pandora_management'] ? $img : '');
$table->cellclass[]['operations'] = 'action_buttons';
$data['operations'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>'; $data['operations'] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
$data['operations'] .= '&nbsp;&nbsp;<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>'; $data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
array_push($table->data, $data); array_push($table->data, $data);
} }

View File

@ -38,13 +38,13 @@ $sort = get_parameter('sort', 'none');
$tab = get_parameter('tab', 'user'); $tab = get_parameter('tab', 'user');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$selected = 'border: 1px solid black;'; $selected = true;
$selectUserIDUp = ''; $selectUserIDUp = false;
$selectUserIDDown = ''; $selectUserIDDown = false;
$selectFullnameUp = ''; $selectFullnameUp = false;
$selectFullnameDown = ''; $selectFullnameDown = false;
$selectLastConnectUp = ''; $selectLastConnectUp = false;
$selectLastConnectDown = ''; $selectLastConnectDown = false;
$order = null; $order = null;
switch ($sortField) { switch ($sortField) {
@ -110,11 +110,11 @@ switch ($sortField) {
default: default:
$selectUserIDUp = $selected; $selectUserIDUp = $selected;
$selectUserIDDown = ''; $selectUserIDDown = false;
$selectFullnameUp = ''; $selectFullnameUp = false;
$selectFullnameDown = ''; $selectFullnameDown = false;
$selectLastConnectUp = ''; $selectLastConnectUp = false;
$selectLastConnectDown = ''; $selectLastConnectDown = false;
$order = [ $order = [
'field' => 'id_user', 'field' => 'id_user',
'order' => 'ASC', 'order' => 'ASC',
@ -300,11 +300,20 @@ if (defined('METACONSOLE')) {
ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search); ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search);
} }
// Urls to sort the table.
$url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure;
$url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure;
$url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure;
$url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure;
$url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure;
$url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure;
$table = new stdClass(); $table = new stdClass();
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->data = []; $table->data = [];
@ -312,9 +321,10 @@ $table->align = [];
$table->size = []; $table->size = [];
$table->valign = []; $table->valign = [];
$table->head[0] = __('User ID').' '.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectUserIDUp]).'</a>'.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectUserIDDown]).'</a>'; $table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown);
$table->head[1] = __('Name').' '.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectFullnameUp ]).'</a>'.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectFullnameDown]).'</a>'; $table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown);
$table->head[2] = __('Last contact').' '.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure.'">'.html_print_image('images/sort_up.png', true, ['style' => $selectLastConnectUp ]).'</a>'.'<a href="?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure.'">'.html_print_image('images/sort_down.png', true, ['style' => $selectLastConnectDown]).'</a>'; $table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown);
$table->head[3] = __('Admin'); $table->head[3] = __('Admin');
$table->head[4] = __('Profile / Group'); $table->head[4] = __('Profile / Group');
$table->head[5] = __('Description'); $table->head[5] = __('Description');
@ -514,6 +524,7 @@ foreach ($info as $user_id => $user_info) {
$data[5] = ui_print_string_substr($user_info['comments'], 24, true); $data[5] = ui_print_string_substr($user_info['comments'], 24, true);
$table->cellclass[][6] = 'action_buttons';
if ($user_info['disabled'] == 0) { if ($user_info['disabled'] == 0) {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=1&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>'; $data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=1&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>';
} else { } else {
@ -535,6 +546,7 @@ foreach ($info as $user_id => $user_info) {
} }
html_print_table($table); html_print_table($table);
ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo '<div style="width: '.$table->width.'" class="action-buttons">'; echo '<div style="width: '.$table->width.'" class="action-buttons">';
unset($table); unset($table);

View File

@ -96,8 +96,20 @@ class DiscoveryTaskList extends Wizard
] ]
); );
// Header // Header.
ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(
__('Task list'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
// Show redirected messages from discovery.php. // Show redirected messages from discovery.php.
if ($status === 0) { if ($status === 0) {
@ -352,10 +364,10 @@ class DiscoveryTaskList extends Wizard
$url_ajax = $config['homeurl'].'ajax.php'; $url_ajax = $config['homeurl'].'ajax.php';
$table = new StdClass(); $table = new StdClass();
$table->cellpadding = 4; $table->cellpadding = 0;
$table->cellspacing = 4; $table->cellspacing = 0;
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->data = []; $table->data = [];
$table->align = []; $table->align = [];
@ -404,15 +416,30 @@ class DiscoveryTaskList extends Wizard
// Exceptions: IPAM. // Exceptions: IPAM.
$ipam = false; $ipam = false;
if ($task['id_recon_script'] != null) { if ($task['id_recon_script'] != null) {
$recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']); $recon_script_data = db_get_row(
if (io_safe_output($recon_script_name) == 'IPAM Recon' 'trecon_script',
&& enterprise_installed() 'id_recon_script',
) { $task['id_recon_script']
$subnet_obj = json_decode($task['macros'], true); );
$subnet = $subnet_obj['1']['value']; if ($recon_script_data !== false) {
$tipam_task_id = db_get_value('id', 'tipam_network', 'id_recon_task', $task['id_rt']); $recon_script_name = $recon_script_data['name'];
$ipam = true; if (io_safe_output($recon_script_name) == 'IPAM Recon'
&& enterprise_installed()
) {
$subnet_obj = json_decode($task['macros'], true);
$subnet = $subnet_obj['1']['value'];
$tipam_task_id = db_get_value(
'id',
'tipam_network',
'id_recon_task',
$task['id_rt']
);
$ipam = true;
}
} }
} else {
$recon_script_data = false;
$recon_script_name = false;
} }
if ($task['disabled'] == 0 && $server_name !== '') { if ($task['disabled'] == 0 && $server_name !== '') {
@ -464,15 +491,56 @@ class DiscoveryTaskList extends Wizard
} }
if ($task['id_recon_script'] == 0) { if ($task['id_recon_script'] == 0) {
// Discovery NetScan. // Internal discovery task.
$data[6] = html_print_image( switch ($task['type']) {
'images/network.png', case DISCOVERY_CLOUD_AWS_RDS:
true, // Discovery Applications MySQL.
['title' => __('Discovery NetScan')] $data[6] = html_print_image(
).'&nbsp;&nbsp;'; 'images/network.png',
$data[6] .= network_profiles_get_name( true,
$task['id_network_profile'] ['title' => __('Discovery Cloud RDS')]
); ).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
case DISCOVERY_APP_MYSQL:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications MySQL')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.MySQL');
break;
case DISCOVERY_APP_ORACLE:
// Discovery Applications Oracle.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications Oracle')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.Oracle');
break;
case DISCOVERY_HOSTDEVICES:
default:
// Discovery NetScan.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery NetScan')]
).'&nbsp;&nbsp;';
$str = network_profiles_get_name(
$task['id_network_profile']
);
if (!empty($str)) {
$data[6] .= $str;
} else {
$data[6] .= __('Discovery.NetScan');
}
break;
}
} else { } else {
// APP recon task. // APP recon task.
$data[6] = html_print_image( $data[6] = html_print_image(
@ -512,7 +580,11 @@ class DiscoveryTaskList extends Wizard
$data[9] .= '</a>'; $data[9] .= '</a>';
} }
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) { if ($task['disabled'] != 2 && $task['utimestamp'] > 0
&& $task['type'] != DISCOVERY_APP_MYSQL
&& $task['type'] != DISCOVERY_APP_ORACLE
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">'; $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/dynamic_network_icon.png', 'images/dynamic_network_icon.png',
@ -548,7 +620,7 @@ class DiscoveryTaskList extends Wizard
$data[9] .= '<a href="'.ui_get_full_url( $data[9] .= '<a href="'.ui_get_full_url(
sprintf( sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d', 'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task), $this->getTargetWiz($task, $recon_script_data),
$task['id_rt'] $task['id_rt']
) )
).'">'.html_print_image( ).'">'.html_print_image(
@ -566,6 +638,8 @@ class DiscoveryTaskList extends Wizard
$data[9] = ''; $data[9] = '';
} }
$table->cellclass[][9] = 'action_buttons';
// Div neccesary for modal progress task. // Div neccesary for modal progress task.
echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>'; echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>';
@ -606,28 +680,49 @@ class DiscoveryTaskList extends Wizard
/** /**
* Return target url sub-string to edit target task. * Return target url sub-string to edit target task.
* *
* @param array $task With all data. * @param array $task With all data.
* @param array $script With all script data or false if undefined.
* *
* @return string * @return string
*/ */
public function getTargetWiz($task) public function getTargetWiz($task, $script=false)
{ {
// TODO: Do not use description. Use recon_script ID instead. if ($script !== false) {
switch ($task['description']) { switch ($script['type']) {
case 'Discovery.Application.VMware': case DISCOVERY_SCRIPT_CLOUD_AWS:
return 'wiz=app&mode=vmware&page=0'; return 'wiz=cloud&mode=amazonws&page=1';
case CLOUDWIZARD_AWS_DESCRIPTION: case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
case DISCOVERY_SCRIPT_IPAM_RECON:
return '';
case DISCOVERY_SCRIPT_IPMI_RECON:
default:
return 'wiz=hd&mode=customnetscan';
}
}
switch ($task['type']) {
case DISCOVERY_APP_MYSQL:
return 'wiz=app&mode=mysql&page=0';
case DISCOVERY_APP_ORACLE:
return 'wiz=app&mode=oracle&page=0';
case DISCOVERY_CLOUD_AWS:
case DISCOVERY_CLOUD_AWS_EC2:
return 'wiz=cloud&mode=amazonws&page=1'; return 'wiz=cloud&mode=amazonws&page=1';
case 'console_task': case DISCOVERY_CLOUD_AWS_RDS:
return 'wiz=ctask'; return 'wiz=cloud&mode=amazonws&sub=rds&page=0';
default: default:
if ($task['id_recon_script'] === null) { if ($task['description'] == 'console_task') {
return 'wiz=hd&mode=netscan'; return 'wiz=ctask';
} else { } else {
return 'wiz=hd&mode=customnetscan'; return 'wiz=hd&mode=netscan';
} }
break; break;
} }

View File

@ -149,7 +149,8 @@ class HostDevices extends Wizard
), ),
'label' => __('Discovery'), 'label' => __('Discovery'),
], ],
] ],
true
); );
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
@ -533,7 +534,19 @@ class HostDevices extends Wizard
if ($this->page < $this->maxPagesNetScan) { if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard. // Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum); $this->prepareBreadcrum($breadcrum);
ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); ui_print_page_header(
__('NetScan'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
} }
if (isset($this->page) === true if (isset($this->page) === true
@ -581,113 +594,83 @@ class HostDevices extends Wizard
if (isset($this->page) === false if (isset($this->page) === false
|| $this->page == 0 || $this->page == 0
) { ) {
$form = [];
// Input task name. // Comment input
$form['inputs'][] = [ $comment_input ='<div class="label_select"><label>'.__('Comment').':</label></div>';
'label' => '<b>'.__('Task name').'</b>',
'arguments' => [ $comment_input .= $this->printInput([
'name' => 'comment',
'rows' => 1,
'columns' => 1,
'value' => $this->task['description'],
'type' => 'textarea',
'size' => 25,
'class' => 'discovery_textarea_input',
'return' => true
]);
// Task input
$taskname_input_label = '<div class="label_select"><label>'.__('Task name').':</label></div>';
$taskname_input = $this->printInput([
'name' => 'taskname', 'name' => 'taskname',
'value' => $this->task['name'], 'value' => $this->task['name'],
'type' => 'text', 'type' => 'text',
'size' => 25, 'size' => 25,
], 'class' => 'discovery_full_width_input'
]; ]);
if (isset($this->task['id_rt']) === true) { // Network input
// Propagate id. $network_input_label .= '<div class="label_select discovery_label_hint"><label>'.__('Network').':</label>'.ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true).'</div>';
$form['inputs'][] = [
'arguments' => [
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden',
],
];
}
// Input task name. $network_input = $this->printInput([
$form['inputs'][] = [
'label' => '<b>'.__('Comment').'</b>',
'arguments' => [
'name' => 'comment',
'value' => $this->task['description'],
'type' => 'text',
'size' => 25,
],
];
// Input Discovery Server.
$form['inputs'][] = [
'label' => '<b>'.__('Discovery server').'</b>'.ui_print_help_tip(
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
true
),
'arguments' => [
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
],
];
// Input Network.
$form['inputs'][] = [
'label' => '<b>'.__('Network').'</b>'.ui_print_help_tip(
__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'),
true
),
'arguments' => [
'name' => 'network', 'name' => 'network',
'value' => $this->task['subnet'], 'value' => $this->task['subnet'],
'type' => 'text', 'type' => 'text',
'size' => 25, 'size' => 25,
], 'class' => 'discovery_full_width_input',
]; ]);
// Input Group.
$form['inputs'][] = [
'label' => '<b>'.__('Group').'</b>',
'arguments' => [
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,
],
];
// Interval and schedules. // Discovery server input
$discovery_server_select_label = '<div class="label_select discovery_label_hint"><label>'.__('Discovery server').':</label>'.ui_print_help_tip(__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'), true).'</div>';
$discovery_server_select = $this->printInput([
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
'style' => 'width: 100%',
]);
// Interval input
$interv_manual = 0; $interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) { if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1; $interv_manual = 1;
} }
// Schedule. $interval_input_label = '<div class="label_select discovery_label_hint" style="padding-top: 6px;"><label>'.__('Interval').':</label>'.ui_print_help_tip(__('Manual interval means that it will run only on demand.'), true).'</div>';
$form['inputs'][] = [
'label' => '<b>'.__('Interval').'</b>'.ui_print_help_tip( $interval_input = $this->printInput([
__('Manual interval means that it will be executed only On-demand'), 'type' => 'select',
true 'selected' => $interv_manual,
), 'fields' => [
'arguments' => [ 0 => __('Defined'),
'type' => 'select', 1 => __('Manual'),
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
], ],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time( 'name' => 'interval_manual_defined',
'return' => true,
'style' => 'float: right;'
]);
$interval_input_extra = '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval', 'interval',
$this->task['interval_sweep'], $this->task['interval_sweep'],
'', '',
@ -700,36 +683,38 @@ class HostDevices extends Wizard
).ui_print_help_tip( ).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'), __('The minimum recomended interval for Recon Task is 5 minutes'),
true true
).'</span>', ).'</span>';
];
$str = __('Next');
if (isset($this->task['id_rt']) === true) { // Group select
$str = __('Update and continue'); $group_select = '<div class="label_select"><label>'.__('Group').':</label></div>';
$group_select .= $this->printInput([
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,
'class' => 'discovery_list_input',
'size' => 9,
'simple_multiple_options' => true,
]);
if (isset($this->task['id_rt']) === true) {
//Propagate ID
$task_hidden = $this->printInput([
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden'
]);
} }
// Submit button.
$form['inputs'][] = [
'arguments' => [
'name' => 'submit',
'label' => $str,
'type' => 'submit',
'attributes' => 'class="sub next"',
'return' => true,
],
];
$task_url = ''; $task_url = '';
if (isset($this->task['id_rt'])) { if (isset($this->task['id_rt'])) {
$task_url = '&task='.$this->task['id_rt']; $task_url = '&task='.$this->task['id_rt'];
} }
$form['form'] = [
'method' => 'POST',
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).$task_url,
];
// Default. // Default.
$interval = 600; $interval = 600;
$unit = 60; $unit = 60;
@ -738,24 +723,62 @@ class HostDevices extends Wizard
$unit = $this->getTimeUnit($interval); $unit = $this->getTimeUnit($interval);
} }
$form['js'] = '
$("select#interval_manual_defined").change(function() {
if ($("#interval_manual_defined").val() == 1) {
$("#interval_manual_container").hide();
$("#text-interval_text").val(0);
$("#hidden-interval").val(0);
}
else {
$("#interval_manual_container").show();
$("#text-interval_text").val(10);
$("#hidden-interval").val('.$interval.');
$("#interval_units").val('.$unit.');
}
}).change();';
// XXX: Could be improved validating inputs before continue (JS) // XXX: Could be improved validating inputs before continue (JS)
// Print NetScan page 0. // Print NetScan page 0.
$this->printForm($form); //$this->printForm($form);
echo '<form action="'.$this->url.'&mode=netscan&page='.($this->page + 1).$task_url.'" method="POST">';
echo $task_hidden;
echo '<div class="white_box">
<div class="edit_discovery_info" style="margin-bottom: 15px;">
<div style="width: 25%; padding: 9px;">'
.'<div style="height: 50%; margin-bottom: 35px;">'.html_print_image ("images/wizard/netscan_green.png", true, array ("title" => __('Close'), "style" => 'width: 60%;'), false).'</div>'
.'<div class="edit_discovery_input"><div style="display: flex;">'.$interval_input_label.'<div style="margin-left: 15 px; width: 50%;">'.$interval_input.'</div></div>'.$interval_input_extra.'</div>'
.'</div>
<div style="width: 40%; padding-left: 5%; padding-right: 12%;">
<div class="edit_discovery_input">'.$taskname_input_label.'<div class="discovery_text_input">'.$taskname_input.'</div></div>'
.'<div class="edit_discovery_input discovery_select_input">'.$discovery_server_select_label.$discovery_server_select.'<div class="discovery_hint"></div></div>'
.'<div class="edit_discovery_input">'.$network_input_label.'<div class="discovery_text_input">'.$network_input.'</div></div>'
.'</div>'
.'<div style="width: 35%;">'.$group_select.'</div>'
.'</div>'
.'<div class="edit_discovery_info">
<div style="width: 100%;">
'.$comment_input.'
</div>
</div>'
.'</div>';
$str = __('Next');
if (isset($this->task['id_rt']) === true) {
$str = __('Update and continue');
}
echo '<div class="action-buttons" style="width: 100%; margin-top: 10px;">'.html_print_submit_button($str, 'submit', false, 'class="sub next"', true).'</div>';
echo '</form>';
echo '<script>
$("select#interval_manual_defined").change(function() {
if ($("#interval_manual_defined").val() == 1) {
$("#interval_manual_container").hide();
$("#text-interval_text").val(0);
$("#hidden-interval").val(0);
}
else {
$("#interval_manual_container").show();
$("#text-interval_text").val(10);
$("#hidden-interval").val('.$interval.');
$("#interval_units").val('.$unit.');
}
}).change();
</script>';
} }
} }
@ -783,7 +806,7 @@ $("select#interval_manual_defined").change(function() {
]; ];
$form['inputs'][] = [ $form['inputs'][] = [
'extra' => '<p>Please, configure task <b>'.io_safe_output($this->task['name']).'</b></p>', 'extra' => '<p><h3>Please, configure task <b>'.io_safe_output($this->task['name']).'</b></h3></p>',
]; ];
// Input: Module template. // Input: Module template.
@ -799,7 +822,6 @@ $("select#interval_manual_defined").change(function() {
'selected' => $this->task['id_network_profile'], 'selected' => $this->task['id_network_profile'],
'nothing_value' => 0, 'nothing_value' => 0,
'nothing' => __('None'), 'nothing' => __('None'),
], ],
]; ];
@ -850,7 +872,7 @@ $("select#interval_manual_defined").change(function() {
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'], 'action' => $this->url.'&mode=netscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
]; ];
$this->printForm($form); $this->printForm($form, false, true);
} }
if ($this->page == 2) { if ($this->page == 2) {

View File

@ -191,21 +191,19 @@ class Wizard
* Builder for breadcrum * Builder for breadcrum
* *
* @param array $urls Array of urls to be stored in breadcrum. * @param array $urls Array of urls to be stored in breadcrum.
* @param boolean $add True if breadcrum should be added instead of * @param boolean $add True if breadcrum should be added
* overwrite it. * instead of overwrite it.
* *
* @return void * @return void
*/ */
public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false) public function prepareBreadcrum(
{ array $urls,
bool $add=false
) {
$bc = []; $bc = [];
$i = 0; $i = 0;
$count = 0;
$array_size = count($urls);
foreach ($urls as $url) { foreach ($urls as $url) {
$count++;
if ($url['selected'] == 1) { if ($url['selected'] == 1) {
$class = 'selected'; $class = 'selected';
} else { } else {
@ -213,20 +211,10 @@ class Wizard
} }
$bc[$i] = ''; $bc[$i] = '';
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
if ($separator_beginning === true) { $bc[$i] .= $url['label'];
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>'; $bc[$i] .= '</a>';
}
$bc[$i] .= '<span><a class="breadcrumb_link '.$class.'" href="'.$url['link'].'">';
$bc[$i] .= $url['label'];
$bc[$i] .= '</a>';
if ($count < $array_size) {
$bc[$i] .= '<span class="breadcrumb_link">&nbsp/&nbsp</span>';
}
$bc[$i] .= '</span>'; $bc[$i] .= '</span>';
$i++; $i++;
} }
@ -235,7 +223,6 @@ class Wizard
} else { } else {
$this->setBreadcrum($bc); $this->setBreadcrum($bc);
} }
} }
@ -275,7 +262,10 @@ class Wizard
*/ */
public function printBreadcrum() public function printBreadcrum()
{ {
return implode('', $this->breadcrum); return implode(
'<span class="breadcrumb_link">&nbsp/&nbsp</span>',
$this->breadcrum
);
} }
@ -483,7 +473,9 @@ class Wizard
((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'), ((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
((isset($data['strict_user']) === true) ? $data['strict_user'] : false), ((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false), ((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
((isset($data['include_groups']) === true) ? $data['include_groups'] : false) ((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
((isset($data['size']) === true) ? $data['size'] : false),
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
); );
case 'submit': case 'submit':
@ -640,7 +632,7 @@ class Wizard
* *
* @return string HTML code. * @return string HTML code.
*/ */
public function printForm(array $data, bool $return=false) public function printForm(array $data, bool $return=false, bool $print_white_box=false)
{ {
$form = $data['form']; $form = $data['form'];
$inputs = $data['inputs']; $inputs = $data['inputs'];
@ -666,13 +658,27 @@ class Wizard
error_log('Error executing wizard callback: ', $e->getMessage()); error_log('Error executing wizard callback: ', $e->getMessage());
} }
$output = '<ul class="wizard">'; $output_submit = '';
$output = '';
if ($print_white_box === true)
$output .= '<div class="white_box">';
$output .= '<ul class="wizard">';
foreach ($inputs as $input) { foreach ($inputs as $input) {
$output .= $this->printBlock($input, true); if ($input['arguments']['type']!='submit')
$output .= $this->printBlock($input, true);
else
$output_submit .= $this->printBlock($input, true);
} }
$output .= '</ul>'; $output .= '</ul>';
if ($print_white_box === true)
$output .= '</div>';
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';

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