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_server/PandoraFMS-Enterprise/pandora_server_enterprise.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_server/pandora_server.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"
DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \
$CODEHOME/pandora_server/DEBIAN \

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# 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
# Base config file for Pandora agents
# Version 7.0NG.733, AIX version
# Version 7.0NG.734, AIX version
# General Parameters
# ==================

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.733-190328
Version: 7.0NG.734-190507
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.733';
use constant AGENT_BUILD => '190328';
use constant AGENT_VERSION => '7.0NG.734';
use constant AGENT_BUILD => '190507';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -662,6 +662,8 @@ sub parse_conf_modules($) {
$module->{'ff_timeout'} = $1;
} elsif ($line =~ /^\s*module_each_ff\s+(\S+)\s*$/) {
$module->{'each_ff'} = $1;
} elsif ($line =~ /^\s*module_ff_type\s+(\d+)\s*$/) {
$module->{'ff_type'} = $1;
# Macros
} elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) {
$module->{'macros'}{$1} = $2;
@ -1073,6 +1075,10 @@ sub send_buffered_xml_files ($;$) {
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)){
swap_servers ();
@ -2101,45 +2107,28 @@ sub cron_next_execution {
}
# 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
my $cur_time = time();
my $cur_wday = (localtime ($cur_time))[6];
# Any day of the week
if ($wday eq '*') {
my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval);
return $nex_time - time();
}
# A range?
else {
$wday = cron_get_closest_in_range ($cur_wday, $wday);
my $nex_time = cron_next_execution_date ($cron, $cur_time, $interval);
# Check the day
while (!cron_check_interval($wday, (localtime ($nex_time))[6])) {
# If it does not acomplish the day of the week, go to the next day.
$nex_time += 86400;
$nex_time = cron_next_execution_date ($cron, $nex_time, 0);
}
# A specific day of the week
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;
return $nex_time - time();
}
###############################################################################
@ -2151,7 +2140,30 @@ sub cron_check_syntax ($) {
return 0 if !defined ($cron);
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.
###############################################################################
@ -2189,8 +2201,7 @@ sub cron_next_execution_date {
my @nex_time_array = @curr_time_array;
# Update minutes
my ($min_down, undef) = cron_get_interval ($min);
$nex_time_array[0] = ($min_down eq '*') ? 0 : $min_down;
$nex_time_array[0] = cron_get_next_time_element($min);
$nex_time = cron_valid_date(@nex_time_array, $cur_year);
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);
#Update the hour if fails
my ($hour_down, undef) = cron_get_interval ($hour);
$nex_time_array[1] = ($hour_down eq '*') ? 0 : $hour_down;
$nex_time_array[1] = cron_get_next_time_element($hour);
# When an overflow is passed check the hour update again
$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);
#Update the day if fails
my ($mday_down, undef) = cron_get_interval ($mday);
$nex_time_array[2] = ($mday_down eq '*') ? 1 : $mday_down;
$nex_time_array[2] = cron_get_next_time_element($mday, 1);
# 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);
if ($nex_time >= $cur_time) {
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);
#Update the month if fails
my ($mon_down, undef) = cron_get_interval ($mon);
$nex_time_array[3] = ($mon_down eq '*') ? 0 : $mon_down;
$nex_time_array[3] = cron_get_next_time_element($mon);
# When an overflow is passed check the month update in the next execution
$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
return 1 unless (defined($elem_cron) || defined($elem_curr_time));
# Go to last element if current is a wild card
if ($elem_cron ne '*') {
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);
}
}
}
# Check the element interval
return 0 unless (cron_check_interval($elem_cron, $elem_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 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);
# Check if current timestamp is a valid cron date
my $next_execution = cron_next_execution_date(
my $next_execution = cron_next_execution(
$module->{'cron'},
$now - $interval,
$interval
0
);
return 1 if ($next_execution == $now);
return 1 if (time() + $next_execution == $now);
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 .= " <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 .= " <ff_type>" . $module->{'ff_type'} . "</ff_type>\n" if (defined ($module->{'ff_type'}));
# Data list
if ($#data > 0) {

View File

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

View File

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

View File

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

View File

@ -4,23 +4,44 @@
# Copyright (c) 2009 Artica Soluciones Tecnologicas S.L.
#
# inventory Generate a hardware/software inventory.
#
#
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
###############################################################################
use strict;
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)
my $Mode;
@ -31,12 +52,12 @@ my $Separator;
sub get_module_data ($$$$) {
my ($name, $hwinfo, $keys, $modules) = @_;
my %module;
# Store keys
$Separator='\s+\*\-';
# Store keys
foreach my $key (@{$keys}) {
push (@{$module{'_keys'}}, $key);
}
# Parse module data
while (my $line = shift (@{$hwinfo})) {
if ($line =~ /$Separator/) {
@ -46,7 +67,7 @@ sub get_module_data ($$$$) {
foreach my $key (@{$keys}) {
if ($line =~ /$key:\s+(.+)/) {
$module{$key} = $1;
# Replace semicolon by comma to avoid parse errors
# Replace semicolon by comma to avoid parse errors
$module{$key} =~ s/;/,/g;
}
}
@ -58,12 +79,65 @@ sub get_module_data ($$$$) {
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
sub get_file_system($$) {
my ($name, $modules) = @_;
my @fileSystems = `df -hP | tail -n +2`; #remove the titles of columns
my @fileSystems;
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) {
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{'avail'} = $3;
$module{'mount'} = $4;
$module{'_keys'} = ['filesystem', 'used','avail', 'mount'];
push (@{$modules->{$name}}, \%module);
}
$module{'_keys'} = ['filesystem', 'used','avail', 'mount'];
push (@{$modules->{$name}}, \%module);
}
}
# Get a list of services init in machine
sub get_servicies_init_machine($$) {
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)
$runlevel =~ s/^\s*//; #ltrim
$runlevel =~ s/\s*$//; #rtrim
#end trim($runlevel)
my $script = "";
my $script;
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 {
$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`;
foreach my $row (@services) {
my %module;
$row =~ s/\n//;
$module{'service'} = $row;
$module{'_keys'} = ['service'];
push (@{$modules->{$name}}, \%module);
$row =~ s/\n//;
$module{'service'} = $row;
$module{'_keys'} = ['service'];
push (@{$modules->{$name}}, \%module);
}
}
# Get a list of running processes
sub get_processes ($$) {
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 %module;
# Remove carriage returns
$row =~ s/[\n\l\f]//g;
# Replace semicolon by comma to avoid parse errors
$row =~ s/;/,/g;
$module{'service'} = $row;
$module{'_keys'} = ['service'];
push (@{$modules->{$name}}, \%module);
}
my @services = `$script`;
foreach my $row (@services) {
my %module;
# Remove carriage returns
$row =~ s/[\n\l\f]//g;
# Replace semicolon by comma to avoid parse errors
$row =~ s/;/,/g;
$module{'service'} = $row;
$module{'_keys'} = ['service'];
push (@{$modules->{$name}}, \%module);
}
}
# Get a list of valid users in the system
sub get_users ($$) {
my ($name, $modules) = @_;
my $script = "cat /etc/passwd";
my ($name, $modules) = @_;
my $script = "cat /etc/passwd";
my $user = "";
my $estado = "";
my @services = `$script`;
foreach my $row (@services) {
my %module;
my @services = `$script`;
foreach my $row (@services) {
my %module;
next unless ($row =~ /^([A-Za-z0-9\-\_]*)/);
$user = $1;
$script = `passwd -S $user`;
if ( $script =~ /^(\S+)\sP./){
$module{'user'} = $user;
$module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module);
next unless ($row =~ /^([A-Za-z0-9\-\_]*)/);
if (is_enabled $AIX) {
$user = $1;
$script = `lsuser $user`;
if ( $script =~ /^(\S+)\sid./){
$module{'user'} = $user;
$module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module);
}
} else {
$user = $1;
$script = `passwd -S $user`;
if ( $script =~ /^(\S+)\sP./){
$module{'user'} = $user;
$module{'_keys'} = ['user'];
push (@{$modules->{$name}}, \%module);
}
}
}
}
# Show Kernel Information
sub get_kernel_info ($$) {
my ($name, $modules) = @_;
my $script = `uname -a | tr -d \";\"`;
my %module;
my ($name, $modules) = @_;
my $script = `uname -a | tr -d \";\"`;
my %module;
$module{'Kernel'} = $script;
$module{'_keys'} = ['Kernel'];
push (@{$modules->{$name}}, \%module);
$module{'Kernel'} = $script;
$module{'_keys'} = ['Kernel'];
push (@{$modules->{$name}}, \%module);
}
@ -171,11 +261,13 @@ sub get_software_module_data ($$) {
# Guess the current distribution
my $distrib_id = "";
if ( -e "/etc/SuSE-release"){
if (is_enabled $AIX) {
$distrib_id = "AIX";
}elsif ( -e "/etc/SuSE-release"){
$distrib_id = "SUSE";
} elsif ( -e "/etc/redhat-release"){
}elsif ( -e "/etc/redhat-release"){
$distrib_id = "REDHAT";
} else {
}else {
$distrib_id = "DEBIAN";
}
@ -183,7 +275,9 @@ sub get_software_module_data ($$) {
my @soft;
if ($distrib_id eq 'DEBIAN') {
@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
@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{'version'} = $2;
$module{'description'} = $3;
# Replace semicolon by comma to avoid parse errors
# Replace semicolon by comma to avoid parse errors
$module{'program'} =~ s/;/,/g;
$module{'version'} =~ s/;/,/g;
$module{'description'} =~ s/;/,/g;
@ -211,67 +305,95 @@ sub get_software_module_data ($$) {
#Get the list of interfaces with the ip assigned
sub get_ips ($$) {
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 $line = $ifconfig_array[$i+1];
$line =~ s/\s+//g;
my @ifconfig_array = split("\n", $ifconfig);
@line_split = split(":", $line);
if($line_split[1] =~ /(\d+\.\d+\.\d+\.\d+).+/) {
$info{'ip'} = $1;
}
$info{'_keys'} = ['interface', 'ip'];
push (@{$modules->{$name}}, \%info);
}
foreach (@ifconfig_array){
if ($_=~/(.*)flags/){
my $match;
($match)=$_=~/^(.*?)\: flags/;
$match=~s/://;
push @interfaces,$match;
}
}
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
sub get_route_table ($$) {
my ($name, $modules) = @_;
my $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);
}
my ($name, $modules) = @_;
my $route_table;
my @table_split;
if (is_enabled $AIX) {
$route_table = `netstat -rn`;
@table_split = split("\n", $route_table);
my $length=scalar @table_split;
for (my $i=4; $i<=$length-4; $i++) {
my @split = split(" ", $table_split[$i]);
my %info;
$info{'destination'} = $split[0];
$info{'gateway'} = $split[1];
$info{'mask'} = $split[2];
$info{'flags'} = $split[3];
$info{'metric'} = $split[4];
$info{'ref'} = $split[5];
$info{'use'} = $split[6];
$info{'interface'} = $split[7];
$info{'_keys'} = ['destination', 'gateway', 'mask', 'flags', 'metric', 'use', 'interface'];
push (@{$modules->{$name}}, \%info);
}
} else {
$route_table = `route`;
my @table_split = split("\n", $route_table);
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
sub print_module ($$) {
@ -309,14 +431,18 @@ my $enable_all = 0;
$interval = $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"){
$enable_all = 1;
}
$enabled{$module} = 1;
$enable_all = 1;
}else {
$enabled{$module} = 1;
}
}
# Check execution interval
@ -333,76 +459,107 @@ close (FILE);
# Retrieve hardware information
$Mode = 'LSHW';
$Separator = '\s+\*\-';
my @hwinfo = `lshw 2>/dev/null`;
if ($? != 0) {
$Mode = 'HWINFO';
$Separator = 'Hardware Class:';
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`;
my @hwinfo;
if (is_enabled $AIX) {
$Separator = '^\s*$';
@hwinfo=`prtconf 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;
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);
# 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
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);
}
}
# RAM
if (($line =~ /\*\-bank/ || $line =~ /\*\-memory/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules);
} else {
get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules);
}
}
# RAM
if (($line =~ /\*\-bank/ || $line =~ /Hardware Class: memory/) && ($enable_all == 1 || $enabled{'ram'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('RAM', \@hwinfo, ['description', 'size'], \%modules);
} else {
get_module_data ('RAM', \@hwinfo, ['Model', 'Memory Size'], \%modules);
}
}
# VIDEO
if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules);
} else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules);
}
}
# VIDEO
if (($line =~ /\*\-display/ || $line =~ /Hardware Class: graphics card/) && ($enable_all == 1 || $enabled{'video'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('VIDEO', \@hwinfo, ['product', 'description', 'vendor'], \%modules);
} else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('VIDEO', \@hwinfo, ['Model', ' Device', ' Vendor'], \%modules);
}
}
# NIC
if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules);
} else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%modules);
}
}
# NIC
if (($line =~ /\*\-network/ || $line =~ /Hardware Class: network/) && ($enable_all == 1 || $enabled{'nic'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('NIC', \@hwinfo, ['product', 'description', 'vendor', 'serial'], \%modules);
} else {
# Spaces before Device and Vendor are intentional to avoid matching SubDevice and SubVendor
get_module_data ('NIC', \@hwinfo, ['Model', ' Device', ' Vendor', 'HW Address'], \%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);
}
}
# 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
if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules);
} else {
get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules);
}
}
# HD
if (($line =~ /\*\-disk/ || $line =~ /Hardware Class: disk/) && ($enable_all == 1 || $enabled{'hd'} == 1)) {
if ($Mode eq 'LSHW') {
get_module_data ('HD', \@hwinfo, ['product', 'description', 'size'], \%modules);
} else {
get_module_data ('HD', \@hwinfo, ['Model', 'Serial ID', 'Size'], \%modules);
}
}
}
}
# Software
if ($enable_all == 1 || $enabled{'software'} == 1) {
get_software_module_data ('Software', \%modules);
@ -410,12 +567,12 @@ if ($enable_all == 1 || $enabled{'software'} == 1) {
#init_services
if ($enable_all == 1 || $enabled{'init_services'} == 1) {
get_servicies_init_machine ('Init services', \%modules);
get_servicies_init_machine ('Init_services', \%modules);
}
#filesystem
if ($enable_all == 1 || $enabled{'filesystem'} == 1) {
get_file_system('File system', \%modules);
get_file_system('Filesystem', \%modules);
}
#processes
@ -442,7 +599,6 @@ if ($enable_all == 1 || $enabled{'route'} == 1) {
if ($enable_all == 1 || $enabled{'kernel'} == 1){
get_kernel_info ('Kernel', \%modules);
}
# Print module data
print "<inventory>\n";
while (my ($name, $module) = each (%modules)) {

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# 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 __rand__
# Agent alias. Name should be unique rather than alias. Hostname by default
# agent_alias $Alias$
#Parent agent_name
#parent_agent_name caprica

View File

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

View File

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

View File

@ -78,6 +78,7 @@ Pandora_Module::Pandora_Module (string name) {
this->warning_inverse = "";
this->quiet = "";
this->module_ff_interval = "";
this->module_ff_type = "";
this->module_alert_template = "";
this->module_crontab = "";
}
@ -733,6 +734,13 @@ Pandora_Module::getXml () {
module_xml += this->module_ff_interval;
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 */
if (this->module_alert_template != "") {
@ -1028,6 +1036,16 @@ Pandora_Module::setModuleFFInterval (string 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.
*

View File

@ -176,6 +176,7 @@ namespace Pandora_Modules {
string unit, custom_id, str_warning, str_critical;
string module_group, warning_inverse, critical_inverse, quiet;
string module_ff_interval, module_alert_template, module_crontab;
string module_ff_type;
string critical_instructions, warning_instructions, unknown_instructions, tags;
protected:
@ -277,6 +278,7 @@ namespace Pandora_Modules {
void setWarningInverse (string value);
void setQuiet (string value);
void setModuleFFInterval (string value);
void setModuleFFType (string value);
void setModuleAlertTemplate (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_QUIET ("module_quiet ")
#define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ")
#define TOKEN_MODULE_FF_TYPE ("module_ff_type ")
#define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#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_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
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;
Pandora_Module *module;
bool numeric;
@ -254,6 +255,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_warning_inverse = "";
module_quiet = "";
module_ff_interval = "";
module_ff_type = "";
module_native_encoding = "";
module_alert_template = "";
module_user_session = "";
@ -507,6 +509,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (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 == "") {
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 != "") {
pos_macro = module_alert_template.find(macro_name);
if (pos_macro != string::npos){
@ -1447,6 +1460,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_ff_interval != "") {
module->setModuleFFInterval (module_ff_interval);
}
if (module_ff_type != "") {
module->setModuleFFType (module_ff_type);
}
if (module_alert_template != "") {
module->setModuleAlertTemplate (module_alert_template);

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#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_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
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"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.733-190328
Version: 7.0NG.734-190507
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -10,5 +10,16 @@
"require": {
"mpdf/mpdf": "^7.1",
"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'
);
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>';
if ($hor_offset > 0) {
@ -421,9 +422,10 @@ function mainAgentsAlerts()
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) {
$new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
@ -455,7 +457,7 @@ function mainAgentsAlerts()
$cellstyle = 'background:'.COL_ALERTFIRED.';';
}
echo '<td style=";'.$cellstyle.'"> ';
echo '<td style=";'.$cellstyle.'" class="action_buttons"> ';
$uniqid = uniqid();
echo '<div>';
@ -478,6 +480,23 @@ function mainAgentsAlerts()
}
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)
{
$table->width = '98%';
$table->class = 'databox';
$table->class = 'info_table';
$table->data = [];
$table->head[0] = __('Module');

View File

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

View File

@ -45,11 +45,9 @@ if (!empty($files)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->style = [];
$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->head = [];
$table->head[0] = __('Name');
@ -81,6 +79,7 @@ if (!empty($files)) {
// Last modification
// Public URL
$data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (!empty($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';
@ -92,7 +91,7 @@ if (!empty($files)) {
}
$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
$data[4] .= '</a>';

View File

@ -66,10 +66,10 @@ function users_extension_main_god($god=true)
$rows = [];
echo "<div class='nf'>".__('No other users connected').'</div>';
} else {
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->size = [];
$table->data = [];
$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)
{
$status_server_log = '';
$size_server_log = number_format(get_logs_size($path));
$size_server_log = get_logs_size($path);
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>";
} else {
@ -157,9 +157,9 @@ function percentage_modules_per_agent()
$total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
$average_modules_per_agent = ($total_modules / $total_agents);
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 {
$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;
@ -202,9 +202,9 @@ function interval_average_of_network_modules()
$average_time = ((int) $total_module_interval_time / $total_network_modules);
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 {
$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) {
@ -274,6 +274,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
}
$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';
$innodb_log_file_size_min_rec_value = '64M';
$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(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(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_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tlocal_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
-- -----------------------------------------------------
-- 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_two_tailed` tinyint(1) unsigned default '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- 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 `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 `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)
@ -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 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 `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`
@ -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 ('small_operation_step_datos_purge', '1000');
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_support_logo', 'default_support.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';
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');
-- ---------------------------------------------------------------------
@ -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 `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 `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`
@ -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_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 `ff_type` tinyint(1) unsigned default '0';
-- ---------------------------------------------------------------------
-- 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 `show_extended_events` tinyint(1) default '0';
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`
@ -2058,3 +2092,14 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di
-- Add column in table `tagent_custom_fields`
-- ----------------------------------------------------------------------
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>';
// 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 .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
$header_docu .= '</a></div>';
@ -591,9 +591,7 @@ if ($config['menu_type'] == 'classic') {
if (fixed_header) {
$('div#head').addClass('fixed_header');
$('div#page')
.css('padding-top', $('div#head').innerHeight() + 'px')
.css('position', 'relative');
$('div#main').css('padding-top', $('div#head').innerHeight() + 'px');
}
check_new_chats_icon('icon_new_messages_chat');

View File

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

View File

@ -4,29 +4,35 @@
<style>
#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;
position:fixed;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
width:650px;
height: 400px;
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{
text-align:center;
width:100%;
height:37px;
left:0px;
background-color:#82b92e;
position:absolute;
top:0;
}
.modalheadertex{
color:white;
position:relative;
color:#000;
font-family:Nunito;
font-size:13pt;
top:8px;
line-height: 40px;
font-size: 23pt;
margin-bottom:30px;
}
.modalclose{
cursor:pointer;
@ -37,50 +43,59 @@
}
.modalconten{
color:black;
background:white;
}
.modalcontentim{
float:left;
margin-left:30px;
margin-top:30px;
margin-bottom:30px;
width:300px;
margin-left: 30px;
}
.modalcontenttex{
float:left;
text-align:justify;
text-align:left;
color:black;
font-size: 9.5pt;
font-size: 11pt;
line-height:13pt;
margin-top:30px;
width:430px;
margin-left:30px;
margin-bottom:30px;
}
.modalokbutto{
cursor:pointer;
text-align:center;
margin-right:45px;
float:right;
display: inline-block;
padding: 6px 45px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin-bottom:30px;
border-radius: 3px;width:90px;height:30px;background-color:white;border: 1px solid #82b92e;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalokbuttontex{
color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
color:#82b92e;
font-family:Nunito;
font-size:13pt;
}
.modalgobutto{
cursor:pointer;text-align:center;margin-right:15px;margin-bottom:30px;float:right;-moz-border-radius: 3px;
-webkit-border-radius: 3px;border-radius: 3px;width:240px;height:30px;background-color:white;border: 1px solid #82b92e;
cursor:pointer;
text-align:center;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color:white;
border: 1px solid #82b92e;
}
.modalgobuttontex{
color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
color:#82b92e;
font-family:Nunito;
font-size:10pt;
}
#opacida{
position:absolute;background:black;opacity:0.6;z-index:-1;left:0px;top:0px;width:100%;height:100%;
#opacidad{
position:fixed;
background:black;
opacity:0.6;
z-index:-1;
left:0px;
top:0px;
width:100%;
height:100%;
}
/*
.textodialog{
margin-left: 0px;
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{
font-size:18pt;
font-size:18pt;
}
*/
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
<span class='modalheadertex'>
<?php echo __("You don't have access to this page"); ?>
</span>
<img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/icono_cerrar.png'>
<div id="alert_messages_na">
<div class='modalheade'>
<img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/input_cross.png'>
</div>
<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 class='modalconten'>
<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>
<div id="opacidad"></div>
</body>
</html>
<script>
$(".cerrar").click(function(){
window.location=".";
});
$(".cerrar").click(function(){
window.location=".";
});
$('div#page').css('background-color','#d3d3d3');
</script>

View File

@ -183,10 +183,10 @@ if (empty($result)) {
}
$table = new stdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->size = [];
$table->data = [];
$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);
ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
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_warning' => $row2['min_ff_event_warning'],
'min_ff_event_critical' => $row2['min_ff_event_critical'],
'ff_type' => $row2['ff_type'],
];
$name = $row2['name'];
@ -224,7 +225,7 @@ if ($result === false) {
$table->width = '100%';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->data = [];
$table->align = [];
@ -252,9 +253,9 @@ foreach ($result as $row) {
$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;';
$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>';
$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] .= '<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);
}

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
enterprise_include('godmode/agentes/configurar_agente.php');
@ -23,10 +23,10 @@ ui_require_javascript_file('encode_decode_base64');
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');
// 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');
$group = 0;
$all_groups = [$group];
@ -46,6 +46,7 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
break;
default:
// Default.
break;
}
@ -63,11 +64,11 @@ require_once 'include/functions_modules.php';
require_once 'include/functions_alerts.php';
require_once 'include/functions_reporting.php';
// Get passed variables
// Get passed variables.
$alerttype = get_parameter('alerttype');
$id_agent_module = (int) get_parameter('id_agent_module');
// Init vars
// Init vars.
$descripcion = '';
$comentarios = '';
$campo_1 = '';
@ -137,7 +138,7 @@ $alert_priority = 0;
$server_name = '';
$grupo = 0;
$id_os = 9;
// Windows
// Windows.
$custom_id = '';
$cascade_protection = 0;
$cascade_protection_modules = 0;
@ -156,23 +157,23 @@ $cps = 0;
$create_agent = (bool) get_parameter('create_agent');
$module_macros = [];
// Create agent
// Create agent.
if ($create_agent) {
$mssg_warning = 0;
$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);
$direccion_agente = (string) get_parameter_post('direccion', '');
$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));
if (!validate_address($direccion_agente)) {
$mssg_warning = 1;
}
// safe-input before validate ip
// Safe-input before validate ip.
$direccion_agente = io_safe_input($direccion_agente);
$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'], '');
}
// Check if agent exists (BUG WC-50518-2)
// Check if agent exists (BUG WC-50518-2).
if ($alias == '') {
$agent_creation_error = __('No agent alias specified');
$agent_created_ok = 0;
@ -256,7 +257,7 @@ if ($create_agent) {
}
if ($id_agente !== false) {
// Create custom fields for this agent
// Create custom fields for this agent.
foreach ($field_values as $key => $value) {
$update_custom = db_process_sql_insert(
'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 != '') {
agents_add_address($id_agente, $direccion_agente);
}
@ -311,7 +312,7 @@ if ($create_agent) {
"Quiet":"'.(int) $quiet.'",
"Cps":"'.(int) $cps.'"}';
// Create the secondary groups
// Create the secondary groups.
enterprise_hook(
'agents_update_secondary_groups',
[
@ -341,14 +342,14 @@ if ($create_agent) {
}
}
// Show tabs
// Show tabs.
$img_style = [
'class' => 'top',
'width' => 16,
];
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>';
if ($tab == 'view') {
@ -359,7 +360,7 @@ if ($id_agente) {
$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>';
if ($tab == 'main') {
$maintab['active'] = true;
@ -367,7 +368,7 @@ if ($id_agente) {
$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>';
if ($tab == 'module') {
@ -376,7 +377,7 @@ if ($id_agente) {
$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>';
if ($tab == 'alert') {
@ -385,7 +386,7 @@ if ($id_agente) {
$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>';
if ($tab == 'template') {
@ -395,7 +396,7 @@ if ($id_agente) {
}
// Inventory
// Inventory.
$inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1) {
@ -412,7 +413,7 @@ if ($id_agente) {
}
if ($has_remote_conf === true) {
// Plugins
// Plugins.
$pluginstab = enterprise_hook('plugins_tab');
if ($pluginstab == -1) {
$pluginstab = '';
@ -421,21 +422,21 @@ if ($id_agente) {
$pluginstab = '';
}
// Collection
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
$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['active'] = false;
$gistab = [];
// GIS tab
// GIS tab.
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>';
@ -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>';
// Hidden subtab layer
// Hidden subtab layer.
$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'] .= '<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);
// Incident tab
// Incident tab.
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>';
@ -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) {
$onheader['incident'] = $incidenttab;
}
@ -545,7 +546,7 @@ if ($id_agente) {
];
}
// Extensions tabs
// Extensions tabs.
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_god_tab'])) {
if (check_acl($config['id_user'], $group, $extension['extension_god_tab']['acl'])) {
@ -574,7 +575,7 @@ if ($id_agente) {
}
$help_header = '';
// This add information to the header
// This add information to the header.
switch ($tab) {
case 'main':
$tab_description = '- '.__('Setup');
@ -639,6 +640,10 @@ if ($id_agente) {
case 'wmi_explorer':
$tab_description = '- '.__('WMI Wizard');
break;
default:
// Default.
break;
}
break;
@ -649,10 +654,15 @@ if ($id_agente) {
$tab_description = '- '.__('SNMP explorer');
$help_header = 'snmp_explorer';
break;
default:
// Default.
break;
}
break;
default:
// Default.
break;
}
@ -668,7 +678,7 @@ if ($id_agente) {
$config['item_title_size_text']
);
} else {
// Create agent
// Create agent.
ui_print_page_header(
__('Agent manager'),
'images/bricks.png',
@ -682,12 +692,12 @@ $delete_conf_file = (bool) get_parameter('delete_conf_file');
if ($delete_conf_file) {
$correct = false;
// Delete remote configuration
// Delete remote configuration.
if (isset($config['remote_config'])) {
$agent_md5 = md5(io_safe_output(agents_get_name($id_agente, 'none')), false);
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';
$correct = @unlink($file_name);
@ -703,7 +713,7 @@ if ($delete_conf_file) {
);
}
// Show agent creation results
// Show agent creation results.
if ($create_agent) {
if (!isset($agent_creation_error)) {
$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'])) {
$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);
// Get average over the year
// Get average over the year.
$media *= 1.3;
$error = '';
$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)) {
$where = [
'datos' => '>'.$media,
@ -759,25 +769,25 @@ if (isset($_GET['fix_module'])) {
$update_agent = (bool) get_parameter('update_agent');
// Update AGENT
// Update AGENT.
if ($update_agent) {
// if modified some agent paramenter
// If modified some agent paramenter.
$mssg_warning = 0;
$id_agente = (int) get_parameter_post('id_agente');
$nombre_agente = str_replace('`', '&lsquo;', (string) get_parameter_post('agente', ''));
$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);
$direccion_agente = (string) get_parameter_post('direccion', '');
$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));
if (!validate_address($direccion_agente)) {
$mssg_warning = 1;
}
// safe-input before validate ip
// Safe-input before validate ip.
$direccion_agente = io_safe_input($direccion_agente);
$address_list = (string) get_parameter_post('address_list', '');
@ -786,10 +796,13 @@ if ($update_agent) {
&& $direccion_agente == 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
// b) field has not changed from current IP
// c) selectbox is not the current IP
/*
* If we selected another IP in the drop down list to be 'primary':
* a) field is not the same as selectbox
* b) field has not changed from current IP
* c) selectbox is not the current IP.
*/
if (!empty($address_list)) {
$direccion_agente = $address_list;
}
@ -799,7 +812,7 @@ if ($update_agent) {
$intervalo = (int) get_parameter_post('intervalo', SECONDS_5MINUTES);
$comentarios = str_replace('`', '&lsquo;', (string) get_parameter_post('comentarios', ''));
$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');
$disabled = (bool) get_parameter_post('disabled');
$server_name = (string) get_parameter_post('server_name', '');
@ -837,7 +850,7 @@ if ($update_agent) {
);
if ($old_value === false) {
// Create custom field if not exist
// Create custom field if not exist.
$update_custom = db_process_sql_insert(
'tagent_custom_data',
[
@ -866,10 +879,10 @@ if ($update_agent) {
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 == '') {
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 != '') {
@ -882,7 +895,7 @@ if ($update_agent) {
} else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address'));
} else {
// If different IP is specified than previous, add the IP
// If different IP is specified than previous, add the IP.
if ($direccion_agente != ''
&& $direccion_agente != agents_get_address($id_agente)
) {
@ -890,7 +903,7 @@ if ($update_agent) {
}
$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) {
$delete_ip = get_parameter_post('address_list');
@ -939,11 +952,11 @@ if ($update_agent) {
__('There was a problem updating the agent')
);
} else {
// Update the agent from the metaconsole cache
// Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php');
enterprise_hook('agent_update_from_cache', [$id_agente, $values, $server_name]);
// Update the configuration files
// Update the configuration files.
if ($old_values['intervalo'] != $intervalo) {
enterprise_hook(
'config_agents_update_config_token',
@ -1057,9 +1070,9 @@ if ($update_agent) {
}
// 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) {
// 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);
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');
@ -1069,13 +1082,13 @@ if ($id_agente) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
if (empty($agent)) {
// Close out the page
// Close out the page.
ui_print_error_message(__('There was a problem loading the agent'));
return;
}
$intervalo = $agent['intervalo'];
// Define interval in seconds
// Define interval in seconds.
$nombre_agente = $agent['nombre'];
if (empty($alias)) {
$alias = $agent['alias'];
@ -1111,11 +1124,11 @@ $create_module = (bool) get_parameter('create_module');
$delete_module = (bool) get_parameter('delete_module');
$enable_module = (int) get_parameter('enable_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');
$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) {
$id_grupo = agents_get_agent_group($id_agente);
$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');
$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:
// 1.23E-10 is 0.000000000123
/*
* 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:
* 1.23E-10 is 0.000000000123.
*/
$post_process = (string) get_parameter('post_process', 0.0);
if (get_parameter('prediction_module')) {
$prediction_module = 1;
@ -1160,7 +1176,7 @@ if ($update_module || $create_module) {
$tcp_send = (string) get_parameter('tcp_send');
$tcp_rcv = (string) get_parameter('tcp_rcv');
$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', '');
if ($is_port_empty === '') {
$tcp_port = null;
@ -1186,7 +1202,7 @@ if ($update_module || $create_module) {
}
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_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
} else {
@ -1198,7 +1214,7 @@ if ($update_module || $create_module) {
$custom_string_3 = (string) get_parameter('custom_string_3', $custom_string_3_default);
$custom_integer_2 = (int) get_parameter('custom_integer_2', 0);
// Get macros
// Get macros.
$macros = (string) get_parameter('macros');
if (!empty($macros)) {
@ -1225,7 +1241,8 @@ if ($update_module || $create_module) {
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
$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)) {
$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);
}
/*
$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(
'\\',
'&#92;',
@ -1269,16 +1278,16 @@ if ($update_module || $create_module) {
$snmp_community = (string) get_parameter('snmp_community');
$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);
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');
}
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');
$plugin_user = (string) get_parameter('snmp3_auth_user');
$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_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff');
$ff_timeout = (int) get_parameter('ff_timeout');
$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_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');
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
if ((!$module_in_policy && !$module_linked )
|| ( $module_in_policy && !$module_linked )
if ((!$module_in_policy && !$module_linked && $update_module)
|| ( $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(
'config_agents_write_module_in_conf',
[
@ -1430,7 +1450,7 @@ if ($update_module || $create_module) {
}
}
// MODULE UPDATE
// MODULE UPDATE.
if ($update_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_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout,
'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');
if ($module_kind == MODULE_DATA) {
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);
ui_print_success_message(__('Module successfully updated'));
@ -1603,8 +1624,7 @@ if ($update_module) {
}
}
// MODULE INSERT
// =================
// MODULE INSERT.
if ($create_module) {
if (isset($_POST['combo_snmp_oid'])) {
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
@ -1628,6 +1648,10 @@ if ($create_module) {
$description = ' ';
}
break;
default:
// Default.
break;
}
$values = [
@ -1677,6 +1701,7 @@ if ($create_module) {
'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff,
'ff_timeout' => $ff_timeout,
'unit' => io_safe_output($unit),
@ -1752,7 +1777,7 @@ if ($create_module) {
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);
ui_print_success_message(__('Module added successfully'));
@ -1773,7 +1798,7 @@ if ($create_module) {
}
// MODULE DELETION
// =================
// =================.
if ($delete_module) {
// DELETE agent module !
$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_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;
// First delete from tagente_modulo -> if not successful, increment
@ -1828,7 +1853,7 @@ if ($delete_module) {
if ($result === false) {
$error++;
} else {
// Set flag to update module status count
// Set flag to update module status count.
db_process_sql(
'UPDATE tagente
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)
// 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]);
$result_ops_synthetic = json_decode($ops_json);
if (!empty($result_ops_synthetic)) {
@ -1878,18 +1903,17 @@ if ($delete_module) {
if ($result === false) {
$error++;
}
} //end if
else {
} else {
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_borrar_modulo]);
$count_components = 1;
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);
$last_target_module = 0;
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)
or ($last_target_module != $id_target_module)
|| ($last_target_module != $id_target_module)
) {
$update_orders = true;
} else {
@ -1908,7 +1932,7 @@ if ($delete_module) {
}
}
// Check for errors
// Check for errors.
if ($error != 0) {
ui_print_error_message(__('There was a problem deleting the module'));
} else {
@ -1926,7 +1950,7 @@ if ($delete_module) {
}
// MODULE DUPLICATION
// ==================
// ==================.
if (!empty($duplicate_module)) {
// DUPLICATE agent module !
$id_duplicate_module = $duplicate_module;
@ -1973,7 +1997,7 @@ if (!empty($duplicate_module)) {
}
// MODULE ENABLE/DISABLE
// =====================
// =====================.
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$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
// ==========
// ==========.
$updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data');
@ -2101,9 +2125,8 @@ switch ($tab) {
break;
case 'alert':
/*
Because $id_agente is set, it will show only agent alerts */
// This var is for not display create button on alert list
// Because $id_agente is set, it will show only agent alerts.
// This var is for not display create button on alert list.
$dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php';
break;
@ -2152,7 +2175,7 @@ switch ($tab) {
default:
if (enterprise_hook('switch_agent_tab', [$tab])) {
// 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'));
}
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->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
if ($fields) {
$table->head = [];
$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;']);
}
$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] .= '&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);
}
if ($fields) {
ui_pagination($count_fields, false, $offset);
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">';

View File

@ -224,13 +224,13 @@ switch ($config['dbtype']) {
break;
}
$selected = 'border: 1px solid black;';
$selectNameUp = '';
$selectNameDown = '';
$selectOsUp = '';
$selectOsDown = '';
$selectGroupUp = '';
$selectGroupDown = '';
$selected = true;
$selectNameUp = false;
$selectNameDown = false;
$selectOsUp = false;
$selectOsDown = false;
$selectGroupUp = false;
$selectGroupDown = false;
switch ($sortField) {
case 'remote':
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);
if ($agents !== false) {
echo "<table cellpadding='4' id='agent_list' cellspacing='4' width='100%' class='databox data'>";
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>';
echo '</th>';
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>';
echo '</th>';
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>';
echo '</th>';
// Urls to sort the table.
$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';
$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';
$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';
$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';
$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';
$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>'.__('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>';
echo '<th>'.__('Group').ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown).'</th>';
echo '<th>'.__('Description').'</th>';
echo "<th style='text-align:left'>".__('Actions').'</th>';
echo '</tr></thead>';
$color = 1;
$rowPair = true;
@ -628,7 +637,7 @@ if ($agents !== false) {
$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']) {
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
@ -654,7 +663,7 @@ if ($agents !== false) {
}
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'";
if ($agent['id_os'] != 100) {
@ -670,7 +679,7 @@ if ($agents !== false) {
}
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'>";
} else {
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
// ==================
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente;
$selectNameUp = '';
$selectNameDown = '';
$selectServerUp = '';
$selectServerDown = '';
$selectTypeUp = '';
$selectTypeDown = '';
$selectIntervalUp = '';
$selectIntervalDown = '';
$selectNameUp = false;
$selectNameDown = false;
$selectServerUp = false;
$selectServerDown = false;
$selectTypeUp = false;
$selectTypeDown = false;
$selectIntervalUp = false;
$selectIntervalDown = false;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = '';
$selected = true;
$order[] = [
'field' => 'tmodule_group.name',
@ -482,13 +482,13 @@ switch ($sortField) {
default:
$selectNameUp = $selected;
$selectNameDown = '';
$selectServerUp = '';
$selectServerDown = '';
$selectTypeUp = '';
$selectTypeDown = '';
$selectIntervalUp = '';
$selectIntervalDown = '';
$selectNameDown = false;
$selectServerUp = false;
$selectServerDown = false;
$selectTypeUp = false;
$selectTypeDown = false;
$selectIntervalUp = false;
$selectIntervalDown = false;
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
@ -626,32 +626,39 @@ if ($paginate_module) {
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->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$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
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
$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[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[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[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown);
$table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown);
$table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown);
$table->head[5] = __('Description');
$table->head[6] = __('Status');
$table->head[7] = __('Warn');
$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->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = [];
$table->size['checkbox'] = '20px';
$table->size[2] = '70px';
$table->align = [];
$table->align[2] = 'left';
@ -706,15 +713,19 @@ foreach ($modules as $module) {
$table->rowstyle[($i - 1)] = 'text-align: center';
$table->rowclass[($i - 1)] = 'datos3';
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->colspan[($i - 1)][0] = 10;
$table->colspan[($i - 1)][0] = 11;
} else {
$table->colspan[($i - 1)][0] = 9;
$table->colspan[($i - 1)][0] = 10;
}
$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] = '';
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) {
$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;">';
$data[8] .= html_print_image(
'images/copy.png',
@ -870,7 +881,7 @@ foreach ($modules as $module) {
// Make a data normalization
if (isset($numericModules[$type])) {
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(
'images/chart_curve.png',
true,
@ -879,18 +890,19 @@ foreach ($modules as $module) {
$data[8] .= '</a>';
}
} else {
$data[8] .= '&nbsp;'.html_print_image(
$data[8] .= html_print_image(
'images/chart_curve.disabled.png',
true,
['title' => __('Normalize (Disabled)')]
);
$data[8] .= '&nbsp;&nbsp;';
}
// create network component action
if ((is_user_admin($config['id_user']))
&& ($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;">';
$data[8] .= html_print_image(
'images/network.png',
@ -899,11 +911,12 @@ foreach ($modules as $module) {
);
$data[8] .= '</a> ';
} else {
$data[8] .= '&nbsp;'.html_print_image(
$data[8] .= html_print_image(
'images/network.disabled.png',
true,
['title' => __('Create network component (Disabled)')]
);
$data[8] .= '&nbsp;&nbsp;';
}
}
@ -917,10 +930,17 @@ foreach ($modules as $module) {
['title' => __('Delete')]
);
$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);
$table->cellclass[] = [
8 => 'action_buttons',
9 => 'action_buttons',
];
}
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_warning = $module['min_ff_event_warning'];
$ff_event_critical = $module['min_ff_event_critical'];
$ff_type = $module['ff_type'];
$each_ff = $module['each_ff'];
$ff_timeout = $module['ff_timeout'];
// Select tag info.
@ -393,6 +394,7 @@ if ($id_agent_module) {
$ff_event_normal = '';
$ff_event_warning = '';
$ff_event_critical = '';
$ff_type = 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] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
// FF stands for Flip-flop
$table_simple->data[6][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true);
// FF stands for Flip-flop.
$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(
'ff_event',
$ff_event,
@ -512,7 +530,16 @@ $table_simple->data[6][1] .= html_print_input_text(
'',
$classdisabledBecauseInPolicy
).'<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] .= html_print_input_text(
'ff_event_normal',
@ -526,6 +553,7 @@ $table_simple->data[6][1] .= html_print_input_text(
'',
$classdisabledBecauseInPolicy
).' ';
$table_simple->data[6][1] .= __('To warning');
$table_simple->data[6][1] .= html_print_input_text(
'ff_event_warning',
@ -539,6 +567,7 @@ $table_simple->data[6][1] .= html_print_input_text(
'',
$classdisabledBecauseInPolicy
).' ';
$table_simple->data[6][1] .= __('To critical');
$table_simple->data[6][1] .= html_print_input_text(
'ff_event_critical',
@ -552,16 +581,31 @@ $table_simple->data[6][1] .= html_print_input_text(
'',
$classdisabledBecauseInPolicy
);
$table_simple->data[7][0] = __('Historical data');
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
$table_simple->data[7][1] = html_print_checkbox('history_data_fake', 1, $history_data, true, $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.
$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.'">';
} 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->id = 'advanced';
$table_advanced->width = '100%';

View File

@ -393,7 +393,7 @@ else {
// View available downtimes present in database (if any of them)
$table = new StdClass();
$table->class = 'databox data';
$table->class = 'info_table';
$table->width = '100%';
$table->cellstyle = [];
@ -518,9 +518,9 @@ else {
}
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 '<br>';
// CSV export button
echo '<div style="display: inline;">';
html_print_button(

View File

@ -221,7 +221,7 @@ if ($delete_action) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->data = [];
$table->head = [];
$table->head[0] = __('Name');
@ -281,6 +281,10 @@ foreach ($actions as $action) {
}
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.'"
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.'"

View File

@ -388,7 +388,7 @@ if ($copy_command) {
}
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->data = [];
$table->head = [];
@ -431,6 +431,7 @@ foreach ($commands as $command) {
io_safe_output($command['description'])
);
$data['action'] = '';
$table->cellclass[]['action'] = 'action_buttons';
if (! $command['internal']) {
$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.'"

View File

@ -226,17 +226,18 @@ $order = null;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$selected = true;
// 'border: 1px solid black;';
$selectDisabledUp = '';
$selectDisabledDown = '';
$selectStandbyUp = '';
$selectStandbyDown = '';
$selectAgentUp = '';
$selectAgentDown = '';
$selectModuleUp = '';
$selectModuleDown = '';
$selectTemplateUp = '';
$selectTemplateDown = '';
$selectAgentUp = false;
$selectAgentDown = false;
$selectModuleUp = false;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
switch ($sortField) {
case 'disabled':
@ -346,11 +347,11 @@ switch ($sortField) {
$selectStandbyUp = '';
$selectStandbyDown = '';
$selectAgentUp = $selected;
$selectAgentDown = '';
$selectModuleUp = '';
$selectModuleDown = '';
$selectTemplateUp = '';
$selectTemplateDown = '';
$selectAgentDown = false;
$selectModuleUp = false;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$order = [
'field' => 'agent_name',
'order' => 'ASC',
@ -360,12 +361,12 @@ switch ($sortField) {
$selectDisabledDown = '';
$selectStandbyUp = '';
$selectStandbyDown = '';
$selectAgentUp = '';
$selectAgentDown = '';
$selectAgentUp = false;
$selectAgentDown = false;
$selectModuleUp = $selected;
$selectModuleDown = '';
$selectTemplateUp = '';
$selectTemplateDown = '';
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$order = [
'field' => 'agent_module_name',
'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;
}
// 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();
if (is_metaconsole()) {
$table->class = 'alert_list databox';
} else {
$table->class = 'databox data';
$table->class = 'info_table';
}
$table->width = '100%';
@ -427,7 +437,7 @@ $table->head = [];
if (! $id_agente) {
$table->style = [];
$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[1] = '8%';
$table->size[2] = '8%';
@ -439,7 +449,7 @@ if (! $id_agente) {
$table->size[4] = '8%';
}*/
} 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
$table->size[0] = '0%';
$table->size[1] = '10%';
@ -452,7 +462,7 @@ if (! $id_agente) {
$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[3] = __('Status');
$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);
$table->cellclass[] = [
3 => 'action_buttons',
4 => 'action_buttons',
];
$data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">';
if ($alert['disabled']) {
$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
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']) {
$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);
@ -771,7 +785,7 @@ foreach ($simple_alerts as $alert) {
// To manage alert is necessary LW permissions in the agent group
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');
if (!$is_cluster) {
if ($alert['disabled']) {
@ -815,6 +829,11 @@ foreach ($simple_alerts as $alert) {
if (isset($data)) {
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 {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]);
}

View File

@ -339,7 +339,7 @@ if ($templates === false) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->data = [];
$table->head = [];
$table->head[0] = __('Name');
@ -375,6 +375,7 @@ foreach ($templates as $template) {
$data[3] = alerts_get_alert_templates_type_name($template['type']);
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] .= html_print_input_hidden('duplicate_template', 1, 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);
if (isset($data)) {
html_print_table($table);
ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else {
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
$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
$rowPair = true;
@ -94,7 +100,7 @@ if (!empty($result)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->data = [];
$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>';
} 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[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>';
}
@ -131,6 +138,7 @@ if (!empty($result)) {
}
html_print_table($table);
ui_pagination($total_categories, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else {
// No categories available or selected
ui_print_info_message(['no_close' => true, 'message' => __('No categories found') ]);

View File

@ -113,31 +113,33 @@ if ($filters === false) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Group');
$table->head[2] = __('Event type');
$table->head[3] = __('Event status');
$table->head[4] = __('Severity');
$table->head[5] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[1] = __('Name');
$table->head[2] = __('Group');
$table->head[3] = __('Event type');
$table->head[4] = __('Event status');
$table->head[5] = __('Severity');
$table->head[6] = __('Action');
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
$table->align = [];
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->align[3] = 'left';
$table->align[4] = 'left';
$table->align[5] = 'left';
$table->align[6] = 'left';
$table->size = [];
$table->size[0] = '50%';
$table->size[1] = '5px';
$table->size[2] = '80px';
$table->size[0] = '20px';
$table->size[1] = '50%';
$table->size[2] = '5px';
$table->size[3] = '80px';
$table->size[4] = '80px';
$table->size[5] = '40px';
$table->size[5] = '80px';
$table->size[6] = '40px';
$table->data = [];
$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) {
$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[1] = ui_print_group_icon($filter['id_group_filter'], true);
$data[2] = events_get_event_types($filter['event_type']);
$data[3] = events_get_status($filter['status']);
$data[4] = events_get_severity_types($filter['severity']);
$data[5] = "<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>'.html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true);
$data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', 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] = ui_print_group_icon($filter['id_group_filter'], true);
$data[3] = events_get_event_types($filter['event_type']);
$data[4] = events_get_status($filter['status']);
$data[5] = events_get_severity_types($filter['severity']);
$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);
}
@ -188,8 +191,6 @@ echo '</div>';
?>
<script type="text/javascript">
$("input[name=all_delete]").css("margin-left", "32px");
$( document ).ready(function() {

View File

@ -36,7 +36,9 @@ if (empty($event_responses)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = [];
$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[1] = $response['description'];
$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] .= '&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;
}

View File

@ -149,7 +149,7 @@ $table->head[] = __('Operation');
$table->width[] = '30%';
*/
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->align = [];
$table->align[] = 'left';
@ -254,6 +254,7 @@ foreach ($extensions as $file => $extension) {
// Avoid to delete or disabled update_manager
if ($file != 'update_manager.php') {
$table->cellclass[][10] = 'action_buttons';
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>';
} else {

View File

@ -515,7 +515,7 @@ if ($tab == 'tree') {
$table = new StdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('ID');
$table->head[1] = __('Name');
@ -559,6 +559,7 @@ if ($tab == 'tree') {
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
$table->data[$key][4] = $group['parent_name'];
$table->data[$key][5] = $group['description'];
$table->cellclass[$key][6] = 'action_buttons';
$table->data[$key][6] = "<a href='$url'>".html_print_image(
'images/config.png',
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;
}
$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',
true,
[
@ -592,7 +593,7 @@ if ($tab == 'tree') {
$block_size,
true,
'offset',
false
true
);
html_print_table($table);
echo ui_pagination(
@ -602,7 +603,8 @@ if ($tab == 'tree') {
$block_size,
true,
'offset',
true
true,
'pagination-bottom'
);
} else {
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');
$url = ui_get_url_refresh(['offset' => false]);
$offset = (int) get_parameter('offset', 0);
ui_pagination($total_groups, $url, $offset);
$sql = 'SELECT *
FROM tmodule_group
@ -230,7 +227,7 @@ $groups = db_get_all_rows_sql($sql);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
if (!empty($groups)) {
$table->head = [];
@ -251,13 +248,16 @@ if (!empty($groups)) {
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>';
} 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>';
}
array_push($table->data, $data);
}
ui_pagination($total_groups, $url, $offset);
html_print_table($table);
ui_pagination($total_groups, $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else {
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);
// FF stands for Flip-flop
$table->data['edit7'][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true);
// FF stands for Flip-flop.
$table->data['edit7'][0] = __('FF threshold').' ';
$table->data['edit7'][0] .= ui_print_help_icon(
'ff_threshold',
true
);
$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] .= __('All state changing').' : '.html_print_input_text('min_ff_event', '', '', 5, 15, true).'<br />';
$table->data['edit7'][1] = __('Mode').' ';
$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] .= __('To normal').html_print_input_text('min_ff_event_normal', '', '', 5, 15, true).' ';
$table->data['edit7'][1] .= __('To warning').html_print_input_text('min_ff_event_warning', '', '', 5, 15, true).' ';
$table->data['edit7'][1] .= __('To critical').html_print_input_text('min_ff_event_critical', '', '', 5, 15, true).' ';
$table->data['edit7'][1] .= __('To normal').' ';
$table->data['edit7'][1] .= html_print_input_text(
'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'][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'][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'][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];
}
// List of fields which can be updated
// List of fields which can be updated.
$fields = [
'dynamic_interval',
'dynamic_max',
@ -1730,6 +1832,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
'min_ff_event_normal',
'min_ff_event_warning',
'min_ff_event_critical',
'ff_type',
'each_ff',
'module_ff_interval',
'ff_timeout',

View File

@ -219,17 +219,19 @@ $groups = component_groups_get_groups_tree_recursive($groups_clean, 0, 0);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$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[0] = 'font-weight: bold';
$table->align = [];
$table->align[1] = 'left';
$table->size = [];
$table->size[0] = '80%';
$table->size[1] = '10%';
$table->size['checkbox'] = '20px';
// $table->size[0] = '80%';
$table->size[1] = '60px';
$table->data = [];
$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) {
$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']);
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>';
@ -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>';
}
$table->cellclass[][1] = 'action_buttons';
$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);
}

View File

@ -124,6 +124,7 @@ $pure = get_parameter('pure', 0);
$ff_event_normal = (int) get_parameter('ff_event_normal');
$ff_event_warning = (int) get_parameter('ff_event_warning');
$ff_event_critical = (int) get_parameter('ff_event_critical');
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff');
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_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff,
]
);
@ -355,6 +357,7 @@ if ($update_component) {
'min_ff_event_normal' => $ff_event_normal,
'min_ff_event_warning' => $ff_event_warning,
'min_ff_event_critical' => $ff_event_critical,
'ff_type' => $ff_type,
'each_ff' => $each_ff,
]
);
@ -496,6 +499,7 @@ $url = ui_get_url_refresh(
'ff_event_warning' => false,
'ff_event_critical' => false,
'each_ff' => false,
'ff_type' => false,
]
);
@ -634,14 +638,16 @@ unset($table);
$table->width = '100%';
$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[1] = __('Type');
$table->head[3] = __('Description');
$table->head[4] = __('Group');
$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['checkbox'] = '20px';
$table->size[1] = '75px';
$table->size[6] = '80px';
$table->align[6] = 'left';
@ -654,6 +660,8 @@ foreach ($components as $component) {
$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] .= io_safe_output($component['name']);
$data[0] .= '</a>';
@ -688,8 +696,9 @@ foreach ($components as $component) {
$data[4] = network_components_get_group_name($component['id_group']);
$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 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);
}
@ -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."'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
ui_pagination($total_components, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right; margin-left: 5px;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';

View File

@ -76,6 +76,7 @@ if ($create_network_from_module) {
$ff_event_normal = $data_module['min_ff_event_normal'];
$ff_event_warning = $data_module['min_ff_event_warning'];
$ff_event_critical = $data_module['min_ff_event_critical'];
$ff_type = $data_module['ff_type'];
$each_ff = $data_module['each_ff'];
}
@ -134,6 +135,7 @@ if (isset($id)) {
$ff_event_normal = $component['min_ff_event_normal'];
$ff_event_warning = $component['min_ff_event_warning'];
$ff_event_critical = $component['min_ff_event_critical'];
$ff_type = $component['ff_type'];
$each_ff = $component['each_ff'];
if ($type >= 15 && $type <= 18) {
@ -192,6 +194,7 @@ if (isset($id)) {
$ff_event_normal = 0;
$ff_event_warning = 0;
$ff_event_critical = 0;
$ff_type = 0;
$each_ff = 0;
$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->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(
'ff_event',
$ff_event,
@ -242,13 +258,40 @@ $table->data[6][1] .= html_print_input_text(
15,
true
).'<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] .= 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] .= 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] .= 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][1] = html_print_checkbox('history_data', 1, $history_data, true);

View File

@ -189,7 +189,20 @@ if ($export_profile) {
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) {
$result = [];
}
@ -197,26 +210,31 @@ if ($result === false) {
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Name');
$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[0] = 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[1] = '65%';
$table->size[2] = '15%';
$table->size[0] = '20px';
$table->size[2] = '65%';
$table->size[3] = '15%';
$table->align = [];
$table->align[2] = 'left';
$table->align[3] = 'left';
$table->data = [];
foreach ($result as $row) {
$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[1] = ui_print_truncate_text(io_safe_output($row['description']), 'description', true, true, true, '[&hellip;]');
$data[2] = html_print_input_image(
$data[0] = html_print_checkbox_extended('delete_multiple[]', $row['id_np'], false, false, '', 'class="check_delete"', true);
$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] = 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',
'images/cross.png',
$row['id_np'],
@ -224,7 +242,7 @@ foreach ($result as $row) {
true,
['onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;']
);
$data[2] .= html_print_input_image(
$data[3] .= html_print_input_image(
'export_profile',
'images/csv.png',
$row['id_np'],
@ -232,8 +250,8 @@ foreach ($result as $row) {
true,
['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[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'.'&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'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV')]).'</a>';
array_push($table->data, $data);
}
@ -241,7 +259,9 @@ foreach ($result as $row) {
if (!empty($table->data)) {
echo '<form method="post" action="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates">';
html_print_input_hidden('multiple_delete', 1);
ui_pagination($count_network_templates, false, $offset);
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; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
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>'.__('ID').'</th>';
echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Description').'</th>';
echo '</thead';
$rows = db_get_all_rows_sql('SELECT * FROM ttipo_modulo ORDER BY nombre');
if ($rows === false) {

View File

@ -133,20 +133,22 @@ if ($filters === false) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Group');
$table->head[2] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[1] = __('Name');
$table->head[2] = __('Group');
$table->head[3] = __('Action');
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
$table->align = [];
$table->size = [];
$table->size[0] = '60%';
$table->size[1] = '30%';
$table->size[2] = '80px';
$table->size[0] = '10px';
$table->size[1] = '60%';
$table->size[2] = '30%';
$table->size[3] = '80px';
$table->data = [];
$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) {
$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[1] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE'));
$data[2] = "<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>'.html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
$data[0] = html_print_checkbox_extended('delete_multiple[]', $filter['id_sg'], false, false, '', 'class="check_delete"', true);
$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] = ui_print_group_icon($filter['id_group'], true, 'groups_small', '', !defined('METACONSOLE'));
$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);
}

View File

@ -159,9 +159,17 @@ ui_pagination(count($graphs));
if (!empty($graphs)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->align = [];
$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[1] = __('Description');
$table->head[2] = __('Number of Graphs');
@ -175,7 +183,7 @@ if (!empty($graphs)) {
if ($report_w || $report_m) {
$op_column = true;
$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';
}
@ -186,6 +194,10 @@ if (!empty($graphs)) {
foreach ($result_graphs as $graph) {
$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[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[4] = '';
$table->cellclass[][4] = 'action_buttons';
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] .= '&nbsp;';
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?').'\'))
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);
@ -213,6 +224,7 @@ if (!empty($graphs)) {
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
@ -228,7 +240,6 @@ if (!empty($graphs)) {
}
echo '</div>';
ui_pagination(count($graphs));
} else {
include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
}
@ -237,8 +248,6 @@ if (!empty($graphs)) {
<script type="text/javascript">
$("input[name=all_delete]").css("margin-left", "32px");
$( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){

View File

@ -327,7 +327,9 @@ echo '</tr></table>';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->data = [];
$table->head = [];
$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
if ($vconsoles_write || $vconsoles_manage) {
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[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 {
@ -462,6 +468,7 @@ if (!$maps && !is_metaconsole()) {
}
html_print_table($table);
ui_pagination($total_maps, $url, $offset, $pagination, false, 'offset', true, 'pagination-bottom');
}
if ($maps) {

View File

@ -119,6 +119,20 @@ $visual_format = 0;
// Others
$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) {
case 'new':
$actionParameter = 'save';
@ -501,6 +515,18 @@ switch ($action) {
$sunday = $item['sunday'];
$time_from = $item['time_from'];
$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;
case 'group_report':
@ -1597,20 +1623,6 @@ $class = 'databox filters';
REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK'),
];
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>
</tr>
@ -1620,6 +1632,65 @@ $class = 'databox filters';
<td><?php html_print_select($show_graph_options, 'combo_graph_options', $show_graph); ?></td>
</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">
<td style="font-weight:bold;">
@ -1629,7 +1700,7 @@ $class = 'databox filters';
</td>
<td>
<?php
html_print_checkbox(
html_print_checkbox_switch(
'checkbox_show_address_agent',
1,
$show_address_agent
@ -1637,12 +1708,13 @@ $class = 'databox filters';
?>
</td>
</tr>
<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>
<?php
html_print_checkbox(
html_print_checkbox_switch(
'checkbox_show_resume',
1,
$show_resume
@ -1650,6 +1722,78 @@ $class = 'databox filters';
?>
</td>
</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">
<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_status").hide();
$("#row_source").hide();
$('#row_select_fields').hide();
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
// SLA list default state
$("#sla_list").hide();
@ -3547,6 +3705,15 @@ function chooseType() {
$("#row_show_resume").show();
$("#row_working_time").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();
break;

View File

@ -330,6 +330,12 @@ if ($items) {
if (defined('METACONSOLE')) {
$table->width = '100%';
$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 = [];
@ -342,18 +348,18 @@ if ($items) {
$table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';
$table->head[1] = __('Type');
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');
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');
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');
@ -493,6 +499,7 @@ foreach ($items as $item) {
$row[6] = '';
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] .= '&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>';

View File

@ -70,7 +70,7 @@ global $config;
// 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
// entry point: enterprise/meta/index.php than normal console !!!
// Login check
// Login check.
check_login();
enterprise_hook('open_meta_frame');
@ -89,7 +89,7 @@ if (!$report_r && !$report_w && !$report_m) {
require_once $config['homedir'].'/include/functions_reports.php';
// Load enterprise extensions
// Load enterprise extensions.
enterprise_include('operation/reporting/custom_reporting.php');
enterprise_include_once('include/functions_metaconsole.php');
@ -98,7 +98,7 @@ if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NO
$enterpriseEnable = true;
}
// Constant with fonts directory
// Constant with fonts directory.
define('_MPDF_TTFONTPATH', 'include/fonts/');
$activeTab = get_parameter('tab', 'main');
@ -117,10 +117,10 @@ if ($schedule_report != '') {
$date = date(DATE_FORMAT);
$time = date(TIME_FORMAT);
$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[2] = get_parameter('schedule_subject', '');
$parameters[3] = get_parameter('schedule_email', '');
$parameters[4] = get_parameter('report_type', '');
$parameters['first_execution'] = strtotime($date.' '.$time);
$values = [
@ -141,7 +141,7 @@ if ($schedule_report != '') {
echo '<br>';
}
// Other Checks for the edit the reports
// Other Checks for the edit the reports.
if ($idReport != 0) {
$report = db_get_row_filter('treport', ['id_report' => $idReport]);
$type_access_selected = reports_get_type_access($report);
@ -162,6 +162,10 @@ if ($idReport != 0) {
$edit = true;
}
break;
default:
// Default.
break;
}
if (! $edit) {
@ -227,6 +231,10 @@ switch ($action) {
ORDER BY "order"'
);
break;
default:
// Default.
break;
}
if ($items === false) {
@ -234,7 +242,7 @@ switch ($action) {
}
// Clean the repeated order values
// Clean the repeated order values.
$order_temp = 1;
foreach ($items as $item) {
switch ($config['dbtype']) {
@ -254,6 +262,10 @@ switch ($action) {
['id_rc' => $item['id_rc']]
);
break;
default:
// Default.
break;
}
$order_temp++;
@ -281,6 +293,10 @@ switch ($action) {
ORDER BY "order"'
);
break;
default:
// Default.
break;
}
if ($items === false) {
@ -293,7 +309,7 @@ switch ($action) {
$temp = [];
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) {
$temp[$item['order']] = $item['id_rc'];
}
@ -344,6 +360,10 @@ switch ($action) {
['id_rc' => $id]
);
break;
default:
// Default.
break;
}
}
@ -415,6 +435,10 @@ switch ($action) {
}
}
break;
default:
// Default.
break;
}
}
break;
@ -444,9 +468,9 @@ switch ($action) {
break;
}
// Page header for metaconsole
if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs
// Page header for metaconsole.
if ($enterpriseEnable && defined('METACONSOLE')) {
// Bread crumbs.
ui_meta_add_breadcrumb(
[
'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);
// Print header
// Print header.
ui_meta_print_header(__('Reporting'), '', $buttons);
}
// Page header for normal console
// Page header for normal console.
else {
ui_print_page_header(__('Custom reporting'), 'images/op_reporting.png', false, '', false, $buttons, false, '', 60);
}
@ -471,7 +496,7 @@ switch ($action) {
case 'group_view':
if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) {
$delete = true;
// owner can delete
// Owner can delete.
} else {
$delete = check_acl(
$config['id_user'],
@ -484,7 +509,7 @@ switch ($action) {
case 'group_edit':
if ($config['id_user'] == $report['id_user'] || is_user_admin($config['id_user'])) {
$delete = true;
// owner can delete
// Owner can delete.
} else {
$delete = check_acl(
$config['id_user'],
@ -501,6 +526,10 @@ switch ($action) {
$delete = true;
}
break;
default:
// Default.
break;
}
if (! $delete) {
@ -571,7 +600,7 @@ switch ($action) {
ui_require_jquery_file('bgiframe');
ui_require_jquery_file('autocomplete');
// Show only selected groups
// Show only selected groups.
if ($id_group > 0) {
$group = ["$id_group" => $id_group];
} else {
@ -595,7 +624,7 @@ switch ($action) {
}
// Fix : group filter was not working
// Show only selected groups
// Show only selected groups.
if ($id_group > 0) {
$group = ["$id_group" => $id_group];
$filter['id_group'] = $id_group;
@ -603,8 +632,8 @@ switch ($action) {
$group = false;
}
// Filter normal and metaconsole reports
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
// Filter normal and metaconsole reports.
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$filter['metaconsole'] = 1;
} else {
$filter['metaconsole'] = 0;
@ -646,7 +675,7 @@ switch ($action) {
$table = new stdClass();
$table->id = 'report_list';
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
@ -670,12 +699,12 @@ switch ($action) {
$table->size['csv'] = '5%';
$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) {
$next = 7;
}
// Admin options only for RM flag
// Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[$next] = __('Private');
$table->size[$next] = '2%';
@ -743,7 +772,7 @@ switch ($action) {
$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']);
$report['overload'] = $item_count >= $config['report_limit'];
if ($report['overload']) {
@ -752,7 +781,7 @@ switch ($action) {
} 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[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 {
$data[2] = html_print_image(
'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;
if (enterprise_hook('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) {
$next = 7;
}
// Admin options only for RM flag
// Admin options only for RM flag.
if (check_acl($config['id_user'], 0, 'RM')) {
if ($report['private'] == 1) {
$data[$next] = __('Yes');
@ -820,10 +849,16 @@ switch ($action) {
$delete = true;
}
break;
default:
// Default.
break;
}
if ($edit || $delete) {
$columnview = true;
$table->cellclass[][$next] = 'action_buttons';
if (!isset($table->head[$next])) {
$table->head[$next] = '<span title="Operations">'.__('Op.').'</span>'.html_print_checkbox('all_delete', 0, false, true, false);
$table->size = [];
@ -833,11 +868,6 @@ switch ($action) {
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] .= html_print_input_hidden(
'id_report',
$report['id_report'],
true
);
$data[$next] .= html_print_input_image(
'edit',
'images/config.png',
@ -846,13 +876,16 @@ switch ($action) {
true,
['title' => __('Edit')]
);
$data[$next] .= html_print_input_hidden(
'id_report',
$report['id_report'],
true
);
$data[$next] .= '</form>';
}
if ($delete) {
$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(
'delete',
'images/cross.png',
@ -861,6 +894,8 @@ switch ($action) {
true,
['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);
@ -887,6 +922,7 @@ switch ($action) {
}
html_print_table($table);
ui_pagination($total_reports, $url, $offset, $pagination, false, 'offset', true, 'pagination-bottom');
} else {
ui_print_info_message([ 'no_close' => true, 'message' => __('No data found.') ]);
}
@ -915,7 +951,6 @@ switch ($action) {
}
enterprise_hook('close_meta_frame');
return;
break;
@ -943,6 +978,10 @@ switch ($action) {
$idGroupReport = $report['id_group'];
$description = $report['description'];
break;
default:
// Default.
break;
}
break;
@ -976,6 +1015,10 @@ switch ($action) {
$id_group_edit = 0;
$private = 1;
break;
default:
// Default.
break;
}
if ($action == 'update') {
@ -1026,10 +1069,10 @@ switch ($action) {
$action = 'edit';
} else if ($action == 'save') {
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();
// 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']) {
$custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo'];
@ -1098,7 +1141,6 @@ switch ($action) {
$good_format = false;
switch ($action) {
case 'update':
$values = [];
$values['id_report'] = $idReport;
// ---------------------------------------------------
@ -1132,7 +1174,6 @@ switch ($action) {
break;
case 'event_report_log':
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
@ -1154,7 +1195,7 @@ switch ($action) {
$values['top_n_value'] = get_parameter('quantity');
$interval_max = get_parameter('max_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)) {
$good_format = true;
}
@ -1221,9 +1262,21 @@ switch ($action) {
case 'availability':
// 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['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;
break;
@ -1258,6 +1311,7 @@ switch ($action) {
$values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true;
break;
}
$values['id_agent'] = get_parameter('id_agent');
@ -1282,6 +1336,19 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 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']) {
case 'mysql':
case 'postgresql':
@ -1293,6 +1360,10 @@ switch ($action) {
$values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
$values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
break;
default:
// Default.
break;
}
$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['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter('combo_group');
$values['show_extended_events'] = get_parameter('include_extended_events');
$values['server_name'] = get_parameter('server_name');
$server_id = (int) get_parameter('server_id');
if ($server_id != 0) {
@ -1314,7 +1384,7 @@ switch ($action) {
$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;
break;
}
@ -1331,7 +1401,7 @@ switch ($action) {
$event_filter_search = get_parameter('filter_search', '');
// If metaconsole is activated
// If metaconsole is activated.
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
$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'));
if (isset($agent_name_server)) {
@ -1352,7 +1422,7 @@ switch ($action) {
$server_name = substr($agent_name_server, $separator_pos);
$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);
$agent_name = substr($agent_name_server, 0, $separator_pos);
}
@ -1448,6 +1518,10 @@ switch ($action) {
$style['label'] = '';
}
break;
default:
// Default.
break;
}
$values['style'] = io_safe_input(json_encode($style));
@ -1462,6 +1536,10 @@ switch ($action) {
unset($values['type']);
}
break;
default:
// Default.
break;
}
$resultOperationDB = db_process_sql_update(
@ -1483,7 +1561,7 @@ switch ($action) {
$values['description'] = get_parameter('description');
$label = get_parameter('label', '');
// Add macros name
// Add macros name.
$items_label = [];
$items_label['type'] = get_parameter('type');
$items_label['id_agent'] = get_parameter('id_agent');
@ -1493,7 +1571,7 @@ switch ($action) {
$values['name'] = reporting_label_macro($items_label, $name_it);
// 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']) {
case 'projection_graph':
$values['period'] = get_parameter('period1');
@ -1595,7 +1673,7 @@ switch ($action) {
case 'availability':
$values['period'] = get_parameter('period');
// 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');
$good_format = true;
break;
@ -1670,6 +1748,10 @@ switch ($action) {
$values['only_display_wrong'] = $only_display_wrong_tmp;
}
break;
default:
// Default.
break;
}
$values['monday'] = get_parameter('monday', 0);
@ -1679,6 +1761,18 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 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']) {
case 'mysql':
case 'postgresql':
@ -1690,6 +1784,10 @@ switch ($action) {
$values['time_from'] = '#to_date(\''.get_parameter('time_from').'\',\'hh24:mi:ss\')';
$values['time_to'] = '#to_date(\''.get_parameter('time_to').'\', \'hh24:mi:ss\')';
break;
default:
// Default.
break;
}
$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['id_module_group'] = get_parameter('combo_modulegroup');
$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'] == '')) {
@ -1718,8 +1815,8 @@ switch ($action) {
}
}
if (($values['type'] == 'sql') or ($values['type'] == 'sql_graph_hbar')
or ($values['type'] == 'sql_graph_vbar') or ($values['type'] == 'sql_graph_pie')
if (($values['type'] == 'sql') || ($values['type'] == 'sql_graph_hbar')
|| ($values['type'] == 'sql_graph_vbar') || ($values['type'] == 'sql_graph_pie')
) {
$values['treport_custom_sql_id'] = get_parameter('id_custom');
if ($values['treport_custom_sql_id'] == 0) {
@ -1761,7 +1858,7 @@ switch ($action) {
$event_filter_search = get_parameter('filter_search', '');
// Added for events items
// Added for events items.
$style['show_summary_group'] = $show_summary_group;
$style['filter_event_severity'] = json_encode($filter_event_severity);
$style['filter_event_type'] = json_encode($filter_event_type);
@ -1783,6 +1880,10 @@ switch ($action) {
$style['label'] = '';
}
break;
default:
// Default.
break;
}
break;
@ -1827,6 +1928,10 @@ switch ($action) {
$style['label'] = '';
}
break;
default:
// Default.
break;
}
$values['style'] = io_safe_input(json_encode($style));
@ -1841,6 +1946,10 @@ switch ($action) {
unset($values['type']);
}
break;
default:
// Default.
break;
}
$result = db_process_sql_insert(
@ -1870,6 +1979,10 @@ switch ($action) {
WHERE id_report = '.$idReport
);
break;
default:
// Default.
break;
}
if ($max === false) {
@ -1895,6 +2008,10 @@ switch ($action) {
['id_rc' => $idItem]
);
break;
default:
// Default.
break;
}
$resultOperationDB = true;
@ -1902,7 +2019,8 @@ switch ($action) {
break;
}
// If fields dont have good format
// If fields dont have good format.
else {
$resultOperationDB = false;
}
@ -1910,7 +2028,7 @@ switch ($action) {
break;
default:
if ($enterpriseEnable and $activeTab != 'advanced') {
if ($enterpriseEnable && $activeTab != 'advanced') {
$resultOperationDB = reporting_enterprise_update_action();
}
break;
@ -1968,7 +2086,7 @@ switch ($action) {
case 'agent':
case 'type':
// Sort functionality for normal console
// Sort functionality for normal console.
if (!defined('METACONSOLE')) {
switch ($field) {
case 'module':
@ -2002,6 +2120,10 @@ switch ($action) {
case 'type':
$sql = 'SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s';
break;
default:
// Default.
break;
}
$sql = sprintf($sql, 'id_report = '.$idReport, '%s');
@ -2013,11 +2135,15 @@ switch ($action) {
case 'down':
$sql = sprintf($sql, 'DESC');
break;
default:
// Default.
break;
}
$ids = db_get_all_rows_sql($sql);
}
// Sort functionality for metaconsole
// Sort functionality for metaconsole.
else if ($config['metaconsole'] == 1) {
switch ($field) {
case 'agent':
@ -2035,14 +2161,14 @@ switch ($action) {
foreach ($report_items as $report_item) {
$connection = metaconsole_get_connection($report_item['server_name']);
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) {
case 'agent':
$agents_name = agents_get_agents(['id_agente' => $report_item['id_agent']], 'nombre');
// Item without agent
// Item without agent.
if (!$agents_name) {
$element_name = '';
} else {
@ -2054,13 +2180,17 @@ switch ($action) {
case 'module':
$module_name = modules_get_agentmodule_name($report_item['id_agent_module']);
// Item without module
// Item without module.
if (!$module_name) {
$element_name = '';
} else {
$element_name = $module_name;
}
break;
default:
// Default.
break;
}
metaconsole_restore_db();
@ -2068,7 +2198,7 @@ switch ($action) {
$temp_sort[$report_item['id_rc']] = $element_name;
}
// Performes sorting
// Performes sorting.
switch ($dir) {
case 'up':
asort($temp_sort);
@ -2077,6 +2207,10 @@ switch ($action) {
case 'down':
arsort($temp_sort);
break;
default:
// Default.
break;
}
foreach ($temp_sort as $temp_element_key => $temp_element_val) {
@ -2085,13 +2219,13 @@ switch ($action) {
$i++;
}
// Free resources
// Free resources.
unset($temp_sort);
unset($report_items);
}
break;
// Type case only depends of local database
// Type case only depends of local database.
case 'type':
$sql = 'SELECT id_rc
FROM treport_content
@ -2110,10 +2244,13 @@ switch ($action) {
case 'down':
$sql = sprintf($sql, 'DESC');
break;
default:
// Default.
break;
}
$ids = db_get_all_rows_sql($sql);
break;
}
}
@ -2152,6 +2289,10 @@ switch ($action) {
WHERE id_rc = '.$idItem
);
break;
default:
// Default.
break;
}
// db_get_value_filter('order', 'treport_content', array('id_rc' => $idItem));
@ -2163,6 +2304,10 @@ switch ($action) {
case 'down':
$newOrder = ($oldOrder + 1);
break;
default:
// Default.
break;
}
switch ($config['dbtype']) {
@ -2200,6 +2345,10 @@ switch ($action) {
false
);
break;
default:
// Default.
break;
}
if ($resultOperationDB !== false) {
@ -2229,13 +2378,17 @@ switch ($action) {
false
);
break;
default:
// Default.
break;
}
}
break;
}
break;
// Added for report templates
// Added for report templates.
default:
if ($enterpriseEnable) {
$buttons = [
@ -2259,7 +2412,7 @@ switch ($action) {
break;
}
// Page header for metaconsole
// Page header for metaconsole.
if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs
ui_meta_add_breadcrumb(
@ -2271,10 +2424,10 @@ switch ($action) {
ui_meta_print_page_header($nav_bar);
// Print header
// Print header.
ui_meta_print_header(__('Reporting'), '', $buttons);
}
// Page header for normal console
// Page header for normal console.
else {
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');
}
// Page header for metaconsole
// Page header for metaconsole.
if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs
// Bread crumbs.
ui_meta_add_breadcrumb(
[
'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);
// Print header
// Print header.
ui_meta_print_header(__('Reporting').$textReportName, '', $buttons);
} else {
ui_print_page_header(

View File

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

View File

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

View File

@ -40,7 +40,9 @@ if ($servers === false) {
$table = new StdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = [];
$table->style = [];
@ -80,7 +82,11 @@ $names_servers = [];
foreach ($servers as $server) {
$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>';
// Status
@ -155,7 +161,7 @@ foreach ($servers as $server) {
'style' => 'width:21px;height:21px;',
]
);
$data[8] .= '</a>&nbsp;&nbsp;';
$data[8] .= '</a>';
}
if ($server['type'] == 'data') {
@ -165,7 +171,7 @@ foreach ($servers as $server) {
true,
['title' => __('Reset module status and fired alert counts')]
);
$data[8] .= '</a>&nbsp;&nbsp;';
$data[8] .= '</a>';
} 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] .= html_print_image(
@ -173,7 +179,7 @@ foreach ($servers as $server) {
true,
['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'].'">';
@ -195,7 +201,7 @@ foreach ($servers as $server) {
$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(
'images/cross.png',
true,

View File

@ -63,14 +63,15 @@ switch ($action) {
break;
}
$table->class = 'info_table';
$table->width = '98%';
$table->head[0] = __('Map connection name');
$table->head[1] = __('Group');
$table->head[3] = __('Delete');
$table->align[1] = 'center';
$table->align[2] = 'center';
$table->align[3] = 'center';
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->align[3] = 'left';
$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"
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)) {
ui_print_info_message(['no_close' => true, 'message' => __("There isn't links") ]);
} 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='10px'>".__('Delete').'</th>';
echo '</tr></thead>';
$color = 1;
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 '<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>';

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') ]);
} else {
// 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>'.__('Type').'</th>';
echo '<th>'.__('Author').'</th>';
echo '<th>'.__('Timestamp').'</th>';
echo '<th>'.__('Expiration').'</th>';
echo '<th>'.__('Delete').'</th>';
echo '</tr></thead>';
$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.'"><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>';

View File

@ -25,7 +25,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head[0] = '';
$table->head[1] = __('ID');
@ -37,7 +37,19 @@ $table->align[4] = 'center';
$table->size[0] = '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) {
$osList = [];
}
@ -54,6 +66,8 @@ foreach ($osList as $os) {
}
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true);
$table->cellclass[][4] = 'action_buttons';
if ($os['id_os'] > 16) {
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>';
@ -69,7 +83,9 @@ foreach ($osList as $os) {
}
if (isset($data)) {
ui_pagination($count_osList, false, $offset);
html_print_table($table);
ui_pagination($count_osList, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
} else {
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;
if ($history_connect !== false) {
if ($config['history_db_connection'] !== false) {
if ($history_connect) {
if ($config['history_db_connection']) {
$time_pandora_db_history = mysql_db_process_sql(
$sql,
'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;
if ($history_connect !== false) {
if ($config['history_db_connection'] != false) {
if ($config['history_db_connection']) {
$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(
'SELECT * FROM tconfig',
'affected_rows',
@ -427,11 +427,11 @@ if ($config['history_db_enabled'] == 1) {
$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) {

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_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][1] = html_print_checkbox_switch(
'paginate_module',
@ -908,6 +904,24 @@ $row++;
$table_vc->size[0] = '50%';
$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[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);
@ -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'>";
$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][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>';

View File

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

View File

@ -191,7 +191,7 @@ if (!empty($result)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->data = [];
$table->head = [];
@ -278,12 +278,14 @@ if (!empty($result)) {
$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>';
array_push($table->data, $data);
}
html_print_table($table);
ui_pagination($total_tags, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else {
if (is_metaconsole()) {
ui_toggle($filter_form, __('Show Options'));

View File

@ -258,7 +258,7 @@ if ($create_profile) {
$table = new stdClass();
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->class = 'databox profile_list data';
$table->class = 'info_table profile_list';
$table->width = '100%';
$table->head = [];
@ -353,8 +353,9 @@ foreach ($profiles as $profile) {
$data['VW'] = ($profile['vconsole_edit'] ? $img : '');
$data['VM'] = ($profile['vconsole_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'] .= '&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);
}

View File

@ -38,13 +38,13 @@ $sort = get_parameter('sort', 'none');
$tab = get_parameter('tab', 'user');
$pure = get_parameter('pure', 0);
$selected = 'border: 1px solid black;';
$selectUserIDUp = '';
$selectUserIDDown = '';
$selectFullnameUp = '';
$selectFullnameDown = '';
$selectLastConnectUp = '';
$selectLastConnectDown = '';
$selected = true;
$selectUserIDUp = false;
$selectUserIDDown = false;
$selectFullnameUp = false;
$selectFullnameDown = false;
$selectLastConnectUp = false;
$selectLastConnectDown = false;
$order = null;
switch ($sortField) {
@ -110,11 +110,11 @@ switch ($sortField) {
default:
$selectUserIDUp = $selected;
$selectUserIDDown = '';
$selectFullnameUp = '';
$selectFullnameDown = '';
$selectLastConnectUp = '';
$selectLastConnectDown = '';
$selectUserIDDown = false;
$selectFullnameUp = false;
$selectFullnameDown = false;
$selectLastConnectUp = false;
$selectLastConnectDown = false;
$order = [
'field' => 'id_user',
'order' => 'ASC',
@ -300,11 +300,20 @@ if (defined('METACONSOLE')) {
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->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->data = [];
@ -312,9 +321,10 @@ $table->align = [];
$table->size = [];
$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[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[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[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown);
$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown);
$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown);
$table->head[3] = __('Admin');
$table->head[4] = __('Profile / Group');
$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);
$table->cellclass[][6] = 'action_buttons';
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>';
} else {
@ -535,6 +546,7 @@ foreach ($info as $user_id => $user_info) {
}
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">';
unset($table);

View File

@ -96,8 +96,20 @@ class DiscoveryTaskList extends Wizard
]
);
// Header
ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
// Header.
ui_print_page_header(
__('Task list'),
'',
false,
'',
true,
'',
false,
'',
GENERIC_SIZE_TEXT,
'',
$this->printHeader(true)
);
// Show redirected messages from discovery.php.
if ($status === 0) {
@ -352,10 +364,10 @@ class DiscoveryTaskList extends Wizard
$url_ajax = $config['homeurl'].'ajax.php';
$table = new StdClass();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = '100%';
$table->class = 'databox data';
$table->class = 'info_table';
$table->head = [];
$table->data = [];
$table->align = [];
@ -404,15 +416,30 @@ class DiscoveryTaskList extends Wizard
// Exceptions: IPAM.
$ipam = false;
if ($task['id_recon_script'] != null) {
$recon_script_name = db_get_value('name', 'trecon_script', 'id_recon_script', $task['id_recon_script']);
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;
$recon_script_data = db_get_row(
'trecon_script',
'id_recon_script',
$task['id_recon_script']
);
if ($recon_script_data !== false) {
$recon_script_name = $recon_script_data['name'];
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 !== '') {
@ -464,15 +491,56 @@ class DiscoveryTaskList extends Wizard
}
if ($task['id_recon_script'] == 0) {
// Discovery NetScan.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery NetScan')]
).'&nbsp;&nbsp;';
$data[6] .= network_profiles_get_name(
$task['id_network_profile']
);
// Internal discovery task.
switch ($task['type']) {
case DISCOVERY_CLOUD_AWS_RDS:
// Discovery Applications MySQL.
$data[6] = html_print_image(
'images/network.png',
true,
['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 {
// APP recon task.
$data[6] = html_print_image(
@ -512,7 +580,11 @@ class DiscoveryTaskList extends Wizard
$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] .= html_print_image(
'images/dynamic_network_icon.png',
@ -548,7 +620,7 @@ class DiscoveryTaskList extends Wizard
$data[9] .= '<a href="'.ui_get_full_url(
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
$this->getTargetWiz($task),
$this->getTargetWiz($task, $recon_script_data),
$task['id_rt']
)
).'">'.html_print_image(
@ -566,6 +638,8 @@ class DiscoveryTaskList extends Wizard
$data[9] = '';
}
$table->cellclass[][9] = 'action_buttons';
// Div neccesary for modal progress task.
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.
*
* @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
*/
public function getTargetWiz($task)
public function getTargetWiz($task, $script=false)
{
// TODO: Do not use description. Use recon_script ID instead.
switch ($task['description']) {
case 'Discovery.Application.VMware':
return 'wiz=app&mode=vmware&page=0';
if ($script !== false) {
switch ($script['type']) {
case DISCOVERY_SCRIPT_CLOUD_AWS:
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';
case 'console_task':
return 'wiz=ctask';
case DISCOVERY_CLOUD_AWS_RDS:
return 'wiz=cloud&mode=amazonws&sub=rds&page=0';
default:
if ($task['id_recon_script'] === null) {
return 'wiz=hd&mode=netscan';
if ($task['description'] == 'console_task') {
return 'wiz=ctask';
} else {
return 'wiz=hd&mode=customnetscan';
return 'wiz=hd&mode=netscan';
}
break;
}

View File

@ -149,7 +149,8 @@ class HostDevices extends Wizard
),
'label' => __('Discovery'),
],
]
],
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) {
// Avoid to print header out of wizard.
$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
@ -581,113 +594,83 @@ class HostDevices extends Wizard
if (isset($this->page) === false
|| $this->page == 0
) {
$form = [];
// Input task name.
$form['inputs'][] = [
'label' => '<b>'.__('Task name').'</b>',
'arguments' => [
// Comment input
$comment_input ='<div class="label_select"><label>'.__('Comment').':</label></div>';
$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',
'value' => $this->task['name'],
'type' => 'text',
'size' => 25,
],
];
'class' => 'discovery_full_width_input'
]);
if (isset($this->task['id_rt']) === true) {
// Propagate id.
$form['inputs'][] = [
'arguments' => [
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden',
],
];
}
// Network input
$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>';
// Input task name.
$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' => [
$network_input = $this->printInput([
'name' => 'network',
'value' => $this->task['subnet'],
'type' => 'text',
'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;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
// Schedule.
$form['inputs'][] = [
'label' => '<b>'.__('Interval').'</b>'.ui_print_help_tip(
__('Manual interval means that it will be executed only On-demand'),
true
),
'arguments' => [
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
$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>';
$interval_input = $this->printInput([
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'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',
$this->task['interval_sweep'],
'',
@ -700,36 +683,38 @@ class HostDevices extends Wizard
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>',
];
).'</span>';
$str = __('Next');
if (isset($this->task['id_rt']) === true) {
$str = __('Update and continue');
// Group select
$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 = '';
if (isset($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.
$interval = 600;
$unit = 60;
@ -738,24 +723,62 @@ class HostDevices extends Wizard
$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)
// 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'][] = [
'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.
@ -799,7 +822,6 @@ $("select#interval_manual_defined").change(function() {
'selected' => $this->task['id_network_profile'],
'nothing_value' => 0,
'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'],
];
$this->printForm($form);
$this->printForm($form, false, true);
}
if ($this->page == 2) {

View File

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

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