Merge remote-tracking branch 'origin/develop' into ent-4035-add-serialize-precision-value-notification
This commit is contained in:
commit
a0ad1f2681
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, AIX version
|
# Version 7.0NG.736, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, FreeBSD Version
|
# Version 7.0NG.736, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, HP-UX Version
|
# Version 7.0NG.736, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, GNU/Linux
|
# Version 7.0NG.736, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, GNU/Linux
|
# Version 7.0NG.736, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, Solaris Version
|
# Version 7.0NG.736, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
|
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.734, AIX version
|
# Version 7.0NG.736, AIX version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
# FreeBSD/IPSO version
|
# FreeBSD/IPSO version
|
||||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.734, HPUX Version
|
# Version 7.0NG.736, HPUX Version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# please visit http://pandora.sourceforge.net
|
# please visit http://pandora.sourceforge.net
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Fichero de configuracion base de agentes de Pandora
|
# Fichero de configuracion base de agentes de Pandora
|
||||||
# Base config file for Pandora agents
|
# Base config file for Pandora agents
|
||||||
# Version 7.0NG.734, Solaris version
|
# Version 7.0NG.736, Solaris version
|
||||||
|
|
||||||
# General Parameters
|
# General Parameters
|
||||||
# ==================
|
# ==================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, AIX version
|
# Version 7.0NG.736, AIX version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.734-190517
|
Version: 7.0NG.736-190715
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.734-190517"
|
pandora_version="7.0NG.736-190715"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, GNU/Linux
|
# Version 7.0NG.736, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, FreeBSD Version
|
# Version 7.0NG.736, FreeBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, HP-UX Version
|
# Version 7.0NG.736, HP-UX Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, GNU/Linux
|
# Version 7.0NG.736, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, GNU/Linux
|
# Version 7.0NG.736, GNU/Linux
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, NetBSD Version
|
# Version 7.0NG.736, NetBSD Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Base config file for Pandora FMS agents
|
# Base config file for Pandora FMS agents
|
||||||
# Version 7.0NG.734, Solaris Version
|
# Version 7.0NG.736, Solaris Version
|
||||||
# Licensed under GPL license v2,
|
# Licensed under GPL license v2,
|
||||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||||
# http://www.pandorafms.com
|
# http://www.pandorafms.com
|
||||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
||||||
# Semaphore used to control the number of threads
|
# Semaphore used to control the number of threads
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.734';
|
use constant AGENT_VERSION => '7.0NG.736';
|
||||||
use constant AGENT_BUILD => '190517';
|
use constant AGENT_BUILD => '190715';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -536,6 +536,12 @@ sub parse_conf_modules($) {
|
||||||
# Check for invalid modules
|
# Check for invalid modules
|
||||||
next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin);
|
next unless (($module->{'name'} ne '' && $module->{'func'} != 0) || $module->{'func'} == \&module_plugin);
|
||||||
|
|
||||||
|
# Skip disabled modules.
|
||||||
|
if (defined($module->{'disabled'}) && $module->{'disabled'} == 1) {
|
||||||
|
log_message('setup', 'Skipping disabled module "' . $module->{'name'} . '"');
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
# Set the intensive interval
|
# Set the intensive interval
|
||||||
if ($module->{'is_intensive'} == 1) {
|
if ($module->{'is_intensive'} == 1) {
|
||||||
$module->{'intensive_interval'} = $module->{'interval'};
|
$module->{'intensive_interval'} = $module->{'interval'};
|
||||||
|
@ -3032,10 +3038,10 @@ while (1) {
|
||||||
my @address_list;
|
my @address_list;
|
||||||
|
|
||||||
if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
|
if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
|
||||||
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
|
@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
|
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (my $i = 0; $i <= $#address_list; $i++) {
|
for (my $i = 0; $i <= $#address_list; $i++) {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.734
|
%define version 7.0NG.736
|
||||||
%define release 190517
|
%define release 190715
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#Pandora FMS Linux Agent
|
#Pandora FMS Linux Agent
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.734
|
%define version 7.0NG.736
|
||||||
%define release 190517
|
%define release 190715
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.734"
|
PI_VERSION="7.0NG.736"
|
||||||
PI_BUILD="190517"
|
PI_BUILD="190715"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
#
|
#
|
||||||
# grep_log Perl script to search log files for a matching pattern. The last
|
# grep_log Perl script to search log files for a matching pattern. The last
|
||||||
# searched position is saved in an index file so that consecutive
|
# searched position is saved in an index file so that consecutive
|
||||||
# runs do not return the same results. The log file inode number is
|
# runs do not return the same results. The log file inode number is
|
||||||
# also saved to detect log rotation.
|
# also saved to detect log rotation.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; version 2 of the License.
|
# the Free Software Foundation; version 2 of the License.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -30,7 +30,7 @@ my $Output = 'module';
|
||||||
my $Verbose = 0;
|
my $Verbose = 0;
|
||||||
|
|
||||||
# Index file storage directory, with a trailing '/'
|
# Index file storage directory, with a trailing '/'
|
||||||
my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/';
|
my $Idx_dir=($^O =~ /win/i)?"$ENV{'TMP'}\\":"/tmp/";
|
||||||
|
|
||||||
# Log file
|
# Log file
|
||||||
my $Log_file = '';
|
my $Log_file = '';
|
||||||
|
@ -64,7 +64,7 @@ if ( (defined ($ENV{GREP_LOG_TMP})) && (-d $ENV{GREP_LOG_TMP}) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Erase blank spaces before and after the string
|
# Erase blank spaces before and after the string
|
||||||
########################################################################################
|
########################################################################################
|
||||||
sub trim($){
|
sub trim($){
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
|
@ -226,7 +226,7 @@ sub parse_log (;$$) {
|
||||||
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
|
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
|
||||||
$!);
|
$!);
|
||||||
|
|
||||||
# Go to starting position.
|
# Go to starting position.
|
||||||
seek(LOGFILE, $Idx_pos, 0);
|
seek(LOGFILE, $Idx_pos, 0);
|
||||||
|
|
||||||
# Parse log file
|
# Parse log file
|
||||||
|
@ -318,7 +318,7 @@ sub print_log ($) {
|
||||||
print_summary() if ($summary_flag == 1);
|
print_summary() if ($summary_flag == 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log module
|
# Log module
|
||||||
if ($Output eq 'log_module') {
|
if ($Output eq 'log_module') {
|
||||||
my $output = "<log_module>\n";
|
my $output = "<log_module>\n";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||||
# Version 7.0NG.734
|
# Version 7.0NG.736
|
||||||
|
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||||
{Yes}
|
{Yes}
|
||||||
|
|
||||||
AppName
|
AppName
|
||||||
{Pandora FMS Windows Agent v7.0NG.734}
|
{Pandora FMS Windows Agent v7.0NG.736}
|
||||||
|
|
||||||
ApplicationID
|
ApplicationID
|
||||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{190517}
|
{190715}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
|
|
@ -1117,6 +1117,12 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Skip disabled modules */
|
||||||
|
if (module_disabled == "1") {
|
||||||
|
pandoraLog ("Skipping disabled module \"%s\"", module_name.c_str ());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create module objects */
|
/* Create module objects */
|
||||||
if (module_exec != "") {
|
if (module_exec != "") {
|
||||||
module = new Pandora_Module_Exec (module_name,
|
module = new Pandora_Module_Exec (module_name,
|
||||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.734(Build 190517)")
|
#define PANDORA_VERSION ("7.0NG.736(Build 190715)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.734(Build 190517))"
|
VALUE "ProductVersion", "(7.0NG.736(Build 190715))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.734-190517
|
Version: 7.0NG.736-190715
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.734-190517"
|
pandora_version="7.0NG.736-190715"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
|
|
@ -1,17 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Ajax handler.
|
||||||
|
*
|
||||||
|
* @category Ajax handler.
|
||||||
|
* @package Pandora FMS.
|
||||||
|
* @subpackage OpenSource.
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
define('AJAX', true);
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU Lesser General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Enable profiler for testing
|
|
||||||
if (!defined('__PAN_XHPROF__')) {
|
if (!defined('__PAN_XHPROF__')) {
|
||||||
define('__PAN_XHPROF__', 0);
|
define('__PAN_XHPROF__', 0);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
|
||||||
|
|
||||||
$public_hash = get_parameter('hash', false);
|
$public_hash = get_parameter('hash', false);
|
||||||
|
|
||||||
// Check user
|
// Check user.
|
||||||
if ($public_hash == false) {
|
if ($public_hash == false) {
|
||||||
check_login();
|
check_login();
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,9 +85,9 @@ if ($public_hash == false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define('AJAX', true);
|
|
||||||
|
|
||||||
// Enterprise support
|
|
||||||
|
// Enterprise support.
|
||||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||||
include_once ENTERPRISE_DIR.'/load_enterprise.php';
|
include_once ENTERPRISE_DIR.'/load_enterprise.php';
|
||||||
}
|
}
|
||||||
|
@ -86,11 +103,9 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
|
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config['metaconsole'])) {
|
if (is_metaconsole()) {
|
||||||
// Not cool way of know if we are executing from metaconsole or normal console
|
// Backward compatibility.
|
||||||
if ($config['metaconsole']) {
|
define('METACONSOLE', true);
|
||||||
define('METACONSOLE', true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($page)) {
|
if (file_exists($page)) {
|
||||||
|
|
|
@ -138,8 +138,15 @@ function mainAgentsAlerts()
|
||||||
$onheader['combo_refr'] = $comborefr;
|
$onheader['combo_refr'] = $comborefr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(__('Agents/Alerts'), 'images/op_alerts.png', false, '', false, $updated_time);
|
ui_print_page_header(
|
||||||
|
__('Agents/Alerts'),
|
||||||
|
'images/op_alerts.png',
|
||||||
|
false,
|
||||||
|
'agents_alerts_view',
|
||||||
|
false,
|
||||||
|
$updated_time
|
||||||
|
);
|
||||||
|
|
||||||
// Old style table, we need a lot of special formatting,don't use table function
|
// Old style table, we need a lot of special formatting,don't use table function
|
||||||
// Prepare old-style table
|
// Prepare old-style table
|
||||||
|
@ -291,7 +298,7 @@ function mainAgentsAlerts()
|
||||||
|
|
||||||
$table2->data[2][0] = __('Threshold');
|
$table2->data[2][0] = __('Threshold');
|
||||||
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
||||||
$table2->data[2][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true);
|
$table2->data[2][1] .= ' '.__('seconds');
|
||||||
|
|
||||||
$content2 = '<form class="add_alert_form" method="post">';
|
$content2 = '<form class="add_alert_form" method="post">';
|
||||||
$content2 .= html_print_table($table2, true);
|
$content2 .= html_print_table($table2, true);
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Pandora FMS - http://pandorafms.com
|
||||||
|
* ==================================================
|
||||||
|
* Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; version 2
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
$refr = (int) get_parameter('refresh', 0);
|
|
||||||
// By default 30 seconds
|
|
||||||
function mainAgentsModules()
|
function mainAgentsModules()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars.
|
||||||
include_once 'include/config.php';
|
include_once 'include/config.php';
|
||||||
include_once 'include/functions_reporting.php';
|
include_once 'include/functions_reporting.php';
|
||||||
include_once $config['homedir'].'/include/functions_agents.php';
|
include_once $config['homedir'].'/include/functions_agents.php';
|
||||||
|
@ -25,7 +26,7 @@ function mainAgentsModules()
|
||||||
include_once $config['homedir'].'/include/functions_users.php';
|
include_once $config['homedir'].'/include/functions_users.php';
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
// ACL Check
|
// ACL Check.
|
||||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
|
@ -37,7 +38,7 @@ function mainAgentsModules()
|
||||||
|
|
||||||
// Update network modules for this group
|
// Update network modules for this group
|
||||||
// Check for Network FLAG change request
|
// Check for Network FLAG change request
|
||||||
// Made it a subquery, much faster on both the database and server side
|
// Made it a subquery, much faster on both the database and server side.
|
||||||
if (isset($_GET['update_netgroup'])) {
|
if (isset($_GET['update_netgroup'])) {
|
||||||
$group = get_parameter_get('update_netgroup', 0);
|
$group = get_parameter_get('update_netgroup', 0);
|
||||||
if (check_acl($config['id_user'], $group, 'AW')) {
|
if (check_acl($config['id_user'], $group, 'AW')) {
|
||||||
|
@ -62,7 +63,7 @@ function mainAgentsModules()
|
||||||
|
|
||||||
$modulegroup = get_parameter('modulegroup', 0);
|
$modulegroup = get_parameter('modulegroup', 0);
|
||||||
$refr = (int) get_parameter('refresh', 0);
|
$refr = (int) get_parameter('refresh', 0);
|
||||||
// By default 30 seconds
|
// By default 30 seconds.
|
||||||
$recursion = get_parameter('recursion', 0);
|
$recursion = get_parameter('recursion', 0);
|
||||||
$group_id = (int) get_parameter('group_id', 0);
|
$group_id = (int) get_parameter('group_id', 0);
|
||||||
$offset = (int) get_parameter('offset', 0);
|
$offset = (int) get_parameter('offset', 0);
|
||||||
|
@ -79,7 +80,8 @@ function mainAgentsModules()
|
||||||
$full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
|
$full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
|
||||||
$full_agents_id = explode(';', get_parameter('full_agents_id', 0));
|
$full_agents_id = explode(';', get_parameter('full_agents_id', 0));
|
||||||
|
|
||||||
if ($save_serialize && $update_item == '') {
|
// In full screen there is no pagination neither filters.
|
||||||
|
if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) {
|
||||||
$unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1);
|
$unserialize_modules_selected = unserialize_in_temp($config['id_user'].'_agent_module', true, 1);
|
||||||
$unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1);
|
$unserialize_agents_id = unserialize_in_temp($config['id_user'].'_agents', true, 1);
|
||||||
if ($unserialize_modules_selected) {
|
if ($unserialize_modules_selected) {
|
||||||
|
@ -102,7 +104,6 @@ function mainAgentsModules()
|
||||||
serialize_in_temp($agents_id, $config['id_user'].'_agents', 1);
|
serialize_in_temp($agents_id, $config['id_user'].'_agents', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($agents_id != -1) $agents_id = null;
|
|
||||||
if ($config['pure'] == 0) {
|
if ($config['pure'] == 0) {
|
||||||
if ($modules_selected[0] && $agents_id[0]) {
|
if ($modules_selected[0] && $agents_id[0]) {
|
||||||
$full_modules = urlencode(implode(';', $modules_selected));
|
$full_modules = urlencode(implode(';', $modules_selected));
|
||||||
|
@ -124,13 +125,13 @@ function mainAgentsModules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// groups
|
// Groups.
|
||||||
$filter_groups_label = '<b>'.__('Group').'</b>';
|
$filter_groups_label = '<b>'.__('Group').'</b>';
|
||||||
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
|
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
|
||||||
|
|
||||||
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
|
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
|
||||||
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
|
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
|
||||||
// groups module
|
// Groups module.
|
||||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
||||||
$filter_module_groups = html_print_select_from_sql(
|
$filter_module_groups = html_print_select_from_sql(
|
||||||
'SELECT * FROM tmodule_group ORDER BY name',
|
'SELECT * FROM tmodule_group ORDER BY name',
|
||||||
|
@ -146,7 +147,7 @@ function mainAgentsModules()
|
||||||
'width: auto;'
|
'width: auto;'
|
||||||
);
|
);
|
||||||
|
|
||||||
// agent
|
// Agent.
|
||||||
$agents = agents_get_group_agents($group_id);
|
$agents = agents_get_group_agents($group_id);
|
||||||
if ((empty($agents)) || $agents == -1) {
|
if ((empty($agents)) || $agents == -1) {
|
||||||
$agents = [];
|
$agents = [];
|
||||||
|
@ -155,7 +156,7 @@ function mainAgentsModules()
|
||||||
$filter_agents_label = '<b>'.__('Agents').'</b>';
|
$filter_agents_label = '<b>'.__('Agents').'</b>';
|
||||||
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
|
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
|
||||||
|
|
||||||
// type show
|
// Type show.
|
||||||
$selection = [
|
$selection = [
|
||||||
0 => __('Show common modules'),
|
0 => __('Show common modules'),
|
||||||
1 => __('Show all modules'),
|
1 => __('Show all modules'),
|
||||||
|
@ -163,12 +164,12 @@ function mainAgentsModules()
|
||||||
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
|
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
|
||||||
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
|
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
|
||||||
|
|
||||||
// modules
|
// Modules.
|
||||||
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
|
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
|
||||||
$filter_modules_label = '<b>'.__('Module').'</b>';
|
$filter_modules_label = '<b>'.__('Module').'</b>';
|
||||||
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
|
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
|
||||||
|
|
||||||
// update
|
// Update.
|
||||||
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
|
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
|
||||||
|
|
||||||
$onheader = [
|
$onheader = [
|
||||||
|
@ -178,11 +179,21 @@ function mainAgentsModules()
|
||||||
'combo_groups' => $filter_groups,
|
'combo_groups' => $filter_groups,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Old style table, we need a lot of special formatting,don't use table function
|
/*
|
||||||
// Prepare old-style table
|
* Old style table, we need a lot of special formatting,don't use table function.
|
||||||
|
* Prepare old-style table.
|
||||||
|
*/
|
||||||
|
|
||||||
if ($config['pure'] == 0) {
|
if ($config['pure'] == 0) {
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(__('Agents/Modules'), 'images/module_mc.png', false, '', false, $updated_time);
|
ui_print_page_header(
|
||||||
|
__('Agents/Modules'),
|
||||||
|
'images/module_mc.png',
|
||||||
|
false,
|
||||||
|
'agents_module_view',
|
||||||
|
false,
|
||||||
|
$updated_time
|
||||||
|
);
|
||||||
echo '<table style="width:100%;">';
|
echo '<table style="width:100%;">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo "<td> <span style='float: right;'>".$fullscreen['text'].'</span> </td>';
|
echo "<td> <span style='float: right;'>".$fullscreen['text'].'</span> </td>';
|
||||||
|
@ -193,38 +204,51 @@ function mainAgentsModules()
|
||||||
$full_modules = urlencode(implode(';', $full_modules_selected));
|
$full_modules = urlencode(implode(';', $full_modules_selected));
|
||||||
$full_agents = urlencode(implode(';', $full_agents_id));
|
$full_agents = urlencode(implode(';', $full_agents_id));
|
||||||
|
|
||||||
$url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset
|
$url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset
|
||||||
&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules
|
&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules
|
||||||
&full_agents_id=$full_agents&selection_agent_module=$selection_a_m";
|
&full_agents_id=$full_agents&selection_agent_module=$selection_a_m';
|
||||||
} else {
|
} else {
|
||||||
$url = " index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr";
|
$url = 'index.php?sec=view&sec2=extensions/agents_modules&pure=0&offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Floating menu - Start
|
// Floating menu - Start.
|
||||||
echo '<div id="vc-controls" style="z-index: 999">';
|
echo '<div id="vc-controls" style="z-index: 999">';
|
||||||
|
|
||||||
echo '<div id="menu_tab">';
|
echo '<div id="menu_tab">';
|
||||||
echo '<ul class="mn">';
|
echo '<ul class="mn">';
|
||||||
|
|
||||||
// Quit fullscreen
|
// Quit fullscreen.
|
||||||
echo '<li class="nomn">';
|
echo '<li class="nomn">';
|
||||||
echo '<a target="_top" href="'.$url.'">';
|
echo '<a target="_top" href="'.$url.'">';
|
||||||
echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
|
echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
|
|
||||||
// Countdown
|
// Countdown.
|
||||||
echo '<li class="nomn">';
|
echo '<li class="nomn">';
|
||||||
echo '<div class="vc-refr">';
|
echo '<div class="vc-refr">';
|
||||||
echo '<div class="vc-countdown"></div>';
|
echo '<div class="vc-countdown style="display: inline;"></div>';
|
||||||
echo '<div id="vc-refr-form">';
|
echo '<div id="vc-refr-form">';
|
||||||
echo __('Refresh').':';
|
echo __('Refresh').':';
|
||||||
echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false);
|
echo html_print_select(
|
||||||
|
get_refresh_time_array(),
|
||||||
|
'refresh',
|
||||||
|
$refr,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'margin-top: 3px;'
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
|
|
||||||
// Console name
|
// Console name.
|
||||||
echo '<li class="nomn">';
|
echo '<li class="nomn">';
|
||||||
echo '<div class="vc-title">'.__('Agent/module view').'</div>';
|
echo '<div class="vc-title">'.__('Agent/module view').'</div>';
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
|
@ -233,35 +257,35 @@ function mainAgentsModules()
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
// Floating menu - End
|
// Floating menu - End.
|
||||||
ui_require_jquery_file('countdown');
|
ui_require_jquery_file('countdown');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['pure'] != 1) {
|
if ($config['pure'] != 1) {
|
||||||
echo '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'">';
|
$show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" style="width:100%;">';
|
||||||
|
$show_filters .= '<table class="white_table" cellpadding="0" cellspacing="0" border="0" style="width:100%; border:none;">';
|
||||||
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
|
$show_filters .= '<tr>';
|
||||||
echo '<tr>';
|
$show_filters .= '<td>'.$filter_groups_label.'</td>';
|
||||||
echo '<td>'.$filter_groups_label.'</td>';
|
$show_filters .= '<td>'.$filter_groups.' '.$filter_recursion_label.$filter_recursion.'</td>';
|
||||||
echo '<td>'.$filter_groups.' '.$filter_recursion_label.$filter_recursion.'</td>';
|
$show_filters .= '<td></td>';
|
||||||
echo '<td></td>';
|
$show_filters .= '<td></td>';
|
||||||
echo '<td></td>';
|
$show_filters .= '<td>'.$filter_module_groups_label.'</td>';
|
||||||
echo '<td>'.$filter_module_groups_label.'</td>';
|
$show_filters .= '<td>'.$filter_module_groups.'</td>';
|
||||||
echo '<td>'.$filter_module_groups.'</td>';
|
$show_filters .= '</tr>';
|
||||||
echo '</tr>';
|
$show_filters .= '<tr>';
|
||||||
echo '<tr>';
|
$show_filters .= '<td>'.$filter_agents_label.'</td>';
|
||||||
echo '<td>'.$filter_agents_label.'</td>';
|
$show_filters .= '<td>'.$filter_agents.'</td>';
|
||||||
echo '<td>'.$filter_agents.'</td>';
|
$show_filters .= '<td>'.$filter_type_show_label.'</td>';
|
||||||
echo '<td>'.$filter_type_show_label.'</td>';
|
$show_filters .= '<td>'.$filter_type_show.'</td>';
|
||||||
echo '<td>'.$filter_type_show.'</td>';
|
$show_filters .= '<td>'.$filter_modules_label.'</td>';
|
||||||
echo '<td>'.$filter_modules_label.'</td>';
|
$show_filters .= '<td>'.$filter_modules.'</td>';
|
||||||
echo '<td>'.$filter_modules.'</td>';
|
$show_filters .= '</tr>';
|
||||||
echo '</tr>';
|
$show_filters .= '<tr>';
|
||||||
echo '<tr>';
|
$show_filters .= "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
|
||||||
echo "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
|
$show_filters .= '</tr>';
|
||||||
echo '</tr>';
|
$show_filters .= '</table>';
|
||||||
echo '</table>';
|
$show_filters .= '</form>';
|
||||||
echo '</form>';
|
ui_toggle($show_filters, __('Filters'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($agents_id[0] != -1) {
|
if ($agents_id[0] != -1) {
|
||||||
|
@ -284,7 +308,7 @@ function mainAgentsModules()
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
// TODO TAGS agents_get_modules
|
// TODO TAGS agents_get_modules.
|
||||||
$module = agents_get_modules(
|
$module = agents_get_modules(
|
||||||
$agent,
|
$agent,
|
||||||
false,
|
false,
|
||||||
|
@ -332,7 +356,7 @@ function mainAgentsModules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO TAGS agents_get_modules
|
// TODO TAGS agents_get_modules.
|
||||||
$all_modules = agents_get_modules(
|
$all_modules = agents_get_modules(
|
||||||
$agents,
|
$agents,
|
||||||
false,
|
false,
|
||||||
|
@ -407,11 +431,11 @@ function mainAgentsModules()
|
||||||
|
|
||||||
if ($hor_offset > 0) {
|
if ($hor_offset > 0) {
|
||||||
$new_hor_offset = ($hor_offset - $block);
|
$new_hor_offset = ($hor_offset - $block);
|
||||||
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'refr=0&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
|
echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&refr=0&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
|
||||||
'images/arrow_left.png',
|
'images/arrow_left_green.png',
|
||||||
true,
|
true,
|
||||||
['title' => __('Previous modules')]
|
['title' => __('Previous modules')]
|
||||||
).'</a>'.'</th>';
|
).'</a></th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$nmodules = 0;
|
$nmodules = 0;
|
||||||
|
@ -433,11 +457,11 @@ function mainAgentsModules()
|
||||||
|
|
||||||
if (($hor_offset + $block) < $nmodules) {
|
if (($hor_offset + $block) < $nmodules) {
|
||||||
$new_hor_offset = ($hor_offset + $block);
|
$new_hor_offset = ($hor_offset + $block);
|
||||||
echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
|
echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
|
||||||
'images/arrow.png',
|
'images/arrow_right_green.png',
|
||||||
true,
|
true,
|
||||||
['title' => __('More modules')]
|
['title' => __('More modules')]
|
||||||
).'</a>'.'</th>';
|
).'</a></th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
@ -450,12 +474,12 @@ function mainAgentsModules()
|
||||||
$filter_agents['id_grupo'] = $group_id;
|
$filter_agents['id_grupo'] = $group_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare pagination
|
// Prepare pagination.
|
||||||
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&'.'hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
$url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
|
||||||
ui_pagination($total_pagination, $url);
|
ui_pagination($total_pagination, $url);
|
||||||
|
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
// Get stats for this group
|
// Get stats for this group.
|
||||||
$agent_status = agents_get_status($agent['id_agente']);
|
$agent_status = agents_get_status($agent['id_agente']);
|
||||||
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
|
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
|
||||||
if (empty($alias['alias'])) {
|
if (empty($alias['alias'])) {
|
||||||
|
@ -464,29 +488,29 @@ function mainAgentsModules()
|
||||||
|
|
||||||
switch ($agent_status) {
|
switch ($agent_status) {
|
||||||
case 4:
|
case 4:
|
||||||
// Alert fired status
|
// Alert fired status.
|
||||||
$rowcolor = 'group_view_alrm';
|
$rowcolor = 'group_view_alrm';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// Critical status
|
// Critical status.
|
||||||
$rowcolor = 'group_view_crit';
|
$rowcolor = 'group_view_crit';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// Warning status
|
// Warning status.
|
||||||
$rowcolor = 'group_view_warn';
|
$rowcolor = 'group_view_warn';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
// Normal status
|
// Normal status.
|
||||||
$rowcolor = 'group_view_ok';
|
$rowcolor = 'group_view_ok';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
case -1:
|
case -1:
|
||||||
default:
|
default:
|
||||||
// Unknown status
|
// Unknown status.
|
||||||
$rowcolor = 'group_view_unk';
|
$rowcolor = 'group_view_unk';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -495,7 +519,7 @@ function mainAgentsModules()
|
||||||
|
|
||||||
echo "<td class='$rowcolor'>
|
echo "<td class='$rowcolor'>
|
||||||
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>';
|
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>';
|
||||||
// TODO TAGS agents_get_modules
|
// TODO TAGS agents_get_modules.
|
||||||
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
|
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
|
||||||
|
|
||||||
$nmodules = 0;
|
$nmodules = 0;
|
||||||
|
@ -565,18 +589,23 @@ function mainAgentsModules()
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
echo "<div class='legend_basic' style='width: 96%'>";
|
$show_legend = "<div class='legend_white'>";
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></div>".__('Orange cell when the module has fired alerts').'</div>';
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></div>".__('Red cell when the module has a critical status').'
|
||||||
|
</div>';
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></div>".__('Yellow cell when the module has a warning status').'</div>';
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></div>".__('Green cell when the module has a normal status').'</div>';
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></div>".__('Grey cell when the module has an unknown status').'</div>';
|
||||||
|
$show_legend .= "<div style='display: flex;align-items: center;'>
|
||||||
|
<div class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></div>".__("Cell turns blue when the module is in 'not initialize' status").'</div>';
|
||||||
|
$show_legend .= '</div>';
|
||||||
|
ui_toggle($show_legend, __('Legend'));
|
||||||
|
|
||||||
echo '<table>';
|
|
||||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>".__('Legend').'</b></td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module has fired alerts').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module has a critical status').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module has a warning status').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module has a normal status').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module has an unknown status').'</td></tr>';
|
|
||||||
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__("Cell turns blue when the module is in 'not initialize' status").'</td></tr>';
|
|
||||||
echo '</table>';
|
|
||||||
echo '</div>';
|
|
||||||
$pure_var = $config['pure'];
|
$pure_var = $config['pure'];
|
||||||
if ($pure_var) {
|
if ($pure_var) {
|
||||||
$pure_var = 1;
|
$pure_var = 1;
|
||||||
|
@ -620,16 +649,14 @@ $ignored_params['refresh'] = '';
|
||||||
$.each($('.th_class_module_r'), function (i, elem) {
|
$.each($('.th_class_module_r'), function (i, elem) {
|
||||||
id = $(elem).attr('id').replace('th_module_r_', '');
|
id = $(elem).attr('id').replace('th_module_r_', '');
|
||||||
$("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
|
$("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
|
||||||
|
|
||||||
//$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px');
|
|
||||||
$("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
|
$("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
|
||||||
$("#div_module_r_" + id).show();
|
$("#div_module_r_" + id).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
var refr =" . $refr . ";
|
var refr = '<?php echo get_parameter('refresh', 0); ?>';
|
||||||
var pure =" . $pure_var . ";
|
var pure = '<?php echo get_parameter('pure', 0); ?>';
|
||||||
var href ='" . ui_get_url_refresh ($ignored_params) . "';
|
var href =' <?php echo ui_get_url_refresh($ignored_params); ?>';
|
||||||
|
|
||||||
if (pure) {
|
if (pure) {
|
||||||
var startCountDown = function (duration, cb) {
|
var startCountDown = function (duration, cb) {
|
||||||
$('div.vc-countdown').countdown('destroy');
|
$('div.vc-countdown').countdown('destroy');
|
||||||
|
@ -639,7 +666,7 @@ $ignored_params['refresh'] = '';
|
||||||
$('div.vc-countdown').countdown({
|
$('div.vc-countdown').countdown({
|
||||||
until: t,
|
until: t,
|
||||||
format: 'MS',
|
format: 'MS',
|
||||||
layout: '(%M%nn%M:%S%nn%S Until refresh)',
|
layout: '(%M%nn%M:%S%nn%S <?php echo __('Until next'); ?>) ',
|
||||||
alwaysExpire: true,
|
alwaysExpire: true,
|
||||||
onExpiry: function () {
|
onExpiry: function () {
|
||||||
$('div.vc-countdown').countdown('destroy');
|
$('div.vc-countdown').countdown('destroy');
|
||||||
|
@ -648,8 +675,11 @@ $ignored_params['refresh'] = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
startCountDown(refr, false);
|
if(refr>0){
|
||||||
|
startCountDown(refr, false);
|
||||||
|
}
|
||||||
|
|
||||||
var controls = document.getElementById('vc-controls');
|
var controls = document.getElementById('vc-controls');
|
||||||
autoHideElement(controls, 1000);
|
autoHideElement(controls, 1000);
|
||||||
|
|
||||||
|
@ -826,4 +856,4 @@ $ignored_params['refresh'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -25,7 +25,7 @@ function extension_db_status()
|
||||||
__('DB Schema check'),
|
__('DB Schema check'),
|
||||||
'images/extensions.png',
|
'images/extensions.png',
|
||||||
false,
|
false,
|
||||||
'',
|
'db_status_tab',
|
||||||
true,
|
true,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -69,7 +69,7 @@ function extension_db_status()
|
||||||
|
|
||||||
echo "<div style='text-align: right;'>";
|
echo "<div style='text-align: right;'>";
|
||||||
html_print_input_hidden('db_status_execute', 1);
|
html_print_input_hidden('db_status_execute', 1);
|
||||||
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
|
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
@ -215,7 +215,7 @@ function extension_db_check_tables_differences(
|
||||||
$diff_tables = array_diff($tables_test, $tables_system);
|
$diff_tables = array_diff($tables_test, $tables_system);
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
!empty($diff_tables),
|
empty($diff_tables),
|
||||||
__('Success! %s DB contains all tables', get_product_name()),
|
__('Success! %s DB contains all tables', get_product_name()),
|
||||||
__(
|
__(
|
||||||
'%s DB could not retrieve all tables. The missing tables are (%s)',
|
'%s DB could not retrieve all tables. The missing tables are (%s)',
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Module groups.
|
||||||
|
*
|
||||||
|
* @category Extensions
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Module groups view.
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
@ -32,10 +47,12 @@ if (is_ajax()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main function of module groups and the enter point to
|
* The main function of module groups and the enter point to
|
||||||
* execute the code.
|
* execute the code.
|
||||||
*/
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function mainModuleGroups()
|
function mainModuleGroups()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -68,13 +85,20 @@ function mainModuleGroups()
|
||||||
$info = array_filter(
|
$info = array_filter(
|
||||||
$info,
|
$info,
|
||||||
function ($v, $k) use ($agent_group_search) {
|
function ($v, $k) use ($agent_group_search) {
|
||||||
return preg_match("/$agent_group_search/i", $v['name']);
|
return preg_match(
|
||||||
|
'/'.$agent_group_search.'/i',
|
||||||
|
$v['name']
|
||||||
|
);
|
||||||
},
|
},
|
||||||
ARRAY_FILTER_USE_BOTH
|
ARRAY_FILTER_USE_BOTH
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($info)) {
|
if (!empty($info)) {
|
||||||
$groups_view = $is_not_paginated ? $info : array_slice($info, $offset, $config['block_size']);
|
$groups_view = ($is_not_paginated) ? $info : array_slice(
|
||||||
|
$info,
|
||||||
|
$offset,
|
||||||
|
$config['block_size']
|
||||||
|
);
|
||||||
$agents_counters = array_reduce(
|
$agents_counters = array_reduce(
|
||||||
$groups_view,
|
$groups_view,
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
|
@ -113,7 +137,7 @@ function mainModuleGroups()
|
||||||
$array_module_group = array_filter(
|
$array_module_group = array_filter(
|
||||||
$array_module_group,
|
$array_module_group,
|
||||||
function ($v, $k) use ($module_group_search) {
|
function ($v, $k) use ($module_group_search) {
|
||||||
return preg_match("/$module_group_search/i", $v);
|
return preg_match('/'.$module_group_search.'/i', $v);
|
||||||
},
|
},
|
||||||
ARRAY_FILTER_USE_BOTH
|
ARRAY_FILTER_USE_BOTH
|
||||||
);
|
);
|
||||||
|
@ -125,66 +149,75 @@ function mainModuleGroups()
|
||||||
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
$sql = sprintf(
|
||||||
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
|
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||||
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
|
SUM(IF(%s, 1, 0)) AS warning_module_count,
|
||||||
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
|
SUM(IF(%s, 1, 0)) AS unknown_module_count,
|
||||||
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
|
SUM(IF(%s, 1, 0)) AS notInit_module_count,
|
||||||
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
|
SUM(IF(%s, 1, 0)) AS critical_module_count,
|
||||||
COUNT(tae.id_agente_modulo) AS total_count,
|
SUM(IF(%s, 1, 0)) AS normal_module_count,
|
||||||
tmg.id_mg,
|
COUNT(tae.id_agente_modulo) AS total_count,
|
||||||
tmg.name as n,
|
tmg.id_mg,
|
||||||
tg.id_grupo
|
tmg.name as n,
|
||||||
FROM (
|
tg.id_grupo
|
||||||
SELECT tam.id_agente_modulo,
|
FROM (
|
||||||
tam.id_module_group,
|
SELECT tam.id_agente_modulo,
|
||||||
ta.id_grupo AS g,
|
tam.id_module_group,
|
||||||
tae.estado,
|
ta.id_grupo AS g,
|
||||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
tae.estado,
|
||||||
FROM tagente_modulo tam
|
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||||
LEFT JOIN talert_template_modules tatm
|
FROM tagente_modulo tam
|
||||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
LEFT JOIN talert_template_modules tatm
|
||||||
AND tatm.times_fired = 1
|
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||||
LEFT JOIN tagente_estado tae
|
AND tatm.times_fired = 1
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
LEFT JOIN tagente_estado tae
|
||||||
INNER JOIN tagente ta
|
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||||
ON ta.id_agente = tam.id_agente
|
INNER JOIN tagente ta
|
||||||
WHERE ta.disabled = 0
|
ON ta.id_agente = tam.id_agente
|
||||||
AND tam.disabled = 0
|
WHERE ta.disabled = 0
|
||||||
AND tam.delete_pending = 0
|
AND tam.disabled = 0
|
||||||
AND ta.id_grupo IN ($ids_group)
|
AND tam.delete_pending = 0
|
||||||
GROUP BY tam.id_agente_modulo
|
AND ta.id_grupo IN (%s)
|
||||||
UNION ALL
|
GROUP BY tam.id_agente_modulo
|
||||||
SELECT tam.id_agente_modulo,
|
UNION ALL
|
||||||
tam.id_module_group,
|
SELECT tam.id_agente_modulo,
|
||||||
tasg.id_group AS g,
|
tam.id_module_group,
|
||||||
tae.estado,
|
tasg.id_group AS g,
|
||||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
tae.estado,
|
||||||
FROM tagente_modulo tam
|
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||||
LEFT JOIN talert_template_modules tatm
|
FROM tagente_modulo tam
|
||||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
LEFT JOIN talert_template_modules tatm
|
||||||
AND tatm.times_fired = 1
|
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||||
LEFT JOIN tagente_estado tae
|
AND tatm.times_fired = 1
|
||||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
LEFT JOIN tagente_estado tae
|
||||||
INNER JOIN tagente ta
|
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||||
ON ta.id_agente = tam.id_agente
|
INNER JOIN tagente ta
|
||||||
INNER JOIN tagent_secondary_group tasg
|
ON ta.id_agente = tam.id_agente
|
||||||
ON ta.id_agente = tasg.id_agent
|
INNER JOIN tagent_secondary_group tasg
|
||||||
WHERE ta.disabled = 0
|
ON ta.id_agente = tasg.id_agent
|
||||||
AND tam.disabled = 0
|
WHERE ta.disabled = 0
|
||||||
AND tam.delete_pending = 0
|
AND tam.disabled = 0
|
||||||
AND tasg.id_group IN ($ids_group)
|
AND tam.delete_pending = 0
|
||||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
AND tasg.id_group IN (%s)
|
||||||
) AS tae
|
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||||
RIGHT JOIN tgrupo tg
|
) AS tae
|
||||||
ON tg.id_grupo = tae.g
|
RIGHT JOIN tgrupo tg
|
||||||
INNER JOIN (
|
ON tg.id_grupo = tae.g
|
||||||
SELECT * FROM tmodule_group
|
INNER JOIN (
|
||||||
UNION ALL
|
SELECT * FROM tmodule_group
|
||||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
UNION ALL
|
||||||
) AS tmg
|
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||||
ON tae.id_module_group = tmg.id_mg
|
) AS tmg
|
||||||
GROUP BY tae.g, tmg.id_mg";
|
ON tae.id_module_group = tmg.id_mg
|
||||||
|
GROUP BY tae.g, tmg.id_mg",
|
||||||
|
$condition_warning,
|
||||||
|
$condition_unknown,
|
||||||
|
$condition_not_init,
|
||||||
|
$condition_critical,
|
||||||
|
$condition_normal,
|
||||||
|
$ids_group,
|
||||||
|
$ids_group
|
||||||
|
);
|
||||||
|
|
||||||
$array_data_prev = db_get_all_rows_sql($sql);
|
$array_data_prev = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
@ -192,7 +225,14 @@ function mainModuleGroups()
|
||||||
$array_data[$value['id_grupo']][$value['id_mg']] = $value;
|
$array_data[$value['id_grupo']][$value['id_mg']] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header(__('Combined table of agent group and module group'), 'images/module_group.png', false, '', false, '');
|
ui_print_page_header(
|
||||||
|
__('Combined table of agent group and module group'),
|
||||||
|
'images/module_group.png',
|
||||||
|
false,
|
||||||
|
'module_groups_view',
|
||||||
|
false,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
|
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
|
||||||
<tr>";
|
<tr>";
|
||||||
|
@ -213,11 +253,29 @@ function mainModuleGroups()
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
|
|
||||||
|
$cell_style = '
|
||||||
|
min-width: 60px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
overflow:hidden;
|
||||||
|
text-align: center;
|
||||||
|
padding: 5px;
|
||||||
|
padding-bottom:10px;
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: center;
|
||||||
|
';
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
|
||||||
|
if ($config['style'] === 'pandora_black') {
|
||||||
|
$background_color = '#333';
|
||||||
|
} else {
|
||||||
|
$background_color = '#fff';
|
||||||
|
}
|
||||||
|
|
||||||
$head[0] = __('Groups');
|
$head[0] = __('Groups');
|
||||||
$headstyle[0] = 'width: 20%; font-weight: bolder;';
|
$headstyle[0] = 'width: 20%; font-weight: bolder;';
|
||||||
foreach ($array_module_group as $key => $value) {
|
foreach ($array_module_group as $key => $value) {
|
||||||
|
@ -241,28 +299,28 @@ function mainModuleGroups()
|
||||||
$color = '#FFA631';
|
$color = '#FFA631';
|
||||||
// Orange when the cell for this model group and agent has at least one alert fired.
|
// Orange when the cell for this model group and agent has at least one alert fired.
|
||||||
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
||||||
$color = '#FC4444';
|
$color = '#e63c52';
|
||||||
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||||
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
|
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||||
$color = '#FAD403';
|
$color = '#f3b200';
|
||||||
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||||
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||||
$color = '#B2B2B2 ';
|
$color = '#B2B2B2 ';
|
||||||
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||||
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
|
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||||
$color = '#80BA27';
|
$color = '#82b92e';
|
||||||
// Green when the cell for this model group and agent has OK state all modules.
|
// Green when the cell for this model group and agent has OK state all modules.
|
||||||
} else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
} else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
||||||
$color = '#5BB6E5';
|
$color = '#5BB6E5';
|
||||||
// Blue when the cell for this module group and all modules have not init value.
|
// Blue when the cell for this module group and all modules have not init value.
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[$i][$j] = "<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
$data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
|
||||||
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
|
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
|
||||||
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
||||||
$data[$i][$j] .= '</a></div>';
|
$data[$i][$j] .= '</a></div>';
|
||||||
} else {
|
} else {
|
||||||
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
$data[$i][$j] = "<div style='background:".$background_color.';'.$cell_style."'>";
|
||||||
$data[$i][$j] .= 0;
|
$data[$i][$j] .= 0;
|
||||||
$data[$i][$j] .= '</div>';
|
$data[$i][$j] .= '</div>';
|
||||||
}
|
}
|
||||||
|
@ -271,7 +329,7 @@ function mainModuleGroups()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($value['gm'] as $k => $v) {
|
foreach ($value['gm'] as $k => $v) {
|
||||||
$data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
$data[$i][$j] = "<div style='background:".$background_color."; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||||
$data[$i][$j] .= 0;
|
$data[$i][$j] .= 0;
|
||||||
$data[$i][$j] .= '</div>';
|
$data[$i][$j] .= '</div>';
|
||||||
$j++;
|
$j++;
|
||||||
|
|
|
@ -1,26 +1,60 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Net tools utils.
|
||||||
|
*
|
||||||
|
* @category Extensions
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage NetTools
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
global $config;
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
// Requires.
|
||||||
// This program is free software; you can redistribute it and/or
|
require_once $config['homedir'].'/include/functions.php';
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
// This extension is usefull only if the agent has associated IP.
|
||||||
// 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.
|
|
||||||
$id_agente = get_parameter('id_agente');
|
$id_agente = get_parameter('id_agente');
|
||||||
|
|
||||||
// This extension is usefull only if the agent has associated IP
|
|
||||||
$address = agents_get_address($id_agente);
|
$address = agents_get_address($id_agente);
|
||||||
|
|
||||||
if (!empty($address) || empty($id_agente)) {
|
if (!empty($address) || empty($id_agente)) {
|
||||||
extensions_add_opemode_tab_agent('network_tools', 'Network Tools', 'extensions/net_tools/nettool.png', 'main_net_tools', 'v1r1', 'AW');
|
extensions_add_opemode_tab_agent(
|
||||||
|
'network_tools',
|
||||||
|
'Network Tools',
|
||||||
|
'extensions/net_tools/nettool.png',
|
||||||
|
'main_net_tools',
|
||||||
|
'v1r1',
|
||||||
|
'AW'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searchs for command.
|
||||||
|
*
|
||||||
|
* @param string $command Command.
|
||||||
|
*
|
||||||
|
* @return string Path.
|
||||||
|
*/
|
||||||
function whereis_the_command($command)
|
function whereis_the_command($command)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -63,6 +97,9 @@ function whereis_the_command($command)
|
||||||
return $snmpget_path;
|
return $snmpget_path;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,85 +124,20 @@ function whereis_the_command($command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function main_net_tools()
|
/**
|
||||||
|
* Execute net tools action.
|
||||||
|
*
|
||||||
|
* @param integer $operation Operation.
|
||||||
|
* @param string $ip Ip.
|
||||||
|
* @param string $community Community.
|
||||||
|
* @param string $snmp_version SNMP version.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function net_tools_execute($operation, $ip, $community, $snmp_version)
|
||||||
{
|
{
|
||||||
$id_agente = get_parameter('id_agente');
|
|
||||||
$principal_ip = db_get_sql("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
|
||||||
|
|
||||||
$list_address = db_get_all_rows_sql('select id_a from taddress_agent where id_agent = '.$id_agente);
|
|
||||||
foreach ($list_address as $address) {
|
|
||||||
$ids[] = join(',', $address);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ids_address = implode(',', $ids);
|
|
||||||
$ips = db_get_all_rows_sql('select ip from taddress where id_a in ('.$ids_address.')');
|
|
||||||
|
|
||||||
if ($ips == '') {
|
|
||||||
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<script type='text/javascript'>
|
|
||||||
function mostrarColumns(ValueSelect) {
|
|
||||||
value = ValueSelect.value;
|
|
||||||
if (value == 3) {
|
|
||||||
$('netToolTable').css('width','100%');
|
|
||||||
$('#snmpcolumn').show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('netToolTable').css('width','100%');
|
|
||||||
$('#snmpcolumn').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>";
|
|
||||||
|
|
||||||
echo '<div>';
|
|
||||||
echo "<form name='actionbox' method='post'>";
|
|
||||||
echo "<table class='databox filters' width=100% id=netToolTable>";
|
|
||||||
echo '<tr><td>';
|
|
||||||
echo __('Operation');
|
|
||||||
ui_print_help_tip(
|
|
||||||
__('You can set the command path in the menu Administration -> Extensions -> Config Network Tools')
|
|
||||||
);
|
|
||||||
echo '</td><td>';
|
|
||||||
echo "<select name='operation' onChange='mostrarColumns(this);'>";
|
|
||||||
echo "<option value='1'>".__('Traceroute');
|
|
||||||
echo "<option value='2'>".__('Ping host & Latency');
|
|
||||||
echo "<option value='3'>".__('SNMP Interface status');
|
|
||||||
echo "<option value='4'>".__('Basic TCP Port Scan');
|
|
||||||
echo "<option value='5'>".__('DiG/Whois Lookup');
|
|
||||||
echo '</select>';
|
|
||||||
echo '</td>';
|
|
||||||
echo '<td>';
|
|
||||||
echo __('IP address');
|
|
||||||
echo '</td><td>';
|
|
||||||
echo "<select name='select_ips'>";
|
|
||||||
foreach ($ips as $ip) {
|
|
||||||
if ($ip['ip'] == $principal_ip) {
|
|
||||||
echo "<option value='".$ip['ip']."' selected = 'selected'>".$ip['ip'];
|
|
||||||
} else {
|
|
||||||
echo "<option value='".$ip['ip']."'>".$ip['ip'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</select>';
|
|
||||||
echo '</td>';
|
|
||||||
echo "<td id='snmpcolumn' style=\"display:none;\">";
|
|
||||||
echo __('SNMP Community').' ';
|
|
||||||
echo "<input name=community type=text value='public'>";
|
|
||||||
echo '</td><td>';
|
|
||||||
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
|
|
||||||
echo '</td>';
|
|
||||||
echo '</tr></table>';
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
$operation = get_parameter('operation', 0);
|
|
||||||
$community = get_parameter('community', 'public');
|
|
||||||
$ip = get_parameter('select_ips');
|
|
||||||
|
|
||||||
if (!validate_address($ip)) {
|
if (!validate_address($ip)) {
|
||||||
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
|
ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
|
||||||
} else {
|
} else {
|
||||||
switch ($operation) {
|
switch ($operation) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -175,7 +147,7 @@ function main_net_tools()
|
||||||
} else {
|
} else {
|
||||||
echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
|
echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
echo system("$traceroute $ip");
|
echo system($traceroute.' '.$ip);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -187,7 +159,7 @@ function main_net_tools()
|
||||||
} else {
|
} else {
|
||||||
echo '<h3>'.__('Ping to %s', $ip).'</h3>';
|
echo '<h3>'.__('Ping to %s', $ip).'</h3>';
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
echo system("$ping -c 5 $ip");
|
echo system($ping.' -c 5 '.$ip);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -199,7 +171,7 @@ function main_net_tools()
|
||||||
} else {
|
} else {
|
||||||
echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
|
echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
echo system("$nmap -F $ip");
|
echo system($nmap.' -F '.$ip);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -212,7 +184,7 @@ function main_net_tools()
|
||||||
ui_print_error_message(__('Dig executable does not exist.'));
|
ui_print_error_message(__('Dig executable does not exist.'));
|
||||||
} else {
|
} else {
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
echo system("dig $ip");
|
echo system('dig '.$ip);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,51 +193,227 @@ function main_net_tools()
|
||||||
ui_print_error_message(__('Whois executable does not exist.'));
|
ui_print_error_message(__('Whois executable does not exist.'));
|
||||||
} else {
|
} else {
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
echo system("whois $ip");
|
echo system('whois '.$ip);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
$snmp_obj = [
|
||||||
|
'ip_target' => $ip,
|
||||||
|
'snmp_version' => $snmp_version,
|
||||||
|
'snmp_community' => $community,
|
||||||
|
'format' => '-Oqn',
|
||||||
|
];
|
||||||
|
|
||||||
|
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0';
|
||||||
|
$result = get_h_snmpwalk($snmp_obj);
|
||||||
echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
|
echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
|
||||||
|
echo '<h4>'.__('Uptime').'</h4>';
|
||||||
$snmpget = whereis_the_command('snmpget');
|
echo '<pre>';
|
||||||
if (empty($snmpget)) {
|
if (empty($result)) {
|
||||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
ui_print_error_message(__('Target unreachable.'));
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
echo '<h4>'.__('Uptime').'</h4>';
|
echo array_pop($result);
|
||||||
echo '<pre>';
|
|
||||||
echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
|
||||||
echo '</pre>';
|
|
||||||
echo '<h4>'.__('Device info').'</h4>';
|
|
||||||
echo '<pre>';
|
|
||||||
|
|
||||||
echo system("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
|
||||||
echo '</pre>';
|
|
||||||
|
|
||||||
echo '<h4>Interface Information</h4>';
|
|
||||||
echo '<table class=databox>';
|
|
||||||
echo '<tr><th>'.__('Interface');
|
|
||||||
echo '<th>'.__('Status');
|
|
||||||
|
|
||||||
$int_max = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
|
||||||
|
|
||||||
for ($ax = 0; $ax < $int_max; $ax++) {
|
|
||||||
$interface = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
|
||||||
$estado = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
|
||||||
echo "<tr><td>$interface<td>$estado";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</table>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '</pre>';
|
||||||
|
echo '<h4>'.__('Device info').'</h4>';
|
||||||
|
echo '<pre>';
|
||||||
|
$snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0';
|
||||||
|
$result = get_h_snmpwalk($snmp_obj);
|
||||||
|
if (empty($result)) {
|
||||||
|
ui_print_error_message(__('Target unreachable.'));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
echo array_pop($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
echo '<h4>Interface Information</h4>';
|
||||||
|
|
||||||
|
$table = new StdClass();
|
||||||
|
$table->class = 'databox';
|
||||||
|
$table->head = [];
|
||||||
|
$table->head[] = __('Interface');
|
||||||
|
$table->head[] = __('Status');
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$base_oid = '.1.3.6.1.2.1.2.2.1';
|
||||||
|
$idx_oids = '.1';
|
||||||
|
$names_oids = '.2';
|
||||||
|
$status_oids = '.8';
|
||||||
|
|
||||||
|
$snmp_obj['base_oid'] = $base_oid.$idx_oids;
|
||||||
|
$idx = get_h_snmpwalk($snmp_obj);
|
||||||
|
|
||||||
|
$snmp_obj['base_oid'] = $base_oid.$names_oids;
|
||||||
|
$names = get_h_snmpwalk($snmp_obj);
|
||||||
|
|
||||||
|
$snmp_obj['base_oid'] = $base_oid.$status_oids;
|
||||||
|
$statuses = get_h_snmpwalk($snmp_obj);
|
||||||
|
|
||||||
|
foreach ($idx as $k => $v) {
|
||||||
|
$index = str_replace($base_oid.$idx_oids, '', $k);
|
||||||
|
$name = $names[$base_oid.$names_oids.$index];
|
||||||
|
|
||||||
|
$status = $statuses[$base_oid.$status_oids.$index];
|
||||||
|
|
||||||
|
$table->data[$i][0] = $name;
|
||||||
|
$table->data[$i++][1] = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_table($table);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignore.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main function.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function main_net_tools()
|
||||||
|
{
|
||||||
|
$operation = get_parameter('operation', 0);
|
||||||
|
$community = get_parameter('community', 'public');
|
||||||
|
$ip = get_parameter('select_ips');
|
||||||
|
$snmp_version = get_parameter('select_version');
|
||||||
|
|
||||||
|
// Show form.
|
||||||
|
$id_agente = get_parameter('id_agente', 0);
|
||||||
|
$principal_ip = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT direccion FROM tagente WHERE id_agente = %d',
|
||||||
|
$id_agente
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$list_address = db_get_all_rows_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_a FROM taddress_agent WHERE id_agent = %d',
|
||||||
|
$id_agente
|
||||||
|
)
|
||||||
|
);
|
||||||
|
foreach ($list_address as $address) {
|
||||||
|
$ids[] = join(',', $address);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ips = db_get_all_rows_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT ip FROM taddress WHERE id_a IN (%s)',
|
||||||
|
join($ids)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($ips == '') {
|
||||||
|
echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Javascript.
|
||||||
|
?>
|
||||||
|
<script type='text/javascript'>
|
||||||
|
$(document).ready(function(){
|
||||||
|
mostrarColumns($('#operation :selected').val());
|
||||||
|
});
|
||||||
|
|
||||||
|
function mostrarColumns(value) {
|
||||||
|
if (value == 3) {
|
||||||
|
$('.snmpcolumn').show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.snmpcolumn').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
echo '<div>';
|
||||||
|
echo "<form name='actionbox' method='post'>";
|
||||||
|
echo "<table class='databox filters' width=100% id=netToolTable>";
|
||||||
|
echo '<tr><td>';
|
||||||
|
echo __('Operation');
|
||||||
|
ui_print_help_tip(
|
||||||
|
__('You can set the command path in the menu Administration -> Extensions -> Config Network Tools')
|
||||||
|
);
|
||||||
|
echo '</td><td>';
|
||||||
|
|
||||||
|
html_print_select(
|
||||||
|
[
|
||||||
|
1 => __('Traceroute'),
|
||||||
|
2 => __('Ping host & Latency'),
|
||||||
|
3 => __('SNMP Interface status'),
|
||||||
|
4 => __('Basic TCP Port Scan'),
|
||||||
|
5 => __('DiG/Whois Lookup'),
|
||||||
|
],
|
||||||
|
'operation',
|
||||||
|
$operation,
|
||||||
|
'mostrarColumns(this.value)',
|
||||||
|
__('Please select')
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '</td>';
|
||||||
|
echo '<td>';
|
||||||
|
echo __('IP address');
|
||||||
|
echo '</td><td>';
|
||||||
|
|
||||||
|
$ips_for_select = array_reduce(
|
||||||
|
$ips,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['ip']] = $item['ip'];
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
html_print_select(
|
||||||
|
$ips_for_select,
|
||||||
|
'select_ips',
|
||||||
|
$principal_ip
|
||||||
|
);
|
||||||
|
echo '</td>';
|
||||||
|
echo "<td class='snmpcolumn'>";
|
||||||
|
echo __('SNMP Version');
|
||||||
|
html_print_select(
|
||||||
|
[
|
||||||
|
'1' => 'v1',
|
||||||
|
'2c' => 'v2c',
|
||||||
|
],
|
||||||
|
'select_version',
|
||||||
|
$snmp_version
|
||||||
|
);
|
||||||
|
echo '</td><td class="snmpcolumn">';
|
||||||
|
echo __('SNMP Community').' ';
|
||||||
|
html_print_input_text('community', $community);
|
||||||
|
echo '</td><td>';
|
||||||
|
echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
|
||||||
|
echo '</td>';
|
||||||
|
echo '</tr></table>';
|
||||||
|
echo '</form>';
|
||||||
|
|
||||||
|
if ($operation) {
|
||||||
|
// Execute form.
|
||||||
|
net_tools_execute($operation, $ip, $community, $snmp_version);
|
||||||
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add option.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function godmode_net_tools()
|
function godmode_net_tools()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
|
@ -29,7 +29,14 @@ function pandora_realtime_graphs()
|
||||||
|
|
||||||
$hide_header = get_parameter('hide_header', 0);
|
$hide_header = get_parameter('hide_header', 0);
|
||||||
if (!$hide_header) {
|
if (!$hide_header) {
|
||||||
ui_print_page_header(__('Realtime graphs'), 'images/extensions.png', false, '', false, $onheader);
|
ui_print_page_header(
|
||||||
|
__('Realtime graphs'),
|
||||||
|
'images/extensions.png',
|
||||||
|
false,
|
||||||
|
'real_time_view',
|
||||||
|
false,
|
||||||
|
$onheader
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart[time()]['graph'] = '0';
|
$chart[time()]['graph'] = '0';
|
||||||
|
@ -166,7 +173,7 @@ function pandora_realtime_graphs()
|
||||||
$table->colspan[2]['snmp_oid'] = 2;
|
$table->colspan[2]['snmp_oid'] = 2;
|
||||||
|
|
||||||
$data['snmp_ver'] = __('Version').' '.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
$data['snmp_ver'] = __('Version').' '.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
|
||||||
$data['snmp_ver'] .= ' '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true);
|
$data['snmp_ver'] .= ' '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true);
|
||||||
$table->colspan[2]['snmp_ver'] = 2;
|
$table->colspan[2]['snmp_ver'] = 2;
|
||||||
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
|
|
||||||
#graph_container {
|
#graph_container {
|
||||||
width: 800px;
|
width: 800px;
|
||||||
margin: 20px auto !important;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
var plot;
|
var plot;
|
||||||
var plotOptions = {
|
var plotOptions = {
|
||||||
legend: { container: $("#chartLegend") },
|
legend: {
|
||||||
|
container: $("#chartLegend")
|
||||||
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
tickFormatter: function(timestamp, axis) {
|
tickFormatter: function(timestamp, axis) {
|
||||||
var date = new Date(timestamp * 1000);
|
var date = new Date(timestamp * 1000);
|
||||||
|
@ -131,47 +133,6 @@
|
||||||
resetDataPooling();
|
resetDataPooling();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the form OID to the value selected in the SNMP browser
|
|
||||||
function setOID() {
|
|
||||||
if ($("#snmp_browser_version").val() == "3") {
|
|
||||||
$("#text-snmp_oid").val($("#table1-0-1").text());
|
|
||||||
} else {
|
|
||||||
$("#text-snmp_oid").val($("#snmp_selected_oid").text());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the SNMP browser
|
|
||||||
$(".ui-dialog-titlebar-close").trigger("click");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show the SNMP browser window
|
|
||||||
function snmpBrowserWindow() {
|
|
||||||
// Keep elements in the form and the SNMP browser synced
|
|
||||||
$("#text-target_ip").val($("#text-ip_target").val());
|
|
||||||
$("#text-community").val($("#text-snmp_community").val());
|
|
||||||
$("#snmp_browser_version").val($("#snmp_version").val());
|
|
||||||
$("#snmp3_browser_auth_user").val($("#snmp3_auth_user").val());
|
|
||||||
$("#snmp3_browser_security_level").val($("#snmp3_security_level").val());
|
|
||||||
$("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val());
|
|
||||||
$("#snmp3_browser_auth_pass").val($("#snmp3_auth_pass").val());
|
|
||||||
$("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val());
|
|
||||||
$("#snmp3_browser_privacy_pass").val($("#snmp3_privacy_pass").val());
|
|
||||||
|
|
||||||
$("#snmp_browser_container")
|
|
||||||
.show()
|
|
||||||
.dialog({
|
|
||||||
title: "",
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
width: 920,
|
|
||||||
height: 500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function shortNumber(number) {
|
function shortNumber(number) {
|
||||||
if (Math.round(number) != number) return number;
|
if (Math.round(number) != number) return number;
|
||||||
number = Number.parseInt(number);
|
number = Number.parseInt(number);
|
||||||
|
@ -187,6 +148,7 @@
|
||||||
|
|
||||||
return number + " " + shorts[pos];
|
return number + " " + shorts[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
function roundToTwo(num) {
|
function roundToTwo(num) {
|
||||||
return +(Math.round(num + "e+2") + "e-2");
|
return +(Math.round(num + "e+2") + "e-2");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
/godmode/servers/recon_script.php
|
operation/servers/recon_view.php
|
||||||
/godmode/servers/manage_recontask_form.php
|
|
||||||
/godmode/servers/manage_recontask.php
|
|
|
@ -9,8 +9,37 @@ ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
|
||||||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
||||||
|
|
||||||
DELETE FROM `tevent_response` WHERE `name` LIKE 'Create Integria IMS incident from event';
|
DELETE FROM `tevent_response` WHERE `name` LIKE 'Create Integria IMS incident from event';
|
||||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official communication"), "admin", 1, 0);
|
||||||
|
UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System status' OR `description` = 'Official communication';
|
||||||
|
UPDATE `tnotification_source` SET `icon`="icono_logo_pandora.png" WHERE `description` = 'Official communication';
|
||||||
|
|
||||||
COMMIT;
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tvisual_console_items_cache`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tvisual_console_elements_cache` (
|
||||||
|
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`vc_id` INTEGER UNSIGNED NOT NULL,
|
||||||
|
`vc_item_id` INTEGER UNSIGNED NOT NULL,
|
||||||
|
`user_id` VARCHAR(60) DEFAULT NULL,
|
||||||
|
`data` TEXT NOT NULL,
|
||||||
|
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire',
|
||||||
|
PRIMARY KEY(`id`),
|
||||||
|
FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`)
|
||||||
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_user` VARCHAR(60);
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_pass` VARCHAR(45);
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_enabled` TINYINT(1) DEFAULT '1';
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`);
|
||||||
|
|
||||||
|
DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||||
|
`identifier` varchar(100) NOT NULL,
|
||||||
|
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||||
|
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
||||||
|
`username` text,
|
||||||
|
`password` text,
|
||||||
|
`extra_1` text,
|
||||||
|
`extra_2` text,
|
||||||
|
PRIMARY KEY (`identifier`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `tcredential_store` (`identifier`, `id_group`, `product`, `username`, `password`) VALUES ("imported_aws_account", 0, "AWS", (SELECT `value` FROM `tconfig` WHERE `token` = "aws_access_key_id" LIMIT 1), (SELECT `value` FROM `tconfig` WHERE `token` = "aws_secret_access_key" LIMIT 1));
|
||||||
|
DELETE FROM `tcredential_store` WHERE `username` IS NULL AND `password` IS NULL;
|
||||||
|
|
||||||
|
UPDATE `tagente` ta INNER JOIN `tagente` taa on ta.`id_parent` = taa.`id_agente` AND taa.`nombre` IN ("us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1") SET ta.nombre = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), ta.`nombre`));
|
||||||
|
|
||||||
|
UPDATE `tagente` SET `nombre` = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), `nombre`)) WHERE `nombre` IN ("Aws", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1");
|
||||||
|
|
||||||
|
UPDATE `trecon_task` SET `auth_strings` = "imported_aws_account" WHERE `type` IN (2,6,7);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,13 @@
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||||
|
|
||||||
|
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -139,8 +139,9 @@ function get_logs_size($file)
|
||||||
function get_status_logs($path)
|
function get_status_logs($path)
|
||||||
{
|
{
|
||||||
$status_server_log = '';
|
$status_server_log = '';
|
||||||
$size_server_log = get_logs_size($path);
|
$size_server_log = number_format(get_logs_size($path));
|
||||||
if ($size_server_log <= 1048576) {
|
$size_server_log = (0 + str_replace(',', '', $size_server_log));
|
||||||
|
if ($size_server_log <= 10485760) {
|
||||||
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   You have less than 10 MB of logs</a>";
|
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   You have less than 10 MB of logs</a>";
|
||||||
} else {
|
} else {
|
||||||
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   You have more than 10 MB of logs</a>";
|
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   You have more than 10 MB of logs</a>";
|
||||||
|
@ -295,7 +296,7 @@ $key_buffer_size_min_rec_value = 256;
|
||||||
$read_buffer_size_min_rec_value = 32;
|
$read_buffer_size_min_rec_value = 32;
|
||||||
$read_rnd_buffer_size_min_rec_value = 32;
|
$read_rnd_buffer_size_min_rec_value = 32;
|
||||||
$query_cache_min_res_unit_min_rec_value = 2;
|
$query_cache_min_res_unit_min_rec_value = 2;
|
||||||
$innodb_file_per_table_min_rec_value = 0;
|
$innodb_file_per_table_min_rec_value = 1;
|
||||||
|
|
||||||
|
|
||||||
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation)
|
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation)
|
||||||
|
@ -345,17 +346,23 @@ if ($console_mode == 1) {
|
||||||
include '../include/config.php';
|
include '../include/config.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not from console, this is a web session
|
// Not from console, this is a web session.
|
||||||
if ((!isset($config['id_user'])) or (!check_acl($config['id_user'], 0, 'PM'))) {
|
if ((!isset($config['id_user'])) || (!check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
echo "<h2>You don't have privileges to use diagnostic tool</h2>";
|
echo "<h2>You don't have privileges to use diagnostic tool</h2>";
|
||||||
echo '<p>Please login with an administrator account before try to use this tool</p>';
|
echo '<p>Please login with an administrator account before try to use this tool</p>';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(__('Pandora FMS Diagnostic tool'), '', false, '', true);
|
ui_print_page_header(
|
||||||
|
__('Pandora FMS Diagnostic tool'),
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'diagnostic_tool_tab',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
|
echo "<table id='diagnostic_info' width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
|
||||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
|
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +685,7 @@ render_info_data(
|
||||||
$read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024);
|
$read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024);
|
||||||
$query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024);
|
$query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024);
|
||||||
$innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table');
|
$innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table');
|
||||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('MySQL Performance metrics').'</th></tr>';
|
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).'</th></tr>';
|
||||||
|
|
||||||
render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size ');
|
render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size ');
|
||||||
render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size ');
|
render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size ');
|
||||||
|
|
|
@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE
|
||||||
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` 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 `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
|
||||||
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||||
|
@ -1007,10 +1009,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||||
`agent_version` varchar(100) default '',
|
`agent_version` varchar(100) default '',
|
||||||
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
|
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
|
||||||
`disabled` tinyint(2) NOT NULL default '0',
|
`disabled` tinyint(2) NOT NULL default '0',
|
||||||
|
`remote` tinyint(1) NOT NULL default '0',
|
||||||
`id_parent` int(10) unsigned default '0',
|
`id_parent` int(10) unsigned default '0',
|
||||||
`custom_id` varchar(255) default '',
|
`custom_id` varchar(255) default '',
|
||||||
`server_name` varchar(100) default '',
|
`server_name` varchar(100) default '',
|
||||||
`cascade_protection` tinyint(2) NOT NULL default '0',
|
`cascade_protection` tinyint(2) NOT NULL default '0',
|
||||||
|
`cascade_protection_module` int(10) unsigned default '0',
|
||||||
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
|
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
|
||||||
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
||||||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||||
|
@ -1025,19 +1029,21 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||||
`fired_count` bigint(20) NOT NULL default '0',
|
`fired_count` bigint(20) NOT NULL default '0',
|
||||||
`update_module_count` tinyint(1) NOT NULL default '0',
|
`update_module_count` tinyint(1) NOT NULL default '0',
|
||||||
`update_alert_count` tinyint(1) NOT NULL default '0',
|
`update_alert_count` tinyint(1) NOT NULL default '0',
|
||||||
|
`update_secondary_groups` tinyint(1) NOT NULL default '0',
|
||||||
|
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||||
|
`alias` varchar(600) BINARY NOT NULL default '',
|
||||||
|
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||||
|
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||||
|
`cps` int NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_agente`),
|
PRIMARY KEY (`id_agente`),
|
||||||
KEY `nombre` (`nombre`(255)),
|
KEY `nombre` (`nombre`(255)),
|
||||||
KEY `direccion` (`direccion`),
|
KEY `direccion` (`direccion`),
|
||||||
|
KEY `id_tagente_idx` (`id_tagente`),
|
||||||
KEY `disabled` (`disabled`),
|
KEY `disabled` (`disabled`),
|
||||||
KEY `id_grupo` (`id_grupo`),
|
KEY `id_grupo` (`id_grupo`),
|
||||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
|
||||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
|
||||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
|
||||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `ttransaction`
|
-- Table `ttransaction`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -1235,13 +1241,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 28);
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30);
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '735');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -1288,6 +1294,11 @@ alter table tusuario add autorefresh_white_list text not null default '';
|
||||||
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
||||||
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||||
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
|
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_user` VARCHAR(60);
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_pass` VARCHAR(45);
|
||||||
|
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_level_enabled` TINYINT(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tagente_modulo`
|
-- Table `tagente_modulo`
|
||||||
|
@ -1370,6 +1381,7 @@ ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default
|
||||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||||
|
ALTER TABLE `tlayout_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tagent_custom_fields`
|
-- Table `tagent_custom_fields`
|
||||||
|
@ -1432,11 +1444,14 @@ 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_max_value` TINYINT(1) DEFAULT '1';
|
||||||
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
|
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
|
||||||
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tmodule_relationship`
|
-- Table `tmodule_relationship`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
|
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tpolicy_module`
|
-- Table `tpolicy_module`
|
||||||
|
@ -1983,6 +1998,33 @@ CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
|
||||||
UNIQUE (`source`, `destination`, `utimestamp`)
|
UNIQUE (`source`, `destination`, `utimestamp`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `user_task`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tuser_task` (
|
||||||
|
`id` int(20) unsigned NOT NULL auto_increment,
|
||||||
|
`function_name` varchar(80) NOT NULL default '',
|
||||||
|
`parameters` text NOT NULL default '',
|
||||||
|
`name` varchar(60) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `user_task_scheduled`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tuser_task_scheduled` (
|
||||||
|
`id` int(20) unsigned NOT NULL auto_increment,
|
||||||
|
`id_usuario` varchar(60) NOT NULL default '0',
|
||||||
|
`id_user_task` int(20) unsigned NOT NULL default '0',
|
||||||
|
`args` TEXT NOT NULL,
|
||||||
|
`scheduled` enum('no','hourly','daily','weekly','monthly','yearly','custom') default 'no',
|
||||||
|
`last_run` int(20) unsigned default '0',
|
||||||
|
`custom_data` int(10) NULL default '0',
|
||||||
|
`flag_delete` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||||
|
`id_grupo` int(10) unsigned NOT NULL default 0,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tnotification_source`
|
-- Table `tnotification_source`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@ -2005,7 +2047,7 @@ INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `
|
||||||
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||||
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||||
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||||
("Official communication", "icono_info_mr.png", 86400, 1, 1, 0),
|
("Official communication", "icono_logo_pandora.png", 86400, 1, 1, 0),
|
||||||
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@ -2102,6 +2144,9 @@ INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fi
|
||||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
||||||
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
||||||
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
||||||
|
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official communication"), "admin", 1, 0);
|
||||||
|
UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System status' OR `description` = 'Official communication';
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
-- Add custom internal recon scripts
|
-- Add custom internal recon scripts
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
|
@ -2123,11 +2168,11 @@ ALTER TABLE `tnetflow_filter` DROP COLUMN `output`;
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
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";
|
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";
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
------ ADD message in table 'tnews'
|
-- ADD message in table 'tnews'
|
||||||
------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
|
|
||||||
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (NULL,'admin','Welcome to Pandora FMS Console', '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ',NOW());
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
-- Alter table `talert_templates`
|
-- Alter table `talert_templates`
|
||||||
|
@ -2135,3 +2180,42 @@ INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES
|
||||||
|
|
||||||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tvisual_console_items_cache`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE `tvisual_console_elements_cache` (
|
||||||
|
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`vc_id` INTEGER UNSIGNED NOT NULL,
|
||||||
|
`vc_item_id` INTEGER UNSIGNED NOT NULL,
|
||||||
|
`user_id` VARCHAR(60) DEFAULT NULL,
|
||||||
|
`data` TEXT NOT NULL,
|
||||||
|
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`expiration` INTEGER UNSIGNED NOT NULL COMMENT 'Seconds to expire',
|
||||||
|
PRIMARY KEY(`id`),
|
||||||
|
FOREIGN KEY(`vc_id`) REFERENCES `tlayout`(`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY(`vc_item_id`) REFERENCES `tlayout_data`(`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`user_id`) REFERENCES `tusuario`(`id_user`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `tcredential_store`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
||||||
|
`identifier` varchar(100) NOT NULL,
|
||||||
|
`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
|
||||||
|
`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
|
||||||
|
`username` text,
|
||||||
|
`password` text,
|
||||||
|
`extra_1` text,
|
||||||
|
`extra_2` text,
|
||||||
|
PRIMARY KEY (`identifier`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- Table `treport_content_sla_combined`
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
|
||||||
|
|
|
@ -35,6 +35,7 @@ ui_require_css_file('firts_task');
|
||||||
</p>
|
</p>
|
||||||
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
|
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
|
||||||
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
|
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
|
||||||
|
<input type="hidden" name="discovery_hint" value="1"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,6 +20,8 @@ if (isset($_SERVER['REQUEST_TIME'])) {
|
||||||
$time = get_system_time();
|
$time = get_system_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_require_css_file('footer');
|
||||||
|
|
||||||
$license_file = 'general/license/pandora_info_'.$config['language'].'.html';
|
$license_file = 'general/license/pandora_info_'.$config['language'].'.html';
|
||||||
if (! file_exists($config['homedir'].$license_file)) {
|
if (! file_exists($config['homedir'].$license_file)) {
|
||||||
$license_file = 'general/license/pandora_info_en.html';
|
$license_file = 'general/license/pandora_info_en.html';
|
||||||
|
@ -41,9 +43,17 @@ if ($current_package == 0) {
|
||||||
$build_package_version = $current_package;
|
$build_package_version = $current_package;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
|
echo __(
|
||||||
|
'%s %s - Build %s - MR %s',
|
||||||
|
get_product_name(),
|
||||||
|
$pandora_version,
|
||||||
|
$build_package_version,
|
||||||
|
$config['MR']
|
||||||
|
);
|
||||||
|
echo '</a><br />';
|
||||||
|
echo '<small><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span></small>';
|
||||||
|
|
||||||
|
|
||||||
echo '</a> ';
|
|
||||||
|
|
||||||
if (isset($config['debug'])) {
|
if (isset($config['debug'])) {
|
||||||
$cache_info = [];
|
$cache_info = [];
|
||||||
|
|
|
@ -143,6 +143,57 @@ if ($config['menu_type'] == 'classic') {
|
||||||
$_GET['sec2'] = '';
|
$_GET['sec2'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
|
||||||
|
// home screen chosen by the user
|
||||||
|
$home_page = '';
|
||||||
|
if (isset($config['id_user'])) {
|
||||||
|
$user_info = users_get_user_by_id($config['id_user']);
|
||||||
|
$home_page = io_safe_output($user_info['section']);
|
||||||
|
$home_url = $user_info['data_section'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($home_page != '') {
|
||||||
|
switch ($home_page) {
|
||||||
|
case 'Event list':
|
||||||
|
$_GET['sec2'] = 'operation/events/events';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Group view':
|
||||||
|
$_GET['sec2'] = 'operation/agentes/group_view';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Alert detail':
|
||||||
|
$_GET['sec2'] = 'operation/agentes/alerts_status';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Tactical view':
|
||||||
|
$_GET['sec2'] = 'operation/agentes/tactical';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Default':
|
||||||
|
$_GET['sec2'] = 'general/logon_ok';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Dashboard':
|
||||||
|
$_GET['sec2'] = 'enterprise/dashboard/main_dashboard';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Visual console':
|
||||||
|
$_GET['sec2'] = 'operation/visual_console/render_view';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Other':
|
||||||
|
$home_url = io_safe_output($home_url);
|
||||||
|
$url_array = parse_url($home_url);
|
||||||
|
parse_str($url_array['query'], $res);
|
||||||
|
foreach ($res as $key => $param) {
|
||||||
|
$_GET[$key] = $param;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($_GET['refr'])) {
|
if (!isset($_GET['refr'])) {
|
||||||
$_GET['refr'] = null;
|
$_GET['refr'] = null;
|
||||||
}
|
}
|
||||||
|
@ -212,14 +263,21 @@ if ($config['menu_type'] == 'classic') {
|
||||||
);
|
);
|
||||||
$autorefresh_additional .= '</span>';
|
$autorefresh_additional .= '</span>';
|
||||||
unset($values);
|
unset($values);
|
||||||
|
if ($home_page != '') {
|
||||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
$autorefresh_link_open_img = '<a class="white autorefresh" href="index.php?refr=">';
|
||||||
|
} else {
|
||||||
|
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET['refr']
|
if ($_GET['refr']
|
||||||
|| ((isset($select[0]['time_autorefresh']) === true)
|
|| ((isset($select[0]['time_autorefresh']) === true)
|
||||||
&& $select[0]['time_autorefresh'] !== 0)
|
&& $select[0]['time_autorefresh'] !== 0)
|
||||||
) {
|
) {
|
||||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
if ($home_page != '') {
|
||||||
|
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="index.php?refr=">';
|
||||||
|
} else {
|
||||||
|
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$autorefresh_link_open_txt = '<a>';
|
$autorefresh_link_open_txt = '<a>';
|
||||||
}
|
}
|
||||||
|
@ -614,7 +672,7 @@ if ($config['menu_type'] == 'classic') {
|
||||||
if ($_GET['refr'] || $do_refresh === true) {
|
if ($_GET['refr'] || $do_refresh === true) {
|
||||||
?>
|
?>
|
||||||
$("#header_autorefresh").css('padding-right', '5px');
|
$("#header_autorefresh").css('padding-right', '5px');
|
||||||
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
|
var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
|
||||||
var t = new Date();
|
var t = new Date();
|
||||||
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
|
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
|
||||||
$("#refrcounter").countdown ({
|
$("#refrcounter").countdown ({
|
||||||
|
|
|
@ -1,455 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package General
|
|
||||||
*/
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
|
|
||||||
function display_register($data)
|
|
||||||
{
|
|
||||||
if ($data['instance_registered'] == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['force_register'] == 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['force_register'] == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['identification_reminder'] == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($data['identification_reminder_timestamp'])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['identification_reminder_timestamp'] < time()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function display_newsletter($data)
|
|
||||||
{
|
|
||||||
if ($data['newsletter_subscribed'] == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['force_newsletter'] == 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['force_newsletter'] == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['newsletter_reminder'] === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($data['newsletter_reminder_timestamp'])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_numeric($data['newsletter_reminder_timestamp'])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['newsletter_reminder_timestamp'] < time()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
|
||||||
include_once $config['homedir'].'/include/functions_update_manager.php';
|
|
||||||
|
|
||||||
$open_wizard = get_parameter('open_wizard', 0);
|
|
||||||
$not_return = get_parameter('not_return', 0);
|
|
||||||
$reset_initial_wizard = get_parameter('reset_initial_wizard', 0);
|
|
||||||
|
|
||||||
if ($reset_initial_wizard) {
|
|
||||||
config_update_value('initial_wizard', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($open_wizard) {
|
|
||||||
$register_pandora = get_parameter('register_pandora', 0);
|
|
||||||
$newsletter = get_parameter('newsletter', 0);
|
|
||||||
$forced = get_parameter('forced', 0);
|
|
||||||
$future_8_days = (time() + 8 * SECONDS_1DAY);
|
|
||||||
$ui_feedback = [
|
|
||||||
'status' => true,
|
|
||||||
'message' => '',
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($register_pandora) {
|
|
||||||
// Pandora register update
|
|
||||||
$um_message = update_manager_register_instance();
|
|
||||||
$ui_feedback['message'] .= $um_message['message'].'<br><br>';
|
|
||||||
if ($um_message['success']) {
|
|
||||||
config_update_value('instance_registered', 1);
|
|
||||||
$ui_feedback['status'] = true && $ui_feedback['status'];
|
|
||||||
} else {
|
|
||||||
$ui_feedback['status'] = false;
|
|
||||||
}
|
|
||||||
} else if (!$forced) {
|
|
||||||
config_update_value('identification_reminder_timestamp', $future_8_days);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($newsletter) {
|
|
||||||
// Pandora newsletter update
|
|
||||||
$email = get_parameter('email', '');
|
|
||||||
$um_message = update_manager_insert_newsletter($email);
|
|
||||||
$ui_feedback['message'] .= $um_message['message'];
|
|
||||||
if ($um_message['success']) {
|
|
||||||
db_process_sql_update('tusuario', ['middlename' => 1], ['id_user' => $config['id_user']]);
|
|
||||||
$ui_feedback['status'] = true && $ui_feedback['status'];
|
|
||||||
} else {
|
|
||||||
$ui_feedback['status'] = false;
|
|
||||||
}
|
|
||||||
} else if (!$forced) {
|
|
||||||
db_process_sql_update('tusuario', ['lastname' => $future_8_days], ['id_user' => $config['id_user']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Form answer JSON
|
|
||||||
$ui_feedback['status'] = $ui_feedback['status'] ? 1 : 0;
|
|
||||||
echo io_json_mb_encode($ui_feedback);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$not_return) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if user is admin
|
|
||||||
if (!license_free()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!users_is_admin($config['id_user'])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get data to display properly the wizard
|
|
||||||
$wizard_data = [];
|
|
||||||
|
|
||||||
$wizard_data['newsletter_subscribed'] = db_get_value('middlename', 'tusuario', 'id_user', $config['id_user']);
|
|
||||||
// force_* = 1 -> force show
|
|
||||||
// force_* = 0 -> force hide
|
|
||||||
// force_* = -1 -> show or hide depends reminder and timestamp
|
|
||||||
$wizard_data['force_newsletter'] = get_parameter('force_newsletter', -1);
|
|
||||||
$wizard_data['newsletter_reminder'] = db_get_value('firstname', 'tusuario', 'id_user', $config['id_user']);
|
|
||||||
$wizard_data['newsletter_reminder_timestamp'] = db_get_value('lastname', 'tusuario', 'id_user', $config['id_user']);
|
|
||||||
|
|
||||||
|
|
||||||
$wizard_data['instance_registered'] = $config['instance_registered'];
|
|
||||||
$wizard_data['force_register'] = get_parameter('force_register', -1);
|
|
||||||
$wizard_data['identification_reminder'] = $config['identification_reminder'];
|
|
||||||
$wizard_data['identification_reminder_timestamp'] = $config['identification_reminder_timestamp'];
|
|
||||||
|
|
||||||
$display_newsletter = display_newsletter($wizard_data);
|
|
||||||
$display_register = display_register($wizard_data);
|
|
||||||
$display_forced = ($wizard_data['force_newsletter'] != -1) || ($wizard_data['force_register'] != -1);
|
|
||||||
|
|
||||||
// Return if it is fully completed
|
|
||||||
if ((!$display_register) && (!$display_newsletter)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$return_button = get_parameter('return_button', 0) == 1;
|
|
||||||
|
|
||||||
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
|
|
||||||
// Avoid to show default email
|
|
||||||
if ($email == 'admin@example.com') {
|
|
||||||
$email = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prints accept register license
|
|
||||||
echo '<div id="login_accept_register" title="'.__('The %s community wizard', get_product_name()).'" style="">';
|
|
||||||
echo '<div style="margin: 5px 0 10px; float: left; padding-left: 15px;">';
|
|
||||||
echo html_print_image('images/pandora_circle_big.png', true);
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div style="font-size: 12pt; margin: 5px 20px; float: left; padding-top: 23px;">';
|
|
||||||
echo __('Stay up to date with the %s community', get_product_name()).'.';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<div id="license_newsletter">';
|
|
||||||
echo '<p>'.__('When you subscribe to the %s Update Manager service, you accept that we register your %s instance as an identifier on the database owned by Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the Update Manager options.', get_product_name(), get_product_name(), get_product_name()).'</p>';
|
|
||||||
echo '<p>'.__('In the same fashion, when subscribed to the newsletter you accept that your email will pass on to a database property of Artica TS. This data will solely be used to provide you with information about %s and will not be conceded to third parties. You can unregister from said database at any time from the newsletter subscription options.', get_product_name()).'</p>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<div style="position:absolute; margin: 0 auto; bottom: 0px; padding-top:10px; position:relative; border: 1px solid #FFF;">';
|
|
||||||
echo '<div style="float: right;">';
|
|
||||||
html_print_submit_button(__('Finish'), 'finish_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
$display_status_return = $return_button ? 'block' : 'none';
|
|
||||||
echo '<div style="float: right; width: 20%; display: '.$display_status_return.';">';
|
|
||||||
html_print_submit_button(__('Return'), 'return_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div style="float: left; margin-left: 0px; width: 50%; text-align: left;">';
|
|
||||||
html_print_checkbox('register', 1, false, false, false, 'cursor: \'pointer\'');
|
|
||||||
echo ' <span style="font-size: 12px;" id="label-register">'.__('Join the %s community!', get_product_name()).'!</span><br>';
|
|
||||||
html_print_checkbox('newsletter', 1, false, false, false, 'cursor: \'pointer\'');
|
|
||||||
echo ' <span style="font-size: 12px;" id="label-newsletter">'.__('Subscribe to our newsletter').'</span>';
|
|
||||||
echo '<br>';
|
|
||||||
echo '<div id="email_container">';
|
|
||||||
echo ' <span id="label-email-newsletter"style="font-size: 12px; display: none">'.__('Email').': </span>';
|
|
||||||
html_print_input_text_extended('email-newsletter', $email, 'text-email-newsletter', '', 30, 255, false, '', ['style' => 'display:none; width: 200px;']);
|
|
||||||
echo ' <span id="label-email-newsletter"style="font-size: 12px; display: none">'.__('Email').': </span>';
|
|
||||||
echo ' <span id="required-email-newsletter">*'.__('Required').' </span>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
// Print yes or not dialog
|
|
||||||
echo '<div id="login_registration_yesno" title="'.__('%s instance identification wizard', get_product_name()).'" style="">';
|
|
||||||
echo '<div style="font-size: 12pt; margin: 20px;">';
|
|
||||||
echo __('Do you want to continue without any registration').'?';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div style="float: left; padding-left: 15px; padding-top: 20px;">';
|
|
||||||
html_print_submit_button(__('No'), 'no_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div style="float: right; padding-right: 15px; padding-top: 20px;">';
|
|
||||||
html_print_submit_button(__('Yes'), 'yes_registration', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
// Print feedback user dialog
|
|
||||||
echo '<div id="ui_messages_feedback" style="">';
|
|
||||||
echo '<div style="float: left; margin: 15px; margin-left: 5px;">';
|
|
||||||
echo html_print_image('images/success_circle_big.png', true);
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div id="feedback_message" style="font-size: 13pt; margin: 15px 20px; padding-left:80px;"></div>';
|
|
||||||
echo '</div>';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">
|
|
||||||
/* <![CDATA[ */
|
|
||||||
|
|
||||||
//Show newsletter and register checkboxes
|
|
||||||
var display_register = <?php echo json_encode($display_register); ?>;
|
|
||||||
var display_newsletter = <?php echo json_encode($display_newsletter); ?>;
|
|
||||||
var display_forced = <?php echo json_encode($display_forced); ?>;
|
|
||||||
var return_button = <?php echo json_encode($return_button); ?>;
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//HELPER FUNCTIONS
|
|
||||||
|
|
||||||
function submit_open_wizard (register, newsletter, email, forced) {
|
|
||||||
|
|
||||||
register = register;
|
|
||||||
newsletter = newsletter ? 1 : 0;
|
|
||||||
forced = forced ? 1 : 0;
|
|
||||||
|
|
||||||
var feedback_message = '';
|
|
||||||
var feedback_status = 1;
|
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
{"page": "general/login_identification_wizard",
|
|
||||||
"open_wizard": 1,
|
|
||||||
"register_pandora": register,
|
|
||||||
"newsletter": newsletter,
|
|
||||||
"email": email,
|
|
||||||
"forced": forced},
|
|
||||||
function (data) {
|
|
||||||
var feedback_message = '';
|
|
||||||
var feedback_status = 1;
|
|
||||||
|
|
||||||
jQuery.each (data, function (i, val) {
|
|
||||||
if (i == 'message') feedback_message = val;
|
|
||||||
if (i == 'status') feedback_status = val;
|
|
||||||
});
|
|
||||||
if (feedback_status == 0) {
|
|
||||||
$("#ui_messages_feedback img").attr("src", "images/fail_circle_big.png");
|
|
||||||
} else {
|
|
||||||
$("#ui_messages_feedback img").attr("src", "images/success_circle_big.png");
|
|
||||||
}
|
|
||||||
$("#feedback_message").html(feedback_message);
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//EVENT FUNCTIONS
|
|
||||||
$("#submit-return_dialog_button").click (function () {
|
|
||||||
$("#login_accept_register" ).dialog('close');
|
|
||||||
$("#all-required").hide();
|
|
||||||
$("#login_id_dialog" ).dialog('open');
|
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
{"page": "general/login_identification_wizard",
|
|
||||||
"reset_initial_wizard": 1},
|
|
||||||
function (data) {}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#submit-finish_dialog_button").click (function () {
|
|
||||||
|
|
||||||
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
|
|
||||||
var register = $("#checkbox-register").is(':checked');
|
|
||||||
var email = $("#text-email-newsletter").val();
|
|
||||||
|
|
||||||
if (email == '' && newsletter) {
|
|
||||||
$("#label-email-newsletter").show();
|
|
||||||
$("#text-email-newsletter").show();
|
|
||||||
$("#required-email-newsletter").show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!register && display_register && !display_forced) {
|
|
||||||
$("#login_registration_yesno").dialog('open');
|
|
||||||
} else {
|
|
||||||
var register_forced = register ? 1 : 0;
|
|
||||||
submit_open_wizard (register_forced, newsletter, email, display_forced);
|
|
||||||
$("#login_accept_register" ).dialog('close');
|
|
||||||
if (register || newsletter) {
|
|
||||||
$("#ui_messages_feedback").dialog('open');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#submit-no_registration").click (function () {
|
|
||||||
$("#login_registration_yesno").dialog('close');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#submit-yes_registration").click (function () {
|
|
||||||
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
|
|
||||||
var email = $("#text-email-newsletter").val();
|
|
||||||
submit_open_wizard (0, newsletter, email, display_forced);
|
|
||||||
|
|
||||||
$("#login_registration_yesno").dialog('close');
|
|
||||||
$("#login_accept_register" ).dialog('close');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#checkbox-newsletter").click (function () {
|
|
||||||
var newsletter = $("#checkbox-newsletter").is(':checked') ? 1 : 0;
|
|
||||||
if (!return_button && newsletter) {
|
|
||||||
$("#label-email-newsletter").show();
|
|
||||||
$("#text-email-newsletter").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!newsletter) {
|
|
||||||
$("#label-email-newsletter").hide();
|
|
||||||
$("#text-email-newsletter").hide();
|
|
||||||
$("#required-email-newsletter").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//DISPLAY
|
|
||||||
$(document).ready (function () {
|
|
||||||
|
|
||||||
$("#login_accept_register").dialog({
|
|
||||||
resizable: false,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
height: 320,
|
|
||||||
width: 750
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#login_registration_yesno").dialog({
|
|
||||||
resizable: false,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
width: 320,
|
|
||||||
overlay: {
|
|
||||||
opacity: 1,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
autoOpen: false
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$("#ui_messages_feedback").dialog({
|
|
||||||
resizable: false,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
width: 300,
|
|
||||||
overlay: {
|
|
||||||
opacity: 1,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
autoOpen: false
|
|
||||||
});
|
|
||||||
|
|
||||||
//Display return button if required
|
|
||||||
if (return_button) {
|
|
||||||
$("#submit-return_dialog_button").show ();
|
|
||||||
}
|
|
||||||
// Remove the completed parts
|
|
||||||
if (!display_register) {
|
|
||||||
$("#checkbox-register").attr ('style', 'display: none !important');
|
|
||||||
$("#label-register").hide ();
|
|
||||||
}
|
|
||||||
if (!display_newsletter) {
|
|
||||||
$("#checkbox-newsletter").attr ('style', 'display: none !important');
|
|
||||||
$("#label-newsletter").hide ();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
#required-email-newsletter{
|
|
||||||
font-size : 9px;
|
|
||||||
color: red;
|
|
||||||
margin-left: -2px;
|
|
||||||
margin-top: 3px;
|
|
||||||
position: absolute;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#email_container{
|
|
||||||
margin-top: 3px;
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#license_newsletter {
|
|
||||||
height: 100px;
|
|
||||||
width: 100%;
|
|
||||||
overflow-y: scroll;
|
|
||||||
border: 1px solid #E4E4E4;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#license_newsletter p{
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-widget-overlay {
|
|
||||||
background: #000;
|
|
||||||
opacity: .6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-draggable {
|
|
||||||
cursor: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -19,8 +19,8 @@ if (isset($config['homedir'])) {
|
||||||
|
|
||||||
ui_require_css_file('login');
|
ui_require_css_file('login');
|
||||||
|
|
||||||
require_once $homedir.'include/functions_ui.php';
|
require_once __DIR__.'/../include/functions_ui.php';
|
||||||
require_once $homedir.'include/functions.php';
|
require_once __DIR__.'/../include/functions.php';
|
||||||
require_once __DIR__.'/../include/functions_html.php';
|
require_once __DIR__.'/../include/functions_html.php';
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ switch ($login_screen) {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div id="log_button" class="login_button" style="display: none;">';
|
echo '<div id="log_button" class="login_button" style="display: none;">';
|
||||||
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="sub next_login"');
|
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="next_login"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<div class="login_button" id="remove_button">';
|
echo '<div class="login_button" id="remove_button">';
|
||||||
|
@ -226,7 +226,7 @@ switch ($login_screen) {
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="login_button">';
|
echo '<div class="login_button">';
|
||||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
|
html_print_submit_button(__('Login'), 'login_button', false, 'class="next_login"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -245,7 +245,7 @@ switch ($login_screen) {
|
||||||
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
|
html_print_input_text_extended('auth_code', '', 'auth_code', '', '', '', false, '', 'class="login login_password" placeholder="'.__('Authentication code').'"', false, true);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="login_button">';
|
echo '<div class="login_button">';
|
||||||
html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="sub next_login"');
|
html_print_submit_button(__('Check code').' >', 'login_button', false, 'class="next_login"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ echo '</div>';
|
||||||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
|
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
if (!isset($process_error_message) && isset($mail)) {
|
if (empty($process_error_message) && isset($mail)) {
|
||||||
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
|
@ -336,7 +336,7 @@ if (!isset($process_error_message) && isset($mail)) {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else if (isset($process_error_message)) {
|
} else if (isset($process_error_message) && !empty($process_error_message)) {
|
||||||
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
echo '<div id="reset_correct" title="'.__('Password reset').'">';
|
||||||
echo '<div class="content_alert">';
|
echo '<div class="content_alert">';
|
||||||
echo '<div class="icon_message_alert">';
|
echo '<div class="icon_message_alert">';
|
||||||
|
@ -518,6 +518,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
|
||||||
ui_require_css_file('dialog');
|
ui_require_css_file('dialog');
|
||||||
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
|
ui_require_css_file('jquery-ui.min', 'include/styles/js/');
|
||||||
ui_require_jquery_file('jquery-ui.min');
|
ui_require_jquery_file('jquery-ui.min');
|
||||||
|
ui_require_jquery_file('jquery-ui_custom');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -1,273 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package General
|
|
||||||
*/
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
|
||||||
$save_identification = get_parameter('save_required_wizard', 0);
|
|
||||||
$change_language = get_parameter('change_language', 0);
|
|
||||||
$cancel_wizard = get_parameter('cancel_wizard', 0);
|
|
||||||
|
|
||||||
// Updates the values get on the identification wizard
|
|
||||||
if ($save_identification) {
|
|
||||||
$email = get_parameter('email', false);
|
|
||||||
$timezone = get_parameter('timezone', false);
|
|
||||||
$language = get_parameter('language', false);
|
|
||||||
|
|
||||||
if ($email !== false) {
|
|
||||||
config_update_value('language', $language);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($timezone !== false) {
|
|
||||||
config_update_value('timezone', $timezone);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($email !== false) {
|
|
||||||
db_process_sql_update(
|
|
||||||
'tusuario',
|
|
||||||
['email' => $email],
|
|
||||||
['id_user' => $config['id_user']]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the alert action Mail to XXX/Administrator if it is set to default
|
|
||||||
$mail_check = 'yourmail@domain.es';
|
|
||||||
$mail_alert = alerts_get_alert_action_field1(1);
|
|
||||||
if ($mail_check === $mail_alert && $email !== false) {
|
|
||||||
alerts_update_alert_action(
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'field1' => $email,
|
|
||||||
'field1_recovery' => $email,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
config_update_value('initial_wizard', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change the language if is change in checkbox
|
|
||||||
if ($change_language !== 0) {
|
|
||||||
config_update_value('language', $change_language);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cancel_wizard !== 0) {
|
|
||||||
config_update_value('initial_wizard', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']);
|
|
||||||
// Avoid to show default email
|
|
||||||
if ($email == 'admin@example.com') {
|
|
||||||
$email = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prints first step pandora registration
|
|
||||||
echo '<div id="login_id_dialog" title="'.__('%s instance identification wizard', get_product_name()).'" style="display: none;">';
|
|
||||||
|
|
||||||
echo '<div style="font-size: 10pt; margin: 20px;">';
|
|
||||||
echo __('Please fill the following information in order to configure your %s instance successfully', get_product_name()).'.';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<div style="">';
|
|
||||||
$table = new StdClass();
|
|
||||||
$table->class = 'databox filters';
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->data = [];
|
|
||||||
$table->size = [];
|
|
||||||
$table->size[0] = '40%';
|
|
||||||
$table->style[0] = 'font-weight:bold';
|
|
||||||
$table->size[1] = '60%';
|
|
||||||
$table->border = '5px solid';
|
|
||||||
|
|
||||||
$table->data[0][0] = __('Language code');
|
|
||||||
$table->data[0][1] = html_print_select_from_sql(
|
|
||||||
'SELECT id_language, name FROM tlanguage',
|
|
||||||
'language',
|
|
||||||
$config['language'],
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$zone_name = [
|
|
||||||
'Africa' => __('Africa'),
|
|
||||||
'America' => __('America'),
|
|
||||||
'Antarctica' => __('Antarctica'),
|
|
||||||
'Arctic' => __('Arctic'),
|
|
||||||
'Asia' => __('Asia'),
|
|
||||||
'Atlantic' => __('Atlantic'),
|
|
||||||
'Australia' => __('Australia'),
|
|
||||||
'Europe' => __('Europe'),
|
|
||||||
'Indian' => __('Indian'),
|
|
||||||
'Pacific' => __('Pacific'),
|
|
||||||
'UTC' => __('UTC'),
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($zone_selected == '') {
|
|
||||||
if ($config['timezone'] != '') {
|
|
||||||
$zone_array = explode('/', $config['timezone']);
|
|
||||||
$zone_selected = $zone_array[0];
|
|
||||||
} else {
|
|
||||||
$zone_selected = 'Europe';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$timezones = timezone_identifiers_list();
|
|
||||||
foreach ($timezones as $timezone) {
|
|
||||||
if (strpos($timezone, $zone_selected) !== false) {
|
|
||||||
$timezone_country = preg_replace('/^.*\//', '', $timezone);
|
|
||||||
$timezone_n[$timezone] = $timezone_country;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[2][0] = __('Timezone setup').' '.ui_print_help_tip(
|
|
||||||
__('Must have the same time zone as the system or database to avoid mismatches of time.'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$table->data[2][1] = html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone()', '', '', true);
|
|
||||||
$table->data[2][1] .= ' '.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
|
|
||||||
|
|
||||||
$table->data[4][0] = __('E-mail for receiving alerts');
|
|
||||||
$table->data[4][1] = html_print_input_text('email', $email, '', 50, 255, true);
|
|
||||||
|
|
||||||
html_print_table($table);
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<div style="position:absolute; margin: 0 auto; bottom: 0px; right: 10px; border: 1px solid #FFF; width: 570px">';
|
|
||||||
echo '<div style="float: right; width: 20%;">';
|
|
||||||
html_print_submit_button(__('Register'), 'id_dialog_button', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div style="float: right; width: 20%;">';
|
|
||||||
html_print_button(__('Cancel'), 'cancel', false, '', 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div id="all-required" style="float: right; margin-right: 30px; display: none; color: red;">';
|
|
||||||
echo __('All fields required');
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">
|
|
||||||
/* <![CDATA[ */
|
|
||||||
|
|
||||||
var default_language_displayed;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//HELPER FUNCTIONS
|
|
||||||
function show_timezone () {
|
|
||||||
zone = $("#zone").val();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "ajax.php",
|
|
||||||
data: "page=godmode/setup/setup&select_timezone=1&zone=" + zone,
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
$("#timezone").empty();
|
|
||||||
jQuery.each (data, function (id, value) {
|
|
||||||
timezone = value;
|
|
||||||
var timezone_country = timezone.replace (/^.*\//g, "");
|
|
||||||
$("select[name='timezone']").append($("<option>").val(timezone).html(timezone_country));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//EVENT FUNCTIONS
|
|
||||||
$("#submit-id_dialog_button").click (function () {
|
|
||||||
|
|
||||||
//All fields required
|
|
||||||
if ($("#text-email").val() == '') {
|
|
||||||
$("#all-required").show();
|
|
||||||
} else {
|
|
||||||
var timezone = $("#timezone").val();
|
|
||||||
var language = $("#language").val();
|
|
||||||
var email_identification = $("#text-email").val();
|
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
{"page": "general/login_required",
|
|
||||||
"save_required_wizard": 1,
|
|
||||||
"email": email_identification,
|
|
||||||
"language": language,
|
|
||||||
"timezone": timezone},
|
|
||||||
function (data) {}
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#login_id_dialog").dialog('close');
|
|
||||||
first_time_identification ();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#language").click(function () {
|
|
||||||
var change_language = $("#language").val();
|
|
||||||
|
|
||||||
if (change_language === default_language_displayed) return;
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
{"page": "general/login_required",
|
|
||||||
"change_language": change_language},
|
|
||||||
function (data) {}
|
|
||||||
).done(function () {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
//DISPLAY
|
|
||||||
$(document).ready (function () {
|
|
||||||
|
|
||||||
$("#login_id_dialog").dialog({
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
height: 280,
|
|
||||||
width: 630,
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
closeOnEscape: false,
|
|
||||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
|
||||||
});
|
|
||||||
|
|
||||||
default_language_displayed = $("#language").val();
|
|
||||||
|
|
||||||
$(".ui-widget-overlay").css("background", "#000");
|
|
||||||
$(".ui-widget-overlay").css("opacity", 0.6);
|
|
||||||
$(".ui-draggable").css("cursor", "inherit");
|
|
||||||
|
|
||||||
$("#button-cancel").click (function () {
|
|
||||||
jQuery.post ("ajax.php",
|
|
||||||
{"page": "general/login_required",
|
|
||||||
"cancel_wizard": 1},
|
|
||||||
function (data) {}
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#login_id_dialog" ).dialog('close');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
|
|
@ -103,246 +103,203 @@ if (!empty($all_data)) {
|
||||||
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_require_css_file('logon');
|
||||||
|
|
||||||
?>
|
echo '<div id="welcome_panel">';
|
||||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td width="25%" style="padding-right: 20px;" valign="top">
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
//
|
|
||||||
// Overview Table.
|
|
||||||
//
|
|
||||||
$table = new stdClass();
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->cellpadding = 4;
|
|
||||||
$table->cellspacing = 4;
|
|
||||||
$table->head = [];
|
|
||||||
$table->data = [];
|
|
||||||
$table->headstyle[0] = 'text-align:center;';
|
|
||||||
$table->width = '100%';
|
|
||||||
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
|
|
||||||
$table->head_colspan[0] = 4;
|
|
||||||
|
|
||||||
// Indicators.
|
//
|
||||||
$tdata = [];
|
// Overview Table.
|
||||||
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
//
|
||||||
$status = '<table class="status_tactical">';
|
$table = new stdClass();
|
||||||
foreach ($stats as $stat) {
|
$table->class = 'no-class';
|
||||||
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
$table->cellpadding = 4;
|
||||||
}
|
$table->cellspacing = 4;
|
||||||
|
$table->head = [];
|
||||||
|
$table->data = [];
|
||||||
|
$table->headstyle[0] = 'text-align:center;';
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->head_colspan[0] = 4;
|
||||||
|
|
||||||
$status .= '</table>';
|
// Indicators.
|
||||||
$table->data[0][0] = $status;
|
$tdata = [];
|
||||||
$table->rowclass[] = '';
|
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
||||||
|
$status = '<table class="status_tactical">';
|
||||||
|
foreach ($stats as $stat) {
|
||||||
|
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
$table->data[] = $tdata;
|
$status .= '</table>';
|
||||||
|
$table->data[0][0] = $status;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
// Alerts.
|
$table->data[] = $tdata;
|
||||||
$tdata = [];
|
|
||||||
$tdata[0] = reporting_get_stats_alerts($data);
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
$table->data[] = $tdata;
|
|
||||||
|
|
||||||
// Modules by status.
|
// Alerts.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
$tdata[0] = reporting_get_stats_alerts($data);
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Total agents and modules.
|
// Modules by status.
|
||||||
$tdata = [];
|
$tdata = [];
|
||||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
$table->data[] = $tdata;
|
$table->data[] = $tdata;
|
||||||
|
|
||||||
// Users.
|
// Total agents and modules.
|
||||||
if (users_is_admin()) {
|
$tdata = [];
|
||||||
$tdata = [];
|
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||||
$tdata[0] = reporting_get_stats_users($data);
|
$table->rowclass[] = '';
|
||||||
$table->rowclass[] = '';
|
$table->data[] = $tdata;
|
||||||
$table->data[] = $tdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
// Users.
|
||||||
unset($table);
|
if (users_is_admin()) {
|
||||||
?>
|
$tdata = [];
|
||||||
|
$tdata[0] = reporting_get_stats_users($data);
|
||||||
|
$table->rowclass[] = '';
|
||||||
</td>
|
$table->data[] = $tdata;
|
||||||
|
}
|
||||||
<td width="75%" valign="top">
|
|
||||||
|
ui_toggle(
|
||||||
|
html_print_table($table, true),
|
||||||
<?php
|
__('%s Overview', get_product_name()),
|
||||||
$options = [];
|
'',
|
||||||
$options['id_user'] = $config['id_user'];
|
'overview',
|
||||||
$options['modal'] = false;
|
false
|
||||||
$options['limit'] = 3;
|
);
|
||||||
$news = get_news($options);
|
unset($table);
|
||||||
|
|
||||||
|
echo '<div id="right">';
|
||||||
|
|
||||||
|
// News.
|
||||||
|
$options = [];
|
||||||
|
$options['id_user'] = $config['id_user'];
|
||||||
|
$options['modal'] = false;
|
||||||
|
$options['limit'] = 3;
|
||||||
|
$news = get_news($options);
|
||||||
|
|
||||||
|
|
||||||
if (!empty($news)) {
|
if (!empty($news)) {
|
||||||
// NEWS BOARD.
|
ui_require_css_file('news');
|
||||||
echo '<div id="news_board">';
|
// NEWS BOARD.
|
||||||
|
if ($config['prominent_time'] == 'timestamp') {
|
||||||
|
$comparation_suffix = '';
|
||||||
|
} else {
|
||||||
|
$comparation_suffix = __('ago');
|
||||||
|
}
|
||||||
|
|
||||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
$output_news = '<div id="news_board" class="new">';
|
||||||
echo '<tr><th style="text-align:center;"><span >'.__('News board').'</span></th></tr>';
|
foreach ($news as $article) {
|
||||||
if ($config['prominent_time'] == 'timestamp') {
|
$image = false;
|
||||||
$comparation_suffix = '';
|
if ($article['text'] == '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ') {
|
||||||
} else {
|
$image = true;
|
||||||
$comparation_suffix = __('ago');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($news as $article) {
|
$text_bbdd = io_safe_output($article['text']);
|
||||||
$text_bbdd = io_safe_output($article['text']);
|
$text = html_entity_decode($text_bbdd);
|
||||||
$text = html_entity_decode($text_bbdd);
|
$output_news .= '<span class="green_title">'.$article['subject'].'</span>';
|
||||||
echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
|
$output_news .= '<div class="new content">';
|
||||||
echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
|
$output_news .= '<p>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</p>';
|
||||||
echo '<tr><td class="datos">';
|
if ($image) {
|
||||||
if ($article['id_news'] == 1) {
|
$output_news .= '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
|
||||||
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
echo nl2br($text);
|
$output_news .= nl2br($text);
|
||||||
echo '</td></tr>';
|
$output_news .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</table>';
|
$output_news .= '</div>';
|
||||||
echo '</div>';
|
|
||||||
// News board.
|
|
||||||
echo '<br><br>';
|
|
||||||
|
|
||||||
// END OF NEWS BOARD.
|
// News board.
|
||||||
}
|
ui_toggle(
|
||||||
|
$output_news,
|
||||||
|
__('News board'),
|
||||||
|
'',
|
||||||
|
'news',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
// END OF NEWS BOARD.
|
||||||
|
}
|
||||||
|
|
||||||
$nots = messages_get_overview('utimestamp', 'DESC', false);
|
// LAST ACTIVITY.
|
||||||
if (!empty($nots)) {
|
// Show last activity from this user.
|
||||||
// Notifications board.
|
$table = new stdClass();
|
||||||
echo '<div id="notifications_board">';
|
$table->class = 'no-td-padding info_table';
|
||||||
|
$table->cellpadding = 0;
|
||||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
$table->cellspacing = 0;
|
||||||
echo '<tr><th style="text-align:center;"><span >'.__('Pending notifications').'</span></th></tr>';
|
$table->width = '100%';
|
||||||
if ($config['prominent_time'] == 'timestamp') {
|
// Don't specify px.
|
||||||
$comparation_suffix = '';
|
$table->data = [];
|
||||||
} else {
|
$table->size = [];
|
||||||
$comparation_suffix = __('ago');
|
$table->headstyle = [];
|
||||||
}
|
$table->size[0] = '5%';
|
||||||
|
$table->size[1] = '15%';
|
||||||
foreach ($nots as $msg) {
|
$table->headstyle[1] = 'min-width: 12em;';
|
||||||
$conversation = io_safe_output(
|
$table->size[2] = '5%';
|
||||||
messages_get_conversation($msg)
|
$table->headstyle[2] = 'min-width: 65px;';
|
||||||
);
|
$table->size[3] = '10%';
|
||||||
|
$table->size[4] = '25%';
|
||||||
if (is_array($conversation)) {
|
$table->head = [];
|
||||||
$text = array_pop($conversation)['message'];
|
$table->head[0] = __('User');
|
||||||
} else {
|
$table->head[1] = __('Action');
|
||||||
// Skip empty message.
|
$table->head[2] = __('Date');
|
||||||
continue;
|
$table->head[3] = __('Source IP');
|
||||||
}
|
$table->head[4] = __('Comments');
|
||||||
|
$table->align[4] = 'left';
|
||||||
$url = ui_get_full_url(
|
$sql = sprintf(
|
||||||
'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$msg['id_mensaje']
|
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||||
);
|
FROM tsesion
|
||||||
if ($msg['url'] != '') {
|
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
||||||
$url = $msg['url'];
|
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
||||||
}
|
$config['id_user']
|
||||||
|
);
|
||||||
echo '<tr><th class="green_title">'.$msg['subject'].'</th></tr>';
|
|
||||||
echo '<tr><td><a href="'.$url.'">';
|
|
||||||
if ($msg['id_usuario_origen'] != '') {
|
|
||||||
echo '<b>'.get_user_fullname($msg['id_usuario_origen']).'</b> ';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<i>'.ui_print_timestamp($msg['timestamp'], true).'</i> '.$comparation_suffix.'</a></td></tr>';
|
|
||||||
echo '<tr><td class="datos">';
|
|
||||||
echo nl2br($text);
|
|
||||||
echo '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</table>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
echo '<br><br>';
|
|
||||||
|
|
||||||
// EO Notifications board.
|
|
||||||
}
|
|
||||||
|
|
||||||
// LAST ACTIVITY.
|
|
||||||
// Show last activity from this user.
|
|
||||||
echo '<div id="activity">';
|
|
||||||
|
|
||||||
$table = new stdClass();
|
|
||||||
$table->class = 'info_table';
|
|
||||||
$table->cellpadding = 0;
|
|
||||||
$table->cellspacing = 0;
|
|
||||||
$table->width = '100%';
|
|
||||||
// Don't specify px.
|
|
||||||
$table->data = [];
|
|
||||||
$table->size = [];
|
|
||||||
$table->size[0] = '5%';
|
|
||||||
$table->size[1] = '15%';
|
|
||||||
$table->size[2] = '15%';
|
|
||||||
$table->size[3] = '10%';
|
|
||||||
$table->size[4] = '25%';
|
|
||||||
$table->head = [];
|
|
||||||
$table->head[0] = __('User');
|
|
||||||
$table->head[1] = __('Action');
|
|
||||||
$table->head[2] = __('Date');
|
|
||||||
$table->head[3] = __('Source IP');
|
|
||||||
$table->head[4] = __('Comments');
|
|
||||||
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
|
||||||
FROM tsesion
|
|
||||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
|
||||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
|
||||||
$config['id_user']
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
$sessions = db_get_all_rows_sql($sql);
|
$sessions = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if ($sessions === false) {
|
if ($sessions === false) {
|
||||||
$sessions = [];
|
$sessions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($sessions as $session) {
|
foreach ($sessions as $session) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$session_id_usuario = $session['id_usuario'];
|
$session_id_usuario = $session['id_usuario'];
|
||||||
$session_ip_origen = $session['ip_origen'];
|
$session_ip_origen = $session['ip_origen'];
|
||||||
|
|
||||||
|
|
||||||
|
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
||||||
|
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
||||||
|
$data[2] = ui_print_help_tip(
|
||||||
|
date($config['date_format'], $session['utimestamp']),
|
||||||
|
true
|
||||||
|
).human_time_comparation($session['utimestamp'], 'tiny');
|
||||||
|
$data[3] = $session_ip_origen;
|
||||||
|
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
||||||
|
if (strlen($description) > 100) {
|
||||||
|
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
|
||||||
|
} else {
|
||||||
|
$data[4] = '<div >'.io_safe_output($description).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
array_push($table->data, $data);
|
||||||
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
}
|
||||||
$data[2] = ui_print_help_tip(
|
|
||||||
date($config['date_format'], $session['utimestamp']),
|
|
||||||
true
|
|
||||||
).human_time_comparation($session['utimestamp'], 'tiny');
|
|
||||||
$data[3] = $session_ip_origen;
|
|
||||||
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
|
||||||
if (strlen($description) > 100) {
|
|
||||||
$data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
|
|
||||||
} else {
|
|
||||||
$data[4] = '<div >'.io_safe_output($description).'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($table->data, $data);
|
$activity .= html_print_table($table, true);
|
||||||
}
|
unset($table);
|
||||||
|
|
||||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
ui_toggle(
|
||||||
html_print_table($table);
|
$activity,
|
||||||
unset($table);
|
__('Latest activity'),
|
||||||
echo '</div>';
|
'',
|
||||||
echo '</div>';
|
'activity',
|
||||||
// END OF LAST ACTIVIYY.
|
false,
|
||||||
?>
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content padded'
|
||||||
</td>
|
);
|
||||||
|
// END OF LAST ACTIVIYY.
|
||||||
</tr>
|
// Close right panel.
|
||||||
</table>
|
echo '</div>';
|
||||||
|
|
||||||
|
// Close welcome panel.
|
||||||
|
echo '</div>';
|
||||||
|
|
|
@ -30,12 +30,6 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Set the height of the menu.
|
|
||||||
$(window).on('load', function (){
|
|
||||||
$("#menu_full").height($("#container").height());
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
$autohidden_menu = 0;
|
$autohidden_menu = 0;
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
#alert_messages_na{
|
||||||
|
z-index:2;
|
||||||
|
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%;
|
||||||
|
position:absolute;
|
||||||
|
top:0;
|
||||||
|
}
|
||||||
|
.modalheadertex{
|
||||||
|
color:#000;
|
||||||
|
font-family:Nunito;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 23pt;
|
||||||
|
margin-bottom:30px;
|
||||||
|
}
|
||||||
|
.modalclose{
|
||||||
|
cursor:pointer;
|
||||||
|
display:inline;
|
||||||
|
float:right;
|
||||||
|
margin-right:10px;
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
.modalconten{
|
||||||
|
color:black;
|
||||||
|
width:300px;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
|
.modalcontenttex{
|
||||||
|
text-align:left;
|
||||||
|
color:black;
|
||||||
|
font-size: 11pt;
|
||||||
|
line-height:13pt;
|
||||||
|
margin-bottom:30px;
|
||||||
|
}
|
||||||
|
.modalokbutto{
|
||||||
|
cursor:pointer;
|
||||||
|
text-align:center;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 45px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color:white;
|
||||||
|
border: 1px solid #82b92e;
|
||||||
|
}
|
||||||
|
.modalokbuttontex{
|
||||||
|
color:#82b92e;
|
||||||
|
font-family:Nunito;
|
||||||
|
font-size:13pt;
|
||||||
|
}
|
||||||
|
.modalgobutto{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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;
|
||||||
|
padding:20px;
|
||||||
|
font-size:9pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cargatextodialog{
|
||||||
|
max-width:58.5%;
|
||||||
|
width:58.5%;
|
||||||
|
min-width:58.5%;
|
||||||
|
float:left;
|
||||||
|
margin-left: 0px;
|
||||||
|
font-size:18pt;
|
||||||
|
padding:20px;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cargatextodialog p, .cargatextodialog b, .cargatextodialog a{
|
||||||
|
font-size:18pt;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<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 SAML only, please contact system administrator if you need assistance.');
|
||||||
|
echo '<br/> <br/>';
|
||||||
|
echo __('Please make sure you have SAML authentication properly configured. For more information the error 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 id="opacidad"></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(".cerrar").click(function(){
|
||||||
|
window.location=".";
|
||||||
|
});
|
||||||
|
|
||||||
|
$('div#page').css('background-color','#d3d3d3');
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,184 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Update Manager registration process client controller.
|
||||||
|
*
|
||||||
|
* @category Client controller
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Update manager
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||||
|
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
// Parse responses, flow control.
|
||||||
|
$configuration_wizard = get_parameter('save_required_wizard', 0);
|
||||||
|
$change_language = get_parameter('change_language', 0);
|
||||||
|
$cancel_wizard = get_parameter('cancel_wizard', 0);
|
||||||
|
|
||||||
|
// Console registration.
|
||||||
|
$cancel_registration = get_parameter('cancel_registration', 0);
|
||||||
|
$register_console = get_parameter('register_console', 0);
|
||||||
|
|
||||||
|
// Newsletter.
|
||||||
|
$cancel_newsletter = get_parameter('cancel_newsletter', 0);
|
||||||
|
$register_newsletter = get_parameter('register_newsletter', 0);
|
||||||
|
|
||||||
|
// Load wizards.
|
||||||
|
$load_wizards = get_parameter('load_wizards', '');
|
||||||
|
|
||||||
|
$feedback = [];
|
||||||
|
|
||||||
|
// Load wizards.
|
||||||
|
if ($load_wizards != '') {
|
||||||
|
switch ($load_wizards) {
|
||||||
|
case 'initial':
|
||||||
|
return config_wiz_modal(false, false);
|
||||||
|
|
||||||
|
case 'registration':
|
||||||
|
return registration_wiz_modal(false, false);
|
||||||
|
|
||||||
|
case 'newsletter':
|
||||||
|
return newsletter_wiz_modal(false, false);
|
||||||
|
|
||||||
|
case 'all':
|
||||||
|
config_wiz_modal(false, false);
|
||||||
|
registration_wiz_modal(false, false);
|
||||||
|
newsletter_wiz_modal(false, false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Ignore.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configuration wizard process.
|
||||||
|
if ($configuration_wizard) {
|
||||||
|
$feedback = config_wiz_process();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($change_language) {
|
||||||
|
// Change the language if is change in checkbox.
|
||||||
|
config_update_value('language', $change_language);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cancel_wizard) {
|
||||||
|
config_update_value('initial_wizard', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Manager registration.
|
||||||
|
if ($cancel_registration) {
|
||||||
|
config_update_value('pandora_uid', 'OFFLINE');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($register_console) {
|
||||||
|
$feedback = registration_wiz_process();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Newsletter.
|
||||||
|
if ($cancel_newsletter) {
|
||||||
|
db_process_sql_update(
|
||||||
|
'tusuario',
|
||||||
|
['middlename' => -1],
|
||||||
|
['id_user' => $config['id_user']]
|
||||||
|
);
|
||||||
|
|
||||||
|
// XXX: Also notify UpdateManager.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($register_newsletter) {
|
||||||
|
$feedback = newsletter_wiz_process();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($feedback)) {
|
||||||
|
echo json_encode($feedback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Ajax calls finish here.
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_require_css_file('register');
|
||||||
|
|
||||||
|
$initial = isset($config['initial_wizard']) !== true
|
||||||
|
|| $config['initial_wizard'] != '1';
|
||||||
|
|
||||||
|
$newsletter = db_get_value(
|
||||||
|
'middlename',
|
||||||
|
'tusuario',
|
||||||
|
'id_user',
|
||||||
|
$config['id_user']
|
||||||
|
);
|
||||||
|
$show_newsletter = $newsletter == '0' || $newsletter == '';
|
||||||
|
|
||||||
|
$registration = isset($config['pandora_uid']) !== true
|
||||||
|
|| $config['pandora_uid'] == '';
|
||||||
|
|
||||||
|
|
||||||
|
if ($initial && users_is_admin()) {
|
||||||
|
// Show all forms in order.
|
||||||
|
// 1- Ask for email, timezone, etc. Fullfill alerts and user mail.
|
||||||
|
config_wiz_modal(
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
(($registration === true) ? 'show_registration_wizard()' : null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$config['disabled_newsletter']) {
|
||||||
|
if ($registration && users_is_admin()) {
|
||||||
|
// Prepare registration wizard, not launch. leave control to flow.
|
||||||
|
registration_wiz_modal(
|
||||||
|
false,
|
||||||
|
// Launch only if not being launch from 'initial'.
|
||||||
|
!$initial,
|
||||||
|
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if ($show_newsletter) {
|
||||||
|
// Show newsletter wizard for current user.
|
||||||
|
newsletter_wiz_modal(
|
||||||
|
false,
|
||||||
|
// Launch only if not being call from 'registration'.
|
||||||
|
!$registration && !$initial
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$newsletter = null;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready (function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
|
@ -94,7 +94,7 @@ $table->data[1] = $data;
|
||||||
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
|
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
|
||||||
$form .= html_print_table($table, true);
|
$form .= html_print_table($table, true);
|
||||||
$form .= '</form>';
|
$form .= '</form>';
|
||||||
ui_toggle($form, __('Filter'), '', false);
|
ui_toggle($form, __('Filter'), '', '', false);
|
||||||
|
|
||||||
$filter = '1=1';
|
$filter = '1=1';
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to schedule tasks on Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Agent editor/ builder.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Classic agent management view.
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars
|
|
||||||
enterprise_include('godmode/agentes/agent_manager.php');
|
enterprise_include('godmode/agentes/agent_manager.php');
|
||||||
|
|
||||||
require_once 'include/functions_clippy.php';
|
require_once 'include/functions_clippy.php';
|
||||||
|
@ -30,23 +45,19 @@ if (is_ajax()) {
|
||||||
|
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
$string = (string) get_parameter('q');
|
$string = (string) get_parameter('q');
|
||||||
// q is what autocomplete plugin gives
|
// Field q is what autocomplete plugin gives.
|
||||||
$filter = [];
|
$filter = [];
|
||||||
|
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
|
||||||
switch ($config['dbtype']) {
|
|
||||||
case 'mysql':
|
|
||||||
case 'postgresql':
|
|
||||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter[] = 'id_agente != '.$id_agent;
|
$filter[] = 'id_agente != '.$id_agent;
|
||||||
|
|
||||||
$agents = agents_get_agents($filter, ['id_agente', 'nombre', 'direccion']);
|
$agents = agents_get_agents(
|
||||||
|
$filter,
|
||||||
|
[
|
||||||
|
'id_agente',
|
||||||
|
'nombre',
|
||||||
|
'direccion',
|
||||||
|
]
|
||||||
|
);
|
||||||
if ($agents === false) {
|
if ($agents === false) {
|
||||||
$agents = [];
|
$agents = [];
|
||||||
}
|
}
|
||||||
|
@ -78,7 +89,7 @@ if (is_ajax()) {
|
||||||
$out = false;
|
$out = false;
|
||||||
foreach ($idSNMP as $id) {
|
foreach ($idSNMP as $id) {
|
||||||
foreach ($snmp[$id] as $key => $value) {
|
foreach ($snmp[$id] as $key => $value) {
|
||||||
// Check if it has "ifXXXX" syntax and skip it
|
// Check if it has "ifXXXX" syntax and skip it.
|
||||||
if (! preg_match('/if/', $key)) {
|
if (! preg_match('/if/', $key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +109,7 @@ if (is_ajax()) {
|
||||||
echo io_json_mb_encode($out);
|
echo io_json_mb_encode($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And and remove groups use the same function
|
// And and remove groups use the same function.
|
||||||
$add_secondary_groups = get_parameter('add_secondary_groups');
|
$add_secondary_groups = get_parameter('add_secondary_groups');
|
||||||
$remove_secondary_groups = get_parameter('remove_secondary_groups');
|
$remove_secondary_groups = get_parameter('remove_secondary_groups');
|
||||||
if ($add_secondary_groups || $remove_secondary_groups) {
|
if ($add_secondary_groups || $remove_secondary_groups) {
|
||||||
|
@ -114,12 +125,12 @@ if (is_ajax()) {
|
||||||
'agents_update_secondary_groups',
|
'agents_update_secondary_groups',
|
||||||
[
|
[
|
||||||
$id_agent,
|
$id_agent,
|
||||||
$add_secondary_groups ? $groups_to_add : [],
|
($add_secondary_groups) ? $groups_to_add : [],
|
||||||
$remove_secondary_groups ? $groups_to_add : [],
|
($remove_secondary_groups) ? $groups_to_add : [],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// Echo 0 in case of error. 0 Otherwise.
|
// Echo 0 in case of error. 0 Otherwise.
|
||||||
echo $ret ? 1 : 0;
|
echo ($ret) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +160,7 @@ if ($new_agent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$new_agent) {
|
if (!$new_agent) {
|
||||||
// Agent remote configuration editor
|
// Agent remote configuration editor.
|
||||||
enterprise_include_once('include/functions_config_agents.php');
|
enterprise_include_once('include/functions_config_agents.php');
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$filename = config_agents_get_agent_config_filenames($id_agente);
|
$filename = config_agents_get_agent_config_filenames($id_agente);
|
||||||
|
@ -157,27 +168,41 @@ if (!$new_agent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$disk_conf_delete = (bool) get_parameter('disk_conf_delete');
|
$disk_conf_delete = (bool) get_parameter('disk_conf_delete');
|
||||||
// Agent remote configuration DELETE
|
// Agent remote configuration DELETE.
|
||||||
if ($disk_conf_delete) {
|
if ($disk_conf_delete) {
|
||||||
// TODO: Get this working on computers where the Pandora server(s) are not on the webserver
|
// TODO: Get this working on computers where the Pandora server(s) are not on the webserver
|
||||||
// TODO: Get a remote_config editor working in the open version
|
// TODO: Get a remote_config editor working in the open version.
|
||||||
@unlink($filename['md5']);
|
@unlink($filename['md5']);
|
||||||
@unlink($filename['conf']);
|
@unlink($filename['conf']);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
echo '<form autocomplete="new-password" name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||||
|
|
||||||
|
// Custom ID.
|
||||||
|
$custom_id_div = '<div class="label_select">';
|
||||||
|
$custom_id_div .= '<p class="input_label">'.__('Custom ID').': </p>';
|
||||||
|
$custom_id_div .= html_print_input_text(
|
||||||
|
'custom_id',
|
||||||
|
$custom_id,
|
||||||
|
'',
|
||||||
|
16,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'agent_custom_id'
|
||||||
|
).'</div>';
|
||||||
|
|
||||||
if (!$new_agent && $alias != '') {
|
if (!$new_agent && $alias != '') {
|
||||||
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'</p>';
|
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'</p>';
|
||||||
$table_agent_name .= '<div class="label_select_parent">';
|
$table_agent_name .= '<div class="label_select_parent">';
|
||||||
$table_agent_name .= '<div class="label_select_child_left">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
|
$table_agent_name .= '<div class="label_select_child_left" style="width: 60%;">'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'</div>';
|
||||||
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name">';
|
$table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
|
||||||
|
|
||||||
$table_qr_code = '<div class="agent_qr white_box"><p class="input_label">'.__('QR Code Agent view').': </p>';
|
|
||||||
|
|
||||||
if ($id_agente) {
|
if ($id_agente) {
|
||||||
$table_agent_name .= '<span>'.__('ID').' '.$id_agente.'</span>';
|
$table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />';
|
||||||
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||||
$table_agent_name .= html_print_image(
|
$table_agent_name .= html_print_image(
|
||||||
'images/zoom.png',
|
'images/zoom.png',
|
||||||
true,
|
true,
|
||||||
|
@ -192,7 +217,7 @@ if (!$new_agent && $alias != '') {
|
||||||
$agent_options_update = 'agent_options_update';
|
$agent_options_update = 'agent_options_update';
|
||||||
|
|
||||||
// Delete link from here.
|
// Delete link from here.
|
||||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||||
|
|
||||||
// Remote configuration available.
|
// Remote configuration available.
|
||||||
if (isset($filename)) {
|
if (isset($filename)) {
|
||||||
|
@ -201,7 +226,7 @@ if (!$new_agent && $alias != '') {
|
||||||
$agent_name = io_safe_output($agent_name);
|
$agent_name = io_safe_output($agent_name);
|
||||||
$agent_md5 = md5($agent_name, false);
|
$agent_md5 = md5($agent_name, false);
|
||||||
|
|
||||||
$table_agent_name .= '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$id_agente.'&'.'disk_conf='.$agent_md5.'">';
|
$table_agent_name .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">';
|
||||||
$table_agent_name .= html_print_image(
|
$table_agent_name .= html_print_image(
|
||||||
'images/application_edit.png',
|
'images/application_edit.png',
|
||||||
true,
|
true,
|
||||||
|
@ -218,6 +243,19 @@ if (!$new_agent && $alias != '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_agent_name .= '</div></div></div>';
|
$table_agent_name .= '</div></div></div>';
|
||||||
|
|
||||||
|
// QR code div.
|
||||||
|
$table_qr_code = '<div class="box-shadow agent_qr white_box">';
|
||||||
|
$table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
|
||||||
|
$table_qr_code .= '<div id="qr_container_image"></div>';
|
||||||
|
if ($id_agente) {
|
||||||
|
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Custom id div.
|
||||||
|
$table_qr_code .= '<br />';
|
||||||
|
$table_qr_code .= $custom_id_div;
|
||||||
|
$table_qr_code .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($new_agent) {
|
if ($new_agent) {
|
||||||
|
@ -257,14 +295,6 @@ if ($id_agente) {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
if (!$new_agent && $alias != '') {
|
|
||||||
if ($id_agente) {
|
|
||||||
$table_qr_code .= "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"".ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente)."\" );'></a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$table_qr_code .= '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups = users_get_groups($config['id_user'], 'AR', false);
|
$groups = users_get_groups($config['id_user'], 'AR', false);
|
||||||
|
|
||||||
$modules = db_get_all_rows_sql(
|
$modules = db_get_all_rows_sql(
|
||||||
|
@ -295,7 +325,21 @@ $table_primary_group .= '</span></div></div></div>';
|
||||||
|
|
||||||
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').': </p>';
|
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').': </p>';
|
||||||
$table_interval .= '<div class="label_select_parent">';
|
$table_interval .= '<div class="label_select_parent">';
|
||||||
$table_interval .= html_print_extended_select_for_time('intervalo', $intervalo, '', '', '0', 10, true);
|
$table_interval .= html_print_extended_select_for_time(
|
||||||
|
'intervalo',
|
||||||
|
$intervalo,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'0',
|
||||||
|
10,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'w40p'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($intervalo < SECONDS_5MINUTES) {
|
if ($intervalo < SECONDS_5MINUTES) {
|
||||||
$table_interval .= clippy_context_help('interval_agent_min');
|
$table_interval .= clippy_context_help('interval_agent_min');
|
||||||
}
|
}
|
||||||
|
@ -341,22 +385,23 @@ $table_server .= html_print_select(
|
||||||
__('None'),
|
__('None'),
|
||||||
0,
|
0,
|
||||||
true
|
true
|
||||||
).'<div class="label_select_child_icons">'.ui_print_help_icon('agent_server', true).'</div></div></div>';
|
).'<div class="label_select_child_icons"></div></div></div>';
|
||||||
|
|
||||||
// Description.
|
// Description.
|
||||||
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').': </p>';
|
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').': </p>';
|
||||||
$table_description .= html_print_input_text(
|
$table_description .= html_print_textarea(
|
||||||
'comentarios',
|
'comentarios',
|
||||||
|
3,
|
||||||
|
10,
|
||||||
$comentarios,
|
$comentarios,
|
||||||
'',
|
'',
|
||||||
45,
|
true,
|
||||||
200,
|
'agent_description'
|
||||||
true
|
|
||||||
).'</div>';
|
).'</div>';
|
||||||
|
|
||||||
|
// QR code.
|
||||||
echo '<div class="first_row">
|
echo '<div class="first_row">
|
||||||
<div class="agent_options '.$agent_options_update.' white_box">
|
<div class="box-shadow agent_options '.$agent_options_update.' white_box">
|
||||||
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
|
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
|
||||||
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
|
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
@ -368,49 +413,49 @@ echo '</div>';
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||||
$table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': '.ui_print_help_icon('secondary_groups', true).'</p></div>';
|
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
|
||||||
$table_adv_secondary_groups_left = html_print_select_groups(
|
$adv_secondary_groups_left = html_print_select_groups(
|
||||||
false,
|
false,
|
||||||
// Use the current user to select the groups
|
// Use the current user to select the groups.
|
||||||
'AR',
|
'AR',
|
||||||
// ACL permission
|
// ACL permission.
|
||||||
false,
|
false,
|
||||||
// Not all group
|
// Not all group.
|
||||||
'secondary_groups',
|
'secondary_groups',
|
||||||
// HTML id
|
// HTML id.
|
||||||
'',
|
'',
|
||||||
// No select any by default
|
// No select any by default.
|
||||||
'',
|
'',
|
||||||
// Javascript onChange code
|
// Javascript onChange code.
|
||||||
'',
|
'',
|
||||||
// Do not user no selected value
|
// Do not user no selected value.
|
||||||
0,
|
0,
|
||||||
// Do not use no selected value
|
// Do not use no selected value.
|
||||||
true,
|
true,
|
||||||
// Return HTML (not echo)
|
// Return HTML (not echo).
|
||||||
true,
|
true,
|
||||||
// Multiple selection
|
// Multiple selection.
|
||||||
true,
|
true,
|
||||||
// Sorting by default
|
// Sorting by default.
|
||||||
'',
|
'',
|
||||||
// CSS classnames (default)
|
// CSS classnames (default).
|
||||||
false,
|
false,
|
||||||
// Not disabled (default)
|
// Not disabled (default).
|
||||||
'width:50%; min-width:170px; text-align:center',
|
'min-width:170px;',
|
||||||
// Inline styles (default)
|
// Inline styles (default).
|
||||||
false,
|
false,
|
||||||
// Option style select (default)
|
// Option style select (default).
|
||||||
false,
|
false,
|
||||||
// Do not truncate the users tree (default)
|
// Do not truncate the users tree (default).
|
||||||
'id_grupo',
|
'id_grupo',
|
||||||
// Key to get as value (default)
|
// Key to get as value (default).
|
||||||
false,
|
false,
|
||||||
// Not strict user (default)
|
// Not strict user (default).
|
||||||
$secondary_groups_selected['plain']
|
$secondary_groups_selected['plain']
|
||||||
// Do not show the primary group in this selection
|
// Do not show the primary group in this selection.
|
||||||
);
|
);
|
||||||
|
|
||||||
$table_adv_secondary_groups_arrows = html_print_input_image(
|
$adv_secondary_groups_arrows = html_print_input_image(
|
||||||
'add_secondary',
|
'add_secondary',
|
||||||
'images/darrowright_green.png',
|
'images/darrowright_green.png',
|
||||||
1,
|
1,
|
||||||
|
@ -434,34 +479,34 @@ if (enterprise_installed()) {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table_adv_secondary_groups_right .= html_print_select(
|
$adv_secondary_groups_right .= html_print_select(
|
||||||
$secondary_groups_selected['for_select'],
|
$secondary_groups_selected['for_select'],
|
||||||
// Values
|
// Values.
|
||||||
'secondary_groups_selected',
|
'secondary_groups_selected',
|
||||||
// HTML id
|
// HTML id.
|
||||||
'',
|
'',
|
||||||
// Selected
|
// Selected.
|
||||||
'',
|
'',
|
||||||
// Javascript onChange code
|
// Javascript onChange code.
|
||||||
'',
|
'',
|
||||||
// Nothing selected
|
// Nothing selected.
|
||||||
0,
|
0,
|
||||||
// Nothing selected
|
// Nothing selected.
|
||||||
true,
|
true,
|
||||||
// Return HTML (not echo)
|
// Return HTML (not echo).
|
||||||
true,
|
true,
|
||||||
// Multiple selection
|
// Multiple selection.
|
||||||
true,
|
true,
|
||||||
// Sort
|
// Sort.
|
||||||
'',
|
'',
|
||||||
// Class
|
// Class.
|
||||||
false,
|
false,
|
||||||
// Disabled
|
// Disabled.
|
||||||
'width:50%; min-width:170px; text-align:center'
|
'min-width:170px;'
|
||||||
// Style
|
// Style.
|
||||||
);
|
);
|
||||||
|
|
||||||
// safe operation mode
|
// Safe operation mode.
|
||||||
if ($id_agente) {
|
if ($id_agente) {
|
||||||
$sql_modules = db_get_all_rows_sql(
|
$sql_modules = db_get_all_rows_sql(
|
||||||
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
|
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
|
||||||
|
@ -485,13 +530,13 @@ if (enterprise_installed()) {
|
||||||
$table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'</div>';
|
$table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remote configuration
|
// Remote configuration.
|
||||||
$table_adv_remote = '<div class="label_select"><p class="input_label">'.__('Remote configuration').': </p>';
|
$table_adv_remote = '<div class="label_select"><p class="input_label">'.__('Remote configuration').': </p>';
|
||||||
|
|
||||||
if (!$new_agent && isset($filename) && file_exists($filename['md5'])) {
|
if (!$new_agent && isset($filename) && file_exists($filename['md5'])) {
|
||||||
$table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5']));
|
$table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5']));
|
||||||
// Delete remote configuration
|
// Delete remote configuration.
|
||||||
$table_adv_remote .= '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=main&'.'disk_conf_delete=1&'.'id_agente='.$id_agente.'">';
|
$table_adv_remote .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
|
||||||
$table_adv_remote .= html_print_image(
|
$table_adv_remote .= html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true,
|
true,
|
||||||
|
@ -510,28 +555,31 @@ if (enterprise_installed()) {
|
||||||
|
|
||||||
$table_adv_remote .= '</div>';
|
$table_adv_remote .= '</div>';
|
||||||
|
|
||||||
$cps_array[-1] = __('Disabled');
|
|
||||||
if ($cps > 0) {
|
|
||||||
$cps_array[$cps] = __('Enabled');
|
|
||||||
} else {
|
|
||||||
$cps_inc = 0;
|
|
||||||
if ($id_agente) {
|
|
||||||
$cps_inc = service_agents_cps($id_agente);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cps_array[$cps_inc] = __('Enabled');
|
// Calculate cps value - agents.
|
||||||
|
if ($id_agente) {
|
||||||
|
$cps_val = service_agents_cps($id_agente);
|
||||||
|
} else {
|
||||||
|
// No agent defined, use received cps as base value.
|
||||||
|
if ($cps >= 0) {
|
||||||
|
$cps_val = $cps;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_adv_cascade = '<div class="label_select"><p class="input_label">'.__('Cascade protection services').': ';
|
$cps_html = '<div class="label_select"><div class="label_simple_items">';
|
||||||
$table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'</p>';
|
$cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true);
|
||||||
$table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'</div>';
|
$cps_html .= __('Cascade protection services').' ';
|
||||||
|
$cps_html .= ui_print_help_tip(
|
||||||
|
__('Alerts and events will be managed by the service joined by this agent.'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$cps_html .= '</div></div>';
|
||||||
|
|
||||||
|
$table_adv_cascade .= $cps_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom ID
|
|
||||||
$table_adv_custom_id = '<div class="label_select"><p class="input_label">'.__('Custom ID').': </p>';
|
|
||||||
$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'</div>';
|
|
||||||
|
|
||||||
$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
|
$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').': </label>';
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['return'] = true;
|
$params['return'] = true;
|
||||||
$params['show_helptip'] = true;
|
$params['show_helptip'] = true;
|
||||||
|
@ -546,13 +594,26 @@ $params['cascade_protection'] = true;
|
||||||
$table_adv_parent .= '<div class="label_simple_items">';
|
$table_adv_parent .= '<div class="label_simple_items">';
|
||||||
$table_adv_parent .= ui_print_agent_autocomplete_input($params);
|
$table_adv_parent .= ui_print_agent_autocomplete_input($params);
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$table_adv_parent .= html_print_checkbox_switch('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').' '.ui_print_help_icon('cascade_protection', true);
|
$table_adv_parent .= html_print_checkbox_switch(
|
||||||
|
'cascade_protection',
|
||||||
|
1,
|
||||||
|
$cascade_protection,
|
||||||
|
true
|
||||||
|
).__('Cascade protection').' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_adv_parent .= __('Module').' '.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true).'</div></div>';
|
$table_adv_parent .= __('Module').' '.html_print_select(
|
||||||
|
$modules_values,
|
||||||
|
'cascade_protection_module',
|
||||||
|
$cascade_protection_module,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
).'</div></div>';
|
||||||
|
|
||||||
// Learn mode / Normal mode
|
// Learn mode / Normal mode.
|
||||||
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': '.ui_print_help_icon('module_definition', true).'</p>';
|
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': </p>';
|
||||||
$table_adv_module_mode .= '<div class="switch_radio_button">';
|
$table_adv_module_mode .= '<div class="switch_radio_button">';
|
||||||
$table_adv_module_mode .= html_print_radio_button_extended(
|
$table_adv_module_mode .= html_print_radio_button_extended(
|
||||||
'modo',
|
'modo',
|
||||||
|
@ -586,9 +647,16 @@ $table_adv_module_mode .= html_print_radio_button_extended(
|
||||||
);
|
);
|
||||||
$table_adv_module_mode .= '</div></div>';
|
$table_adv_module_mode .= '</div></div>';
|
||||||
|
|
||||||
// Status (Disabled / Enabled)
|
// Status (Disabled / Enabled).
|
||||||
$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
|
$table_adv_status = '<div class="label_select_simple label_simple_one_item">';
|
||||||
$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'</div>';
|
$table_adv_status .= html_print_checkbox_switch(
|
||||||
|
'disabled',
|
||||||
|
1,
|
||||||
|
$disabled,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
|
||||||
|
$table_adv_status .= '</div>';
|
||||||
|
|
||||||
// Url address.
|
// Url address.
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
|
@ -599,7 +667,14 @@ if (enterprise_installed()) {
|
||||||
'',
|
'',
|
||||||
45,
|
45,
|
||||||
255,
|
255,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
// Autocomplete.
|
||||||
|
'new-password'
|
||||||
).'</div>';
|
).'</div>';
|
||||||
} else {
|
} else {
|
||||||
$table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
|
$table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
|
||||||
|
@ -613,9 +688,11 @@ if (enterprise_installed()) {
|
||||||
).'</div>';
|
).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Quiet').': ';
|
$table_adv_quiet = '<div class="label_select_simple label_simple_one_item">';
|
||||||
|
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true);
|
||||||
|
$table_adv_quiet .= '<p class="input_label input_label_simple">'.__('Quiet').': ';
|
||||||
$table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'</p>';
|
$table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'</p>';
|
||||||
$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true).'</div>';
|
$table_adv_quiet .= '</div>';
|
||||||
|
|
||||||
$listIcons = gis_get_array_list_icons();
|
$listIcons = gis_get_array_list_icons();
|
||||||
|
|
||||||
|
@ -625,11 +702,11 @@ foreach ($listIcons as $index => $value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = 'images/gis_map/icons/';
|
$path = 'images/gis_map/icons/';
|
||||||
// TODO set better method the path
|
// TODO set better method the path.
|
||||||
$table_adv_agent_icon = '<div class="label_select"><p class="input_label">'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'</p>';
|
$table_adv_agent_icon = '<div class="label_select"><p class="input_label">'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'</p>';
|
||||||
if ($icon_path == '') {
|
if ($icon_path == '') {
|
||||||
$display_icons = 'none';
|
$display_icons = 'none';
|
||||||
// Hack to show no icon. Use any given image to fix not found image errors
|
// Hack to show no icon. Use any given image to fix not found image errors.
|
||||||
$path_without = 'images/spinner.png';
|
$path_without = 'images/spinner.png';
|
||||||
$path_default = 'images/spinner.png';
|
$path_default = 'images/spinner.png';
|
||||||
$path_ok = 'images/spinner.png';
|
$path_ok = 'images/spinner.png';
|
||||||
|
@ -686,24 +763,47 @@ if ($config['activate_gis']) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
|
// General display distribution.
|
||||||
<div class="secondary_groups_list_left">
|
$table_adv_options = '
|
||||||
'.$table_adv_secondary_groups_left.'
|
<div class="secondary_groups_list">
|
||||||
|
'.$adv_secondary_groups_label.'
|
||||||
|
<div class="sg_source">
|
||||||
|
'.$adv_secondary_groups_left.'
|
||||||
|
</div>
|
||||||
|
<div class="secondary_group_arrows">
|
||||||
|
'.$adv_secondary_groups_arrows.'
|
||||||
|
</div>
|
||||||
|
<div class="sg_target">
|
||||||
|
'.$adv_secondary_groups_right.'
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="secondary_groups_select_arrows">
|
<div class="agent_av_opt_right" >
|
||||||
'.$table_adv_secondary_groups_arrows.'
|
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
|
||||||
</div>
|
|
||||||
<div class="secondary_groups_list_right">
|
if ($new_agent) {
|
||||||
'.$table_adv_secondary_groups_right.'
|
// If agent is new, show custom id as old style format.
|
||||||
</div>
|
$table_adv_options .= $custom_id_div;
|
||||||
</div>
|
}
|
||||||
<div class="agent_options agent_options_adv">
|
|
||||||
<div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'</div>
|
$table_adv_options .= '</div>';
|
||||||
<div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
|
|
||||||
</div>';
|
$table_adv_options .= '
|
||||||
|
<div class="agent_av_opt_left" >
|
||||||
|
'.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
|
||||||
echo '<div class="ui_toggle">';
|
echo '<div class="ui_toggle">';
|
||||||
ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened');
|
ui_toggle(
|
||||||
|
$table_adv_options,
|
||||||
|
__('Advanced options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'white_box white_box_opened',
|
||||||
|
'no-border flex'
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
@ -711,10 +811,17 @@ $table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'custom_fields_table';
|
$table->class = 'custom_fields_table';
|
||||||
|
|
||||||
$table->head = [];
|
$table->head = [
|
||||||
|
0 => __('Click to display').ui_print_help_tip(
|
||||||
|
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
];
|
||||||
|
$table->class = 'info_table';
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bold;';
|
$table->style[0] = 'font-weight: bold;';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
$table->rowstyle = [];
|
||||||
|
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
|
@ -722,15 +829,12 @@ if ($fields === false) {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$id_custom_field = $field['id_field'];
|
$id_custom_field = $field['id_field'];
|
||||||
|
|
||||||
$data[0] = '<div class="field_title" onclick="show_custom_field_row('.$id_custom_field.')">';
|
$data[0] = '<div class="field_title" onclick="show_custom_field_row('.$id_custom_field.')">';
|
||||||
$data[0] .= '<b>'.$field['name'].'</b>';
|
$data[0] .= '<b>'.$field['name'].'</b>';
|
||||||
$data[0] .= ui_print_help_tip(
|
|
||||||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$data[0] .= '</div>';
|
$data[0] .= '</div>';
|
||||||
$combo = [];
|
$combo = [];
|
||||||
$combo = $field['combo_values'];
|
$combo = $field['combo_values'];
|
||||||
|
@ -753,6 +857,13 @@ foreach ($fields as $field) {
|
||||||
$custom_value = '';
|
$custom_value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table->rowstyle[$i] = 'cursor: pointer;user-select: none;';
|
||||||
|
if (!empty($custom_value)) {
|
||||||
|
$table->rowstyle[($i + 1)] = 'display: table-row;';
|
||||||
|
} else {
|
||||||
|
$table->rowstyle[($i + 1)] = 'display: none;';
|
||||||
|
}
|
||||||
|
|
||||||
if ($field['is_password_type']) {
|
if ($field['is_password_type']) {
|
||||||
$data_field[1] = html_print_input_text_extended(
|
$data_field[1] = html_print_input_text_extended(
|
||||||
'customvalue_'.$field['id_field'],
|
'customvalue_'.$field['id_field'],
|
||||||
|
@ -801,21 +912,30 @@ foreach ($fields as $field) {
|
||||||
};
|
};
|
||||||
|
|
||||||
$table->rowid[] = 'name_field-'.$id_custom_field;
|
$table->rowid[] = 'name_field-'.$id_custom_field;
|
||||||
array_push($table->data, $data);
|
$table->data[] = $data;
|
||||||
|
|
||||||
$table->rowid[] = 'field-'.$id_custom_field;
|
$table->rowid[] = 'field-'.$id_custom_field;
|
||||||
array_push($table->data, $data_field);
|
$table->data[] = $data_field;
|
||||||
|
$i += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields)) {
|
if (!empty($fields)) {
|
||||||
echo '<div class="ui_toggle">';
|
echo '<div class="ui_toggle">';
|
||||||
ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened');
|
ui_toggle(
|
||||||
|
html_print_table($table, true),
|
||||||
|
__('Custom fields'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'white_box white_box_opened',
|
||||||
|
'no-border'
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
|
||||||
|
|
||||||
|
|
||||||
// The context help about the learning mode.
|
// The context help about the learning mode.
|
||||||
if ($modo == 0) {
|
if ($modo == 0) {
|
||||||
echo "<span id='modules_not_learning_mode_context_help' style='padding-right:8px;'>";
|
echo "<span id='modules_not_learning_mode_context_help' style='padding-right:8px;'>";
|
||||||
|
@ -1042,6 +1162,19 @@ ui_require_jquery_file('bgiframe');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready (function() {
|
$(document).ready (function() {
|
||||||
|
|
||||||
|
var previous_primary_group_select;
|
||||||
|
$("#grupo").on('focus', function () {
|
||||||
|
previous_primary_group_select = this.value;
|
||||||
|
}).change(function() {
|
||||||
|
if ($("#secondary_groups_selected option[value="+$("#grupo").val()+"]").length) {
|
||||||
|
alert("<?php echo __('Secondary group cannot be primary too.'); ?>");
|
||||||
|
$("#grupo").val(previous_primary_group_select);
|
||||||
|
} else {
|
||||||
|
previous_primary_group_select = this.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("select#id_os").pandoraSelectOS ();
|
$("select#id_os").pandoraSelectOS ();
|
||||||
|
|
||||||
var checked = $("#checkbox-cascade_protection").is(":checked");
|
var checked = $("#checkbox-cascade_protection").is(":checked");
|
||||||
|
|
|
@ -23,7 +23,6 @@ $idAgent = (int) get_parameter('id_agente', 0);
|
||||||
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
$ip_target = (string) get_parameter('ip_target', $ipAgent);
|
$ip_target = (string) get_parameter('ip_target', $ipAgent);
|
||||||
$use_agent = get_parameter('use_agent');
|
$use_agent = get_parameter('use_agent');
|
||||||
$snmp_community = (string) get_parameter('snmp_community', 'public');
|
$snmp_community = (string) get_parameter('snmp_community', 'public');
|
||||||
|
@ -322,7 +321,7 @@ if ($create_modules) {
|
||||||
} else if (preg_match('/ifAdminStatus/', $name_array[1])) {
|
} else if (preg_match('/ifAdminStatus/', $name_array[1])) {
|
||||||
$module_type = 2;
|
$module_type = 2;
|
||||||
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
|
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
|
||||||
$module_type = 18;
|
$module_type = 2;
|
||||||
} else {
|
} else {
|
||||||
$module_type = 4;
|
$module_type = 4;
|
||||||
}
|
}
|
||||||
|
@ -469,6 +468,9 @@ if (enterprise_installed()) {
|
||||||
if ($row['server_type'] != 13) {
|
if ($row['server_type'] != 13) {
|
||||||
$s_type = ' (Standard)';
|
$s_type = ' (Standard)';
|
||||||
} else {
|
} else {
|
||||||
|
// Check if satellite server has remote configuration enabled
|
||||||
|
$satellite_remote = config_agents_has_remote_configuration($id_agent);
|
||||||
|
$id_satellite = $row['id_server'];
|
||||||
$s_type = ' (Satellite)';
|
$s_type = ' (Satellite)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +479,17 @@ if (enterprise_installed()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
|
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
|
||||||
$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
|
$table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
|
||||||
|
$table->data[1][4] = html_print_select(
|
||||||
|
$servers_to_exec,
|
||||||
|
'server_to_exec',
|
||||||
|
$server_to_exec,
|
||||||
|
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')
|
||||||
|
',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$snmp_versions['1'] = 'v. 1';
|
$snmp_versions['1'] = 'v. 1';
|
||||||
$snmp_versions['2'] = 'v. 2';
|
$snmp_versions['2'] = 'v. 2';
|
||||||
|
@ -607,12 +619,16 @@ ui_require_jquery_file('bgiframe');
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
|
|
||||||
var inputActive = true;
|
var inputActive = true;
|
||||||
|
|
||||||
|
$('#server_to_exec option').trigger('change');
|
||||||
|
|
||||||
$(document).data('text_for_module', $("#none_text").html());
|
$(document).data('text_for_module', $("#none_text").html());
|
||||||
|
|
||||||
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
|
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
|
||||||
|
|
||||||
$("#snmp_version").change(function () {
|
$("#snmp_version").change(function () {
|
||||||
if (this.value == "3") {
|
if (this.value == "3") {
|
||||||
$("#snmp3_options").css("display", "");
|
$("#snmp3_options").css("display", "");
|
||||||
|
@ -621,26 +637,27 @@ $(document).ready (function () {
|
||||||
$("#snmp3_options").css("display", "none");
|
$("#snmp3_options").css("display", "none");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#walk_form").submit(function() {
|
$("#walk_form").submit(function() {
|
||||||
$("#submit-snmp_walk").disable ();
|
$("#submit-snmp_walk").disable ();
|
||||||
$("#oid_loading").show ();
|
$("#oid_loading").show ();
|
||||||
$("#no_snmp").hide ();
|
$("#no_snmp").hide ();
|
||||||
$("#form_interfaces").hide ();
|
$("#form_interfaces").hide ();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||||
var idSNMP = Array();
|
var idSNMP = Array();
|
||||||
|
|
||||||
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
||||||
idSNMP.push($(val).val());
|
idSNMP.push($(val).val());
|
||||||
});
|
});
|
||||||
$('#module').attr ('disabled', 1);
|
$('#module').attr ('disabled', 1);
|
||||||
$('#module').empty ();
|
$('#module').empty ();
|
||||||
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||||
|
|
||||||
jQuery.post ('ajax.php',
|
jQuery.post ('ajax.php',
|
||||||
{"page" : "godmode/agentes/agent_manager",
|
{"page" : "godmode/agentes/agent_manager",
|
||||||
"get_modules_json_for_multiple_snmp": 1,
|
"get_modules_json_for_multiple_snmp": 1,
|
||||||
"id_snmp[]": idSNMP,
|
"id_snmp[]": idSNMP,
|
||||||
|
@ -655,7 +672,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||||
$('#module').fadeIn ('normal');
|
$('#module').fadeIn ('normal');
|
||||||
c++;
|
c++;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
||||||
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
|
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
|
||||||
|
@ -666,11 +683,11 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||||
|
|
||||||
if (anyText == null) {
|
if (anyText == null) {
|
||||||
anyText = 'Any';
|
anyText = 'Any';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
|
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,6 +699,20 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||||
"json");
|
"json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function satellite_remote_warn(id_satellite, remote)
|
||||||
|
{
|
||||||
|
if(!remote)
|
||||||
|
{
|
||||||
|
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
|
||||||
|
$('#satellite_remote_tip').removeAttr("style").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#satellite_remote_tip').removeAttr("style").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,6 @@ $table->data[0][0] = '<b>'.__('Target IP').'</b>';
|
||||||
$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||||
|
|
||||||
$table->data[0][2] = '<b>'.__('Namespace').'</b>';
|
$table->data[0][2] = '<b>'.__('Namespace').'</b>';
|
||||||
$table->data[0][2] .= ui_print_help_icon('wminamespace', true);
|
|
||||||
$table->data[0][3] = html_print_input_text('tcp_send', $tcp_send, '', 15, 60, true);
|
$table->data[0][3] = html_print_input_text('tcp_send', $tcp_send, '', 15, 60, true);
|
||||||
|
|
||||||
$table->data[1][0] = '<b>'.__('Username').'</b>';
|
$table->data[1][0] = '<b>'.__('Username').'</b>';
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Configure agents.
|
||||||
|
*
|
||||||
|
* @category Agents view - management.
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage User interface.
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||||
|
@ -20,6 +35,7 @@ enterprise_include_once('include/functions_modules.php');
|
||||||
require_once $config['homedir'].'/include/functions_agents.php';
|
require_once $config['homedir'].'/include/functions_agents.php';
|
||||||
require_once $config['homedir'].'/include/functions_cron.php';
|
require_once $config['homedir'].'/include/functions_cron.php';
|
||||||
ui_require_javascript_file('encode_decode_base64');
|
ui_require_javascript_file('encode_decode_base64');
|
||||||
|
ui_require_css_file('agent_manager');
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
@ -194,7 +210,7 @@ if ($create_agent) {
|
||||||
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
||||||
$url_description = (string) get_parameter('url_description');
|
$url_description = (string) get_parameter('url_description');
|
||||||
$quiet = (int) get_parameter('quiet', 0);
|
$quiet = (int) get_parameter('quiet', 0);
|
||||||
$cps = (int) get_parameter('cps', 0);
|
$cps = (int) get_parameter_switch('cps', -1);
|
||||||
|
|
||||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
@ -325,7 +341,7 @@ if ($create_agent) {
|
||||||
$unsafe_alias = io_safe_output($alias);
|
$unsafe_alias = io_safe_output($alias);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Created agent $unsafe_alias",
|
'Created agent '.$unsafe_alias,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
$info
|
$info
|
||||||
|
@ -489,7 +505,7 @@ if ($id_agente) {
|
||||||
$agent_name = io_safe_output($agent_name);
|
$agent_name = io_safe_output($agent_name);
|
||||||
$agent_md5 = md5($agent_name, false);
|
$agent_md5 = md5($agent_name, false);
|
||||||
|
|
||||||
$remote_configuration_tab['text'] = '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$id_agente.'&'.'disk_conf='.$agent_md5.'">'.html_print_image(
|
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">'.html_print_image(
|
||||||
'images/remote_configuration.png',
|
'images/remote_configuration.png',
|
||||||
true,
|
true,
|
||||||
['title' => __('Remote configuration')]
|
['title' => __('Remote configuration')]
|
||||||
|
@ -575,20 +591,24 @@ if ($id_agente) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$help_header = '';
|
$help_header = '';
|
||||||
|
$tab_name = '';
|
||||||
// This add information to the header.
|
// This add information to the header.
|
||||||
switch ($tab) {
|
switch ($tab) {
|
||||||
case 'main':
|
case 'main':
|
||||||
$tab_description = '- '.__('Setup');
|
$tab_description = '- '.__('Setup');
|
||||||
|
$help_header = 'main_tab';
|
||||||
|
$tab_name = 'Setup';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'collection':
|
case 'collection':
|
||||||
$tab_description = '- '.__('Collection');
|
$tab_description = '- '.__('Collection');
|
||||||
$help_header = 'collection_tab';
|
$tab_name = 'Collection';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'inventory':
|
case 'inventory':
|
||||||
$tab_description = '- '.__('Inventory');
|
$tab_description = '- '.__('Inventory');
|
||||||
$help_header = 'inventory_tab';
|
$help_header = 'inventory_tab';
|
||||||
|
$tab_name = 'Inventory';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'plugins':
|
case 'plugins':
|
||||||
|
@ -599,19 +619,23 @@ if ($id_agente) {
|
||||||
case 'module':
|
case 'module':
|
||||||
$type_module_t = get_parameter('moduletype', '');
|
$type_module_t = get_parameter('moduletype', '');
|
||||||
$tab_description = '- '.__('Modules');
|
$tab_description = '- '.__('Modules');
|
||||||
|
$tab_name = 'Modules';
|
||||||
if ($type_module_t == 'webux') {
|
if ($type_module_t == 'webux') {
|
||||||
$help_header = 'wux_console';
|
$help_header = 'wux_console';
|
||||||
|
} else {
|
||||||
|
$help_header = 'local_module_tab';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'alert':
|
case 'alert':
|
||||||
$tab_description = '- '.__('Alert');
|
$tab_description = '- '.__('Alert');
|
||||||
$help_header = 'manage_alert_list';
|
$help_header = 'manage_alert_list';
|
||||||
|
$tab_name = 'Alerts';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'template':
|
case 'template':
|
||||||
$tab_description = '- '.__('Templates');
|
$tab_description = '- '.__('Templates');
|
||||||
$help_header = 'template_tab';
|
$tab_name = 'Module templates';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'gis':
|
case 'gis':
|
||||||
|
@ -631,14 +655,20 @@ if ($id_agente) {
|
||||||
switch (get_parameter('wizard_section')) {
|
switch (get_parameter('wizard_section')) {
|
||||||
case 'snmp_explorer':
|
case 'snmp_explorer':
|
||||||
$tab_description = '- '.__('SNMP Wizard');
|
$tab_description = '- '.__('SNMP Wizard');
|
||||||
|
$help_header = 'agent_snmp_explorer_tab';
|
||||||
|
$tab_name = 'SNMP Wizard';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'snmp_interfaces_explorer':
|
case 'snmp_interfaces_explorer':
|
||||||
$tab_description = '- '.__('SNMP Interfaces wizard');
|
$tab_description = '- '.__('SNMP Interfaces wizard');
|
||||||
|
$help_header = 'agent_snmp_interfaces_explorer_tab';
|
||||||
|
$tab_name = 'SNMP Interfaces wizard';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'wmi_explorer':
|
case 'wmi_explorer':
|
||||||
$tab_description = '- '.__('WMI Wizard');
|
$tab_description = '- '.__('WMI Wizard');
|
||||||
|
$help_header = 'agent_snmp_wmi_explorer_tab';
|
||||||
|
$tab_name = 'WMI Wizard';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -675,7 +705,15 @@ if ($id_agente) {
|
||||||
$onheader,
|
$onheader,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
$config['item_title_size_text']
|
$config['item_title_size_text'],
|
||||||
|
'',
|
||||||
|
ui_print_breadcrums(
|
||||||
|
[
|
||||||
|
__('Resources'),
|
||||||
|
__('Manage agents'),
|
||||||
|
'<span class="breadcrumb_active">'.$tab_name.'</span>',
|
||||||
|
]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Create agent.
|
// Create agent.
|
||||||
|
@ -684,7 +722,19 @@ if ($id_agente) {
|
||||||
'images/bricks.png',
|
'images/bricks.png',
|
||||||
false,
|
false,
|
||||||
'create_agent',
|
'create_agent',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
GENERIC_SIZE_TEXT,
|
||||||
|
'',
|
||||||
|
ui_print_breadcrums(
|
||||||
|
[
|
||||||
|
__('Resources'),
|
||||||
|
__('Manage agents'),
|
||||||
|
'<span class="breadcrumb_active">'.__('Create agent').'</span>',
|
||||||
|
]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,8 +875,7 @@ if ($update_agent) {
|
||||||
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
|
||||||
$url_description = (string) get_parameter('url_description');
|
$url_description = (string) get_parameter('url_description');
|
||||||
$quiet = (int) get_parameter('quiet', 0);
|
$quiet = (int) get_parameter('quiet', 0);
|
||||||
$cps = (int) get_parameter('cps', 0);
|
$cps = get_parameter_switch('cps', -1);
|
||||||
|
|
||||||
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
|
@ -974,7 +1023,7 @@ if ($update_agent) {
|
||||||
[
|
[
|
||||||
$id_agente,
|
$id_agente,
|
||||||
'standby',
|
'standby',
|
||||||
$disabled ? '1' : '0',
|
($disabled) ? '1' : '0',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// Validate alerts for disabled agents.
|
// Validate alerts for disabled agents.
|
||||||
|
@ -1060,7 +1109,7 @@ if ($update_agent) {
|
||||||
ui_print_success_message(__('Successfully updated'));
|
ui_print_success_message(__('Successfully updated'));
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Updated agent $alias",
|
'Updated agent '.$alias,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$info
|
$info
|
||||||
|
@ -1164,7 +1213,7 @@ if ($update_module || $create_module) {
|
||||||
|
|
||||||
$max_timeout = (int) get_parameter('max_timeout');
|
$max_timeout = (int) get_parameter('max_timeout');
|
||||||
$max_retries = (int) get_parameter('max_retries');
|
$max_retries = (int) get_parameter('max_retries');
|
||||||
$min = (int) get_parameter_post('min');
|
$min = (int) get_parameter('min');
|
||||||
$max = (int) get_parameter('max');
|
$max = (int) get_parameter('max');
|
||||||
$interval = (int) get_parameter('module_interval', $intervalo);
|
$interval = (int) get_parameter('module_interval', $intervalo);
|
||||||
$ff_interval = (int) get_parameter('module_ff_interval');
|
$ff_interval = (int) get_parameter('module_ff_interval');
|
||||||
|
@ -1202,7 +1251,7 @@ if ($update_module || $create_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_module_type == 25) {
|
if ($id_module_type == 25) {
|
||||||
// web analysis, from MODULE_WUX.
|
// Web analysis, from MODULE_WUX.
|
||||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
||||||
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1216,6 +1265,7 @@ if ($update_module || $create_module) {
|
||||||
|
|
||||||
// Get macros.
|
// Get macros.
|
||||||
$macros = (string) get_parameter('macros');
|
$macros = (string) get_parameter('macros');
|
||||||
|
$macros_names = (array) get_parameter('macro_name', []);
|
||||||
|
|
||||||
if (!empty($macros)) {
|
if (!empty($macros)) {
|
||||||
$macros = json_decode(base64_decode($macros), true);
|
$macros = json_decode(base64_decode($macros), true);
|
||||||
|
@ -1239,12 +1289,11 @@ if ($update_module || $create_module) {
|
||||||
|
|
||||||
foreach ($conf_array as $line) {
|
foreach ($conf_array as $line) {
|
||||||
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
|
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
|
||||||
$new_configuration_data .= 'module_name '.io_safe_output($name)."\n";
|
$new_configuration_data .= 'module_name ';
|
||||||
}
|
$new_configuration_data .= io_safe_output($name)."\n";
|
||||||
|
} else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
|
||||||
// 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";
|
||||||
$new_configuration_data .= "$line\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,9 +1455,13 @@ if ($update_module || $create_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||||
if ($active_snmp_v3) {
|
|
||||||
// LOST CODE?
|
/*
|
||||||
}
|
* if ($active_snmp_v3) {
|
||||||
|
* // LOST CODE?.
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
$throw_unknown_events = (bool) get_parameter('throw_unknown_events', false);
|
$throw_unknown_events = (bool) get_parameter('throw_unknown_events', false);
|
||||||
// Set the event type that can show.
|
// Set the event type that can show.
|
||||||
|
@ -1424,32 +1477,11 @@ if ($update_module || $create_module) {
|
||||||
|
|
||||||
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
|
$module_in_policy = enterprise_hook('policies_is_module_in_policy', [$id_agent_module]);
|
||||||
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
|
$module_linked = enterprise_hook('policies_is_module_linked', [$id_agent_module]);
|
||||||
|
|
||||||
if ((!$module_in_policy && !$module_linked && $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',
|
|
||||||
[
|
|
||||||
$id_agente,
|
|
||||||
io_safe_output($old_configuration_data),
|
|
||||||
io_safe_output($configuration_data),
|
|
||||||
$disabled,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize result of the action (insert or update).
|
||||||
|
$success_action = NOERR;
|
||||||
|
|
||||||
// MODULE UPDATE.
|
// MODULE UPDATE.
|
||||||
if ($update_module) {
|
if ($update_module) {
|
||||||
$id_agent_module = (int) get_parameter('id_agent_module');
|
$id_agent_module = (int) get_parameter('id_agent_module');
|
||||||
|
@ -1585,6 +1617,8 @@ if ($update_module) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I save the result of the action (insert or update).
|
||||||
|
$success_action = $result;
|
||||||
$result = false;
|
$result = false;
|
||||||
ui_print_error_message($msg);
|
ui_print_error_message($msg);
|
||||||
|
|
||||||
|
@ -1592,7 +1626,7 @@ if ($update_module) {
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Fail to try update module '$name' for agent ".$agent['alias']
|
"Fail to try update module '".$name."' for agent ".$agent['alias']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($prediction_module == 3) {
|
if ($prediction_module == 3) {
|
||||||
|
@ -1616,7 +1650,7 @@ if ($update_module) {
|
||||||
|
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Updated module '$name' for agent ".$agent['alias'],
|
"Updated module '".$name."' for agent ".$agent['alias'],
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
io_json_mb_encode($values)
|
io_json_mb_encode($values)
|
||||||
|
@ -1626,6 +1660,9 @@ if ($update_module) {
|
||||||
|
|
||||||
// MODULE INSERT.
|
// MODULE INSERT.
|
||||||
if ($create_module) {
|
if ($create_module) {
|
||||||
|
// Old configuration data must always be empty in case of creation.
|
||||||
|
$old_configuration_data = '';
|
||||||
|
|
||||||
if (isset($_POST['combo_snmp_oid'])) {
|
if (isset($_POST['combo_snmp_oid'])) {
|
||||||
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
|
$combo_snmp_oid = get_parameter_post('combo_snmp_oid');
|
||||||
}
|
}
|
||||||
|
@ -1635,12 +1672,6 @@ if ($create_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$id_module = (int) get_parameter('id_module');
|
$id_module = (int) get_parameter('id_module');
|
||||||
// Commented because can't create prediction modules
|
|
||||||
/*
|
|
||||||
if ($id_module == 5) {
|
|
||||||
$prediction_module = 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
|
@ -1764,17 +1795,26 @@ if ($create_module) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I save the result of the action (insert or update).
|
||||||
|
$success_action = $id_agent_module;
|
||||||
|
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
ui_print_error_message($msg);
|
ui_print_error_message($msg);
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
$moduletype = $id_module;
|
$moduletype = $id_module;
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Fail to try added module '$name' for agent ".$agent['alias']
|
"Fail to try added module '".$name."' for agent ".$agent['alias']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($prediction_module == 3) {
|
if ($prediction_module == 3) {
|
||||||
enterprise_hook('modules_create_synthetic_operations', [$id_agent_module, $serialize_ops]);
|
enterprise_hook(
|
||||||
|
'modules_create_synthetic_operations',
|
||||||
|
[
|
||||||
|
$id_agent_module,
|
||||||
|
$serialize_ops,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the module interval.
|
// Update the module interval.
|
||||||
|
@ -1789,7 +1829,7 @@ if ($create_module) {
|
||||||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'Agent management',
|
'Agent management',
|
||||||
"Added module '$name' for agent ".$agent['alias'],
|
"Added module '".$name."' for agent ".$agent['alias'],
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
io_json_mb_encode($values)
|
io_json_mb_encode($values)
|
||||||
|
@ -1797,6 +1837,112 @@ if ($create_module) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MODULE ENABLE/DISABLE
|
||||||
|
// =====================.
|
||||||
|
if ($enable_module) {
|
||||||
|
$result = modules_change_disabled($enable_module, 0);
|
||||||
|
$module_name = modules_get_agentmodule_name($enable_module);
|
||||||
|
|
||||||
|
// Write for conf disable if remote_config.
|
||||||
|
$configuration_data = enterprise_hook(
|
||||||
|
'config_agents_get_module_from_conf',
|
||||||
|
[
|
||||||
|
$id_agente,
|
||||||
|
io_safe_output($module_name),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
// Force disable.
|
||||||
|
$disabled = 0;
|
||||||
|
|
||||||
|
// Force Update when disabled for save disabled in conf.
|
||||||
|
$old_configuration_data = $configuration_data;
|
||||||
|
|
||||||
|
// Successfull action.
|
||||||
|
$success_action = $result;
|
||||||
|
|
||||||
|
$success_action = $result;
|
||||||
|
if ($result === NOERR) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'Module management',
|
||||||
|
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
db_pandora_audit(
|
||||||
|
'Module management',
|
||||||
|
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_result_message(
|
||||||
|
$result,
|
||||||
|
__('Successfully enabled'),
|
||||||
|
__('Could not be enabled')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($disable_module) {
|
||||||
|
$result = modules_change_disabled($disable_module, 1);
|
||||||
|
$module_name = modules_get_agentmodule_name($disable_module);
|
||||||
|
|
||||||
|
// Write for conf disable if remote_config.
|
||||||
|
$configuration_data = enterprise_hook(
|
||||||
|
'config_agents_get_module_from_conf',
|
||||||
|
[
|
||||||
|
$id_agente,
|
||||||
|
io_safe_output($module_name),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
// Force disable.
|
||||||
|
$disabled = 1;
|
||||||
|
|
||||||
|
// Force Update when disabled for save disabled in conf.
|
||||||
|
$old_configuration_data = $configuration_data;
|
||||||
|
|
||||||
|
// Successfull action.
|
||||||
|
$success_action = $result;
|
||||||
|
|
||||||
|
|
||||||
|
if ($result === NOERR) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'Module management',
|
||||||
|
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
db_pandora_audit(
|
||||||
|
'Module management',
|
||||||
|
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_result_message(
|
||||||
|
$result,
|
||||||
|
__('Successfully disabled'),
|
||||||
|
__('Could not be disabled')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix to stop the module from being added to the agent's conf
|
||||||
|
// when an error occurred while updating or inserting. or enable disable module.
|
||||||
|
if ($update_module || $create_module
|
||||||
|
|| $enable_module || $disable_module
|
||||||
|
) {
|
||||||
|
if ((!$module_in_policy && !$module_linked)
|
||||||
|
|| ($module_in_policy && !$module_linked)
|
||||||
|
) {
|
||||||
|
if ($success_action > 0) {
|
||||||
|
enterprise_hook(
|
||||||
|
'config_agents_write_module_in_conf',
|
||||||
|
[
|
||||||
|
$id_agente,
|
||||||
|
io_safe_output($old_configuration_data),
|
||||||
|
io_safe_output($configuration_data),
|
||||||
|
$disabled,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MODULE DELETION
|
// MODULE DELETION
|
||||||
// =================.
|
// =================.
|
||||||
if ($delete_module) {
|
if ($delete_module) {
|
||||||
|
@ -1996,46 +2142,6 @@ 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.'');
|
|
||||||
$modulo_nombre = $modulo_nombre['nombre'];
|
|
||||||
|
|
||||||
if ($result === NOERR) {
|
|
||||||
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
|
|
||||||
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
|
||||||
} else {
|
|
||||||
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
|
||||||
$result,
|
|
||||||
__('Successfully enabled'),
|
|
||||||
__('Could not be enabled')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($disable_module) {
|
|
||||||
$result = modules_change_disabled($disable_module, 1);
|
|
||||||
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
|
|
||||||
$modulo_nombre = $modulo_nombre['nombre'];
|
|
||||||
|
|
||||||
if ($result === NOERR) {
|
|
||||||
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
|
|
||||||
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
|
||||||
} else {
|
|
||||||
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_result_message(
|
|
||||||
$result,
|
|
||||||
__('Successfully disabled'),
|
|
||||||
__('Could not be disabled')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// UPDATE GIS
|
// UPDATE GIS
|
||||||
// ==========.
|
// ==========.
|
||||||
$updateGIS = get_parameter('update_gis', 0);
|
$updateGIS = get_parameter('update_gis', 0);
|
||||||
|
|
|
@ -118,7 +118,7 @@ if ($enable_agent) {
|
||||||
enterprise_include_once('include/functions_agents.php');
|
enterprise_include_once('include/functions_agents.php');
|
||||||
$values = ['disabled' => 0];
|
$values = ['disabled' => 0];
|
||||||
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
|
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
|
||||||
|
config_agents_update_config_token($enable_agent, 'standby', 0);
|
||||||
db_pandora_audit('Agent management', 'Enable '.$alias);
|
db_pandora_audit('Agent management', 'Enable '.$alias);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Agent management', 'Fail to enable '.$alias);
|
db_pandora_audit('Agent management', 'Fail to enable '.$alias);
|
||||||
|
@ -140,6 +140,7 @@ if ($disable_agent) {
|
||||||
enterprise_include_once('include/functions_agents.php');
|
enterprise_include_once('include/functions_agents.php');
|
||||||
$values = ['disabled' => 1];
|
$values = ['disabled' => 1];
|
||||||
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
|
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
|
||||||
|
config_agents_update_config_token($disable_agent, 'standby', 1);
|
||||||
|
|
||||||
db_pandora_audit('Agent management', 'Disable '.$alias);
|
db_pandora_audit('Agent management', 'Disable '.$alias);
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +163,7 @@ echo '<td>';
|
||||||
|
|
||||||
echo __('Group').' ';
|
echo __('Group').' ';
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
|
||||||
$return_all_group = false;
|
$return_all_group = false;
|
||||||
} else {
|
} else {
|
||||||
$return_all_group = true;
|
$return_all_group = true;
|
||||||
|
@ -679,7 +680,7 @@ if ($agents !== false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
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);
|
||||||
echo "<table width='100%'><tr><td align='right'>";
|
echo "<table width='100%'><tr><td align='right'>";
|
||||||
} else {
|
} else {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
|
||||||
|
|
|
@ -267,10 +267,10 @@ if ($id_agent_module) {
|
||||||
$cron_interval = explode(' ', $module['cron_interval']);
|
$cron_interval = explode(' ', $module['cron_interval']);
|
||||||
if (isset($cron_interval[4])) {
|
if (isset($cron_interval[4])) {
|
||||||
$minute_from = $cron_interval[0];
|
$minute_from = $cron_interval[0];
|
||||||
$min = explode('-', $minute_from);
|
$minute = explode('-', $minute_from);
|
||||||
$minute_from = $min[0];
|
$minute_from = $minute[0];
|
||||||
if (isset($min[1])) {
|
if (isset($minute[1])) {
|
||||||
$minute_to = $min[1];
|
$minute_to = $minute[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$hour_from = $cron_interval[1];
|
$hour_from = $cron_interval[1];
|
||||||
|
@ -583,7 +583,13 @@ echo '<h3 id="message" class="error invisible"></h3>';
|
||||||
// TODO: Change to the ui_print_error system
|
// TODO: Change to the ui_print_error system
|
||||||
echo '<form method="post" id="module_form">';
|
echo '<form method="post" id="module_form">';
|
||||||
|
|
||||||
html_print_table($table_simple);
|
ui_toggle(
|
||||||
|
html_print_table($table_simple, true),
|
||||||
|
__('Base options'),
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
ui_toggle(
|
ui_toggle(
|
||||||
html_print_table($table_advanced, true),
|
html_print_table($table_advanced, true),
|
||||||
|
@ -591,7 +597,7 @@ ui_toggle(
|
||||||
);
|
);
|
||||||
ui_toggle(
|
ui_toggle(
|
||||||
html_print_table($table_macros, true),
|
html_print_table($table_macros, true),
|
||||||
__('Custom macros').ui_print_help_icon('module_macros', true)
|
__('Custom macros')
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($moduletype != 13) {
|
if ($moduletype != 13) {
|
||||||
|
|
|
@ -78,10 +78,16 @@ function push_table_advanced($row, $id=false)
|
||||||
function add_component_selection($id_network_component_type)
|
function add_component_selection($id_network_component_type)
|
||||||
{
|
{
|
||||||
global $table_simple;
|
global $table_simple;
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if ($config['style'] === 'pandora_black') {
|
||||||
|
$background_row = 'background-color: #444';
|
||||||
|
} else {
|
||||||
|
$background_row = 'background-color: #cfcfcf';
|
||||||
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Using module component').' ';
|
$data[0] = __('Using module component').' ';
|
||||||
$data[0] .= ui_print_help_icon('network_component', true);
|
|
||||||
|
|
||||||
$component_groups = network_components_get_groups($id_network_component_type);
|
$component_groups = network_components_get_groups($id_network_component_type);
|
||||||
$data[1] = '<span id="component_group" class="left">';
|
$data[1] = '<span id="component_group" class="left">';
|
||||||
|
@ -117,7 +123,7 @@ function add_component_selection($id_network_component_type)
|
||||||
$data[1] .= '</span>';
|
$data[1] .= '</span>';
|
||||||
|
|
||||||
$table_simple->colspan['module_component'][1] = 3;
|
$table_simple->colspan['module_component'][1] = 3;
|
||||||
$table_simple->rowstyle['module_component'] = 'background-color: #cfcfcf';
|
$table_simple->rowstyle['module_component'] = $background_row;
|
||||||
|
|
||||||
prepend_table_simple($data, 'module_component');
|
prepend_table_simple($data, 'module_component');
|
||||||
}
|
}
|
||||||
|
@ -135,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
|
||||||
|
|
||||||
$page = get_parameter('page', '');
|
$page = get_parameter('page', '');
|
||||||
|
|
||||||
if (strstr($page, 'policy_modules') === false && $id_agent_module) {
|
$in_policies_page = strstr($page, 'policy_modules');
|
||||||
|
|
||||||
|
if ($in_policies_page === false && $id_agent_module) {
|
||||||
if ($config['enterprise_installed']) {
|
if ($config['enterprise_installed']) {
|
||||||
if (policies_is_module_linked($id_agent_module) == 1) {
|
if (policies_is_module_linked($id_agent_module) == 1) {
|
||||||
$disabledBecauseInPolicy = 1;
|
$disabledBecauseInPolicy = 1;
|
||||||
|
@ -159,10 +167,11 @@ if ($disabledBecauseInPolicy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_module_id = (int) get_parameter_get('update_module');
|
$update_module_id = (int) get_parameter_get('update_module');
|
||||||
|
$edit_module = (bool) get_parameter_get('edit_module');
|
||||||
$table_simple = new stdClass();
|
$table_simple = new stdClass();
|
||||||
$table_simple->id = 'simple';
|
$table_simple->id = 'simple';
|
||||||
$table_simple->width = '100%';
|
$table_simple->width = '100%';
|
||||||
$table_simple->class = 'databox';
|
$table_simple->class = 'no-class';
|
||||||
$table_simple->data = [];
|
$table_simple->data = [];
|
||||||
$table_simple->style = [];
|
$table_simple->style = [];
|
||||||
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
|
||||||
|
@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
|
||||||
$disabledBecauseInPolicy
|
$disabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
|
||||||
|
$edit = false;
|
||||||
|
} else {
|
||||||
|
$edit = true;
|
||||||
|
}
|
||||||
|
|
||||||
$in_policy = strstr($page, 'policy_modules');
|
$in_policy = strstr($page, 'policy_modules');
|
||||||
if (!$in_policy) {
|
if (!$in_policy) {
|
||||||
// Cannot select the current module to be itself parent
|
// Cannot select the current module to be itself parent
|
||||||
|
@ -270,20 +285,9 @@ if (!$in_policy) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon('module_type', true);
|
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
|
||||||
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
|
$table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
|
||||||
|
|
||||||
if (isset($id_agent_module)) {
|
|
||||||
if ($id_agent_module) {
|
|
||||||
$edit = false;
|
|
||||||
} else {
|
|
||||||
$edit = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Run into a policy
|
|
||||||
$edit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$edit) {
|
if (!$edit) {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id_tipo, nombre
|
'SELECT id_tipo, nombre
|
||||||
|
@ -350,11 +354,40 @@ if (!$edit) {
|
||||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($edit_module) {
|
||||||
|
$id_module_type = (int) $id_module_type;
|
||||||
|
if (($id_module_type >= 1 && $id_module_type <= 5)
|
||||||
|
|| ($id_module_type >= 21 && $id_module_type <= 23)
|
||||||
|
|| ($id_module_type == 100)
|
||||||
|
) {
|
||||||
|
$help_header = 'local_module';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_module_type === 6 || $id_module_type === 7
|
||||||
|
) {
|
||||||
|
$help_header = 'icmp_module_tab';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||||
|
$help_header = 'snmp_module_tab';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_module_type >= 8 && $id_module_type <= 11) {
|
||||||
|
$help_header = 'tcp_module_tab';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_module_type >= 30 && $id_module_type <= 33) {
|
||||||
|
$help_header = 'webserver_module_tab';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_header, true);
|
||||||
|
}
|
||||||
|
|
||||||
if ($disabledBecauseInPolicy) {
|
if ($disabledBecauseInPolicy) {
|
||||||
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
|
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval').' '.ui_print_help_icon('dynamic_threshold', true);
|
$table_simple->data[3][0] = __('Dynamic Threshold Interval');
|
||||||
$table_simple->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
$table_simple->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||||
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||||
if ($in_policy) {
|
if ($in_policy) {
|
||||||
|
@ -394,7 +427,7 @@ $table_simple->data[3][2] .= html_print_input_text(
|
||||||
$table_simple->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
$table_simple->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
||||||
$table_simple->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
$table_simple->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
||||||
|
|
||||||
$table_simple->data[4][0] = __('Warning status').' '.ui_print_help_icon('warning_status', true);
|
$table_simple->data[4][0] = __('Warning status');
|
||||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||||
$table_simple->data[4][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
|
$table_simple->data[4][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
|
||||||
$table_simple->data[4][1] .= html_print_input_text(
|
$table_simple->data[4][1] .= html_print_input_text(
|
||||||
|
@ -447,7 +480,7 @@ if (!modules_is_string_type($id_module_type) || $edit) {
|
||||||
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_simple->data[5][0] = __('Critical status').' '.ui_print_help_icon('critical_status', true);
|
$table_simple->data[5][0] = __('Critical status');
|
||||||
if (!modules_is_string_type($id_module_type) || $edit) {
|
if (!modules_is_string_type($id_module_type) || $edit) {
|
||||||
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
$table_simple->data[5][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
|
||||||
$table_simple->data[5][1] .= html_print_input_text(
|
$table_simple->data[5][1] .= html_print_input_text(
|
||||||
|
@ -498,7 +531,6 @@ $table_simple->data[5][1] .= html_print_checkbox('critical_inverse', 1, $critica
|
||||||
|
|
||||||
// FF stands for Flip-flop.
|
// FF stands for Flip-flop.
|
||||||
$table_simple->data[6][0] = __('FF threshold').' ';
|
$table_simple->data[6][0] = __('FF threshold').' ';
|
||||||
$table_simple->data[6][0] .= ui_print_help_icon('ff_threshold', true);
|
|
||||||
|
|
||||||
$table_simple->data[6][1] .= __('Keep counters');
|
$table_simple->data[6][1] .= __('Keep counters');
|
||||||
$table_simple->data[6][1] .= html_print_checkbox(
|
$table_simple->data[6][1] .= html_print_checkbox(
|
||||||
|
@ -609,7 +641,7 @@ if ($disabledBecauseInPolicy) {
|
||||||
$table_advanced = new stdClass();
|
$table_advanced = new stdClass();
|
||||||
$table_advanced->id = 'advanced';
|
$table_advanced->id = 'advanced';
|
||||||
$table_advanced->width = '100%';
|
$table_advanced->width = '100%';
|
||||||
$table_advanced->class = 'databox filters';
|
$table_advanced->class = 'no-class';
|
||||||
$table_advanced->data = [];
|
$table_advanced->data = [];
|
||||||
$table_advanced->style = [];
|
$table_advanced->style = [];
|
||||||
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
|
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
|
||||||
|
@ -673,15 +705,15 @@ if ($moduletype == MODULE_DATA) {
|
||||||
if (isset($id_agente)) {
|
if (isset($id_agente)) {
|
||||||
$agent_interval = agents_get_interval($id_agente);
|
$agent_interval = agents_get_interval($id_agente);
|
||||||
$interval_factor = ($interval / $agent_interval);
|
$interval_factor = ($interval / $agent_interval);
|
||||||
$table_advanced->data[2][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') '.ui_print_help_icon('module_interval_factor', true);
|
$table_advanced->data[2][1] = human_time_description_raw($interval).' ('.sprintf(__('Agent interval x %s'), $interval_factor).') ';
|
||||||
} else {
|
} else {
|
||||||
$table_advanced->data[2][1] = sprintf(__('Agent interval x %s'), $interval_factor).ui_print_help_icon('module_interval_factor', true);
|
$table_advanced->data[2][1] = sprintf(__('Agent interval x %s'), $interval_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($__code_from == 'policies') {
|
if ($__code_from == 'policies') {
|
||||||
// If is the policy form, module_interval will store the factor (not the seconds).
|
// If is the policy form, module_interval will store the factor (not the seconds).
|
||||||
// So server will transform it to interval in seconds
|
// So server will transform it to interval in seconds
|
||||||
$table_advanced->data[2][1] = sprintf(__('Default').': 1', $interval_factor).ui_print_help_icon('module_interval_factor', true);
|
$table_advanced->data[2][1] = sprintf(__('Default').': 1', $interval_factor);
|
||||||
$table_advanced->data[2][1] .= html_print_input_hidden('module_interval', $interval_factor, true);
|
$table_advanced->data[2][1] .= html_print_input_hidden('module_interval', $interval_factor, true);
|
||||||
} else if ($module_id_policy_module != 0) {
|
} else if ($module_id_policy_module != 0) {
|
||||||
$table_advanced->data[2][1] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
$table_advanced->data[2][1] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
||||||
|
@ -690,14 +722,14 @@ if ($moduletype == MODULE_DATA) {
|
||||||
// If it is a non policy form, the module_interval will not provided and will
|
// If it is a non policy form, the module_interval will not provided and will
|
||||||
// be taken the agent interval (this code is at configurar_agente.php)
|
// be taken the agent interval (this code is at configurar_agente.php)
|
||||||
} else {
|
} else {
|
||||||
$table_advanced->data[2][0] = __('Interval').ui_print_help_icon('module_interval', true);
|
$table_advanced->data[2][0] = __('Interval');
|
||||||
$table_advanced->colspan[2][1] = 2;
|
$table_advanced->colspan[2][1] = 2;
|
||||||
$table_advanced->data[2][1] = html_print_extended_select_for_time('module_interval', $interval, '', '', '0', false, true, false, false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
$table_advanced->data[2][1] = html_print_extended_select_for_time('module_interval', $interval, '', '', '0', false, true, false, false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_advanced->data[2][1] .= html_print_input_hidden('moduletype', $moduletype, true);
|
$table_advanced->data[2][1] .= html_print_input_hidden('moduletype', $moduletype, true);
|
||||||
|
|
||||||
$table_advanced->data[2][3] = __('Post process').' '.ui_print_help_icon('postprocess', true);
|
$table_advanced->data[2][3] = __('Post process');
|
||||||
$table_advanced->data[2][4] = html_print_extended_select_for_post_process(
|
$table_advanced->data[2][4] = html_print_extended_select_for_post_process(
|
||||||
'post_process',
|
'post_process',
|
||||||
$post_process,
|
$post_process,
|
||||||
|
@ -763,7 +795,7 @@ $table_advanced->data[4][4] = html_print_checkbox(
|
||||||
);
|
);
|
||||||
$table_advanced->colspan[4][4] = 3;
|
$table_advanced->colspan[4][4] = 3;
|
||||||
|
|
||||||
$table_advanced->data[5][0] = __('FF interval').' '.ui_print_help_icon('ff_interval', true);
|
$table_advanced->data[5][0] = __('FF interval');
|
||||||
$table_advanced->data[5][1] = html_print_input_text(
|
$table_advanced->data[5][1] = html_print_input_text(
|
||||||
'module_ff_interval',
|
'module_ff_interval',
|
||||||
$ff_interval,
|
$ff_interval,
|
||||||
|
@ -778,7 +810,7 @@ $table_advanced->data[5][1] = html_print_input_text(
|
||||||
).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true);
|
).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true);
|
||||||
$table_advanced->colspan[5][1] = 2;
|
$table_advanced->colspan[5][1] = 2;
|
||||||
|
|
||||||
$table_advanced->data[5][3] = __('FF timeout').' '.ui_print_help_icon('ff_timeout', true);
|
$table_advanced->data[5][3] = __('FF timeout');
|
||||||
|
|
||||||
$module_type_name = modules_get_type_name($id_module_type);
|
$module_type_name = modules_get_type_name($id_module_type);
|
||||||
$table_advanced->data[5][4] = '';
|
$table_advanced->data[5][4] = '';
|
||||||
|
@ -980,7 +1012,7 @@ $table_advanced->colspan[10][1] = 6;
|
||||||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
|
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
|
||||||
if ($has_remote_conf) {
|
if ($has_remote_conf) {
|
||||||
$table_advanced->data[11][0] = __('Cron from').ui_print_help_icon('cron', true);
|
$table_advanced->data[11][0] = __('Cron from');
|
||||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||||
$table_advanced->colspan[11][1] = 6;
|
$table_advanced->colspan[11][1] = 6;
|
||||||
|
|
||||||
|
@ -988,7 +1020,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||||
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||||
$table_advanced->colspan[12][1] = 6;
|
$table_advanced->colspan[12][1] = 6;
|
||||||
} else {
|
} else {
|
||||||
$table_advanced->data[11][0] = __('Cron from').ui_print_help_icon('cron', true);
|
$table_advanced->data[11][0] = __('Cron from');
|
||||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||||
$table_advanced->colspan[11][1] = 6;
|
$table_advanced->colspan[11][1] = 6;
|
||||||
|
|
||||||
|
@ -997,7 +1029,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||||
$table_advanced->colspan[12][1] = 6;
|
$table_advanced->colspan[12][1] = 6;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$table_advanced->data[11][0] = __('Cron from').ui_print_help_icon('cron', true);
|
$table_advanced->data[11][0] = __('Cron from');
|
||||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||||
$table_advanced->colspan[11][1] = 6;
|
$table_advanced->colspan[11][1] = 6;
|
||||||
|
|
||||||
|
@ -1038,7 +1070,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$table_macros = new stdClass();
|
$table_macros = new stdClass();
|
||||||
$table_macros->id = 'module_macros';
|
$table_macros->id = 'module_macros';
|
||||||
$table_macros->width = '100%';
|
$table_macros->width = '100%';
|
||||||
$table_macros->class = 'databox filters';
|
$table_macros->class = 'no-class';
|
||||||
$table_macros->data = [];
|
$table_macros->data = [];
|
||||||
$table_macros->style = [];
|
$table_macros->style = [];
|
||||||
$table_macros->style[0] = 'font-weight: bold;';
|
$table_macros->style[0] = 'font-weight: bold;';
|
||||||
|
@ -1073,20 +1105,20 @@ $macro_count++;
|
||||||
|
|
||||||
html_print_input_hidden('module_macro_count', $macro_count);
|
html_print_input_hidden('module_macro_count', $macro_count);
|
||||||
|
|
||||||
/*
|
// Advanced form part.
|
||||||
Advanced form part */
|
// Add relationships.
|
||||||
// Add relationships
|
|
||||||
$table_new_relations = new stdClass();
|
$table_new_relations = new stdClass();
|
||||||
$table_new_relations->id = 'module_new_relations';
|
$table_new_relations->id = 'module_new_relations';
|
||||||
$table_new_relations->width = '100%';
|
$table_new_relations->width = '100%';
|
||||||
$table_new_relations->class = 'databox filters';
|
$table_new_relations->class = 'no-class';
|
||||||
$table_new_relations->data = [];
|
$table_new_relations->data = [];
|
||||||
$table_new_relations->style = [];
|
$table_new_relations->style = [];
|
||||||
$table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
|
$table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
|
||||||
$table_new_relations->style[1] = 'width: 25%; text-align: center;';
|
$table_new_relations->style[1] = 'width: 25%; text-align: center;';
|
||||||
$table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
|
$table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
|
||||||
$table_new_relations->style[3] = 'width: 25%; text-align: center;';
|
$table_new_relations->style[3] = 'width: 25%; text-align: center;';
|
||||||
$table_new_relations->style[4] = 'width: 30%; text-align: center;';
|
$table_new_relations->style[4] = 'width: 10%; font-weight: bold;';
|
||||||
|
$table_new_relations->style[5] = 'width: 25%; text-align: center;';
|
||||||
|
|
||||||
$table_new_relations->data[0][0] = __('Agent');
|
$table_new_relations->data[0][0] = __('Agent');
|
||||||
$params = [];
|
$params = [];
|
||||||
|
@ -1100,10 +1132,35 @@ $params['javascript_function_action_after_select_js_call'] = 'change_modules_aut
|
||||||
$table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params);
|
$table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params);
|
||||||
$table_new_relations->data[0][2] = __('Module');
|
$table_new_relations->data[0][2] = __('Module');
|
||||||
$table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>";
|
$table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>";
|
||||||
$table_new_relations->data[0][4] = html_print_button(__('Add relationship'), 'add_relation', false, 'javascript: add_new_relation();', 'class="sub add"', true);
|
|
||||||
$table_new_relations->data[0][4] .= " <div id='add_relation_status' style='display: inline;'></div>";
|
|
||||||
|
|
||||||
// Relationship list
|
$array_rel_type = [];
|
||||||
|
$array_rel_type['direct'] = __('Direct');
|
||||||
|
$array_rel_type['failover'] = __('Failover');
|
||||||
|
$table_new_relations->data[0][4] = __('Rel. type');
|
||||||
|
$table_new_relations->data[0][5] = html_print_select(
|
||||||
|
$array_rel_type,
|
||||||
|
'relation_type',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
$table_new_relations->data[0][6] = html_print_button(
|
||||||
|
__('Add relationship'),
|
||||||
|
'add_relation',
|
||||||
|
false,
|
||||||
|
'javascript: add_new_relation();',
|
||||||
|
'class="sub add"',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table_new_relations->data[0][6] .= " <div id='add_relation_status' style='display: inline;'></div>";
|
||||||
|
|
||||||
|
// Relationship list.
|
||||||
$table_relations = new stdClass();
|
$table_relations = new stdClass();
|
||||||
$table_relations->id = 'module_relations';
|
$table_relations->id = 'module_relations';
|
||||||
$table_relations->width = '100%';
|
$table_relations->width = '100%';
|
||||||
|
@ -1113,19 +1170,26 @@ $table_relations->data = [];
|
||||||
$table_relations->rowstyle = [];
|
$table_relations->rowstyle = [];
|
||||||
$table_relations->rowstyle[-1] = 'display: none;';
|
$table_relations->rowstyle[-1] = 'display: none;';
|
||||||
$table_relations->style = [];
|
$table_relations->style = [];
|
||||||
$table_relations->style[2] = 'width: 10%; text-align: center;';
|
|
||||||
$table_relations->style[3] = 'width: 10%; text-align: center;';
|
$table_relations->style[3] = 'width: 10%; text-align: center;';
|
||||||
|
$table_relations->style[4] = 'width: 10%; text-align: center;';
|
||||||
|
|
||||||
$table_relations->head[0] = __('Agent');
|
$table_relations->head[0] = __('Agent');
|
||||||
$table_relations->head[1] = __('Module');
|
$table_relations->head[1] = __('Module');
|
||||||
$table_relations->head[2] = __('Changes').ui_print_help_tip(__('Activate this to prevent the relation from being updated or deleted'), true);
|
$table_relations->head[2] = __('Type');
|
||||||
$table_relations->head[3] = __('Delete');
|
$table_relations->head[3] = __('Changes').ui_print_help_tip(
|
||||||
|
__('Activate this to prevent the relation from being updated or deleted'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table_relations->head[4] = __('Delete');
|
||||||
|
|
||||||
// Create an invisible row to use their html to add new rows
|
// Create an invisible row to use their html to add new rows.
|
||||||
$table_relations->data[-1][0] = '';
|
$table_relations->data[-1][0] = '';
|
||||||
$table_relations->data[-1][1] = '';
|
$table_relations->data[-1][1] = '';
|
||||||
$table_relations->data[-1][2] = '<a id="disable_updates_button" class="alpha50" href="">'.html_print_image('images/lock.png', true).'</a>';
|
$table_relations->data[-1][2] = '';
|
||||||
$table_relations->data[-1][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>';
|
$table_relations->data[-1][3] = '<a id="disable_updates_button" class="alpha50" href="">';
|
||||||
|
$table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>';
|
||||||
|
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
|
||||||
|
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
|
||||||
|
|
||||||
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
||||||
if (!$module_relations) {
|
if (!$module_relations) {
|
||||||
|
@ -1136,10 +1200,14 @@ $relations_count = 0;
|
||||||
foreach ($module_relations as $key => $module_relation) {
|
foreach ($module_relations as $key => $module_relation) {
|
||||||
if ($module_relation['module_a'] == $id_agent_module) {
|
if ($module_relation['module_a'] == $id_agent_module) {
|
||||||
$module_id = $module_relation['module_b'];
|
$module_id = $module_relation['module_b'];
|
||||||
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_b']);
|
$agent_id = modules_give_agent_id_from_module_id(
|
||||||
|
$module_relation['module_b']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$module_id = $module_relation['module_a'];
|
$module_id = $module_relation['module_a'];
|
||||||
$agent_id = modules_give_agent_id_from_module_id($module_relation['module_a']);
|
$agent_id = modules_give_agent_id_from_module_id(
|
||||||
|
$module_relation['module_a']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$agent_name = ui_print_agent_name($agent_id, true);
|
$agent_name = ui_print_agent_name($agent_id, true);
|
||||||
|
@ -1155,14 +1223,16 @@ foreach ($module_relations as $key => $module_relation) {
|
||||||
$disabled_update_class = 'alpha50';
|
$disabled_update_class = 'alpha50';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Agent name
|
// Agent name.
|
||||||
$table_relations->data[$relations_count][0] = $agent_name;
|
$table_relations->data[$relations_count][0] = $agent_name;
|
||||||
// Module name
|
// Module name.
|
||||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
||||||
// Lock relationship updates
|
// Type.
|
||||||
$table_relations->data[$relations_count][2] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
|
||||||
// Delete relationship
|
// Lock relationship updates.
|
||||||
$table_relations->data[$relations_count][3] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
||||||
|
// Delete relationship.
|
||||||
|
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
||||||
$relations_count++;
|
$relations_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1170,7 +1240,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
|
||||||
|
|
||||||
ui_require_jquery_file('json');
|
ui_require_jquery_file('json');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -1224,7 +1293,120 @@ $(document).ready (function () {
|
||||||
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
|
var type_names = jQuery.parseJSON(Base64.decode($('#hidden-type_names').val()));
|
||||||
|
|
||||||
var type_name_selected = type_names[type_selected];
|
var type_name_selected = type_names[type_selected];
|
||||||
|
var element = document.getElementById("module_type_help");
|
||||||
|
var language = "<?php echo $config['language']; ?>" ;
|
||||||
|
element.onclick = function (event) {
|
||||||
|
if(type_name_selected == 'async_data' ||
|
||||||
|
type_name_selected == 'async_proc' ||
|
||||||
|
type_name_selected == 'async_string' ||
|
||||||
|
type_name_selected == 'generic_proc'||
|
||||||
|
type_name_selected == 'generic_data' ||
|
||||||
|
type_name_selected == 'generic_data_inc' ||
|
||||||
|
type_name_selected == 'generic_data_inc_abs'||
|
||||||
|
type_name_selected == 'generic_data_string' ||
|
||||||
|
type_name_selected == 'keep_alive'
|
||||||
|
){
|
||||||
|
if (language == 'es'){
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type_name_selected == 'remote_icmp' ||
|
||||||
|
type_name_selected == 'remote_icmp_proc'
|
||||||
|
){
|
||||||
|
if(language == 'es'){
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type_name_selected == 'remote_snmp_string' ||
|
||||||
|
type_name_selected == 'remote_snmp_proc' ||
|
||||||
|
type_name_selected == 'remote_snmp_inc' ||
|
||||||
|
type_name_selected == 'remote_snmp'
|
||||||
|
){
|
||||||
|
if(language == 'es'){
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if(type_name_selected == 'remote_tcp_string' ||
|
||||||
|
type_name_selected == 'remote_tcp_proc' ||
|
||||||
|
type_name_selected == 'remote_tcp_inc' ||
|
||||||
|
type_name_selected == 'remote_tcp'
|
||||||
|
){
|
||||||
|
if(language == 'es'){
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(type_name_selected == 'web_data' ||
|
||||||
|
type_name_selected == 'web_proc' ||
|
||||||
|
type_name_selected == 'web_content_data' ||
|
||||||
|
type_name_selected == 'web_content_string'
|
||||||
|
){
|
||||||
|
if(language == 'es'){
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.open(
|
||||||
|
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
|
||||||
|
'_blank',
|
||||||
|
'width=800,height=600'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type_name_selected.match(/_string$/) == null) {
|
if (type_name_selected.match(/_string$/) == null) {
|
||||||
// Numeric types
|
// Numeric types
|
||||||
$('#string_critical').hide();
|
$('#string_critical').hide();
|
||||||
|
@ -1241,7 +1423,7 @@ $(document).ready (function () {
|
||||||
$('#minmax_warning').hide();
|
$('#minmax_warning').hide();
|
||||||
$('#svg_dinamic').hide();
|
$('#svg_dinamic').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type_name_selected.match(/async/) == null) {
|
if (type_name_selected.match(/async/) == null) {
|
||||||
$('#ff_timeout').hide();
|
$('#ff_timeout').hide();
|
||||||
$('#ff_timeout_disable').show();
|
$('#ff_timeout_disable').show();
|
||||||
|
@ -1251,16 +1433,16 @@ $(document).ready (function () {
|
||||||
$('#ff_timeout_disable').hide();
|
$('#ff_timeout_disable').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#id_module_type").trigger('change');
|
$("#id_module_type").trigger('change');
|
||||||
|
|
||||||
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
|
// Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
|
||||||
$("#text-autocomplete_agent_name").keydown(function(event) {
|
$("#text-autocomplete_agent_name").keydown(function(event) {
|
||||||
if(event.keyCode == 13) { // key code 13 is the enter button
|
if(event.keyCode == 13) { // key code 13 is the enter button
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//validate post_process. Change ',' by '.'
|
//validate post_process. Change ',' by '.'
|
||||||
$("#submit-updbutton").click (function () {
|
$("#submit-updbutton").click (function () {
|
||||||
validate_post_process();
|
validate_post_process();
|
||||||
|
@ -1367,7 +1549,6 @@ function advanced_option_dynamic() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('.hide_dinamic').show();
|
$('.hide_dinamic').show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,11 +1560,9 @@ function change_modules_autocomplete_input () {
|
||||||
var module_autocomplete = $("#module_autocomplete");
|
var module_autocomplete = $("#module_autocomplete");
|
||||||
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
|
var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
|
||||||
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
|
var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
|
||||||
|
|
||||||
if (!module_autocomplete.hasClass('working')) {
|
if (!module_autocomplete.hasClass('working')) {
|
||||||
module_autocomplete.addClass('working');
|
module_autocomplete.addClass('working');
|
||||||
module_autocomplete.html(load_icon);
|
module_autocomplete.html(load_icon);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "ajax.php",
|
||||||
|
@ -1418,22 +1597,26 @@ function change_modules_autocomplete_input () {
|
||||||
|
|
||||||
// Add a new relation
|
// Add a new relation
|
||||||
function add_new_relation () {
|
function add_new_relation () {
|
||||||
var module_a_id = parseInt($("#hidden-id_agent_module").val());
|
var module_a_id = parseInt(
|
||||||
var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val());
|
$("#hidden-id_agent_module").val()
|
||||||
|
);
|
||||||
|
var module_b_id = parseInt(
|
||||||
|
$("#hidden-autocomplete_module_name_hidden").val()
|
||||||
|
);
|
||||||
var module_b_name = $("#text-autocomplete_module_name").val();
|
var module_b_name = $("#text-autocomplete_module_name").val();
|
||||||
var agent_b_name = $("#text-autocomplete_agent_name").val();
|
var agent_b_name = $("#text-autocomplete_agent_name").val();
|
||||||
|
var relation_type = $("#relation_type").val();
|
||||||
var hiddenRow = $("#module_relations--1");
|
var hiddenRow = $("#module_relations--1");
|
||||||
var button = $("#button-add_relation");
|
var button = $("#button-add_relation");
|
||||||
var iconPlaceholder = $("#add_relation_status");
|
var iconPlaceholder = $("#add_relation_status");
|
||||||
var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>';
|
var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>';
|
||||||
var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>';
|
var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>';
|
||||||
var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
|
var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
|
||||||
|
|
||||||
|
|
||||||
if (!button.hasClass('working')) {
|
if (!button.hasClass('working')) {
|
||||||
button.addClass('working');
|
button.addClass('working');
|
||||||
iconPlaceholder.html(load_icon);
|
iconPlaceholder.html(load_icon);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "ajax.php",
|
||||||
|
@ -1443,7 +1626,8 @@ function add_new_relation () {
|
||||||
add_module_relation: true,
|
add_module_relation: true,
|
||||||
id_module_a: module_a_id,
|
id_module_a: module_a_id,
|
||||||
id_module_b: module_b_id,
|
id_module_b: module_b_id,
|
||||||
name_module_b: module_b_name
|
name_module_b: module_b_name,
|
||||||
|
relation_type: relation_type
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
button.removeClass('working');
|
button.removeClass('working');
|
||||||
|
@ -1454,29 +1638,30 @@ function add_new_relation () {
|
||||||
else {
|
else {
|
||||||
iconPlaceholder.html(suc_icon);
|
iconPlaceholder.html(suc_icon);
|
||||||
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
setTimeout( function() { iconPlaceholder.html(''); }, 2000);
|
||||||
|
|
||||||
// Add the new row
|
// Add the new row
|
||||||
var relationsCount = parseInt($("#hidden-module_relations_count").val());
|
var relationsCount = parseInt($("#hidden-module_relations_count").val());
|
||||||
|
|
||||||
var rowClass = "datos";
|
var rowClass = "datos";
|
||||||
if (relationsCount % 2 != 0) {
|
if (relationsCount % 2 != 0) {
|
||||||
rowClass = "datos2";
|
rowClass = "datos2";
|
||||||
}
|
}
|
||||||
|
|
||||||
var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' +
|
var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' +
|
||||||
'<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
|
'<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
|
||||||
'<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
|
'<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
|
||||||
'<td id="module_relations-' + relationsCount + '-2" style="width: 10%; text-align: center;">' +
|
'<td id="module_relations-' + relationsCount + '-2">' + relation_type + '</td>' +
|
||||||
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
|
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
|
||||||
'<?php echo html_print_image('images/lock.png', true); ?>' +
|
'<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
|
||||||
'</a>' +
|
'<?php echo html_print_image('images/lock.png', true); ?>' +
|
||||||
'</td>' +
|
'</a>' +
|
||||||
'<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
|
'</td>' +
|
||||||
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
|
'<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
|
||||||
'<?php echo html_print_image('images/cross.png', true); ?>' +
|
'<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data + ');">' +
|
||||||
'</a>' +
|
'<?php echo html_print_image('images/cross.png', true); ?>' +
|
||||||
'</td>' +
|
'</a>' +
|
||||||
'</tr>';
|
'</td>' +
|
||||||
|
'</tr>';
|
||||||
$("#module_relations").find("tbody").append(rowHTML);
|
$("#module_relations").find("tbody").append(rowHTML);
|
||||||
|
|
||||||
$("#hidden-module_relations_count").val(relationsCount + 1);
|
$("#hidden-module_relations_count").val(relationsCount + 1);
|
||||||
|
|
|
@ -128,7 +128,7 @@ $snmp_versions['2c'] = 'v. 2c';
|
||||||
$snmp_versions['3'] = 'v. 3';
|
$snmp_versions['3'] = 'v. 3';
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('SNMP community').ui_print_help_icon('column_macros', true);
|
$data[0] = __('SNMP community');
|
||||||
$adopt = false;
|
$adopt = false;
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
||||||
$adopt = policies_is_module_adopt($id_agent_module);
|
$adopt = policies_is_module_adopt($id_agent_module);
|
||||||
|
@ -233,7 +233,7 @@ push_table_simple($data, 'snmp_2');
|
||||||
|
|
||||||
// Advanced stuff
|
// Advanced stuff
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true);
|
$data[0] = __('TCP send');
|
||||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||||
$table_simple->colspan['tcp_send'][1] = 3;
|
$table_simple->colspan['tcp_send'][1] = 3;
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ if (!isset($id_agent_module)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Auth user').ui_print_help_icon('column_macros', true);
|
$data[0] = __('Auth user');
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
'snmp3_auth_user',
|
'snmp3_auth_user',
|
||||||
$snmp3_auth_user,
|
$snmp3_auth_user,
|
||||||
|
@ -290,7 +290,7 @@ $data[1] = html_print_input_text(
|
||||||
'',
|
'',
|
||||||
$classdisabledBecauseInPolicy
|
$classdisabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$data[2] = __('Auth password').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'snmp3_auth_pass',
|
'snmp3_auth_pass',
|
||||||
$snmp3_auth_pass,
|
$snmp3_auth_pass,
|
||||||
|
@ -312,7 +312,7 @@ push_table_simple($data, 'field_snmpv3_row1');
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Privacy method');
|
$data[0] = __('Privacy method');
|
||||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||||
$data[2] = __('Privacy pass').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'snmp3_privacy_pass',
|
'snmp3_privacy_pass',
|
||||||
$snmp3_privacy_pass,
|
$snmp3_privacy_pass,
|
||||||
|
@ -506,45 +506,5 @@ $(document).ready (function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show the SNMP browser window
|
|
||||||
function snmpBrowserWindow () {
|
|
||||||
|
|
||||||
// Keep elements in the form and the SNMP browser synced
|
|
||||||
$('#text-target_ip').val($('#text-ip_target').val());
|
|
||||||
$('#text-community').val($('#text-snmp_community').val());
|
|
||||||
$('#snmp_browser_version').val($('#snmp_version').val());
|
|
||||||
$('#text-snmp3_browser_auth_user').val($('#text-snmp3_auth_user').val());
|
|
||||||
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
|
|
||||||
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
|
|
||||||
$('#password-snmp3_browser_auth_pass').val($('#password-snmp3_auth_pass').val());
|
|
||||||
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
|
|
||||||
$('#password-snmp3_browser_privacy_pass').val($('#password-snmp3_privacy_pass').val());
|
|
||||||
|
|
||||||
$("#snmp_browser_container").show().dialog ({
|
|
||||||
title: '',
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
width: 920,
|
|
||||||
height: 500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the form OID to the value selected in the SNMP browser
|
|
||||||
function setOID () {
|
|
||||||
|
|
||||||
if($('#snmp_browser_version').val() == '3'){
|
|
||||||
$('#text-snmp_oid').val($('#table1-0-1').text());
|
|
||||||
} else {
|
|
||||||
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the SNMP browser
|
|
||||||
$('.ui-dialog-titlebar-close').trigger('click');
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -79,7 +79,7 @@ push_table_simple($data, 'plugin_1');
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = 'macro_desc';
|
$data[0] = 'macro_desc';
|
||||||
$data[0] .= ui_print_help_tip('macro_help', true);
|
$data[0] .= ui_print_help_tip('macro_help', true);
|
||||||
$data[1] = html_print_input_text('macro_name', 'macro_value', '', 100, 1024, true);
|
$data[1] = html_print_input_text('macro_name[]', 'macro_value', '', 100, 1024, true);
|
||||||
$table_simple->colspan['macro_field'][1] = 3;
|
$table_simple->colspan['macro_field'][1] = 3;
|
||||||
$table_simple->rowstyle['macro_field'] = 'display:none';
|
$table_simple->rowstyle['macro_field'] = 'display:none';
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ if (empty($update_module_id)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Target IP');
|
$data[0] = __('Target IP').' '.ui_print_help_icon('wmi_module_tab', true);
|
||||||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||||
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
|
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
|
||||||
$data[3] = html_print_input_text(
|
$data[3] = html_print_input_text(
|
||||||
|
@ -60,7 +60,7 @@ $data[3] = html_print_input_text(
|
||||||
push_table_simple($data, 'target_ip');
|
push_table_simple($data, 'target_ip');
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Username').ui_print_help_icon('column_macros', true);
|
$data[0] = __('Username');
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
'plugin_user',
|
'plugin_user',
|
||||||
$plugin_user,
|
$plugin_user,
|
||||||
|
@ -73,7 +73,7 @@ $data[1] = html_print_input_text(
|
||||||
'',
|
'',
|
||||||
$classdisabledBecauseInPolicy
|
$classdisabledBecauseInPolicy
|
||||||
);
|
);
|
||||||
$data[2] = __('Password').ui_print_help_icon('column_macros', true);
|
$data[2] = __('Password');
|
||||||
$data[3] = html_print_input_password(
|
$data[3] = html_print_input_password(
|
||||||
'plugin_pass',
|
'plugin_pass',
|
||||||
$plugin_pass,
|
$plugin_pass,
|
||||||
|
@ -83,15 +83,14 @@ $data[3] = html_print_input_password(
|
||||||
true,
|
true,
|
||||||
$disabledBecauseInPolicy,
|
$disabledBecauseInPolicy,
|
||||||
false,
|
false,
|
||||||
'',
|
$classdisabledBecauseInPolicy,
|
||||||
$classdisabledBecauseInPolicy
|
'new-password'
|
||||||
);
|
);
|
||||||
|
|
||||||
push_table_simple($data, 'user_pass');
|
push_table_simple($data, 'user_pass');
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('WMI query');
|
$data[0] = __('WMI query');
|
||||||
$data[0] .= ui_print_help_icon('wmiquery', true);
|
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
'snmp_oid',
|
'snmp_oid',
|
||||||
$snmp_oid,
|
$snmp_oid,
|
||||||
|
|
|
@ -1,16 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
// Pandora FMS - http://pandorafms.com
|
/**
|
||||||
// ==================================================
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
* point to.
|
||||||
// Please see http://pandorafms.org for full contribution list
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* @category Planned Donwtimes
|
||||||
// modify it under the terms of the GNU General Public License
|
* @package Pandora FMS
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @subpackage Community
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @version 1.0.0
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* @license See below
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
// GNU General Public License for more details.
|
* ______ ___ _______ _______ ________
|
||||||
// Load global vars
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
@ -27,82 +43,119 @@ if (!$agent_d && !$agent_w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
// Default.
|
||||||
set_unless_defined($config['past_planned_downtimes'], 1);
|
set_unless_defined($config['past_planned_downtimes'], 1);
|
||||||
|
|
||||||
require_once 'include/functions_users.php';
|
require_once 'include/functions_users.php';
|
||||||
|
|
||||||
// Buttons
|
// Buttons.
|
||||||
$buttons = [
|
$buttons = [
|
||||||
'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image('images/list.png', true, ['title' => __('List')]).'</a>',
|
'text' => "<a href='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>".html_print_image(
|
||||||
|
'images/list.png',
|
||||||
|
true,
|
||||||
|
['title' => __('List')]
|
||||||
|
).'</a>',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Planned Downtime'),
|
__('Planned Downtime'),
|
||||||
'images/gm_monitoring.png',
|
'images/gm_monitoring.png',
|
||||||
false,
|
false,
|
||||||
'planned_downtime',
|
'planned_downtime_editor',
|
||||||
true,
|
true,
|
||||||
$buttons
|
$buttons
|
||||||
);
|
);
|
||||||
|
|
||||||
// recursion group filter
|
// Recursion group filter.
|
||||||
$recursion = get_parameter('recursion', $_POST['recursion']);
|
$recursion = get_parameter('recursion', $_POST['recursion']);
|
||||||
|
|
||||||
|
|
||||||
// Initialize data
|
// Initialize data.
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
$name = (string) get_parameter('name');
|
$name = (string) get_parameter('name');
|
||||||
$description = (string) get_parameter('description');
|
$description = (string) get_parameter('description');
|
||||||
|
|
||||||
$type_downtime = (string) get_parameter('type_downtime', 'quiet');
|
$type_downtime = (string) get_parameter('type_downtime', 'quiet');
|
||||||
$type_execution = (string) get_parameter('type_execution', 'once');
|
$type_execution = (string) get_parameter('type_execution', 'once');
|
||||||
$type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
|
$type_periodicity = (string) get_parameter('type_periodicity', 'weekly');
|
||||||
|
|
||||||
$utimestamp = get_system_time();
|
$utimestamp = get_system_time();
|
||||||
// Fake utimestamp to retrieve the string date of the system
|
// Fake utimestamp to retrieve the string date of the system.
|
||||||
$system_time = ($utimestamp - get_fixed_offset());
|
$system_time = ($utimestamp - get_fixed_offset());
|
||||||
|
|
||||||
$once_date_from = (string) get_parameter('once_date_from', date(DATE_FORMAT, $utimestamp));
|
$once_date_from = (string) get_parameter(
|
||||||
$once_time_from = (string) get_parameter('once_time_from', date(TIME_FORMAT, $utimestamp));
|
'once_date_from',
|
||||||
$once_date_to = (string) get_parameter('once_date_to', date(DATE_FORMAT, $utimestamp));
|
date(DATE_FORMAT, $utimestamp)
|
||||||
$once_time_to = (string) get_parameter('once_time_to', date(TIME_FORMAT, ($utimestamp + SECONDS_1HOUR)));
|
);
|
||||||
|
$once_time_from = (string) get_parameter(
|
||||||
|
'once_time_from',
|
||||||
|
date(TIME_FORMAT, $utimestamp)
|
||||||
|
);
|
||||||
|
$once_date_to = (string) get_parameter(
|
||||||
|
'once_date_to',
|
||||||
|
date(DATE_FORMAT, $utimestamp)
|
||||||
|
);
|
||||||
|
$once_time_to = (string) get_parameter(
|
||||||
|
'once_time_to',
|
||||||
|
date(TIME_FORMAT, ($utimestamp + SECONDS_1HOUR))
|
||||||
|
);
|
||||||
|
|
||||||
$periodically_day_from = (int) get_parameter('periodically_day_from', 1);
|
$periodically_day_from = (int) get_parameter(
|
||||||
$periodically_day_to = (int) get_parameter('periodically_day_to', 31);
|
'periodically_day_from',
|
||||||
$periodically_time_from = (string) get_parameter('periodically_time_from', date(TIME_FORMAT, $system_time));
|
1
|
||||||
$periodically_time_to = (string) get_parameter('periodically_time_to', date(TIME_FORMAT, ($system_time + SECONDS_1HOUR)));
|
);
|
||||||
|
$periodically_day_to = (int) get_parameter(
|
||||||
|
'periodically_day_to',
|
||||||
|
31
|
||||||
|
);
|
||||||
|
$periodically_time_from = (string) get_parameter(
|
||||||
|
'periodically_time_from',
|
||||||
|
date(TIME_FORMAT, $system_time)
|
||||||
|
);
|
||||||
|
$periodically_time_to = (string) get_parameter(
|
||||||
|
'periodically_time_to',
|
||||||
|
date(TIME_FORMAT, ($system_time + SECONDS_1HOUR))
|
||||||
|
);
|
||||||
|
|
||||||
$monday = (bool) get_parameter('monday');
|
$monday = (bool) get_parameter('monday');
|
||||||
$tuesday = (bool) get_parameter('tuesday');
|
$tuesday = (bool) get_parameter('tuesday');
|
||||||
$wednesday = (bool) get_parameter('wednesday');
|
$wednesday = (bool) get_parameter('wednesday');
|
||||||
$thursday = (bool) get_parameter('thursday');
|
$thursday = (bool) get_parameter('thursday');
|
||||||
$friday = (bool) get_parameter('friday');
|
$friday = (bool) get_parameter('friday');
|
||||||
$saturday = (bool) get_parameter('saturday');
|
$saturday = (bool) get_parameter('saturday');
|
||||||
$sunday = (bool) get_parameter('sunday');
|
$sunday = (bool) get_parameter('sunday');
|
||||||
|
|
||||||
$first_create = (int) get_parameter('first_create');
|
$first_create = (int) get_parameter('first_create');
|
||||||
$create_downtime = (int) get_parameter('create_downtime');
|
$create_downtime = (int) get_parameter('create_downtime');
|
||||||
$update_downtime = (int) get_parameter('update_downtime');
|
$update_downtime = (int) get_parameter('update_downtime');
|
||||||
$edit_downtime = (int) get_parameter('edit_downtime');
|
$edit_downtime = (int) get_parameter('edit_downtime');
|
||||||
$id_downtime = (int) get_parameter('id_downtime');
|
$id_downtime = (int) get_parameter('id_downtime');
|
||||||
|
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
$insert_downtime_agent = (int) get_parameter('insert_downtime_agent');
|
$insert_downtime_agent = (int) get_parameter('insert_downtime_agent');
|
||||||
$delete_downtime_agent = (int) get_parameter('delete_downtime_agent');
|
$delete_downtime_agent = (int) get_parameter('delete_downtime_agent');
|
||||||
|
|
||||||
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
|
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
|
||||||
|
|
||||||
// User groups with AD or AW permission for ACL checks
|
// User groups with AD or AW permission for ACL checks.
|
||||||
$user_groups_ad = array_keys(users_get_groups($config['id_user'], $access));
|
$user_groups_ad = array_keys(
|
||||||
|
users_get_groups($config['id_user'], $access)
|
||||||
|
);
|
||||||
|
|
||||||
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION
|
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION.
|
||||||
if ($insert_downtime_agent === 1) {
|
if ($insert_downtime_agent === 1) {
|
||||||
// Check AD permission on downtime
|
// Check AD permission on downtime.
|
||||||
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
|
$downtime_group = db_get_value(
|
||||||
|
'id_group',
|
||||||
|
'tplanned_downtime',
|
||||||
|
'id',
|
||||||
|
$id_downtime
|
||||||
|
);
|
||||||
|
|
||||||
if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
|
if ($downtime_group === false
|
||||||
|
|| !in_array($downtime_group, $user_groups_ad)
|
||||||
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
|
@ -116,17 +169,27 @@ if ($insert_downtime_agent === 1) {
|
||||||
|
|
||||||
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
|
$all_modules = (empty($module_names) || ($module_names[0] === '0'));
|
||||||
|
|
||||||
// 'Is running' check
|
// 'Is running' check.
|
||||||
$is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime);
|
$is_running = (bool) db_get_value(
|
||||||
|
'executed',
|
||||||
|
'tplanned_downtime',
|
||||||
|
'id',
|
||||||
|
$id_downtime
|
||||||
|
);
|
||||||
if ($is_running) {
|
if ($is_running) {
|
||||||
ui_print_error_message(__('This elements cannot be modified while the downtime is being executed'));
|
ui_print_error_message(
|
||||||
|
__('This elements cannot be modified while the downtime is being executed')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
foreach ($agents as $agent_id) {
|
foreach ($agents as $agent_id) {
|
||||||
// check module belongs to the agent
|
// Check module belongs to the agent.
|
||||||
if ($modules_selection_mode == 'all') {
|
if ($modules_selection_mode == 'all') {
|
||||||
$check = false;
|
$check = false;
|
||||||
foreach ($module_names as $module_name) {
|
foreach ($module_names as $module_name) {
|
||||||
$check_module = modules_get_agentmodule_id($module_name, $agent_id);
|
$check_module = modules_get_agentmodule_id(
|
||||||
|
$module_name,
|
||||||
|
$agent_id
|
||||||
|
);
|
||||||
if (!empty($check_module)) {
|
if (!empty($check_module)) {
|
||||||
$check = true;
|
$check = true;
|
||||||
}
|
}
|
||||||
|
@ -137,10 +200,17 @@ if ($insert_downtime_agent === 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check AD permission on agent
|
// Check AD permission on agent.
|
||||||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
|
$agent_group = db_get_value(
|
||||||
|
'id_grupo',
|
||||||
|
'tagente',
|
||||||
|
'id_agente',
|
||||||
|
$agent_id
|
||||||
|
);
|
||||||
|
|
||||||
if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
|
if ($agent_group === false
|
||||||
|
|| !in_array($agent_group, $user_groups_ad)
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,11 +219,17 @@ if ($insert_downtime_agent === 1) {
|
||||||
'id_agent' => $agent_id,
|
'id_agent' => $agent_id,
|
||||||
'all_modules' => $all_modules,
|
'all_modules' => $all_modules,
|
||||||
];
|
];
|
||||||
$result = db_process_sql_insert('tplanned_downtime_agents', $values);
|
$result = db_process_sql_insert(
|
||||||
|
'tplanned_downtime_agents',
|
||||||
|
$values
|
||||||
|
);
|
||||||
|
|
||||||
if ($result && !$all_modules) {
|
if ($result && !$all_modules) {
|
||||||
foreach ($module_names as $module_name) {
|
foreach ($module_names as $module_name) {
|
||||||
$module = modules_get_agentmodule_id($module_name, $agent_id);
|
$module = modules_get_agentmodule_id(
|
||||||
|
$module_name,
|
||||||
|
$agent_id
|
||||||
|
);
|
||||||
|
|
||||||
if (empty($module)) {
|
if (empty($module)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -164,7 +240,10 @@ if ($insert_downtime_agent === 1) {
|
||||||
'id_agent' => $agent_id,
|
'id_agent' => $agent_id,
|
||||||
'id_agent_module' => $module['id_agente_modulo'],
|
'id_agent_module' => $module['id_agente_modulo'],
|
||||||
];
|
];
|
||||||
$result = db_process_sql_insert('tplanned_downtime_modules', $values);
|
$result = db_process_sql_insert(
|
||||||
|
'tplanned_downtime_modules',
|
||||||
|
$values
|
||||||
|
);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$values = ['id_user' => $config['id_user']];
|
$values = ['id_user' => $config['id_user']];
|
||||||
|
@ -180,14 +259,21 @@ if ($insert_downtime_agent === 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE A DOWNTIME_AGENT ASSOCIATION
|
// DELETE A DOWNTIME_AGENT ASSOCIATION.
|
||||||
if ($delete_downtime_agent === 1) {
|
if ($delete_downtime_agent === 1) {
|
||||||
$id_da = (int) get_parameter('id_downtime_agent');
|
$id_da = (int) get_parameter('id_downtime_agent');
|
||||||
|
|
||||||
// Check AD permission on downtime
|
// Check AD permission on downtime.
|
||||||
$downtime_group = db_get_value('id_group', 'tplanned_downtime', 'id', $id_downtime);
|
$downtime_group = db_get_value(
|
||||||
|
'id_group',
|
||||||
|
'tplanned_downtime',
|
||||||
|
'id',
|
||||||
|
$id_downtime
|
||||||
|
);
|
||||||
|
|
||||||
if ($downtime_group === false || !in_array($downtime_group, $user_groups_ad)) {
|
if ($downtime_group === false
|
||||||
|
|| !in_array($downtime_group, $user_groups_ad)
|
||||||
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
|
@ -196,10 +282,17 @@ if ($delete_downtime_agent === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check AD permission on agent
|
// Check AD permission on agent.
|
||||||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
|
$agent_group = db_get_value(
|
||||||
|
'id_grupo',
|
||||||
|
'tagente',
|
||||||
|
'id_agente',
|
||||||
|
$id_agent
|
||||||
|
);
|
||||||
|
|
||||||
if ($agent_group === false || !in_array($agent_group, $user_groups_ad)) {
|
if ($agent_group === false
|
||||||
|
|| !in_array($agent_group, $user_groups_ad)
|
||||||
|
) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
'Trying to access downtime scheduler'
|
'Trying to access downtime scheduler'
|
||||||
|
@ -208,17 +301,27 @@ if ($delete_downtime_agent === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'Is running' check
|
// 'Is running' check.
|
||||||
$is_running = (bool) db_get_value('executed', 'tplanned_downtime', 'id', $id_downtime);
|
$is_running = (bool) db_get_value(
|
||||||
|
'executed',
|
||||||
|
'tplanned_downtime',
|
||||||
|
'id',
|
||||||
|
$id_downtime
|
||||||
|
);
|
||||||
if ($is_running) {
|
if ($is_running) {
|
||||||
ui_print_error_message(__('This elements cannot be modified while the downtime is being executed'));
|
ui_print_error_message(
|
||||||
|
__('This elements cannot be modified while the downtime is being executed')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$row_to_delete = db_get_row('tplanned_downtime_agents', 'id', $id_da);
|
$row_to_delete = db_get_row('tplanned_downtime_agents', 'id', $id_da);
|
||||||
|
|
||||||
$result = db_process_sql_delete('tplanned_downtime_agents', ['id' => $id_da]);
|
$result = db_process_sql_delete(
|
||||||
|
'tplanned_downtime_agents',
|
||||||
|
['id' => $id_da]
|
||||||
|
);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Delete modules in downtime
|
// Delete modules in downtime.
|
||||||
db_process_sql_delete(
|
db_process_sql_delete(
|
||||||
'tplanned_downtime_modules',
|
'tplanned_downtime_modules',
|
||||||
[
|
[
|
||||||
|
@ -230,7 +333,7 @@ if ($delete_downtime_agent === 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION)
|
// UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION).
|
||||||
if ($create_downtime || $update_downtime) {
|
if ($create_downtime || $update_downtime) {
|
||||||
$check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $name);
|
$check = (bool) db_get_value('name', 'tplanned_downtime', 'name', $name);
|
||||||
|
|
||||||
|
@ -239,22 +342,32 @@ if ($create_downtime || $update_downtime) {
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
if ($type_execution == 'once' && !$config['past_planned_downtimes'] && $datetime_from < $now) {
|
if ($type_execution == 'once' && !$config['past_planned_downtimes'] && $datetime_from < $now) {
|
||||||
ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time'));
|
ui_print_error_message(
|
||||||
|
__('Not created. Error inserting data. Start time must be higher than the current time')
|
||||||
|
);
|
||||||
} else if ($type_execution == 'once' && $datetime_from >= $datetime_to) {
|
} else if ($type_execution == 'once' && $datetime_from >= $datetime_to) {
|
||||||
ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'));
|
ui_print_error_message(
|
||||||
|
__('Not created. Error inserting data').'. '.__('The end date must be higher than the start date')
|
||||||
|
);
|
||||||
} else if ($type_execution == 'once' && $datetime_to <= $now && !$config['past_planned_downtimes']) {
|
} else if ($type_execution == 'once' && $datetime_to <= $now && !$config['past_planned_downtimes']) {
|
||||||
ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'));
|
ui_print_error_message(
|
||||||
|
__('Not created. Error inserting data').'. '.__('The end date must be higher than the current time')
|
||||||
|
);
|
||||||
} else if ($type_execution == 'periodically'
|
} else if ($type_execution == 'periodically'
|
||||||
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|
||||||
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))
|
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))
|
||||||
) {
|
) {
|
||||||
ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time'));
|
ui_print_error_message(
|
||||||
|
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
|
||||||
|
);
|
||||||
} else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from > $periodically_day_to) {
|
} else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from > $periodically_day_to) {
|
||||||
ui_print_error_message(__('Not created. Error inserting data').'. '.__('The end day must be higher than the start day'));
|
ui_print_error_message(
|
||||||
|
__('Not created. Error inserting data').'. '.__('The end day must be higher than the start day')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql = '';
|
$sql = '';
|
||||||
if ($create_downtime) {
|
if ($create_downtime) {
|
||||||
// Check AD permission on new downtime
|
// Check AD permission on new downtime.
|
||||||
if (!in_array($id_group, $user_groups_ad)) {
|
if (!in_array($id_group, $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
|
@ -295,7 +408,10 @@ if ($create_downtime || $update_downtime) {
|
||||||
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to'];
|
$values['periodically_time_to'] = '1970/01/01 '.$values['periodically_time_to'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_process_sql_insert('tplanned_downtime', $values);
|
$result = db_process_sql_insert(
|
||||||
|
'tplanned_downtime',
|
||||||
|
$values
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
__('Each planned downtime must have a different name')
|
__('Each planned downtime must have a different name')
|
||||||
|
@ -309,7 +425,7 @@ if ($create_downtime || $update_downtime) {
|
||||||
} else if ($update_downtime) {
|
} else if ($update_downtime) {
|
||||||
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
$old_downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||||
|
|
||||||
// Check AD permission on OLD downtime
|
// Check AD permission on OLD downtime.
|
||||||
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
|
if (empty($old_downtime) || !in_array($old_downtime['id_group'], $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
|
@ -319,7 +435,7 @@ if ($create_downtime || $update_downtime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check AD permission on NEW downtime group
|
// Check AD permission on NEW downtime group.
|
||||||
if (!in_array($id_group, $user_groups_ad)) {
|
if (!in_array($id_group, $user_groups_ad)) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
'ACL Violation',
|
'ACL Violation',
|
||||||
|
@ -329,14 +445,17 @@ if ($create_downtime || $update_downtime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'Is running' check
|
// 'Is running' check.
|
||||||
$is_running = (bool) $old_downtime['executed'];
|
$is_running = (bool) $old_downtime['executed'];
|
||||||
|
|
||||||
$values = [];
|
$values = [];
|
||||||
if (trim(io_safe_output($name)) == '') {
|
if (trim(io_safe_output($name)) == '') {
|
||||||
ui_print_error_message(__('Planned downtime must have a name'));
|
ui_print_error_message(
|
||||||
|
__('Planned downtime must have a name')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// When running only certain items can be modified for the 'once' type
|
|
||||||
|
// When running only certain items can be modified for the 'once' type.
|
||||||
else if ($is_running && $type_execution == 'once') {
|
else if ($is_running && $type_execution == 'once') {
|
||||||
$values = [
|
$values = [
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
|
@ -344,7 +463,9 @@ if ($create_downtime || $update_downtime) {
|
||||||
'id_user' => $config['id_user'],
|
'id_user' => $config['id_user'],
|
||||||
];
|
];
|
||||||
} else if ($is_running) {
|
} else if ($is_running) {
|
||||||
ui_print_error_message(__('Cannot be modified while the downtime is being executed'));
|
ui_print_error_message(
|
||||||
|
__('Cannot be modified while the downtime is being executed')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$values = [
|
$values = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
@ -376,7 +497,11 @@ if ($create_downtime || $update_downtime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($values)) {
|
if (!empty($values)) {
|
||||||
$result = db_process_sql_update('tplanned_downtime', $values, ['id' => $id_downtime]);
|
$result = db_process_sql_update(
|
||||||
|
'tplanned_downtime',
|
||||||
|
$values,
|
||||||
|
['id' => $id_downtime]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +524,7 @@ if ($create_downtime || $update_downtime) {
|
||||||
|
|
||||||
// Have any data to show ?
|
// Have any data to show ?
|
||||||
if ($id_downtime > 0) {
|
if ($id_downtime > 0) {
|
||||||
// Columns of the table tplanned_downtime
|
// Columns of the table tplanned_downtime.
|
||||||
$columns = [
|
$columns = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
|
@ -436,7 +561,8 @@ if ($id_downtime > 0) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
// Oracle doesn't have TIME type, so we should transform the DATE value
|
// Oracle doesn't have TIME type,
|
||||||
|
// so we should transform the DATE value.
|
||||||
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
|
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
|
||||||
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
|
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
|
||||||
|
|
||||||
|
@ -500,7 +626,8 @@ if ($id_downtime > 0) {
|
||||||
$running = (bool) $result['executed'];
|
$running = (bool) $result['executed'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// when the planned downtime is in execution, only action to postpone on once type is enabled and the other are disabled.
|
// When the planned downtime is in execution,
|
||||||
|
// only action to postpone on once type is enabled and the other are disabled.
|
||||||
$disabled_in_execution = (int) $running;
|
$disabled_in_execution = (int) $running;
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
|
@ -508,11 +635,40 @@ $table->class = 'databox filters';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->data[0][0] = __('Name');
|
$table->data[0][0] = __('Name');
|
||||||
$table->data[0][1] = html_print_input_text('name', $name, '', 25, 40, true, $disabled_in_execution);
|
$table->data[0][1] = html_print_input_text(
|
||||||
|
'name',
|
||||||
|
$name,
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
40,
|
||||||
|
true,
|
||||||
|
$disabled_in_execution
|
||||||
|
);
|
||||||
$table->data[1][0] = __('Group');
|
$table->data[1][0] = __('Group');
|
||||||
$table->data[1][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', 0, true, false, true, '', $disabled_in_execution);
|
$table->data[1][1] = html_print_select_groups(
|
||||||
|
false,
|
||||||
|
$access,
|
||||||
|
true,
|
||||||
|
'id_group',
|
||||||
|
$id_group,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$disabled_in_execution
|
||||||
|
);
|
||||||
$table->data[2][0] = __('Description');
|
$table->data[2][0] = __('Description');
|
||||||
$table->data[2][1] = html_print_textarea('description', 3, 35, $description, '', true);
|
$table->data[2][1] = html_print_textarea(
|
||||||
|
'description',
|
||||||
|
3,
|
||||||
|
35,
|
||||||
|
$description,
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[3][0] = __('Type').ui_print_help_tip(
|
$table->data[3][0] = __('Type').ui_print_help_tip(
|
||||||
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
|
__('Quiet: Modules will not generate events or fire alerts.').'<br>'.__('Disable Agents: Disables the selected agents.').'<br>'.__('Disable Alerts: Disable alerts for the selected agents.'),
|
||||||
|
@ -554,7 +710,7 @@ $table->data[4][1] = html_print_select(
|
||||||
);
|
);
|
||||||
|
|
||||||
$days = array_combine(range(1, 31), range(1, 31));
|
$days = array_combine(range(1, 31), range(1, 31));
|
||||||
$table->data[5][0] = __('Configure the time').' '.ui_print_help_icon('planned_downtime_time', true);
|
$table->data[5][0] = __('Configure the time').' ';
|
||||||
;
|
;
|
||||||
$table->data[5][1] = "
|
$table->data[5][1] = "
|
||||||
<div id='once_time' style='display: none;'>
|
<div id='once_time' style='display: none;'>
|
||||||
|
@ -678,7 +834,7 @@ if ($id_downtime > 0) {
|
||||||
echo "<tr><td width=75% valign='top'>";
|
echo "<tr><td width=75% valign='top'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor form
|
// Editor form.
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
html_print_input_hidden('id_agent', $id_agent);
|
html_print_input_hidden('id_agent', $id_agent);
|
||||||
|
@ -686,10 +842,20 @@ echo '<div class="action-buttons" style="width: 100%">';
|
||||||
if ($id_downtime > 0) {
|
if ($id_downtime > 0) {
|
||||||
html_print_input_hidden('update_downtime', 1);
|
html_print_input_hidden('update_downtime', 1);
|
||||||
html_print_input_hidden('id_downtime', $id_downtime);
|
html_print_input_hidden('id_downtime', $id_downtime);
|
||||||
html_print_submit_button(__('Update'), 'updbutton', false, 'class="sub upd"');
|
html_print_submit_button(
|
||||||
|
__('Update'),
|
||||||
|
'updbutton',
|
||||||
|
false,
|
||||||
|
'class="sub upd"'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
html_print_input_hidden('create_downtime', 1);
|
html_print_input_hidden('create_downtime', 1);
|
||||||
html_print_submit_button(__('Add'), 'crtbutton', false, 'class="sub wand"');
|
html_print_submit_button(
|
||||||
|
__('Add'),
|
||||||
|
'crtbutton',
|
||||||
|
false,
|
||||||
|
'class="sub wand"'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -700,11 +866,11 @@ if ($id_downtime > 0) {
|
||||||
|
|
||||||
$filter_group = (int) get_parameter('filter_group', 0);
|
$filter_group = (int) get_parameter('filter_group', 0);
|
||||||
|
|
||||||
// User AD groups to str for the filter
|
// User AD groups to str for the filter.
|
||||||
$id_groups_str = implode(',', $user_groups_ad);
|
$id_groups_str = implode(',', $user_groups_ad);
|
||||||
|
|
||||||
if (empty($id_groups_str)) {
|
if (empty($id_groups_str)) {
|
||||||
// Restrictive filter on error. This will filter all the downtimes
|
// Restrictive filter on error. This will filter all the downtimes.
|
||||||
$id_groups_str = '-1';
|
$id_groups_str = '-1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,7 +918,7 @@ if ($id_downtime > 0) {
|
||||||
|
|
||||||
$agent_ids = extract_column($agents, 'id_agente');
|
$agent_ids = extract_column($agents, 'id_agente');
|
||||||
$agent_names = extract_column($agents, 'alias');
|
$agent_names = extract_column($agents, 'alias');
|
||||||
// item[<id>] = <name>;
|
|
||||||
$agents = array_combine($agent_ids, $agent_names);
|
$agents = array_combine($agent_ids, $agent_names);
|
||||||
if ($agents === false) {
|
if ($agents === false) {
|
||||||
$agents = [];
|
$agents = [];
|
||||||
|
@ -763,7 +929,6 @@ if ($id_downtime > 0) {
|
||||||
$disabled_add_button = true;
|
$disabled_add_button = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||||
|
|
||||||
|
@ -803,7 +968,10 @@ if ($id_downtime > 0) {
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
echo '<h4>'.__('Available modules:').ui_print_help_tip(__('Only for type Quiet for downtimes.'), true).'</h4>';
|
echo '<h4>'.__('Available modules:').ui_print_help_tip(
|
||||||
|
__('Only for type Quiet for downtimes.'),
|
||||||
|
true
|
||||||
|
).'</h4>';
|
||||||
|
|
||||||
if ($type_downtime != 'quiet') {
|
if ($type_downtime != 'quiet') {
|
||||||
echo '<div id="available_modules" style="display: none;">';
|
echo '<div id="available_modules" style="display: none;">';
|
||||||
|
@ -811,17 +979,36 @@ if ($id_downtime > 0) {
|
||||||
echo '<div id="available_modules" style="">';
|
echo '<div id="available_modules" style="">';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo html_print_select([], 'module[]', '', '', '', 0, false, true, true, '', false, 'width: 180px;');
|
echo html_print_select(
|
||||||
|
[],
|
||||||
|
'module[]',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width: 180px;'
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<br /><br /><br />';
|
echo '<br /><br /><br />';
|
||||||
html_print_submit_button(__('Add'), 'add_item', $disabled_add_button, 'class="sub next"', false);
|
html_print_submit_button(
|
||||||
|
__('Add'),
|
||||||
|
'add_item',
|
||||||
|
$disabled_add_button,
|
||||||
|
'class="sub next"',
|
||||||
|
false
|
||||||
|
);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
// Start Overview of existing planned downtime
|
// Start Overview of existing planned downtime.
|
||||||
echo '<h4>'.__('Agents planned for this downtime').':</h4>';
|
echo '<h4>'.__('Agents planned for this downtime').':</h4>';
|
||||||
|
|
||||||
// User the $id_groups_str built before
|
// User the $id_groups_str built before.
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT ta.nombre, tpda.id,
|
'SELECT ta.nombre, tpda.id,
|
||||||
ta.id_os, ta.id_agente, ta.id_grupo,
|
ta.id_os, ta.id_agente, ta.id_grupo,
|
||||||
|
@ -860,13 +1047,18 @@ if ($id_downtime > 0) {
|
||||||
foreach ($downtimes_agents as $downtime_agent) {
|
foreach ($downtimes_agents as $downtime_agent) {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$alias = db_get_value('alias', 'tagente', 'id_agente', $downtime_agent['id_agente']);
|
$alias = db_get_value(
|
||||||
|
'alias',
|
||||||
|
'tagente',
|
||||||
|
'id_agente',
|
||||||
|
$downtime_agent['id_agente']
|
||||||
|
);
|
||||||
$data[0] = $alias;
|
$data[0] = $alias;
|
||||||
|
|
||||||
$data[1] = db_get_sql(
|
$data[1] = db_get_sql(
|
||||||
'SELECT nombre
|
'SELECT nombre
|
||||||
FROM tgrupo
|
FROM tgrupo
|
||||||
WHERE id_grupo = '.$downtime_agent['id_grupo']
|
WHERE id_grupo = '.$downtime_agent['id_grupo']
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true);
|
$data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true);
|
||||||
|
@ -887,7 +1079,9 @@ if ($id_downtime > 0) {
|
||||||
|
|
||||||
if (!$running) {
|
if (!$running) {
|
||||||
$data[5] = '';
|
$data[5] = '';
|
||||||
if ($type_downtime != 'disable_agents_alerts' && $type_downtime != 'disable_agents') {
|
if ($type_downtime != 'disable_agents_alerts'
|
||||||
|
&& $type_downtime != 'disable_agents'
|
||||||
|
) {
|
||||||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ if ($migrate_malformed) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Planned Downtime'),
|
__('Scheduled Downtime'),
|
||||||
'images/gm_monitoring.png',
|
'images/gm_monitoring.png',
|
||||||
false,
|
false,
|
||||||
'planned_downtime',
|
'planned_downtime',
|
||||||
|
@ -115,7 +115,7 @@ if ($delete_downtime) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter parameters
|
// Filter parameters.
|
||||||
$offset = (int) get_parameter('offset');
|
$offset = (int) get_parameter('offset');
|
||||||
$filter_params = [];
|
$filter_params = [];
|
||||||
|
|
||||||
|
@ -131,21 +131,18 @@ $module_name = $filter_params['module_name'] = (string) (!empty($module_
|
||||||
|
|
||||||
$filter_params_str = http_build_query($filter_params);
|
$filter_params_str = http_build_query($filter_params);
|
||||||
|
|
||||||
// Table filter
|
// Table filter.
|
||||||
$table_form = new StdClass();
|
$table_form = new StdClass();
|
||||||
$table_form->class = 'databox filters';
|
$table_form->class = 'databox filters';
|
||||||
$table_form->width = '100%';
|
$table_form->width = '100%';
|
||||||
$table_form->rowstyle = [];
|
$table_form->rowstyle = [];
|
||||||
$table_form->rowstyle[0] = 'background-color: #f9faf9;';
|
|
||||||
$table_form->rowstyle[1] = 'background-color: #f9faf9;';
|
|
||||||
$table_form->rowstyle[2] = 'background-color: #f9faf9;';
|
|
||||||
$table_form->data = [];
|
$table_form->data = [];
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
// Search text
|
// Search text.
|
||||||
$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true);
|
$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true);
|
||||||
// Dates
|
// Dates.
|
||||||
$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true);
|
$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true);
|
||||||
$date_inputs .= ' ';
|
$date_inputs .= ' ';
|
||||||
$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true);
|
$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true);
|
||||||
|
@ -155,20 +152,20 @@ $table_form->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
// Execution type
|
// Execution type.
|
||||||
$execution_type_fields = [
|
$execution_type_fields = [
|
||||||
'once' => __('Once'),
|
'once' => __('Once'),
|
||||||
'periodically' => __('Periodically'),
|
'periodically' => __('Periodically'),
|
||||||
];
|
];
|
||||||
$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
|
$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
|
||||||
// Show past downtimes
|
// Show past downtimes.
|
||||||
$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true);
|
$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true);
|
||||||
|
|
||||||
$table_form->data[] = $row;
|
$table_form->data[] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
// Agent
|
// Agent.
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['show_helptip'] = true;
|
$params['show_helptip'] = true;
|
||||||
$params['input_name'] = 'agent_name';
|
$params['input_name'] = 'agent_name';
|
||||||
|
@ -180,14 +177,14 @@ $params['hidden_input_idagent_value'] = $agent_id;
|
||||||
$agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
$agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
||||||
$row[] = $agent_input;
|
$row[] = $agent_input;
|
||||||
|
|
||||||
// Module
|
// Module.
|
||||||
$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
|
$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
|
||||||
|
|
||||||
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
|
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
|
||||||
|
|
||||||
$table_form->data[] = $row;
|
$table_form->data[] = $row;
|
||||||
// End of table filter
|
// End of table filter.
|
||||||
// Useful to know if the user has done a form filtering
|
// Useful to know if the user has done a form filtering.
|
||||||
$filter_performed = false;
|
$filter_performed = false;
|
||||||
|
|
||||||
$groups = users_get_groups(false, $access);
|
$groups = users_get_groups(false, $access);
|
||||||
|
@ -197,7 +194,7 @@ if (!empty($groups)) {
|
||||||
$groups_string = implode(',', array_keys($groups));
|
$groups_string = implode(',', array_keys($groups));
|
||||||
$where_values .= " AND id_group IN ($groups_string)";
|
$where_values .= " AND id_group IN ($groups_string)";
|
||||||
|
|
||||||
// WARNING: add $filter_performed = true; to any future filter
|
// WARNING: add $filter_performed = true; to any future filter.
|
||||||
if (!empty($search_text)) {
|
if (!empty($search_text)) {
|
||||||
$filter_performed = true;
|
$filter_performed = true;
|
||||||
|
|
||||||
|
@ -272,7 +269,7 @@ if (!empty($groups)) {
|
||||||
AND tpda.all_modules = 1))";
|
AND tpda.all_modules = 1))";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Columns of the table tplanned_downtime
|
// Columns of the table tplanned_downtime.
|
||||||
$columns = [
|
$columns = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
|
@ -353,23 +350,23 @@ if (!empty($groups)) {
|
||||||
$downtimes = [];
|
$downtimes = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// No downtimes cause the user has not anyone
|
// No downtimes cause the user has not anyone.
|
||||||
if (!$downtimes && !$filter_performed) {
|
if (!$downtimes && !$filter_performed) {
|
||||||
include_once $config['homedir'].'/general/firts_task/planned_downtime.php';
|
include_once $config['homedir'].'/general/firts_task/planned_downtime.php';
|
||||||
}
|
}
|
||||||
// No downtimes cause the user performed a search
|
// No downtimes cause the user performed a search.
|
||||||
else if (!$downtimes) {
|
else if (!$downtimes) {
|
||||||
// Filter form
|
// Filter form.
|
||||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||||
html_print_table($table_form);
|
html_print_table($table_form);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
// Info message
|
// Info message.
|
||||||
echo '<div class="nf">'.__('No planned downtime').'</div>';
|
echo '<div class="nf">'.__('No planned downtime').'</div>';
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: 100%">';
|
echo '<div class="action-buttons" style="width: 100%">';
|
||||||
|
|
||||||
// Create button
|
// Create button.
|
||||||
if ($write_permisson) {
|
if ($write_permisson) {
|
||||||
echo ' ';
|
echo ' ';
|
||||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||||
|
@ -379,7 +376,7 @@ else if (!$downtimes) {
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
// Has downtimes
|
// Has downtimes.
|
||||||
else {
|
else {
|
||||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||||
html_print_table($table_form);
|
html_print_table($table_form);
|
||||||
|
@ -387,11 +384,11 @@ else {
|
||||||
|
|
||||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||||
|
|
||||||
// User groups with AR, AD or AW permission
|
// User groups with AR, AD or AW permission.
|
||||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||||
$groupsAD = array_keys($groupsAD);
|
$groupsAD = array_keys($groupsAD);
|
||||||
|
|
||||||
// View available downtimes present in database (if any of them)
|
// View available downtimes present in database (if any of them).
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->class = 'info_table';
|
$table->class = 'info_table';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
@ -475,7 +472,7 @@ else {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If user have writting permissions
|
// If user have writting permissions.
|
||||||
if (in_array($downtime['id_group'], $groupsAD)) {
|
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||||
// Stop button
|
// Stop button
|
||||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||||
|
@ -484,16 +481,16 @@ else {
|
||||||
$data['stop'] = '';
|
$data['stop'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit & delete buttons
|
// Edit & delete buttons.
|
||||||
if ($downtime['executed'] == 0) {
|
if ($downtime['executed'] == 0) {
|
||||||
// Edit
|
// Edit.
|
||||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||||
// Delete
|
// Delete.
|
||||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||||
// Edit
|
// Edit.
|
||||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||||
// Delete
|
// Delete.
|
||||||
$data['delete'] = __('N/A');
|
$data['delete'] = __('N/A');
|
||||||
} else {
|
} else {
|
||||||
$data['edit'] = '';
|
$data['edit'] = '';
|
||||||
|
@ -521,7 +518,7 @@ else {
|
||||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
|
|
||||||
// CSV export button
|
// CSV export button.
|
||||||
echo '<div style="display: inline;">';
|
echo '<div style="display: inline;">';
|
||||||
html_print_button(
|
html_print_button(
|
||||||
__('Export to CSV'),
|
__('Export to CSV'),
|
||||||
|
@ -532,7 +529,7 @@ else {
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Create button
|
// Create button.
|
||||||
if ($write_permisson) {
|
if ($write_permisson) {
|
||||||
echo ' ';
|
echo ' ';
|
||||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||||
|
|
|
@ -62,7 +62,7 @@ if ((!$copy_action) && (!$delete_action)) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true);
|
ui_print_page_header(__('Alerts').' » '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_action', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,9 +84,7 @@ if (is_ajax()) {
|
||||||
// If the field is the number one, print the help message.
|
// If the field is the number one, print the help message.
|
||||||
if ($i == 1) {
|
if ($i == 1) {
|
||||||
// If our context is snmpconsole, show snmp_alert helps.
|
// If our context is snmpconsole, show snmp_alert helps.
|
||||||
if ((isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
|
if ((!isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
|
||||||
$fdesc .= ui_print_help_icon('snmp_alert_field1', true);
|
|
||||||
} else {
|
|
||||||
$fdesc .= ui_print_help_icon('alert_config', true);
|
$fdesc .= ui_print_help_icon('alert_config', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +268,13 @@ if ($update_command) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Alert commands'), 'images/gm_alerts.png', false, 'alerts_config', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Alert commands'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'alerts_command_tab',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($create_command) {
|
if ($create_command) {
|
||||||
|
|
|
@ -37,14 +37,10 @@ $table->head = [];
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->size[0] = '5%';
|
$table->style[0] = 'font-weight: bold;';
|
||||||
$table->size[1] = '25%';
|
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
|
||||||
$table->size[2] = '5%';
|
$table->style[2] = 'font-weight: bold;';
|
||||||
$table->size[3] = '20%';
|
$table->style[3] = 'font-weight: bold;';
|
||||||
$table->style[0] = 'font-weight: bold; ';
|
|
||||||
$table->style[1] = 'font-weight: bold; ';
|
|
||||||
$table->style[2] = 'font-weight: bold; ';
|
|
||||||
$table->style[3] = 'font-weight: bold; ';
|
|
||||||
|
|
||||||
// This is because if this view is reused after list alert view then
|
// This is because if this view is reused after list alert view then
|
||||||
// styles in the previous view can affect this table.
|
// styles in the previous view can affect this table.
|
||||||
|
@ -89,7 +85,7 @@ $table->data[0][1] = html_print_select(
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
($id_agente == 0),
|
($id_agente == 0),
|
||||||
'width: 250px;'
|
'min-width: 250px;margin-right: 0.5em;'
|
||||||
);
|
);
|
||||||
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
|
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
|
||||||
$table->data[0][1] .= '<span id="value"> </span></span>';
|
$table->data[0][1] .= '<span id="value"> </span></span>';
|
||||||
|
@ -117,23 +113,19 @@ $table->data[1][1] = html_print_select(
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'width: 250px;'
|
'min-width: 250px;'
|
||||||
);
|
);
|
||||||
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
|
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
|
||||||
$table->data[1][1] .= __('Number of alerts match from').' ';
|
$table->data[1][1] .= __('Number of alerts match from').' ';
|
||||||
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
|
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
|
||||||
$table->data[1][1] .= ' '.__('to').' ';
|
$table->data[1][1] .= ' '.__('to').' ';
|
||||||
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
|
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
|
||||||
$table->data[1][1] .= ui_print_help_icon(
|
|
||||||
'alert-matches',
|
|
||||||
true,
|
|
||||||
ui_get_full_url(false, false, false, false)
|
|
||||||
);
|
|
||||||
$table->data[1][1] .= '</span>';
|
$table->data[1][1] .= '</span>';
|
||||||
if (check_acl($config['id_user'], 0, 'LM')) {
|
if (check_acl($config['id_user'], 0, 'LM')) {
|
||||||
$table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
$table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||||
$table->data[1][1] .= html_print_image('images/add.png', true);
|
$table->data[1][1] .= html_print_image('images/add.png', true);
|
||||||
$table->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
|
$table->data[1][1] .= '<span style="margin-left:0.5em;">'.__('Create Action').'</span>';
|
||||||
$table->data[1][1] .= '</a>';
|
$table->data[1][1] .= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,14 +158,13 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||||
if (check_acl($config['id_user'], 0, 'LM')) {
|
if (check_acl($config['id_user'], 0, 'LM')) {
|
||||||
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||||
$table->data[2][1] .= html_print_image('images/add.png', true);
|
$table->data[2][1] .= html_print_image('images/add.png', true);
|
||||||
$table->data[2][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
|
$table->data[2][1] .= '<span style="margin-left:0.5em;">'.__('Create Template').'</span>';
|
||||||
$table->data[2][1] .= '</a>';
|
$table->data[2][1] .= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[3][0] = __('Threshold');
|
$table->data[3][0] = __('Threshold');
|
||||||
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
$table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
|
||||||
$table->data[3][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true);
|
$table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>';
|
||||||
|
|
||||||
|
|
||||||
if (!isset($step)) {
|
if (!isset($step)) {
|
||||||
echo '<form class="add_alert_form" method="post">';
|
echo '<form class="add_alert_form" method="post">';
|
||||||
|
|
|
@ -438,11 +438,11 @@ if (! $id_agente) {
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bold;';
|
$table->style[0] = 'font-weight: bold;';
|
||||||
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
|
||||||
$table->size[0] = '4%';
|
$table->headstyle[0] = 'width: 100%; min-width: 12em;';
|
||||||
$table->size[1] = '8%';
|
$table->headstyle[1] = 'min-width: 15em;';
|
||||||
$table->size[2] = '8%';
|
$table->headstyle[2] = 'min-width: 20em;';
|
||||||
$table->size[3] = '4%';
|
$table->headstyle[3] = 'min-width: 1em;';
|
||||||
$table->size[4] = '4%';
|
$table->headstyle[4] = 'min-width: 15em;';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||||
|
@ -450,16 +450,11 @@ if (! $id_agente) {
|
||||||
}*/
|
}*/
|
||||||
} else {
|
} else {
|
||||||
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||||
// Different sizes or the layout screws up
|
$table->headstyle[0] = 'width: 100%; min-width: 15em;';
|
||||||
$table->size[0] = '0%';
|
$table->headstyle[1] = 'min-width: 15em;';
|
||||||
$table->size[1] = '10%';
|
$table->headstyle[2] = 'min-width: 20em;';
|
||||||
$table->size[2] = '30%';
|
$table->headstyle[3] = 'min-width: 1em;';
|
||||||
/*
|
$table->headstyle[4] = 'min-width: 15em;';
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|
||||||
$table->size[4] = '25%';
|
|
||||||
} */
|
|
||||||
$table->size[3] = '1%';
|
|
||||||
$table->size[4] = '1%';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||||
|
@ -700,20 +695,41 @@ foreach ($simple_alerts as $alert) {
|
||||||
$data[2] .= '</tr>';
|
$data[2] .= '</tr>';
|
||||||
$data[2] .= '<tr class="datos">';
|
$data[2] .= '<tr class="datos">';
|
||||||
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
|
||||||
$data[2] .= __('Number of alerts match from').' '.ui_print_help_icon('alert-matches', true, ui_get_full_url(false, false, false, false));
|
$data[2] .= __('Number of alerts match from');
|
||||||
$data[2] .= '</td>';
|
$data[2] .= '</td>';
|
||||||
$data[2] .= '<td class="datos">';
|
$data[2] .= '<td class="datos">';
|
||||||
$data[2] .= html_print_input_text('fires_min', 0, '', 4, 10, true);
|
$data[2] .= html_print_input_text(
|
||||||
|
'fires_min',
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
4,
|
||||||
|
10,
|
||||||
|
true
|
||||||
|
);
|
||||||
$data[2] .= ' '.__('to').' ';
|
$data[2] .= ' '.__('to').' ';
|
||||||
$data[2] .= html_print_input_text('fires_max', 0, '', 4, 10, true);
|
$data[2] .= html_print_input_text(
|
||||||
|
'fires_max',
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
4,
|
||||||
|
10,
|
||||||
|
true
|
||||||
|
);
|
||||||
$data[2] .= '</td>';
|
$data[2] .= '</td>';
|
||||||
$data[2] .= '</tr>';
|
$data[2] .= '</tr>';
|
||||||
$data[2] .= '<tr class="datos2">';
|
$data[2] .= '<tr class="datos2">';
|
||||||
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
|
||||||
$data[2] .= __('Threshold').' '.ui_print_help_icon('action_threshold', true, ui_get_full_url(false, false, false, false));
|
$data[2] .= __('Threshold');
|
||||||
$data[2] .= '</td>';
|
$data[2] .= '</td>';
|
||||||
$data[2] .= '<td class="datos2">';
|
$data[2] .= '<td class="datos2">';
|
||||||
$data[2] .= html_print_input_text('module_action_threshold', '', '', 4, 10, true);
|
$data[2] .= html_print_input_text(
|
||||||
|
'module_action_threshold',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
4,
|
||||||
|
10,
|
||||||
|
true
|
||||||
|
);
|
||||||
$data[2] .= '</td>';
|
$data[2] .= '</td>';
|
||||||
$data[2] .= '</tr>';
|
$data[2] .= '</tr>';
|
||||||
$data[2] .= '</table>';
|
$data[2] .= '</table>';
|
||||||
|
|
|
@ -41,7 +41,13 @@ if (is_ajax()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Special days list'), 'images/gm_alerts.png', false, 'alert_special_days', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Special days list'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'alert_special_days',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$update_special_day = (bool) get_parameter('update_special_day');
|
$update_special_day = (bool) get_parameter('update_special_day');
|
||||||
$create_special_day = (bool) get_parameter('create_special_day');
|
$create_special_day = (bool) get_parameter('create_special_day');
|
||||||
|
|
|
@ -132,7 +132,13 @@ if (!$delete_template) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
// ~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
// ~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Alert templates'), 'images/gm_alerts.png', false, '', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Alert templates'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'alert_templates_tab',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +207,13 @@ if ($delete_template) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Alert templates'), 'images/gm_alerts.png', false, 'alerts_config', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Alert templates'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'alerts_config',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
|
@ -216,7 +228,13 @@ if ($delete_template) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Alert templates'), 'images/gm_alerts.png', false, 'alerts_config', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Alert templates'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'alerts_config',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@ if (count($actions) == 1 && isset($actions[0])) {
|
||||||
$table->data[$kaction][($k + 1)] = human_time_description_raw($action_threshold, true, 'tiny');
|
$table->data[$kaction][($k + 1)] = human_time_description_raw($action_threshold, true, 'tiny');
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->head[($k + 1)] = __('Threshold').'<span style="float: right;">'.ui_print_help_icon('action_threshold', true, '', 'images/header_help.png').'</span>';
|
$table->head[($k + 1)] = __('Threshold');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,6 @@ $table->colspan[2][1] = 2;
|
||||||
|
|
||||||
$table->data[3][0] = __('Threshold');
|
$table->data[3][0] = __('Threshold');
|
||||||
$table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true);
|
$table->data[3][1] = html_print_input_text('action_threshold', $action_threshold, '', 5, 7, true);
|
||||||
$table->data[3][1] .= ' '.__('seconds').ui_print_help_icon('action_threshold', true);
|
|
||||||
$table->colspan[3][1] = 2;
|
$table->colspan[3][1] = 2;
|
||||||
|
|
||||||
$table->data[4][0] = '';
|
$table->data[4][0] = '';
|
||||||
|
@ -318,9 +317,9 @@ $(document).ready (function () {
|
||||||
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
|
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
|
||||||
values,
|
values,
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
original_command = js_html_entity_decode (data["command"]);
|
original_command = data["command"];
|
||||||
render_command_preview (original_command);
|
render_command_preview (original_command);
|
||||||
command_description = js_html_entity_decode (data["description"]);
|
command_description = data["description"];
|
||||||
render_command_description(command_description);
|
render_command_description(command_description);
|
||||||
|
|
||||||
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
|
||||||
|
|
|
@ -43,7 +43,7 @@ if (defined('METACONSOLE')) {
|
||||||
__('Alerts').' » '.__('Configure alert command'),
|
__('Alerts').' » '.__('Configure alert command'),
|
||||||
'images/gm_alerts.png',
|
'images/gm_alerts.png',
|
||||||
false,
|
false,
|
||||||
'alerts_config',
|
'alerts_config_command_tab',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,6 @@ $table->data['name'][2] = html_print_input_text('name', $name, '', 35, 255, true
|
||||||
|
|
||||||
$table->colspan['command'][1] = 3;
|
$table->colspan['command'][1] = 3;
|
||||||
$table->data['command'][0] = __('Command');
|
$table->data['command'][0] = __('Command');
|
||||||
$table->data['command'][0] .= ui_print_help_icon('alert_macros', true);
|
|
||||||
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true);
|
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true);
|
||||||
|
|
||||||
$table->colspan['group'][1] = 3;
|
$table->colspan['group'][1] = 3;
|
||||||
|
@ -199,11 +198,6 @@ $table->data['description'][1] = html_print_textarea('description', 10, 30, $des
|
||||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
||||||
|
|
||||||
// Only show help on first row.
|
|
||||||
if ($i == 1) {
|
|
||||||
$table->data['field'.$i][0] .= ui_print_help_icon('alert_fields_description', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($fields_descriptions)) {
|
if (!empty($fields_descriptions)) {
|
||||||
$field_description = $fields_descriptions[($i - 1)];
|
$field_description = $fields_descriptions[($i - 1)];
|
||||||
} else {
|
} else {
|
||||||
|
@ -214,11 +208,6 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
|
|
||||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||||
|
|
||||||
// Only show help on first row.
|
|
||||||
if ($i == 1) {
|
|
||||||
$table->data['field'.$i][2] .= ui_print_help_icon('alert_fields_values', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($fields_values)) {
|
if (!empty($fields_values)) {
|
||||||
$field_values = $fields_values[($i - 1)];
|
$field_values = $fields_values[($i - 1)];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,14 +56,20 @@ if ($a_template !== false) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
// ~ ui_print_page_header (__('Alerts') .
|
$step = (int) get_parameter('step', 1);
|
||||||
// ~ ' » ' . __('Configure alert template'), "",
|
if ($step == 1) {
|
||||||
// ~ false, "alerts_config", true);
|
$help_header = 'configure_alert_template_step_1';
|
||||||
|
} else if ($step == 2) {
|
||||||
|
$help_header = 'configure_alert_template_step_2';
|
||||||
|
} else if ($step == 3) {
|
||||||
|
$help_header = 'configure_alert_template_step_3';
|
||||||
|
}
|
||||||
|
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Alerts').' » '.__('Configure alert template'),
|
__('Alerts').' » '.__('Configure alert template'),
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'',
|
$help_header,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +89,13 @@ if ($a_template !== false) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Configure alert template'), 'images/gm_alerts.png', false, 'conf_alert_template', true);
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Configure alert template'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
'conf_alert_template',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
|
@ -101,7 +113,22 @@ if ($a_template !== false) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(__('Alerts').' » '.__('Configure alert template'), 'images/gm_alerts.png', false, 'conf_alert_template', true);
|
$step = (int) get_parameter('step', 1);
|
||||||
|
if ($step == 1) {
|
||||||
|
$help_header = 'configure_alert_template_step_1';
|
||||||
|
} else if ($step == 2) {
|
||||||
|
$help_header = 'configure_alert_template_step_2';
|
||||||
|
} else if ($step == 3) {
|
||||||
|
$help_header = 'configure_alert_template_step_3';
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_page_header(
|
||||||
|
__('Alerts').' » '.__('Configure alert template'),
|
||||||
|
'images/gm_alerts.png',
|
||||||
|
false,
|
||||||
|
$help_header,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,96 +60,12 @@ $fields_selected = explode(',', $config['event_fields']);
|
||||||
|
|
||||||
$result_selected = [];
|
$result_selected = [];
|
||||||
|
|
||||||
// show list of fields selected.
|
// Show list of fields selected.
|
||||||
if ($fields_selected[0] != '') {
|
if ($fields_selected[0] != '') {
|
||||||
foreach ($fields_selected as $field_selected) {
|
foreach ($fields_selected as $field_selected) {
|
||||||
switch ($field_selected) {
|
$result_selected[$field_selected] = events_get_column_name(
|
||||||
case 'id_evento':
|
$field_selected
|
||||||
$result = __('Event Id');
|
);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'evento':
|
|
||||||
$result = __('Event Name');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_agente':
|
|
||||||
$result = __('Agent Name');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_usuario':
|
|
||||||
$result = __('User');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_grupo':
|
|
||||||
$result = __('Group');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'estado':
|
|
||||||
$result = __('Status');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'timestamp':
|
|
||||||
$result = __('Timestamp');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'event_type':
|
|
||||||
$result = __('Event Type');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_agentmodule':
|
|
||||||
$result = __('Module Name');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_alert_am':
|
|
||||||
$result = __('Alert');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'criticity':
|
|
||||||
$result = __('Severity');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'user_comment':
|
|
||||||
$result = __('Comment');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'tags':
|
|
||||||
$result = __('Tags');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'source':
|
|
||||||
$result = __('Source');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'id_extra':
|
|
||||||
$result = __('Extra Id');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'owner_user':
|
|
||||||
$result = __('Owner');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ack_utimestamp':
|
|
||||||
$result = __('ACK Timestamp');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'instructions':
|
|
||||||
$result = __('Instructions');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'server_name':
|
|
||||||
$result = __('Server Name');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'data':
|
|
||||||
$result = __('Data');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'module_status':
|
|
||||||
$result = __('Module Status');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result_selected[$field_selected] = $result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +93,8 @@ $fields_available = [];
|
||||||
|
|
||||||
$fields_available['id_evento'] = __('Event Id');
|
$fields_available['id_evento'] = __('Event Id');
|
||||||
$fields_available['evento'] = __('Event Name');
|
$fields_available['evento'] = __('Event Name');
|
||||||
$fields_available['id_agente'] = __('Agent Name');
|
$fields_available['id_agente'] = __('Agent ID');
|
||||||
|
$fields_available['agent_name'] = __('Agent Name');
|
||||||
$fields_available['id_usuario'] = __('User');
|
$fields_available['id_usuario'] = __('User');
|
||||||
$fields_available['id_grupo'] = __('Group');
|
$fields_available['id_grupo'] = __('Group');
|
||||||
$fields_available['estado'] = __('Status');
|
$fields_available['estado'] = __('Status');
|
||||||
|
@ -196,20 +113,20 @@ $fields_available['instructions'] = __('Instructions');
|
||||||
$fields_available['server_name'] = __('Server Name');
|
$fields_available['server_name'] = __('Server Name');
|
||||||
$fields_available['data'] = __('Data');
|
$fields_available['data'] = __('Data');
|
||||||
$fields_available['module_status'] = __('Module Status');
|
$fields_available['module_status'] = __('Module Status');
|
||||||
|
$fields_available['mini_severity'] = __('Severity mini');
|
||||||
|
|
||||||
// remove fields already selected
|
|
||||||
|
// Remove fields already selected.
|
||||||
foreach ($fields_available as $key => $available) {
|
foreach ($fields_available as $key => $available) {
|
||||||
foreach ($result_selected as $selected) {
|
if (isset($result_selected[$key])) {
|
||||||
if ($selected == $available) {
|
unset($fields_available[$key]);
|
||||||
unset($fields_available[$key]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
|
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
|
||||||
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||||
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
||||||
'images/darrowright.png',
|
'images/darrowright_green.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'id' => 'right',
|
'id' => 'right',
|
||||||
|
@ -217,7 +134,7 @@ $table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
||||||
]
|
]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
||||||
'images/darrowleft.png',
|
'images/darrowleft_green.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
'id' => 'left',
|
'id' => 'left',
|
||||||
|
|
|
@ -124,7 +124,7 @@ $data[3] .= '<span class="size">'.html_print_input_text('modal_height', $event_r
|
||||||
$table->data[2] = $data;
|
$table->data[2] = $data;
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = __('Parameters').ui_print_help_icon('response_parameters', true);
|
$data[0] = __('Parameters');
|
||||||
$data[1] = html_print_input_text(
|
$data[1] = html_print_input_text(
|
||||||
'params',
|
'params',
|
||||||
$event_response['params'],
|
$event_response['params'],
|
||||||
|
|
|
@ -50,17 +50,10 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=responses&pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
|
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=responses&pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!is_metaconsole()) {
|
$buttons['fields'] = [
|
||||||
$buttons['fields'] = [
|
'active' => false,
|
||||||
'active' => false,
|
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
||||||
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
];
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$buttons['fields'] = [
|
|
||||||
'active' => false,
|
|
||||||
'text' => '<a href="index.php?sec=eventos&sec2=event/custom_events&section=fields&pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($section) {
|
switch ($section) {
|
||||||
|
@ -77,6 +70,7 @@ switch ($section) {
|
||||||
case 'responses':
|
case 'responses':
|
||||||
$buttons['responses']['active'] = true;
|
$buttons['responses']['active'] = true;
|
||||||
$subpage = ' - '.__('Responses');
|
$subpage = ' - '.__('Responses');
|
||||||
|
$help_header = 'events_responses_tab';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'view':
|
case 'view':
|
||||||
|
@ -90,7 +84,14 @@ switch ($section) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! defined('METACONSOLE')) {
|
if (! defined('METACONSOLE')) {
|
||||||
ui_print_page_header(__('Manage events').$subpage, 'images/gm_events.png', false, '', true, $buttons);
|
ui_print_page_header(
|
||||||
|
__('Manage events').$subpage,
|
||||||
|
'images/gm_events.png',
|
||||||
|
false,
|
||||||
|
$help_header,
|
||||||
|
true,
|
||||||
|
$buttons
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
ui_meta_print_header(__('Manage events').$subpage, '', $buttons);
|
ui_meta_print_header(__('Manage events').$subpage, '', $buttons);
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ ui_print_page_header(
|
||||||
__('GIS Maps builder'),
|
__('GIS Maps builder'),
|
||||||
'images/gm_gis.png',
|
'images/gm_gis.png',
|
||||||
false,
|
false,
|
||||||
'configure_gis_map',
|
'configure_gis_map_edit',
|
||||||
true,
|
true,
|
||||||
$buttons
|
$buttons
|
||||||
);
|
);
|
||||||
|
@ -357,8 +357,8 @@ function addConnectionMap() {
|
||||||
for (var index in connectionMaps) {
|
for (var index in connectionMaps) {
|
||||||
if (isInt(index)) {
|
if (isInt(index)) {
|
||||||
if (connectionMaps[index] == idConnectionMap) {
|
if (connectionMaps[index] == idConnectionMap) {
|
||||||
alert("<?php echo __('The connection'); ?> "' + connectionMapName + '" <?php echo __('just added previously.'); ?>");
|
alert("<?php echo __('The connection'); ?> " + connectionMapName + " <?php echo __('just added previously.'); ?>");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,14 @@ if (defined('METACONSOLE')) {
|
||||||
$title_in_header = __('Create group');
|
$title_in_header = __('Create group');
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_page_header($title_in_header, 'images/group.png', false, '', true, '');
|
ui_print_page_header(
|
||||||
|
$title_in_header,
|
||||||
|
'images/group.png',
|
||||||
|
false,
|
||||||
|
'create_group_tab',
|
||||||
|
true,
|
||||||
|
''
|
||||||
|
);
|
||||||
$sec = 'gagente';
|
$sec = 'gagente';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +182,11 @@ if ($config['enterprise_installed']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[$i][0] = __('Alerts');
|
$table->data[$i][0] = __('Alerts');
|
||||||
$table->data[$i][1] = html_print_checkbox('alerts_enabled', 1, ! $alerts_disabled, true);
|
$table->data[$i][1] = html_print_checkbox_switch('alerts_enabled', 1, ! $alerts_disabled, true);
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$table->data[$i][0] = __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true);
|
$table->data[$i][0] = __('Propagate ACL').ui_print_help_tip(__('Propagate the same ACL security into the child subgroups.'), true);
|
||||||
$table->data[$i][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon('propagate_acl', true);
|
$table->data[$i][1] = html_print_checkbox_switch('propagate', 1, $propagate, true);
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$table->data[$i][0] = __('Custom ID');
|
$table->data[$i][0] = __('Custom ID');
|
||||||
|
|
|
@ -0,0 +1,632 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Credentials management view.
|
||||||
|
*
|
||||||
|
* @category Credentials management
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Opensource
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Check access.
|
||||||
|
check_login();
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access event viewer'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
return ['error' => 'noaccess'];
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required files.
|
||||||
|
ui_require_css_file('credential_store');
|
||||||
|
require_once $config['homedir'].'/include/functions_credential_store.php';
|
||||||
|
require_once $config['homedir'].'/include/functions_io.php';
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
$draw = get_parameter('draw', 0);
|
||||||
|
$filter = get_parameter('filter', []);
|
||||||
|
$get_key = get_parameter('get_key', 0);
|
||||||
|
$new_form = get_parameter('new_form', 0);
|
||||||
|
$new_key = get_parameter('new_key', 0);
|
||||||
|
$update_key = get_parameter('update_key', 0);
|
||||||
|
$delete_key = get_parameter('delete_key', 0);
|
||||||
|
|
||||||
|
if ($new_form) {
|
||||||
|
echo print_inputs();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($delete_key) {
|
||||||
|
$identifier = get_parameter('identifier', null);
|
||||||
|
|
||||||
|
if (empty($identifier)) {
|
||||||
|
ajax_msg('error', __('identifier cannot be empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db_process_sql_delete(
|
||||||
|
'tcredential_store',
|
||||||
|
['identifier' => $identifier]
|
||||||
|
) === false
|
||||||
|
) {
|
||||||
|
ajax_msg('error', $config['dbconnection']->error, true);
|
||||||
|
} else {
|
||||||
|
ajax_msg('result', $identifier, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update_key) {
|
||||||
|
$data = get_parameter('values', null);
|
||||||
|
|
||||||
|
if ($data === null || !is_array($data)) {
|
||||||
|
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if ($key == 'identifier') {
|
||||||
|
$identifier = base64_decode($value);
|
||||||
|
} else if ($key == 'product') {
|
||||||
|
$product = base64_decode($value);
|
||||||
|
} else {
|
||||||
|
$values[$key] = base64_decode($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($identifier)) {
|
||||||
|
ajax_msg('error', __('identifier cannot be empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($product)) {
|
||||||
|
ajax_msg('error', __('product cannot be empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db_process_sql_update(
|
||||||
|
'tcredential_store',
|
||||||
|
$values,
|
||||||
|
['identifier' => $identifier]
|
||||||
|
) === false
|
||||||
|
) {
|
||||||
|
ajax_msg('error', $config['dbconnection']->error);
|
||||||
|
} else {
|
||||||
|
ajax_msg('result', $identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($new_key) {
|
||||||
|
$data = get_parameter('values', null);
|
||||||
|
|
||||||
|
if ($data === null || !is_array($data)) {
|
||||||
|
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
$values[$key] = base64_decode($value);
|
||||||
|
if ($key == 'identifier') {
|
||||||
|
$values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$identifier = $values['identifier'];
|
||||||
|
|
||||||
|
if (empty($identifier)) {
|
||||||
|
ajax_msg('error', __('identifier cannot be empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($values['product'])) {
|
||||||
|
ajax_msg('error', __('product cannot be empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db_process_sql_insert('tcredential_store', $values) === false) {
|
||||||
|
ajax_msg('error', $config['dbconnection']->error);
|
||||||
|
} else {
|
||||||
|
ajax_msg('result', $identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($get_key) {
|
||||||
|
$identifier = get_parameter('identifier', null);
|
||||||
|
|
||||||
|
$key = get_key($identifier);
|
||||||
|
echo print_inputs($key);
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($draw) {
|
||||||
|
// Datatables offset, limit and order.
|
||||||
|
$start = get_parameter('start', 0);
|
||||||
|
$length = get_parameter('length', $config['block_size']);
|
||||||
|
$order = get_datatable_order(true);
|
||||||
|
try {
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
'cs.*',
|
||||||
|
'tg.nombre as `group`',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Retrieve data.
|
||||||
|
$data = credentials_get_all(
|
||||||
|
// Fields.
|
||||||
|
$fields,
|
||||||
|
// Filter.
|
||||||
|
$filter,
|
||||||
|
// Offset.
|
||||||
|
$start,
|
||||||
|
// Limit.
|
||||||
|
$length,
|
||||||
|
// Order.
|
||||||
|
$order['direction'],
|
||||||
|
// Sort field.
|
||||||
|
$order['field']
|
||||||
|
);
|
||||||
|
|
||||||
|
// Retrieve counter.
|
||||||
|
$count = credentials_get_all(
|
||||||
|
'count',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($data) {
|
||||||
|
$data = array_reduce(
|
||||||
|
$data,
|
||||||
|
function ($carry, $item) {
|
||||||
|
// Transforms array of arrays $data into an array
|
||||||
|
// of objects, making a post-process of certain fields.
|
||||||
|
$tmp = (object) $item;
|
||||||
|
$tmp->username = io_safe_output($tmp->username);
|
||||||
|
|
||||||
|
if (empty($tmp->group)) {
|
||||||
|
$tmp->group = __('All');
|
||||||
|
} else {
|
||||||
|
$tmp->group = io_safe_output($tmp->group);
|
||||||
|
}
|
||||||
|
|
||||||
|
$carry[] = $tmp;
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatables format: RecordsTotal && recordsfiltered.
|
||||||
|
echo json_encode(
|
||||||
|
[
|
||||||
|
'data' => $data,
|
||||||
|
'recordsTotal' => $count,
|
||||||
|
'recordsFiltered' => $count,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
// Capture output.
|
||||||
|
$response = ob_get_clean();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not valid, show error with issue.
|
||||||
|
json_decode($response);
|
||||||
|
if (json_last_error() == JSON_ERROR_NONE) {
|
||||||
|
// If valid dump.
|
||||||
|
echo $response;
|
||||||
|
} else {
|
||||||
|
echo json_encode(
|
||||||
|
['error' => $response]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatables list.
|
||||||
|
try {
|
||||||
|
$columns = [
|
||||||
|
'group',
|
||||||
|
'identifier',
|
||||||
|
'product',
|
||||||
|
'username',
|
||||||
|
'options',
|
||||||
|
];
|
||||||
|
|
||||||
|
$column_names = [
|
||||||
|
__('Group'),
|
||||||
|
__('Identifier'),
|
||||||
|
__('Product'),
|
||||||
|
__('User'),
|
||||||
|
[
|
||||||
|
'text' => __('Options'),
|
||||||
|
'class' => 'action_buttons',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$table_id = 'keystore';
|
||||||
|
// Load datatables user interface.
|
||||||
|
ui_print_datatable(
|
||||||
|
[
|
||||||
|
'id' => $table_id,
|
||||||
|
'class' => 'info_table',
|
||||||
|
'style' => 'width: 100%',
|
||||||
|
'columns' => $columns,
|
||||||
|
'column_names' => $column_names,
|
||||||
|
'ajax_url' => 'godmode/groups/credential_store',
|
||||||
|
'ajax_postprocess' => 'process_datatables_item(item)',
|
||||||
|
'no_sortable_columns' => [-1],
|
||||||
|
'order' => [
|
||||||
|
'field' => 'identifier',
|
||||||
|
'direction' => 'asc',
|
||||||
|
],
|
||||||
|
'search_button_class' => 'sub filter float-right',
|
||||||
|
'form' => [
|
||||||
|
'inputs' => [
|
||||||
|
[
|
||||||
|
'label' => __('Group'),
|
||||||
|
'type' => 'select',
|
||||||
|
'id' => 'filter_id_group',
|
||||||
|
'name' => 'filter_id_group',
|
||||||
|
'options' => users_get_groups_for_select(
|
||||||
|
$config['id_user'],
|
||||||
|
'AR',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => __('Free search'),
|
||||||
|
'type' => 'text',
|
||||||
|
'class' => 'mw250px',
|
||||||
|
'id' => 'free_search',
|
||||||
|
'name' => 'free_search',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auxiliar div.
|
||||||
|
$new = '<div id="new_key" style="display: none"><form id="form_new">';
|
||||||
|
$new .= '</form></div>';
|
||||||
|
$details = '<div id="info_key" style="display: none"><form id="form_update">';
|
||||||
|
$details .= '</form></div>';
|
||||||
|
$aux = '<div id="aux" style="display: none"></div>';
|
||||||
|
|
||||||
|
|
||||||
|
echo $new.$details.$aux;
|
||||||
|
|
||||||
|
// Create button.
|
||||||
|
echo '<div class="w100p flex-content-right">';
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Add key'),
|
||||||
|
'create',
|
||||||
|
false,
|
||||||
|
'class="sub next"'
|
||||||
|
);
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function process_datatables_item(item) {
|
||||||
|
item.options = '<a href="javascript:" onclick="display_key(\'';
|
||||||
|
item.options += item.identifier;
|
||||||
|
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
|
||||||
|
|
||||||
|
item.options += '<a href="javascript:" onclick="delete_key(\'';
|
||||||
|
item.options += item.identifier;
|
||||||
|
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle_response(data) {
|
||||||
|
var title = "<?php echo __('Success'); ?>";
|
||||||
|
var text = '';
|
||||||
|
var failed = 0;
|
||||||
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
text = data['result'];
|
||||||
|
} catch (err) {
|
||||||
|
title = "<?php echo __('Failed'); ?>";
|
||||||
|
text = err.message;
|
||||||
|
failed = 1;
|
||||||
|
}
|
||||||
|
if (!failed && data['error']) {
|
||||||
|
title = "<?php echo __('Failed'); ?>";
|
||||||
|
text = data['error'];
|
||||||
|
failed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#aux').empty();
|
||||||
|
$('#aux').html(text);
|
||||||
|
$('#aux').dialog({
|
||||||
|
width: 450,
|
||||||
|
position: {
|
||||||
|
my: 'center',
|
||||||
|
at: 'center',
|
||||||
|
of: window,
|
||||||
|
collision: 'fit'
|
||||||
|
},
|
||||||
|
title: title,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'OK',
|
||||||
|
click: function(e) {
|
||||||
|
if (!failed) {
|
||||||
|
dt_<?php echo $table_id; ?>.draw(0);
|
||||||
|
$(".ui-dialog-content").dialog("close");
|
||||||
|
cleanupDOM();
|
||||||
|
} else {
|
||||||
|
$(this).dialog('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_key(id) {
|
||||||
|
$('#aux').empty();
|
||||||
|
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||||
|
$('#aux').dialog({
|
||||||
|
title: '<?php echo __('Delete'); ?> ' + id,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||||
|
text: '<?php echo __('Cancel'); ?>',
|
||||||
|
click: function(e) {
|
||||||
|
$(this).dialog('close');
|
||||||
|
cleanupDOM();
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Delete',
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||||
|
click: function(e) {
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/groups/credential_store',
|
||||||
|
delete_key: 1,
|
||||||
|
identifier: id
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
handle_response(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
handle_response(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function display_key(id) {
|
||||||
|
$('#form_update').empty();
|
||||||
|
$('#form_update').html('Loading...');
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/groups/credential_store',
|
||||||
|
get_key: 1,
|
||||||
|
identifier: id
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$('#info_key').dialog({
|
||||||
|
width: 580,
|
||||||
|
height: 400,
|
||||||
|
position: {
|
||||||
|
my: 'center',
|
||||||
|
at: 'center',
|
||||||
|
of: window,
|
||||||
|
collision: 'fit'
|
||||||
|
},
|
||||||
|
title: id,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||||
|
text: '<?php echo __('Cancel'); ?>',
|
||||||
|
click: function(e) {
|
||||||
|
$(this).dialog('close');
|
||||||
|
cleanupDOM();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Update',
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||||
|
click: function(e) {
|
||||||
|
var values = {};
|
||||||
|
|
||||||
|
$('#form_update :input').each(function() {
|
||||||
|
values[this.name] = btoa($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/groups/credential_store',
|
||||||
|
update_key: 1,
|
||||||
|
values: values
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
handle_response(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
handle_response(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
$('#form_update').html(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanupDOM() {
|
||||||
|
$('#div-identifier').empty();
|
||||||
|
$('#div-product').empty();
|
||||||
|
$('#div-username').empty();
|
||||||
|
$('#div-password').empty();
|
||||||
|
$('#div-extra_1').empty();
|
||||||
|
$('#div-extra_2').empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculate_inputs() {
|
||||||
|
if ($('#product :selected').val() == "CUSTOM") {
|
||||||
|
$('#div-username label').text('<?php echo __('Username'); ?>');
|
||||||
|
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||||
|
$('#div-extra_1 label').text('<?php echo __('Extra'); ?>');
|
||||||
|
$('#div-extra_2 label').text('<?php echo __('Extra (2)'); ?>');
|
||||||
|
$('#div-extra_1').show();
|
||||||
|
$('#div-extra_2').show();
|
||||||
|
} else if ($('#product :selected').val() == "AWS") {
|
||||||
|
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
|
||||||
|
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
|
||||||
|
$('#div-extra_1').hide();
|
||||||
|
$('#div-extra_2').hide();
|
||||||
|
} else if ($('#product :selected').val() == "AZURE") {
|
||||||
|
$('#div-username label').text('<?php echo __('Client ID'); ?>');
|
||||||
|
$('#div-password label').text('<?php echo __('Application secret'); ?>');
|
||||||
|
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
||||||
|
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
||||||
|
$('#div-extra_1').show();
|
||||||
|
$('#div-extra_2').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_key() {
|
||||||
|
// Clear form.
|
||||||
|
$('#form_update').empty();
|
||||||
|
$('#form_update').html('Loading...');
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/groups/credential_store',
|
||||||
|
new_form: 1
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$('#form_new').html(data);
|
||||||
|
$('#id_group').val(0);
|
||||||
|
// By default AWS.
|
||||||
|
$('#product').val('AWS');
|
||||||
|
calculate_inputs();
|
||||||
|
|
||||||
|
$('#product').on('change', function() {
|
||||||
|
calculate_inputs()
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show form.
|
||||||
|
$('#new_key').dialog({
|
||||||
|
width: 580,
|
||||||
|
height: 400,
|
||||||
|
position: {
|
||||||
|
my: 'center',
|
||||||
|
at: 'center',
|
||||||
|
of: window,
|
||||||
|
collision: 'fit'
|
||||||
|
},
|
||||||
|
title: "<?php echo __('Register new key into keystore'); ?>",
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||||
|
text: "<?php echo __('Cancel'); ?>",
|
||||||
|
click: function(e) {
|
||||||
|
$(this).dialog('close');
|
||||||
|
cleanupDOM();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||||
|
text: 'OK',
|
||||||
|
click: function(e) {
|
||||||
|
var values = {};
|
||||||
|
|
||||||
|
console.log($('#form_new'));
|
||||||
|
|
||||||
|
$('#form_new :input').each(function() {
|
||||||
|
values[this.name] = btoa($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
data: {
|
||||||
|
page: 'godmode/groups/credential_store',
|
||||||
|
new_key: 1,
|
||||||
|
values: values
|
||||||
|
},
|
||||||
|
datatype: "json",
|
||||||
|
success: function (data) {
|
||||||
|
handle_response(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
handle_response(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$("#submit-create").on('click', function(){
|
||||||
|
add_key();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -1,20 +1,36 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Group management view.
|
||||||
|
*
|
||||||
|
* @category Group View
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Opensource
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Begin.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
ui_require_css_file('tree');
|
ui_require_css_file('tree');
|
||||||
ui_require_css_file('fixed-bottom-box');
|
ui_require_css_file('fixed-bottom-box');
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
@ -76,15 +92,17 @@ if (is_ajax()) {
|
||||||
$recursion = (int) get_parameter('recursion', 0);
|
$recursion = (int) get_parameter('recursion', 0);
|
||||||
$privilege = (string) get_parameter('privilege', '');
|
$privilege = (string) get_parameter('privilege', '');
|
||||||
$all_agents = (int) get_parameter('all_agents', 0);
|
$all_agents = (int) get_parameter('all_agents', 0);
|
||||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
// Is is possible add keys prefix to avoid auto sorting in
|
||||||
|
// js object conversion.
|
||||||
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
||||||
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
// This attr is for the operation "bulk alert accions add", it controls
|
||||||
// from db
|
// the query that take the agents from db.
|
||||||
$add_alert_bulk_op = get_parameter('add_alert_bulk_op', false);
|
$add_alert_bulk_op = get_parameter('add_alert_bulk_op', false);
|
||||||
// Ids of agents to be include in the SQL clause as id_agent IN ()
|
// Ids of agents to be include in the SQL clause as id_agent IN ().
|
||||||
$filter_agents_json = (string) get_parameter('filter_agents_json', '');
|
$filter_agents_json = (string) get_parameter('filter_agents_json', '');
|
||||||
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
|
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
|
||||||
// Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
|
// Juanma (22/05/2014) Fix: If setted remove void agents from result
|
||||||
|
// (by default and for compatibility show void agents).
|
||||||
$show_void_agents = (int) get_parameter('show_void_agents', 1);
|
$show_void_agents = (int) get_parameter('show_void_agents', 1);
|
||||||
$serialized = (bool) get_parameter('serialized', false);
|
$serialized = (bool) get_parameter('serialized', false);
|
||||||
$serialized_separator = (string) get_parameter('serialized_separator', '|');
|
$serialized_separator = (string) get_parameter('serialized_separator', '|');
|
||||||
|
@ -121,7 +139,7 @@ if (is_ajax()) {
|
||||||
$filter['status'] = $status_agents;
|
$filter['status'] = $status_agents;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Juanma (22/05/2014) Fix: If remove void agents setted
|
// Juanma (22/05/2014) Fix: If remove void agents set.
|
||||||
$_sql_post = ' 1=1 ';
|
$_sql_post = ' 1=1 ';
|
||||||
if ($show_void_agents == 0) {
|
if ($show_void_agents == 0) {
|
||||||
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
|
$_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
|
||||||
|
@ -131,8 +149,9 @@ if (is_ajax()) {
|
||||||
$id_groups_get_agents = $id_group;
|
$id_groups_get_agents = $id_group;
|
||||||
if ($id_group == 0 && $privilege != '') {
|
if ($id_group == 0 && $privilege != '') {
|
||||||
$groups = users_get_groups($config['id_user'], $privilege, false);
|
$groups = users_get_groups($config['id_user'], $privilege, false);
|
||||||
// if group ID doesn't matter and $privilege is specified (like 'AW'),
|
// If group ID doesn't matter and $privilege is specified
|
||||||
// retruns all agents that current user has $privilege privilege for.
|
// (like 'AW'), retruns all agents that current user has $privilege
|
||||||
|
// privilege for.
|
||||||
$id_groups_get_agents = array_keys($groups);
|
$id_groups_get_agents = array_keys($groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,13 +168,13 @@ if (is_ajax()) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$agents_disabled = [];
|
$agents_disabled = [];
|
||||||
// Add keys prefix
|
// Add keys prefix.
|
||||||
if ($keys_prefix !== '') {
|
if ($keys_prefix !== '') {
|
||||||
foreach ($agents as $k => $v) {
|
foreach ($agents as $k => $v) {
|
||||||
$agents[$keys_prefix.$k] = $v;
|
$agents[$keys_prefix.$k] = $v;
|
||||||
unset($agents[$k]);
|
unset($agents[$k]);
|
||||||
if ($all_agents) {
|
if ($all_agents) {
|
||||||
// Unserialize to get the status
|
// Unserialize to get the status.
|
||||||
if ($serialized && is_metaconsole()) {
|
if ($serialized && is_metaconsole()) {
|
||||||
$agent_info = explode($serialized_separator, $k);
|
$agent_info = explode($serialized_separator, $k);
|
||||||
$agent_disabled = db_get_value_filter(
|
$agent_disabled = db_get_value_filter(
|
||||||
|
@ -174,7 +193,8 @@ if (is_ajax()) {
|
||||||
['id_agente' => $agent_info[1]]
|
['id_agente' => $agent_info[1]]
|
||||||
);
|
);
|
||||||
} else if (!$serialized && is_metaconsole()) {
|
} else if (!$serialized && is_metaconsole()) {
|
||||||
// Cannot retrieve the disabled status. Mark all as not disabled
|
// Cannot retrieve the disabled status.
|
||||||
|
// Mark all as not disabled.
|
||||||
$agent_disabled = 0;
|
$agent_disabled = 0;
|
||||||
} else {
|
} else {
|
||||||
$agent_disabled = db_get_value_filter(
|
$agent_disabled = db_get_value_filter(
|
||||||
|
@ -226,11 +246,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||||
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
|
$url_credbox = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
|
||||||
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
|
$url_tree = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
|
||||||
|
$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
|
||||||
|
|
||||||
$buttons['tree'] = [
|
$buttons['tree'] = [
|
||||||
'active' => false,
|
'active' => false,
|
||||||
'text' => "<a href='$url_tree'>".html_print_image(
|
'text' => '<a href="'.$url_tree.'">'.html_print_image(
|
||||||
'images/gm_massive_operations.png',
|
'images/gm_massive_operations.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
@ -241,7 +263,7 @@ $buttons['tree'] = [
|
||||||
|
|
||||||
$buttons['groups'] = [
|
$buttons['groups'] = [
|
||||||
'active' => false,
|
'active' => false,
|
||||||
'text' => "<a href='$url_groups'>".html_print_image(
|
'text' => '<a href="'.$url_groups.'">'.html_print_image(
|
||||||
'images/group.png',
|
'images/group.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
@ -250,21 +272,38 @@ $buttons['groups'] = [
|
||||||
).'</a>',
|
).'</a>',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$buttons['credbox'] = [
|
||||||
|
'active' => false,
|
||||||
|
'text' => '<a href="'.$url_credbox.'">'.html_print_image(
|
||||||
|
'images/key.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Credential Store'),
|
||||||
|
]
|
||||||
|
).'</a>',
|
||||||
|
];
|
||||||
|
|
||||||
$tab = (string) get_parameter('tab', 'groups');
|
$tab = (string) get_parameter('tab', 'groups');
|
||||||
|
|
||||||
// Marks correct tab
|
$title = __('Groups defined in %s', get_product_name());
|
||||||
|
// Marks correct tab.
|
||||||
switch ($tab) {
|
switch ($tab) {
|
||||||
case 'tree':
|
case 'tree':
|
||||||
$buttons['tree']['active'] = true;
|
$buttons['tree']['active'] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'credbox':
|
||||||
|
$buttons['credbox']['active'] = true;
|
||||||
|
$title = __('Credential store');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'groups':
|
case 'groups':
|
||||||
default:
|
default:
|
||||||
$buttons['groups']['active'] = true;
|
$buttons['groups']['active'] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
agents_meta_print_header();
|
agents_meta_print_header();
|
||||||
echo '<div class="notify">';
|
echo '<div class="notify">';
|
||||||
|
@ -272,21 +311,28 @@ if (defined('METACONSOLE')) {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Groups defined in %s', get_product_name()),
|
$title,
|
||||||
'images/group.png',
|
'images/group.png',
|
||||||
false,
|
false,
|
||||||
'',
|
'group_list_tab',
|
||||||
true,
|
true,
|
||||||
$buttons
|
$buttons
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load credential store view before parse list-tree forms.
|
||||||
|
if ($tab == 'credbox') {
|
||||||
|
include_once __DIR__.'/credential_store.php';
|
||||||
|
// Stop script.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$create_group = (bool) get_parameter('create_group');
|
$create_group = (bool) get_parameter('create_group');
|
||||||
$update_group = (bool) get_parameter('update_group');
|
$update_group = (bool) get_parameter('update_group');
|
||||||
$delete_group = (bool) get_parameter('delete_group');
|
$delete_group = (bool) get_parameter('delete_group');
|
||||||
$pure = get_parameter('pure', 0);
|
$pure = get_parameter('pure', 0);
|
||||||
|
|
||||||
// Create group
|
// Create group.
|
||||||
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
$name = (string) get_parameter('name');
|
$name = (string) get_parameter('name');
|
||||||
$icon = (string) get_parameter('icon');
|
$icon = (string) get_parameter('icon');
|
||||||
|
@ -301,7 +347,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
|
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
|
||||||
$propagate = (bool) get_parameter('propagate');
|
$propagate = (bool) get_parameter('propagate');
|
||||||
|
|
||||||
// Check if name field is empty
|
// Check if name field is empty.
|
||||||
if ($name != '') {
|
if ($name != '') {
|
||||||
if (!$check) {
|
if (!$check) {
|
||||||
$values = [
|
$values = [
|
||||||
|
@ -328,12 +374,11 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
ui_print_error_message(__('Each group must have a different name'));
|
ui_print_error_message(__('Each group must have a different name'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// $result = false;
|
|
||||||
ui_print_error_message(__('Group must have a name'));
|
ui_print_error_message(__('Group must have a name'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update group
|
// Update group.
|
||||||
if ($update_group) {
|
if ($update_group) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
$name = (string) get_parameter('name');
|
$name = (string) get_parameter('name');
|
||||||
|
@ -349,49 +394,35 @@ if ($update_group) {
|
||||||
$contact = (string) get_parameter('contact');
|
$contact = (string) get_parameter('contact');
|
||||||
$other = (string) get_parameter('other');
|
$other = (string) get_parameter('other');
|
||||||
|
|
||||||
// Check if name field is empty
|
// Check if name field is empty.
|
||||||
if ($name != '') {
|
if ($name != '') {
|
||||||
switch ($config['dbtype']) {
|
$sql = sprintf(
|
||||||
case 'mysql':
|
'UPDATE tgrupo
|
||||||
$sql = sprintf(
|
SET nombre = "%s",
|
||||||
'UPDATE tgrupo SET nombre = "%s",
|
icon = "%s",
|
||||||
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s"
|
disabled = %d,
|
||||||
WHERE id_grupo = %d',
|
parent = %d,
|
||||||
$name,
|
custom_id = "%s",
|
||||||
empty($icon) ? '' : substr($icon, 0, -4),
|
propagate = %d,
|
||||||
!$alerts_enabled,
|
id_skin = %d,
|
||||||
$id_parent,
|
description = "%s",
|
||||||
$custom_id,
|
contact = "%s",
|
||||||
$propagate,
|
other = "%s",
|
||||||
$skin,
|
password = "%s"
|
||||||
$description,
|
WHERE id_grupo = %d',
|
||||||
$contact,
|
$name,
|
||||||
$other,
|
empty($icon) ? '' : substr($icon, 0, -4),
|
||||||
$group_pass,
|
!$alerts_enabled,
|
||||||
$id_group
|
$id_parent,
|
||||||
);
|
$custom_id,
|
||||||
break;
|
$propagate,
|
||||||
|
$skin,
|
||||||
case 'postgresql':
|
$description,
|
||||||
case 'oracle':
|
$contact,
|
||||||
$sql = sprintf(
|
$other,
|
||||||
'UPDATE tgrupo SET nombre = \'%s\',
|
$group_pass,
|
||||||
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\', contact = \'%s\', other = \'%s\'
|
$id_group
|
||||||
WHERE id_grupo = %d',
|
);
|
||||||
$name,
|
|
||||||
substr($icon, 0, -4),
|
|
||||||
!$alerts_enabled,
|
|
||||||
$id_parent,
|
|
||||||
$custom_id,
|
|
||||||
$propagate,
|
|
||||||
$skin,
|
|
||||||
$description,
|
|
||||||
$contact,
|
|
||||||
$other,
|
|
||||||
$id_group
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = db_process_sql($sql);
|
$result = db_process_sql($sql);
|
||||||
} else {
|
} else {
|
||||||
|
@ -405,7 +436,7 @@ if ($update_group) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete group
|
// Delete group.
|
||||||
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
|
|
||||||
|
@ -445,7 +476,14 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Credential store is loaded previously in this document to avoid
|
||||||
|
// process group tree - list forms.
|
||||||
if ($tab == 'tree') {
|
if ($tab == 'tree') {
|
||||||
|
/*
|
||||||
|
* Group tree view.
|
||||||
|
*/
|
||||||
|
|
||||||
echo html_print_image(
|
echo html_print_image(
|
||||||
'images/spinner.gif',
|
'images/spinner.gif',
|
||||||
true,
|
true,
|
||||||
|
@ -456,6 +494,10 @@ if ($tab == 'tree') {
|
||||||
);
|
);
|
||||||
echo "<div id='tree-controller-recipient'></div>";
|
echo "<div id='tree-controller-recipient'></div>";
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
* Group list view.
|
||||||
|
*/
|
||||||
|
|
||||||
$acl = '';
|
$acl = '';
|
||||||
$search_name = '';
|
$search_name = '';
|
||||||
$offset = (int) get_parameter('offset', 0);
|
$offset = (int) get_parameter('offset', 0);
|
||||||
|
@ -463,17 +505,22 @@ if ($tab == 'tree') {
|
||||||
$block_size = $config['block_size'];
|
$block_size = $config['block_size'];
|
||||||
|
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
$search_name = 'AND t.nombre LIKE "%'.$search.'%"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!users_can_manage_group_all('AR')) {
|
if (!users_can_manage_group_all('AR')) {
|
||||||
$user_groups_acl = users_get_groups(false, 'AR');
|
$user_groups_acl = users_get_groups(false, 'AR');
|
||||||
$groups_acl = implode(',', $user_groups_ACL);
|
$groups_acl = implode(',', $user_groups_ACL);
|
||||||
if (empty($groups_acl)) {
|
if (empty($groups_acl)) {
|
||||||
return ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);
|
return ui_print_info_message(
|
||||||
|
[
|
||||||
|
'no_close' => true,
|
||||||
|
'message' => __('There are no defined groups'),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
$acl = 'AND t.id_grupo IN ('.$groups_acl.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = "<form method='post' action=''>";
|
$form = "<form method='post' action=''>";
|
||||||
|
@ -488,42 +535,58 @@ if ($tab == 'tree') {
|
||||||
|
|
||||||
echo $form;
|
echo $form;
|
||||||
|
|
||||||
$groups_sql = "SELECT t.*,
|
$groups_sql = sprintf(
|
||||||
|
'SELECT t.*,
|
||||||
p.nombre AS parent_name,
|
p.nombre AS parent_name,
|
||||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||||
FROM tgrupo t
|
FROM tgrupo t
|
||||||
LEFT JOIN tgrupo p
|
LEFT JOIN tgrupo p
|
||||||
ON t.parent=p.id_grupo
|
ON t.parent=p.id_grupo
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
$acl
|
%s
|
||||||
$search_name
|
%s
|
||||||
ORDER BY nombre
|
ORDER BY nombre
|
||||||
LIMIT $offset, $block_size
|
LIMIT %d, %d',
|
||||||
";
|
$acl,
|
||||||
|
$search_name,
|
||||||
|
$offset,
|
||||||
|
$block_size
|
||||||
|
);
|
||||||
|
|
||||||
$groups = db_get_all_rows_sql($groups_sql);
|
$groups = db_get_all_rows_sql($groups_sql);
|
||||||
|
|
||||||
if (!empty($groups)) {
|
if (!empty($groups)) {
|
||||||
// Count all groups for pagination only saw user and filters
|
// Count all groups for pagination only saw user and filters.
|
||||||
$groups_sql_count = "SELECT count(*)
|
$groups_sql_count = sprintf(
|
||||||
|
'SELECT count(*)
|
||||||
FROM tgrupo t
|
FROM tgrupo t
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
$acl
|
%s
|
||||||
$search_name
|
%s',
|
||||||
";
|
$acl,
|
||||||
|
$search_name
|
||||||
|
);
|
||||||
$groups_count = db_get_value_sql($groups_sql_count);
|
$groups_count = db_get_value_sql($groups_sql_count);
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'info_table';
|
$table->class = 'info_table';
|
||||||
|
$table->headstyle = [];
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
$table->head[0] = __('ID');
|
$table->head[0] = __('ID');
|
||||||
|
$table->headstyle[0] = 'min-width: 100px;';
|
||||||
$table->head[1] = __('Name');
|
$table->head[1] = __('Name');
|
||||||
|
$table->headstyle[1] = 'min-width: 100px;';
|
||||||
$table->head[2] = __('Icon');
|
$table->head[2] = __('Icon');
|
||||||
|
$table->headstyle[2] = 'min-width: 100px;';
|
||||||
$table->head[3] = __('Alerts');
|
$table->head[3] = __('Alerts');
|
||||||
|
$table->headstyle[3] = 'min-width: 100px;';
|
||||||
$table->head[4] = __('Parent');
|
$table->head[4] = __('Parent');
|
||||||
|
$table->headstyle[4] = 'min-width: 100px;';
|
||||||
$table->head[5] = __('Description');
|
$table->head[5] = __('Description');
|
||||||
|
$table->headstyle[5] = 'min-width: 100px;';
|
||||||
$table->head[6] = __('Actions');
|
$table->head[6] = __('Actions');
|
||||||
|
$table->headstyle[6] = 'min-width: 100px;';
|
||||||
$table->align = [];
|
$table->align = [];
|
||||||
$table->align[0] = 'left';
|
$table->align[0] = 'left';
|
||||||
$table->align[2] = 'left';
|
$table->align[2] = 'left';
|
||||||
|
@ -537,7 +600,7 @@ if ($tab == 'tree') {
|
||||||
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
|
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
|
||||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||||
$table->data[$key][0] = $group['id_grupo'];
|
$table->data[$key][0] = $group['id_grupo'];
|
||||||
$table->data[$key][1] = "<a href='$url'>".$group['nombre'].'</a>';
|
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||||
if ($group['icon'] != '') {
|
if ($group['icon'] != '') {
|
||||||
$table->data[$key][2] = html_print_image(
|
$table->data[$key][2] = html_print_image(
|
||||||
'images/groups_small/'.$group['icon'].'.png',
|
'images/groups_small/'.$group['icon'].'.png',
|
||||||
|
@ -545,22 +608,25 @@ if ($tab == 'tree') {
|
||||||
[
|
[
|
||||||
'style' => '',
|
'style' => '',
|
||||||
'class' => 'bot',
|
'class' => 'bot',
|
||||||
'alt' => $group['nombre'],
|
'alt' => $group['nombre'],
|
||||||
'title' => $group['nombre'],
|
'title' => $group['nombre'],
|
||||||
false, false, false, true
|
],
|
||||||
]
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$table->data[$key][2] = '';
|
$table->data[$key][2] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// reporting_get_group_stats
|
// Reporting_get_group_stats.
|
||||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
$table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
|
||||||
$table->data[$key][4] = $group['parent_name'];
|
$table->data[$key][4] = $group['parent_name'];
|
||||||
$table->data[$key][5] = $group['description'];
|
$table->data[$key][5] = $group['description'];
|
||||||
$table->cellclass[$key][6] = 'action_buttons';
|
$table->cellclass[$key][6] = 'action_buttons';
|
||||||
$table->data[$key][6] = "<a href='$url'>".html_print_image(
|
$table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
|
||||||
'images/config.png',
|
'images/config.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
|
|
|
@ -215,7 +215,6 @@ $table->data[3][1] .= __('Number of alerts match from').' ';
|
||||||
$table->data[3][1] .= html_print_input_text('fires_min', 0, '', 4, 10, true);
|
$table->data[3][1] .= html_print_input_text('fires_min', 0, '', 4, 10, true);
|
||||||
$table->data[3][1] .= ' '.__('to').' ';
|
$table->data[3][1] .= ' '.__('to').' ';
|
||||||
$table->data[3][1] .= html_print_input_text('fires_max', 0, '', 4, 10, true);
|
$table->data[3][1] .= html_print_input_text('fires_max', 0, '', 4, 10, true);
|
||||||
$table->data[3][1] .= ui_print_help_icon('alert-matches', true);
|
|
||||||
$table->data[3][1] .= '</span>';
|
$table->data[3][1] .= '</span>';
|
||||||
|
|
||||||
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_action_alerts">';
|
echo '<form method="post" id="form_alerts" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_action_alerts">';
|
||||||
|
|
|
@ -84,7 +84,9 @@ if ($create_profiles) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($table);
|
if ($table !== null) {
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
unset($table);
|
unset($table);
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive
|
||||||
|
|
||||||
echo '<fieldset id="fieldset_source">';
|
echo '<fieldset id="fieldset_source">';
|
||||||
echo '<legend>';
|
echo '<legend>';
|
||||||
echo '<span>'.__('Source').ui_print_help_icon('manageconfig', true).'</span>';
|
echo '<span>'.__('Source');
|
||||||
echo '</legend>';
|
echo '</legend>';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
@ -177,6 +177,9 @@ $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, tru
|
||||||
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
|
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
|
||||||
$table->data['operations'][1] .= '</span>';
|
$table->data['operations'][1] .= '</span>';
|
||||||
|
|
||||||
|
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||||
|
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||||
|
|
||||||
$table->data[1][0] = __('Modules');
|
$table->data[1][0] = __('Modules');
|
||||||
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
|
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
|
||||||
$table->data[1][1] .= html_print_select(
|
$table->data[1][1] .= html_print_select(
|
||||||
|
@ -302,6 +305,8 @@ echo '<h3 class="error invisible" id="message"> </h3>';
|
||||||
ui_require_jquery_file('form');
|
ui_require_jquery_file('form');
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
var module_alerts;
|
var module_alerts;
|
||||||
|
@ -478,6 +483,9 @@ $(document).ready (function () {
|
||||||
}
|
}
|
||||||
$("#fieldset_targets").show ();
|
$("#fieldset_targets").show ();
|
||||||
$("#target_modules, #target_alerts").enable ();
|
$("#target_modules, #target_alerts").enable ();
|
||||||
|
//Filter modules. Call the function when the select is fully loaded.
|
||||||
|
var textNoData = "<?php echo __('None'); ?>";
|
||||||
|
filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,6 +31,7 @@ require_once $config['homedir'].'/include/functions_users.php';
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$get_agents = (bool) get_parameter('get_agents');
|
$get_agents = (bool) get_parameter('get_agents');
|
||||||
$recursion = (int) get_parameter('recursion');
|
$recursion = (int) get_parameter('recursion');
|
||||||
|
$disabled_modules = (int) get_parameter('disabled_modules');
|
||||||
|
|
||||||
if ($get_agents) {
|
if ($get_agents) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
|
@ -44,12 +45,18 @@ if (is_ajax()) {
|
||||||
$groups = [$id_group];
|
$groups = [$id_group];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled_modules == 0) {
|
||||||
|
$filter['tagente_modulo.disabled'] = '<> 1';
|
||||||
|
} else {
|
||||||
|
unset($filter['tagente_modulo.disabled']);
|
||||||
|
}
|
||||||
|
|
||||||
$agents_alerts = [];
|
$agents_alerts = [];
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$agents_alerts_one_group = alerts_get_agents_with_alert_template(
|
$agents_alerts_one_group = alerts_get_agents_with_alert_template(
|
||||||
$id_alert_template,
|
$id_alert_template,
|
||||||
$group,
|
$group,
|
||||||
false,
|
$filter,
|
||||||
[
|
[
|
||||||
'tagente.alias',
|
'tagente.alias',
|
||||||
'tagente.id_agente',
|
'tagente.id_agente',
|
||||||
|
@ -253,6 +260,11 @@ $table->data[1][1] = html_print_select_groups(
|
||||||
'',
|
'',
|
||||||
$id_alert_template == 0
|
$id_alert_template == 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table->data[0][2] = __('Show alerts on disabled modules');
|
||||||
|
$table->data[0][3] = html_print_checkbox('disabled_modules', 1, false, true, false);
|
||||||
|
|
||||||
|
|
||||||
$table->data[1][2] = __('Group recursion');
|
$table->data[1][2] = __('Group recursion');
|
||||||
$table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
|
$table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
|
||||||
|
|
||||||
|
@ -360,6 +372,7 @@ $(document).ready (function () {
|
||||||
"get_agents" : 1,
|
"get_agents" : 1,
|
||||||
"id_group" : this.value,
|
"id_group" : this.value,
|
||||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||||
|
"disabled_modules" : $("#checkbox-disabled_modules").is(":checked") ? 1 : 0,
|
||||||
"id_alert_template" : $("#id_alert_template").val(),
|
"id_alert_template" : $("#id_alert_template").val(),
|
||||||
// Add a key prefix to avoid auto sorting in js object conversion
|
// Add a key prefix to avoid auto sorting in js object conversion
|
||||||
"keys_prefix" : "_"
|
"keys_prefix" : "_"
|
||||||
|
@ -387,6 +400,10 @@ $(document).ready (function () {
|
||||||
$("#modules_selection_mode").change (function() {
|
$("#modules_selection_mode").change (function() {
|
||||||
$("#id_agents").trigger('change');
|
$("#id_agents").trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#checkbox-disabled_modules").click(function () {
|
||||||
|
$("#id_group").trigger("change");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
|
||||||
);
|
);
|
||||||
$table->data['form_modules_3'][3] = '';
|
$table->data['form_modules_3'][3] = '';
|
||||||
|
|
||||||
|
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
|
||||||
|
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
|
||||||
|
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||||
|
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||||
|
|
||||||
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
||||||
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
||||||
$table->data['form_modules_2'][0] = __('Modules');
|
$table->data['form_modules_2'][0] = __('Modules');
|
||||||
|
@ -571,6 +576,7 @@ if ($selection_mode == 'modules') {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
|
|
||||||
|
@ -650,6 +656,9 @@ $(document).ready (function () {
|
||||||
});
|
});
|
||||||
$("#module_loading").hide();
|
$("#module_loading").hide();
|
||||||
$("#module_name").removeAttr ("disabled");
|
$("#module_name").removeAttr ("disabled");
|
||||||
|
//Filter modules. Call the function when the select is fully loaded.
|
||||||
|
var textNoData = "<?php echo __('None'); ?>";
|
||||||
|
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
|
|
|
@ -92,7 +92,9 @@ if ($delete_profiles) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table($table);
|
if ($table !== null) {
|
||||||
|
html_print_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
unset($table);
|
unset($table);
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ $params['selectbox_id'] = 'cascade_protection_module';
|
||||||
$params['javascript_is_function_select'] = true;
|
$params['javascript_is_function_select'] = true;
|
||||||
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
|
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
|
||||||
|
|
||||||
$table->data[0][1] .= '<b>'.__('Cascade protection').'</b> '.ui_print_help_icon('cascade_protection', true).html_print_select(
|
$table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
|
||||||
[
|
[
|
||||||
1 => __('Yes'),
|
1 => __('Yes'),
|
||||||
0 => __('No'),
|
0 => __('No'),
|
||||||
|
@ -587,7 +587,7 @@ $table->data[0][0] = __('Custom ID');
|
||||||
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
|
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
|
||||||
|
|
||||||
// Learn mode / Normal mode
|
// Learn mode / Normal mode
|
||||||
$table->data[1][0] = __('Module definition').ui_print_help_icon('module_definition', true);
|
$table->data[1][0] = __('Module definition');
|
||||||
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[1][1] = __('No change').' '.html_print_radio_button_extended('mode', -1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[1][1] .= __('Learning mode').' '.html_print_radio_button_extended('mode', 1, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[1][1] .= __('Normal mode').' '.html_print_radio_button_extended('mode', 0, '', $mode, false, '', 'style="margin-right: 40px;"', true);
|
||||||
|
|
|
@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
|
||||||
|
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
|
||||||
|
$table->data['form_modules_filter'][0] = __('Filter Modules');
|
||||||
|
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
|
||||||
|
|
||||||
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
|
||||||
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
|
||||||
$table->data['form_modules_2'][0] = __('Modules');
|
$table->data['form_modules_2'][0] = __('Modules');
|
||||||
|
@ -695,7 +700,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data['edit3'][0] = __('Post process').ui_print_help_icon('postprocess', true);
|
$table->data['edit3'][0] = __('Post process');
|
||||||
|
|
||||||
$table->data['edit3'][1] = html_print_extended_select_for_post_process(
|
$table->data['edit3'][1] = html_print_extended_select_for_post_process(
|
||||||
'post_process',
|
'post_process',
|
||||||
|
@ -846,10 +851,6 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||||
|
|
||||||
// FF stands for Flip-flop.
|
// FF stands for Flip-flop.
|
||||||
$table->data['edit7'][0] = __('FF threshold').' ';
|
$table->data['edit7'][0] = __('FF threshold').' ';
|
||||||
$table->data['edit7'][0] .= ui_print_help_icon(
|
|
||||||
'ff_threshold',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->colspan['edit7'][1] = 3;
|
$table->colspan['edit7'][1] = 3;
|
||||||
$table->data['edit7'][1] = __('Mode').' ';
|
$table->data['edit7'][1] = __('Mode').' ';
|
||||||
|
@ -1060,26 +1061,26 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon('web_checks', true);
|
$table->data['edit22'][0] = __('Web checks');
|
||||||
;
|
;
|
||||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter_text" cols="65" rows="15"></textarea>';
|
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter_text" cols="65" rows="15"></textarea>';
|
||||||
|
|
||||||
$table->data['edit16'][2] = __('Port');
|
$table->data['edit16'][2] = __('Port');
|
||||||
$table->data['edit16'][3] = html_print_input_text('tcp_port', '', '', 5, 20, true);
|
$table->data['edit16'][3] = html_print_input_text('tcp_port', '', '', 5, 20, true);
|
||||||
|
|
||||||
$table->data['edit17'][0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true);
|
$table->data['edit17'][0] = __('TCP send');
|
||||||
$table->data['edit17'][1] = html_print_textarea('tcp_send2', 2, 65, '', '', true);
|
$table->data['edit17'][1] = html_print_textarea('tcp_send2', 2, 65, '', '', true);
|
||||||
|
|
||||||
$table->data['edit17'][2] = __('TCP receive');
|
$table->data['edit17'][2] = __('TCP receive');
|
||||||
$table->data['edit17'][3] = html_print_textarea('tcp_rcv', 2, 65, '', '', true);
|
$table->data['edit17'][3] = html_print_textarea('tcp_rcv', 2, 65, '', '', true);
|
||||||
|
|
||||||
$table->data['edit18'][0] = __('WMI query').ui_print_help_icon('wmiquery', true);
|
$table->data['edit18'][0] = __('WMI query');
|
||||||
$table->data['edit18'][1] = html_print_input_text('wmi_query', '', '', 35, 255, true);
|
$table->data['edit18'][1] = html_print_input_text('wmi_query', '', '', 35, 255, true);
|
||||||
|
|
||||||
$table->data['edit18'][2] = __('Key string');
|
$table->data['edit18'][2] = __('Key string');
|
||||||
$table->data['edit18'][3] = html_print_input_text('key_string', '', '', 20, 60, true);
|
$table->data['edit18'][3] = html_print_input_text('key_string', '', '', 20, 60, true);
|
||||||
|
|
||||||
$table->data['edit19'][0] = __('Field number').ui_print_help_icon('wmifield', true);
|
$table->data['edit19'][0] = __('Field number');
|
||||||
$table->data['edit19'][1] = html_print_input_text('field_number', '', '', 5, 15, true);
|
$table->data['edit19'][1] = html_print_input_text('field_number', '', '', 5, 15, true);
|
||||||
|
|
||||||
$table->data['edit20'][0] = __('Plugin').ui_print_help_icon('plugin_macros', true);
|
$table->data['edit20'][0] = __('Plugin').ui_print_help_icon('plugin_macros', true);
|
||||||
|
@ -1251,6 +1252,9 @@ $(document).ready (function () {
|
||||||
});
|
});
|
||||||
$("#module_loading").hide ();
|
$("#module_loading").hide ();
|
||||||
$("#module_name").removeAttr ("disabled");
|
$("#module_name").removeAttr ("disabled");
|
||||||
|
//Filter modules. Call the function when the select is fully loaded.
|
||||||
|
var textNoData = "<?php echo __('None'); ?>";
|
||||||
|
filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue