mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge remote-tracking branch 'origin/develop' into 2716-ue-plugin-modifications
This commit is contained in:
commit
7f093b29e3
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, AIX version
|
||||
# Version 7.0NG.728, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, FreeBSD Version
|
||||
# Version 7.0NG.728, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, HP-UX Version
|
||||
# Version 7.0NG.728, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, GNU/Linux
|
||||
# Version 7.0NG.728, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, GNU/Linux
|
||||
# Version 7.0NG.728, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, Solaris Version
|
||||
# Version 7.0NG.728, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
|
||||
# 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.726, AIX version
|
||||
# Version 7.0NG.728, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.726, HPUX Version
|
||||
# Version 7.0NG.728, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.726, Solaris version
|
||||
# Version 7.0NG.728, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, AIX version
|
||||
# Version 7.0NG.728, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -87,6 +87,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.726-180903
|
||||
Version: 7.0NG.728-181031
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.726-180903"
|
||||
pandora_version="7.0NG.728-181031"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, GNU/Linux
|
||||
# Version 7.0NG.728, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -117,6 +117,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, FreeBSD Version
|
||||
# Version 7.0NG.728, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -130,6 +130,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, HP-UX Version
|
||||
# Version 7.0NG.728, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -89,6 +89,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, GNU/Linux
|
||||
# Version 7.0NG.728, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -136,6 +136,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, GNU/Linux
|
||||
# Version 7.0NG.728, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -41,9 +41,9 @@ udp_server_auth_address 0.0.0.0
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
#group Servers
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Autotime: Enforce to server to ignore timestamp coming from this
|
||||
# agent, used when agents has no timer or it's inestable. 1 to enable
|
||||
@ -102,6 +102,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, NetBSD Version
|
||||
# Version 7.0NG.728, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -98,6 +98,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.726, Solaris Version
|
||||
# Version 7.0NG.728, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
@ -92,6 +92,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.726';
|
||||
use constant AGENT_BUILD => '180903';
|
||||
use constant AGENT_VERSION => '7.0NG.728';
|
||||
use constant AGENT_BUILD => '181031';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -186,6 +186,7 @@ my %DefaultConf = (
|
||||
'xml_buffer' => 0,
|
||||
'custom_id' => '',
|
||||
'url_address' => '',
|
||||
'standby' => 0,
|
||||
);
|
||||
my %Conf = %DefaultConf;
|
||||
|
||||
@ -1333,6 +1334,41 @@ sub check_collections () {
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Sleep function
|
||||
################################################################################
|
||||
sub sleep_agent {
|
||||
my ($main_agent, $iter_base_time) = @_;
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
exit (0) if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
return $iter_base_time;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Return the MD5 checksum of the given string as a hex string.
|
||||
# Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode
|
||||
@ -2959,6 +2995,12 @@ while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
# Do not report to server if standby mode is enabled
|
||||
if ($Conf{'standby'} eq '1' && $Conf{'debug'} ne '1') {
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
next;
|
||||
}
|
||||
|
||||
my $address;
|
||||
|
||||
if(defined($Conf{'address'})) {
|
||||
@ -3161,31 +3203,8 @@ while (1) {
|
||||
$SIG{'INT'} = \&udp_server_signal;
|
||||
}
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
last if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
# Sleep agent function
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
}
|
||||
|
||||
__END__
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.726
|
||||
%define release 180903
|
||||
%define version 7.0NG.728
|
||||
%define release 181031
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog)
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
@ -95,7 +95,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
mkdir -p /etc/pandora/collections
|
||||
fi
|
||||
|
||||
mkdir -p /var/spool/pandora/data_out
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.726
|
||||
%define release 180903
|
||||
%define version 7.0NG.728
|
||||
%define release 181031
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -88,7 +88,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
||||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
mkdir /etc/pandora/collections
|
||||
fi
|
||||
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.726"
|
||||
PI_BUILD="180903"
|
||||
PI_VERSION="7.0NG.728"
|
||||
PI_BUILD="181031"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
@ -388,8 +388,8 @@ install () {
|
||||
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
cp -r collections $PANDORA_BASE$PANDORA_HOME
|
||||
echo "Creating the collections directory in to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
mkdir -p $PANDORA_BASE$PANDORA_HOME/collections
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.726
|
||||
# Version 7.0NG.728
|
||||
|
||||
# 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
|
||||
@ -82,6 +82,9 @@ server_port 41121
|
||||
# Debug mode renames XML in the temp folder and continues running
|
||||
# debug 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here.
|
||||
#encoding ISO-8859-1
|
||||
|
||||
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.726}
|
||||
{Pandora FMS Windows Agent v7.0NG.728}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{180903}
|
||||
{181031}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -227,7 +227,7 @@ int Cron::getResetValue (int position) {
|
||||
* @return false if should not execute
|
||||
*/
|
||||
bool Cron::shouldExecuteAt (time_t date) {
|
||||
return this->utimestamp < date;
|
||||
return this->utimestamp <= date;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ using namespace Pandora;
|
||||
*/
|
||||
Pandora_Data::Pandora_Data (string value) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = pandora_data_unknown_source;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
|
||||
*/
|
||||
Pandora_Data::Pandora_Data (string value, string data_origin) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = data_origin;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time, string data_o
|
||||
*/
|
||||
Pandora_Data::Pandora_Data () {
|
||||
this->value = "";
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = "";
|
||||
}
|
||||
|
||||
|
@ -67,16 +67,16 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
|
||||
|
||||
// Set the type filter
|
||||
int type_number = -1;
|
||||
if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = EVENTLOG_ERROR_TYPE;
|
||||
if (upper_type.compare("CRITICAL") == 0) {
|
||||
type_number = WINEVENT_LEVEL_CRITICAL;
|
||||
} else if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = WINEVENT_LEVEL_ERROR;
|
||||
} else if (upper_type.compare("WARNING") == 0) {
|
||||
type_number = EVENTLOG_WARNING_TYPE;
|
||||
} else if (upper_type.compare("INFORMATION") == 0) {
|
||||
type_number = EVENTLOG_INFORMATION_TYPE;
|
||||
} else if (upper_type.compare("AUDIT SUCCESS") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_SUCCESS;
|
||||
} else if (upper_type.compare("AUDIT FAILURE") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_FAILURE;
|
||||
type_number = WINEVENT_LEVEL_WARNING;
|
||||
} else if (upper_type.compare("INFO") == 0) {
|
||||
type_number = WINEVENT_LEVEL_INFO;
|
||||
} else if (upper_type.compare("VERBOSE") == 0) {
|
||||
type_number = WINEVENT_LEVEL_VERBOSE;
|
||||
}
|
||||
// Append type to log query
|
||||
if (type_number != -1) {
|
||||
|
@ -29,6 +29,13 @@
|
||||
// Log event read buffer size
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
// WINEVENT consts
|
||||
#define WINEVENT_LEVEL_CRITICAL 1
|
||||
#define WINEVENT_LEVEL_ERROR 2
|
||||
#define WINEVENT_LEVEL_WARNING 3
|
||||
#define WINEVENT_LEVEL_INFO 4
|
||||
#define WINEVENT_LEVEL_VERBOSE 5
|
||||
|
||||
// Types for pointers to Wevtapi.dll functions
|
||||
typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags);
|
||||
typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned);
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.726(Build 180903)")
|
||||
#define PANDORA_VERSION ("7.0NG.728(Build 181031)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -1869,7 +1869,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
||||
|
||||
server_addr = conf->getValue ("server_ip");
|
||||
|
||||
if (this->broker_modules != NULL) {
|
||||
if (this->broker_modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->broker_modules->goFirst ();
|
||||
|
||||
while (! this->broker_modules->isLast ()) {
|
||||
@ -1937,7 +1937,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
||||
}
|
||||
}
|
||||
|
||||
if (data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
@ -1997,7 +1997,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
||||
|
||||
execution_number++;
|
||||
|
||||
if (this->modules != NULL) {
|
||||
if (this->modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->modules->goFirst ();
|
||||
|
||||
while (! this->modules->isLast ()) {
|
||||
@ -2057,7 +2057,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
||||
}
|
||||
}
|
||||
|
||||
if (forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.726(Build 180903))"
|
||||
VALUE "ProductVersion", "(7.0NG.728(Build 181031))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.726-180903
|
||||
Version: 7.0NG.728-181031
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Artica ST <deptec@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | php5-ldap, mysql-client | virtual-mysql-client
|
||||
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc
|
||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.726-180903"
|
||||
pandora_version="7.0NG.728-181031"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -77,15 +77,6 @@ $isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK)
|
||||
$config["relative_path"] = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));
|
||||
|
||||
// Load user language
|
||||
$user_language = get_user_language ($config['id_user']);
|
||||
|
||||
$l10n = NULL;
|
||||
if (file_exists ('./include/languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
if (isset($config['metaconsole'])) {
|
||||
// Not cool way of know if we are executing from metaconsole or normal console
|
||||
if ($config['metaconsole'])
|
||||
|
3
pandora_console/attachment/.htaccess
Normal file
3
pandora_console/attachment/.htaccess
Normal file
@ -0,0 +1,3 @@
|
||||
Order deny,allow
|
||||
Deny from All
|
||||
Allow from localhost
|
14
pandora_console/composer.json
Normal file
14
pandora_console/composer.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "Pandora FMS",
|
||||
"description": "Pandora Flexible Monitoring System ",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Artica",
|
||||
"email": "info@artica.es"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"mpdf/mpdf": "^7.1",
|
||||
"swiftmailer/swiftmailer": "^6.0"
|
||||
}
|
||||
}
|
442
pandora_console/composer.lock
generated
Normal file
442
pandora_console/composer.lock
generated
Normal file
@ -0,0 +1,442 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "18364e5cd8c79657279985942190b4a7",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/lexer.git",
|
||||
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Common\\Lexer\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"lexer",
|
||||
"parser"
|
||||
],
|
||||
"time": "2014-09-09T13:34:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "egulias/email-validator",
|
||||
"version": "2.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/egulias/EmailValidator.git",
|
||||
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/lexer": "^1.0.1",
|
||||
"php": ">= 5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"dominicsayers/isemail": "dev-master",
|
||||
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
|
||||
"satooshi/php-coveralls": "^1.0.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Egulias\\EmailValidator\\": "EmailValidator"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Eduardo Gulias Davis"
|
||||
}
|
||||
],
|
||||
"description": "A library for validating emails against several RFCs",
|
||||
"homepage": "https://github.com/egulias/EmailValidator",
|
||||
"keywords": [
|
||||
"email",
|
||||
"emailvalidation",
|
||||
"emailvalidator",
|
||||
"validation",
|
||||
"validator"
|
||||
],
|
||||
"time": "2018-09-25T20:47:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v7.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"myclabs/deep-copy": "^1.7",
|
||||
"paragonie/random_compat": "^1.4|^2.0|9.99.99",
|
||||
"php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0",
|
||||
"psr/log": "^1.0",
|
||||
"setasign/fpdi": "1.6.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.5",
|
||||
"phpunit/phpunit": "^5.0",
|
||||
"squizlabs/php_codesniffer": "^2.7.0",
|
||||
"tracy/tracy": "^2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "Needed for generation of some types of barcodes",
|
||||
"ext-xml": "Needed mainly for SVG manipulation",
|
||||
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-development": "7.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mpdf\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Matěj Humpál",
|
||||
"role": "Developer, maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Ian Back",
|
||||
"role": "Developer (retired)"
|
||||
}
|
||||
],
|
||||
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||
"homepage": "https://mpdf.github.io",
|
||||
"keywords": [
|
||||
"pdf",
|
||||
"php",
|
||||
"utf-8"
|
||||
],
|
||||
"time": "2018-09-19T09:58:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/common": "^2.6",
|
||||
"phpunit/phpunit": "^4.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
},
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2017-10-19T19:58:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.99",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2018-07-02T15:55:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
"version": "1.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Setasign/FPDI.git",
|
||||
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"suggest": {
|
||||
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
|
||||
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
|
||||
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"filters/",
|
||||
"fpdi.php",
|
||||
"fpdf_tpl.php",
|
||||
"fpdi_pdf_parser.php",
|
||||
"pdf_context.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Slabon",
|
||||
"email": "jan.slabon@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
}
|
||||
],
|
||||
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||
"homepage": "https://www.setasign.com/fpdi",
|
||||
"keywords": [
|
||||
"fpdf",
|
||||
"fpdi",
|
||||
"pdf"
|
||||
],
|
||||
"time": "2017-05-11T14:25:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
"version": "v6.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/swiftmailer/swiftmailer.git",
|
||||
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"egulias/email-validator": "~2.0",
|
||||
"php": ">=7.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9.1",
|
||||
"symfony/phpunit-bridge": "~3.3@dev"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "Needed to support internationalized email addresses",
|
||||
"true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.1-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"lib/swift_required.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Chris Corbyn"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Swiftmailer, free feature-rich PHP mailer",
|
||||
"homepage": "https://swiftmailer.symfony.com",
|
||||
"keywords": [
|
||||
"email",
|
||||
"mail",
|
||||
"mailer"
|
||||
],
|
||||
"time": "2018-09-11T07:12:52+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
@ -472,7 +472,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
|
||||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
@ -70,7 +70,7 @@ function mainAgentsModules() {
|
||||
$hor_offset = (int)get_parameter('hor_offset', 0);
|
||||
$block = $config['block_size'];
|
||||
if(get_parameter('modulegroup') != null){
|
||||
$agents_id = (array)get_parameter('id_agents2', -1);
|
||||
$agents_id = (array)get_parameter('id_agents2', null);
|
||||
}
|
||||
$selection_a_m = (int)get_parameter('selection_agent_module');
|
||||
$modules_selected = (array)get_parameter('module', 0);
|
||||
@ -100,6 +100,9 @@ function mainAgentsModules() {
|
||||
if($agents_id[0] != -1 ){
|
||||
serialize_in_temp($agents_id, $config['id_user']."_agents", 1);
|
||||
}
|
||||
|
||||
|
||||
//if($agents_id != -1) $agents_id = null;
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
if($modules_selected[0] && $agents_id[0]){
|
||||
@ -132,8 +135,6 @@ function mainAgentsModules() {
|
||||
}
|
||||
}
|
||||
|
||||
$groups = users_get_groups ();
|
||||
|
||||
//groups
|
||||
$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;');
|
||||
@ -144,18 +145,7 @@ function mainAgentsModules() {
|
||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
||||
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
|
||||
'modulegroup', $modulegroup, '',__('All'), 0, true, false, true, false, 'width: auto;');
|
||||
|
||||
$agents_select = array();
|
||||
if (is_array($id_agents) || is_object($id_agents)){
|
||||
foreach ($id_agents as $id) {
|
||||
foreach ($agents as $key => $a) {
|
||||
if ($key == (int)$id) {
|
||||
$agents_select[$key] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//agent
|
||||
$agents = agents_get_group_agents($group_id);
|
||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||
@ -293,6 +283,7 @@ function mainAgentsModules() {
|
||||
|
||||
$count = 0;
|
||||
foreach ($agents as $agent) {
|
||||
// TODO TAGS agents_get_modules
|
||||
$module = agents_get_modules($agent, false,
|
||||
$filter_module_group, true, true);
|
||||
if ($module == false) {
|
||||
@ -301,7 +292,6 @@ function mainAgentsModules() {
|
||||
$count++;
|
||||
}
|
||||
$total_pagination = count($agents);
|
||||
|
||||
if($agents_id[0] != -1){
|
||||
$all_modules = array();
|
||||
foreach ($modules_selected as $key => $value) {
|
||||
@ -332,11 +322,11 @@ function mainAgentsModules() {
|
||||
foreach ($result_sql as $key => $value) {
|
||||
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
|
||||
}
|
||||
}
|
||||
// $all_modules[$value] = modules_get_agentmodule_name($value);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// TODO TAGS agents_get_modules
|
||||
$all_modules = agents_get_modules($agents, false,
|
||||
$filter_module_group, true, true);
|
||||
}
|
||||
@ -346,7 +336,6 @@ function mainAgentsModules() {
|
||||
$modules_by_name = array();
|
||||
$name = '';
|
||||
$cont = 0;
|
||||
|
||||
foreach ($all_modules as $key => $module) {
|
||||
if ($module == $name) {
|
||||
$modules_by_name[$cont-1]['id'][] = $key;
|
||||
@ -358,7 +347,6 @@ function mainAgentsModules() {
|
||||
$cont ++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($config["pure"] == 1) {
|
||||
$block = count($modules_by_name);
|
||||
}
|
||||
@ -381,7 +369,10 @@ function mainAgentsModules() {
|
||||
$filter_groups['id_grupo'] = $group_id;
|
||||
}
|
||||
}
|
||||
$agents = agents_get_agents ($filter_groups);
|
||||
|
||||
if (!empty($filter_groups['id_agente'])) {
|
||||
$agents = agents_get_agents ($filter_groups);
|
||||
}
|
||||
$nagents = count($agents);
|
||||
|
||||
if ($all_modules == false || $agents == false) {
|
||||
@ -499,10 +490,10 @@ function mainAgentsModules() {
|
||||
<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
|
||||
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
|
||||
|
||||
$nmodules = 0;
|
||||
|
||||
foreach ($modules_by_name as $module) {
|
||||
$nmodules++;
|
||||
|
||||
|
@ -14,52 +14,35 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/*
|
||||
function extension_db_status_extension_tables() {
|
||||
return array(
|
||||
'tbackup',
|
||||
'tfiles_repo',
|
||||
'tfiles_repo_group',
|
||||
'tipam_ip',
|
||||
'tipam_network',
|
||||
'tuser_task',
|
||||
'tuser_task_scheduled',
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
function extension_db_status() {
|
||||
global $config;
|
||||
|
||||
|
||||
$db_user = get_parameter('db_user', '');
|
||||
$db_password = get_parameter('db_password', '');
|
||||
$db_host = get_parameter('db_host', '');
|
||||
$db_name = get_parameter('db_name', '');
|
||||
$db_status_execute = (bool)get_parameter('db_status_execute', false);
|
||||
|
||||
|
||||
|
||||
ui_print_page_header (__("DB Schema check"),
|
||||
"images/extensions.png", false, "", true, "");
|
||||
|
||||
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access db status");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui_print_info_message(
|
||||
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
|
||||
ui_print_info_message(
|
||||
__('At the moment the checks is for MySQL/MariaDB.'));
|
||||
|
||||
|
||||
echo "<form method='post'>";
|
||||
|
||||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('DB settings') . "</legend>";
|
||||
$table = null;
|
||||
$table = new stdClass();
|
||||
$table->data = array();
|
||||
$row = array();
|
||||
$row[] = __("DB User with privileges");
|
||||
@ -75,175 +58,263 @@ function extension_db_status() {
|
||||
$table->data[] = $row;
|
||||
html_print_table($table);
|
||||
echo "</fieldset>";
|
||||
|
||||
|
||||
echo "<div style='text-align: right;'>";
|
||||
html_print_input_hidden('db_status_execute', 1);
|
||||
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
|
||||
echo "</div>";
|
||||
|
||||
|
||||
echo "</form>";
|
||||
|
||||
|
||||
if ($db_status_execute) {
|
||||
extension_db_status_execute_checks($db_user, $db_password,
|
||||
$db_host, $db_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
|
||||
global $config;
|
||||
|
||||
|
||||
$connection_system = $config['dbconnection'];
|
||||
|
||||
|
||||
// Avoid SQL injection
|
||||
$db_name = io_safe_output($db_name);
|
||||
$db_name = str_replace(';', ' ', $db_name);
|
||||
$db_name = explode(" ", $db_name);
|
||||
$db_name = $db_name[0];
|
||||
|
||||
$connection_test = mysql_connect ($db_host, $db_user, $db_password);
|
||||
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
$connection_test = mysqli_connect($db_host, $db_user, $db_password);
|
||||
}
|
||||
else{
|
||||
$connection_test = mysql_connect($db_host, $db_user, $db_password);
|
||||
}
|
||||
|
||||
if (!$connection_test) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful connected to the DB'));
|
||||
}
|
||||
else {
|
||||
$create_db = mysql_query ("CREATE DATABASE `$db_name`");
|
||||
|
||||
if($config["mysqli"] === true){
|
||||
$create_db = mysqli_query($connection_test, "CREATE DATABASE `$db_name`");
|
||||
}else{
|
||||
$create_db = mysql_query("CREATE DATABASE `$db_name`");
|
||||
}
|
||||
|
||||
if (!$create_db) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful created the testing DB'));
|
||||
}
|
||||
else {
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
}
|
||||
|
||||
$install_tables = extension_db_status_execute_sql_file(
|
||||
$config['homedir'] . "/pandoradb.sql",
|
||||
$connection_test);
|
||||
|
||||
|
||||
if (!$install_tables) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful installed tables into the testing DB'));
|
||||
}
|
||||
else {/*
|
||||
if (enterprise_installed()) {
|
||||
$install_tables_enterprise =
|
||||
extension_db_status_execute_sql_file(
|
||||
$config['homedir'] . "/enterprise/pandoradb.sql",
|
||||
$connection_test);
|
||||
|
||||
if (!$install_tables_enterprise) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful installed enterprise tables into the testing DB'));
|
||||
}
|
||||
}
|
||||
*/
|
||||
else {
|
||||
extension_db_check_tables_differences(
|
||||
$connection_test,
|
||||
$connection_system,
|
||||
$db_name,
|
||||
$config['dbname']);
|
||||
//extension_db_check_data_differences();
|
||||
}
|
||||
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
mysql_query ("DROP DATABASE IF EXISTS `$db_name`");
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name);
|
||||
mysqli_query($connection_test, "DROP DATABASE IF EXISTS `$db_name`");
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
mysql_query("DROP DATABASE IF EXISTS `$db_name`", $connection_test);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function extension_db_check_tables_differences($connection_test,
|
||||
$connection_system, $db_name_test, $db_name_system) {
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
|
||||
// --------- Check the tables --------------------------------------
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "SHOW TABLES");
|
||||
}else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
}
|
||||
|
||||
$tables_test = array();
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$tables_test[] = $row[0];
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$tables_test[] = $row[0];
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
|
||||
mysqli_select_db($connection_test, $db_name_system);
|
||||
|
||||
$result = mysqli_query( $connection_test, "SHOW TABLES");
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
//~ $tables_test = array_merge($tables_test,
|
||||
//~ extension_db_status_extension_tables());
|
||||
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
else{
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$tables_test[] = $row[0];
|
||||
}
|
||||
mysql_free_result($result);
|
||||
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
}
|
||||
|
||||
$tables_system = array();
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$tables_system[] = $row[0];
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$tables_system[] = $row[0];
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$tables_system[] = $row[0];
|
||||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
$diff_tables = array_diff($tables_test, $tables_system);
|
||||
|
||||
|
||||
ui_print_result_message(
|
||||
!empty($diff_tables),
|
||||
__('Success! %s DB contains all tables', get_product_name()),
|
||||
__('%s DB could not retrieve all tables. The missing tables are (%s)',
|
||||
get_product_name(), implode(", ", $diff_tables)));
|
||||
|
||||
|
||||
if (!empty($diff_tables)) {
|
||||
foreach ($diff_tables as $table) {
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
|
||||
$tables_test = array();
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
$row[1] .
|
||||
'</pre>'
|
||||
);
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "SHOW CREATE TABLE " . $table);
|
||||
$tables_test = array();
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
$row[1] .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
|
||||
$tables_test = array();
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
$row[1] .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------- Check the fields -------------------------------
|
||||
$correct_fields = true;
|
||||
|
||||
|
||||
foreach ($tables_system as $table) {
|
||||
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
}
|
||||
|
||||
$fields_test = array();
|
||||
if (!empty($result)) {
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$fields_test[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$fields_test[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysqli_free_result ($result);
|
||||
mysqli_select_db($connection_test, $db_name_system);
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$fields_test[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
|
||||
if($config["mysqli"] === true){
|
||||
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||
}
|
||||
else{
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
}
|
||||
|
||||
$fields_system = array();
|
||||
if (!empty($result)) {
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
foreach ($fields_test as $name_field => $field_test) {
|
||||
if (!isset($fields_system[$name_field])) {
|
||||
$correct_fields = false;
|
||||
|
||||
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the table %s has not the field %s',
|
||||
$table, $name_field));
|
||||
@ -257,63 +328,59 @@ function extension_db_check_tables_differences($connection_test,
|
||||
else {
|
||||
$correct_fields = false;
|
||||
$field_system = $fields_system[$name_field];
|
||||
|
||||
|
||||
$diff = array_diff($field_test, $field_system);
|
||||
|
||||
|
||||
if (!empty($diff)) {
|
||||
$info_message = "";
|
||||
$error_message = "";
|
||||
if($diff['type']){
|
||||
$error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."<br>";
|
||||
}
|
||||
|
||||
|
||||
if($diff['null']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").<br>";
|
||||
}
|
||||
|
||||
|
||||
if($diff['default']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.<br>";
|
||||
}
|
||||
|
||||
|
||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||
$null_defect = " NULL";
|
||||
}
|
||||
else{
|
||||
$null_defect = " NOT NULL";
|
||||
}
|
||||
|
||||
|
||||
if(!isset($field_test['default']) || $field_test['default'] == ""){
|
||||
$default_value = "";
|
||||
}
|
||||
else{
|
||||
$default_value = " DEFAULT ".$field_test['default'];
|
||||
}
|
||||
|
||||
|
||||
if($diff['type'] || $diff['null'] || $diff['default']){
|
||||
$info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";";
|
||||
}
|
||||
|
||||
|
||||
if($diff['key']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of key needed.";
|
||||
}
|
||||
|
||||
if($diff['extra']){
|
||||
|
||||
if($diff['extra']){
|
||||
$error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.<br>";
|
||||
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
||||
}
|
||||
|
||||
ui_print_error_message(
|
||||
__($error_message));
|
||||
|
||||
ui_print_info_message(
|
||||
__($info_message));
|
||||
|
||||
|
||||
ui_print_error_message(__($error_message));
|
||||
|
||||
ui_print_info_message(__($info_message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($correct_fields) {
|
||||
ui_print_success_message(
|
||||
__('Successful all the tables have the correct fields')
|
||||
@ -322,6 +389,7 @@ function extension_db_check_tables_differences($connection_test,
|
||||
}
|
||||
|
||||
function extension_db_status_execute_sql_file($url, $connection) {
|
||||
global $config;
|
||||
if (file_exists($url)) {
|
||||
$file_content = file($url);
|
||||
$query = "";
|
||||
@ -329,10 +397,19 @@ function extension_db_status_execute_sql_file($url, $connection) {
|
||||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
||||
$query .= $sql_line;
|
||||
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
||||
if (!$result = mysql_query($query, $connection)) {
|
||||
echo mysql_error(); //Uncomment for debug
|
||||
echo "<i><br>$query<br></i>";
|
||||
return 0;
|
||||
if ($config["mysqli"] === true) {
|
||||
if (!$result = mysqli_query($connection, $query)) {
|
||||
echo mysqli_error(); //Uncomment for debug
|
||||
echo "<i><br>$query<br></i>";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (!$result = mysql_query($query, $connection)) {
|
||||
echo mysql_error(); //Uncomment for debug
|
||||
echo "<i><br>$query<br></i>";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$query = "";
|
||||
}
|
||||
|
@ -16,123 +16,80 @@
|
||||
|
||||
function dbmanager_query ($sql, &$error, $dbconnection) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
return false;
|
||||
|
||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
||||
if ($config["mysqli"]) {
|
||||
$result = mysqli_query ($dbconnection, $sql);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
$error = mysqli_error ($dbconnection);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$result = mysql_query ($sql, $dbconnection);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
$error = mysql_error ();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === true) {
|
||||
if($config["mysqli"]){
|
||||
return mysqli_affected_rows ($dbconnection);
|
||||
}
|
||||
else{
|
||||
return mysql_affected_rows ();
|
||||
}
|
||||
}
|
||||
|
||||
if($config["mysqli"]){
|
||||
while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
}
|
||||
|
||||
if($config["mysqli"]){
|
||||
mysqli_free_result ($result);
|
||||
}
|
||||
else{
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
|
||||
if (! empty ($retval))
|
||||
return $retval;
|
||||
|
||||
//Return false, check with === or !==
|
||||
return "Empty";
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
return false;
|
||||
|
||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
||||
|
||||
$result = db_process_sql($sql, "affected_rows", '', false, $status);
|
||||
|
||||
//$result = mysql_query ($sql);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace();
|
||||
$error = db_get_last_error();
|
||||
|
||||
if (empty($error)) {
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($status == 2) {
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
return false;
|
||||
|
||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
||||
if ($config["mysqli"]) {
|
||||
$result = mysqli_query ($dbconnection, $sql);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
$error = mysqli_error ($dbconnection);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$result = mysql_query ($sql, $dbconnection);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
$error = mysql_error ();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === true) {
|
||||
if($config["mysqli"]){
|
||||
return mysqli_affected_rows ($dbconnection);
|
||||
}
|
||||
else{
|
||||
return mysql_affected_rows ();
|
||||
}
|
||||
}
|
||||
|
||||
if($config["mysqli"]){
|
||||
while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
}
|
||||
|
||||
if($config["mysqli"]){
|
||||
mysqli_free_result ($result);
|
||||
}
|
||||
else{
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
|
||||
if (! empty ($retval))
|
||||
return $retval;
|
||||
|
||||
//Return false, check with === or !==
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
|
||||
function dbmgr_extension_main () {
|
||||
ui_require_css_file ('dbmanager', 'extensions/dbmanager/');
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabled at the moment.
|
||||
if (!check_referer()) {
|
||||
require ("general/noaccess.php");
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$sql = (string) get_parameter ('sql');
|
||||
|
||||
|
||||
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
|
||||
|
||||
|
||||
echo '<div class="notify">';
|
||||
echo __("This is an advanced extension to interface with %s database directly from WEB console
|
||||
using native SQL sentences. Please note that <b>you can damage</b> your %s installation
|
||||
@ -142,10 +99,10 @@ function dbmgr_extension_main () {
|
||||
with a depth knowledge of %s internals.",
|
||||
get_product_name(), get_product_name(), get_product_name());
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo "<br />";
|
||||
echo "Some samples of usage: <blockquote><em>SHOW STATUS;<br />DESCRIBE tagente<br />SELECT * FROM tserver<br />UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</em></blockquote>";
|
||||
|
||||
|
||||
echo "<br /><br />";
|
||||
echo "<form method='post' action=''>";
|
||||
html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES));
|
||||
@ -155,45 +112,45 @@ function dbmgr_extension_main () {
|
||||
html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo "</form>";
|
||||
|
||||
|
||||
// Processing SQL Code
|
||||
if ($sql == '')
|
||||
return;
|
||||
|
||||
|
||||
echo "<br />";
|
||||
echo "<hr />";
|
||||
echo "<br />";
|
||||
|
||||
|
||||
$dbconnection = $config['dbconnection'];
|
||||
$error = '';
|
||||
|
||||
|
||||
$result = dbmanager_query ($sql, $error, $dbconnection);
|
||||
|
||||
|
||||
if ($result === false) {
|
||||
echo '<strong>An error has occured when querying the database.</strong><br />';
|
||||
echo $error;
|
||||
|
||||
|
||||
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (! is_array ($result)) {
|
||||
echo "<strong>Output: <strong>".$result;
|
||||
|
||||
|
||||
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
echo "<div style='overflow: auto;'>";
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->head = array_keys ($result[0]);
|
||||
|
||||
|
||||
$table->data = $result;
|
||||
|
||||
|
||||
html_print_table ($table);
|
||||
echo "</div>";
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
|
||||
$data
|
||||
);
|
||||
|
||||
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
|
||||
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data";
|
||||
return (bool) @file_put_contents($file_name, $xml);
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ function mainInsertData() {
|
||||
$utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
|
||||
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
|
||||
$result = createXMLData($agent, $agentModule, $timestamp, $data);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$done++;
|
||||
}
|
||||
|
@ -32,26 +32,17 @@ if (is_ajax()) {
|
||||
$limit = (int) get_parameter("limit", 5);
|
||||
|
||||
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
||||
$filter = "estado<>1 $tags_condition";
|
||||
|
||||
$filter = "estado <> 1 $tags_condition";
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT id_agente, evento, utimestamp
|
||||
FROM tevento
|
||||
WHERE %s
|
||||
ORDER BY utimestamp DESC LIMIT %d",
|
||||
$filter, $limit);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("SELECT *
|
||||
FROM tevento
|
||||
WHERE %s
|
||||
AND rownum <= %d
|
||||
ORDER BY utimestamp DESC",
|
||||
$filter, $limit);
|
||||
break;
|
||||
}
|
||||
$sql = sprintf ("SELECT id_agente, evento, utimestamp
|
||||
FROM tevento
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tevento.id_agente = tagent_secondary_group.id_agent
|
||||
WHERE %s
|
||||
ORDER BY utimestamp DESC LIMIT %d",
|
||||
$filter, $limit);
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
$events = array();
|
||||
|
@ -17,103 +17,21 @@
|
||||
|
||||
global $config;
|
||||
|
||||
if (is_ajax ()) {
|
||||
check_login ();
|
||||
|
||||
require_once('include/functions_agents.php');
|
||||
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
$module_group = (int)get_parameter('module_group');
|
||||
$id_agent_group = (int)get_parameter('id_agent_group');
|
||||
|
||||
$data = false;
|
||||
if ($get_info_alert_module_group) {
|
||||
$agents = agents_get_group_agents($id_agent_group);
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
if ($module_group == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$data = true;
|
||||
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
|
||||
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
|
||||
echo '<strong>' . __('Agent').': </strong>';
|
||||
echo io_safe_output($agent['nombre']) . '<br />';
|
||||
echo '<strong>' . __('Module') . ': </strong>';
|
||||
echo io_safe_output($module['nombre']) . '<br />';
|
||||
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
|
||||
echo '<strong>' . __('Alert template') . ': </strong>';
|
||||
echo io_safe_output($template['name']) . '<br />';
|
||||
|
||||
// This prevent from templates without predefined actions
|
||||
if (empty($template['id_alert_action']))
|
||||
$template_id_alert_action = "''";
|
||||
else
|
||||
$template_id_alert_action = $template['id_alert_action'];
|
||||
|
||||
// True if the alert only has the default template action
|
||||
$default_action = false;
|
||||
// Try to get actions for the current alert
|
||||
$sql = 'SELECT t2.name
|
||||
FROM talert_template_module_actions t1
|
||||
INNER JOIN talert_actions t2
|
||||
INNER JOIN talert_template_modules t3
|
||||
ON t3.id = t1.id_alert_template_module
|
||||
AND t1.id_alert_action = t2.id
|
||||
WHERE (t3.id_alert_template = ' . $template['id'] . ' AND
|
||||
t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
|
||||
// If this alert doesn't have actions try to get default action from template
|
||||
if ($actions === false) {
|
||||
$sql = 'SELECT name
|
||||
FROM talert_actions
|
||||
WHERE (id = ' . $template_id_alert_action . ');';
|
||||
|
||||
$default_action = true;
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
if ($actions === false) {
|
||||
$actions = array();
|
||||
}
|
||||
|
||||
echo '<strong>' . __('Actions') . ': </strong>' . '<br />';
|
||||
echo '<ul style="margin-top: 0px; margin-left: 30px;">';
|
||||
foreach ($actions as $action) {
|
||||
echo '<li style="list-style: disc;">';
|
||||
if ($default_action)
|
||||
echo 'Default: ';
|
||||
echo $action['name'] . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
if ($alert != end($alerts)) {
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$data) {
|
||||
echo '<i>These module/s have no alerts or alert/s are not fired</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
check_login ();
|
||||
|
||||
/**
|
||||
* Translate the array texts using gettext
|
||||
*/
|
||||
function translate(&$item, $key) {
|
||||
$item = __($item);
|
||||
if (is_ajax ()) {
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
|
||||
if ($get_info_alert_module_group) {
|
||||
$send_tooltip = json_decode(io_safe_output(get_parameter('send_tooltip')), true);
|
||||
echo "<ul class='tooltip_counters'><h3>" . __('Counters Module') . "</h3>";
|
||||
echo "<li><div style='background-color: " . COL_ALERTFIRED . ";'></div>" . __('Alerts_Fired') . ": " . $send_tooltip['alerts_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_CRITICAL . ";'></div>" . __('Critical') . ": " . $send_tooltip['critical_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_WARNING . ";'></div>" . __('warning') . ": " . $send_tooltip['warning_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_UNKNOWN . ";'></div>" . __('Unknown') . ": " . $send_tooltip['unknown_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_NORMAL . ";'></div>" . __('OK') . ": " . $send_tooltip['normal_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_MAINTENANCE . ";'></div>" . __('Not_init') . ": " . $send_tooltip['notInit_module_count'] . "</li></ul>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,169 +39,231 @@ function translate(&$item, $key) {
|
||||
* execute the code.
|
||||
*/
|
||||
function mainModuleGroups() {
|
||||
global $config; //the useful global var of Pandora Console, it has many data can you use
|
||||
|
||||
require_once ('include/functions_reporting.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
require_once($config['homedir'] . "/include/functions_users.php");
|
||||
|
||||
//The big query
|
||||
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
|
||||
FROM tagente_estado
|
||||
WHERE id_agente IN
|
||||
(SELECT id_agente
|
||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE (ta.id_grupo = %d OR tasg.id_group = %d) AND disabled IS FALSE
|
||||
)
|
||||
AND id_agente_modulo IN
|
||||
(SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
|
||||
GROUP BY estado";
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_groupview.php");
|
||||
|
||||
$tree_group = new TreeGroup("group", "group");
|
||||
$tree_group->setPropagateCounters(false);
|
||||
$tree_group->setDisplayAllGroups(true);
|
||||
$tree_group->setFilter( array(
|
||||
'searchAgent' => '',
|
||||
'statusAgent' => AGENT_STATUS_ALL,
|
||||
'searchModule' => '',
|
||||
'statusModule' => -1,
|
||||
'groupID' => 0,
|
||||
'tagID' => 0,
|
||||
'show_not_init_agents' => 1,
|
||||
'show_not_init_modules' => 1
|
||||
));
|
||||
$info = $tree_group->getArray();
|
||||
$info = groupview_plain_groups($info);
|
||||
$counter = count($info);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$groups_view = $is_not_paginated
|
||||
? $info
|
||||
: array_slice($info, $offset, $config['block_size']);
|
||||
$agents_counters = array_reduce($groups_view, function($carry, $item){
|
||||
$carry[$item['id']] = $item;
|
||||
return $carry;
|
||||
}, array());
|
||||
|
||||
$ids_array = array_keys($agents_counters);
|
||||
|
||||
$ids_group = implode(',', $ids_array);
|
||||
|
||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
||||
$condition_not_init = modules_get_state_condition(AGENT_MODULE_STATUS_NO_DATA);
|
||||
$condition_normal = modules_get_state_condition(AGENT_MODULE_STATUS_NORMAL);
|
||||
|
||||
$array_for_defect = array();
|
||||
$array_module_group = array();
|
||||
$array_data = array();
|
||||
|
||||
$sql = "SELECT id_mg, `name` FROM tmodule_group";
|
||||
$array_mod= db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_mod as $key => $value) {
|
||||
$array_module_group[$value['id_mg']] = $value['name'];
|
||||
}
|
||||
$array_module_group[0] = 'Nothing';
|
||||
foreach ($agents_counters as $key => $value) {
|
||||
$array_for_defect[$key]['gm'] = $array_module_group;
|
||||
$array_for_defect[$key]['data']['name'] = $value['name'];
|
||||
$array_for_defect[$key]['data']['parent'] = $value['parent'];
|
||||
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
||||
}
|
||||
|
||||
$sql =
|
||||
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
|
||||
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
|
||||
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
|
||||
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
|
||||
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
|
||||
COUNT(tae.id_agente_modulo) AS total_count,
|
||||
tmg.id_mg,
|
||||
tmg.name as n,
|
||||
tg.id_grupo
|
||||
FROM (
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
ta.id_grupo AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND ta.id_grupo IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo
|
||||
UNION ALL
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
tasg.id_group AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.times_fired = 1
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND tasg.id_group IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||
) AS tae
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON tg.id_grupo = tae.g
|
||||
INNER JOIN (
|
||||
SELECT * FROM tmodule_group
|
||||
UNION ALL
|
||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||
) AS tmg
|
||||
ON tae.id_module_group = tmg.id_mg
|
||||
GROUP BY tae.g, tmg.id_mg";
|
||||
|
||||
$array_data_prev = db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_data_prev as $key => $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_info_message ( array('no_close'=>true, 'message'=>
|
||||
__("This table shows in columns the modules group and in rows agents group. The cell shows all modules") )
|
||||
);
|
||||
|
||||
|
||||
$agentGroups = users_get_groups ($config['id_user'], "AR", false);
|
||||
$modelGroups = users_get_all_model_groups();
|
||||
|
||||
if (!empty($agentGroups) && !empty($modelGroups)) {
|
||||
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
|
||||
|
||||
$table = null;
|
||||
$table->headstyle[] = "width: 20%";
|
||||
foreach ($modelGroups as $i => $n) {
|
||||
$table->headstyle[] = "min-width: 60px;max-width: 5%;text-align:center;";
|
||||
$modelGroups[$i] = ui_print_truncate_text($n, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$head = $modelGroups;
|
||||
array_unshift($head, ' ');
|
||||
|
||||
//Metaobject use in html_print_table
|
||||
$table->align[0] = 'left'; //Align to left the first column.
|
||||
$table->style[0] = 'color: #ffffff; '.
|
||||
'background-color: #373737; font-weight: bolder; padding-right: 10px; width:20%; ';
|
||||
$table->head = $head;
|
||||
$table->width = '100%';
|
||||
|
||||
//The content of table
|
||||
$tableData = array();
|
||||
|
||||
//Create rows and cells
|
||||
foreach ($agentGroups as $idAgentGroup => $name) {
|
||||
$fired = false;
|
||||
$row = array();
|
||||
|
||||
array_push($row, ui_print_truncate_text($name, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF'));
|
||||
|
||||
foreach ($modelGroups as $idModelGroup => $modelGroup) {
|
||||
$fired = false;
|
||||
$query = sprintf($sql, $idAgentGroup, $idAgentGroup, $idModelGroup);
|
||||
|
||||
$rowsDB = db_get_all_rows_sql ($query);
|
||||
|
||||
$agents = agents_get_group_agents($idAgentGroup);
|
||||
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
if ($idModelGroup == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$fired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$states = array();
|
||||
if ($rowsDB !== false) {
|
||||
foreach ($rowsDB as $rowDB) {
|
||||
$states[$rowDB['estado']] = $rowDB['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($states as $idState => $state) {
|
||||
$count += $state;
|
||||
}
|
||||
|
||||
$color = 'transparent'; //Defaut color for cell
|
||||
$font_color = '#000000'; //Default font color for cell
|
||||
if ($count == 0) {
|
||||
$color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
|
||||
$alinkStart = '';
|
||||
$alinkEnd = '';
|
||||
}
|
||||
else {
|
||||
|
||||
if ($fired) {
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if (array_key_exists(1, $states)) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$font_color = '#ffffff';
|
||||
}
|
||||
elseif (array_key_exists(2, $states)) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif (array_key_exists(3, $states)) {
|
||||
$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.
|
||||
}
|
||||
elseif (array_key_exists(0, $states)) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif (array_key_exists(5, $states)) {
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
|
||||
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' .
|
||||
$idModelGroup . '&id_agent_group=' . $idAgentGroup . '"href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' .
|
||||
$idAgentGroup . '&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
|
||||
$alinkEnd = '</a>';
|
||||
}
|
||||
|
||||
array_push($row,
|
||||
'<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;">
|
||||
' . $alinkStart . $count . $alinkEnd . '</div>');
|
||||
}
|
||||
array_push($tableData,$row);
|
||||
}
|
||||
$table->data = $tableData;
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
|
||||
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 group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
if(count($array_for_defect) > 0){
|
||||
$table = new StdClass();
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
||||
$head[0] = __('Groups');
|
||||
$headstyle[0] = "width: 20%; font-weight: bolder;";
|
||||
foreach ($array_module_group as $key => $value) {
|
||||
$headstyle[] = "min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;";
|
||||
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($array_for_defect as $key => $value) {
|
||||
$deep = groups_get_group_deep($key);
|
||||
$data[$i][0] = $deep . ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
$j = 1;
|
||||
if(isset($array_data[$key])){
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
if(isset($array_data[$key][$k])){
|
||||
$send_tooltip = json_encode($array_data[$key][$k]);
|
||||
$rel = "ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&send_tooltip=" . $send_tooltip;
|
||||
$url = "index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=" . $key . "&modulegroup=" . $k;
|
||||
|
||||
if ($array_data[$key][$k]['alerts_module_count'] != 0) {
|
||||
$color = '#FFA631'; //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) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||
$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.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
||||
$color = '#5BB6E5'; // 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] .= "<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] .= "</a></div>";
|
||||
}
|
||||
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] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
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] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$table->head = $head;
|
||||
$table->headstyle = $headstyle;
|
||||
$table->data = $data;
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
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 group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") ));
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups or module groups') ));
|
||||
}
|
||||
|
||||
|
||||
ui_require_css_file('cluetip');
|
||||
ui_require_jquery_file('cluetip');
|
||||
?>
|
||||
@ -292,7 +272,8 @@ function mainModuleGroups() {
|
||||
$("a.info_cell").cluetip ({
|
||||
arrows: true,
|
||||
attribute: 'rel',
|
||||
cluetipClass: 'default'
|
||||
cluetipClass: 'default',
|
||||
width: '200px'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -77,6 +77,15 @@ switch($graph) {
|
||||
if (count($data_array) > 1) {
|
||||
$data = $data_array[1];
|
||||
}
|
||||
// Redefine boolean data
|
||||
switch ($data) {
|
||||
case "up(1)":
|
||||
$data = 1;
|
||||
break;
|
||||
case "down(0)":
|
||||
$data = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -28,6 +28,11 @@
|
||||
return formattedTime;
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
tickFormatter: function (value, axis) {
|
||||
return shortNumber(value);
|
||||
}
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
lineWidth: 2,
|
||||
@ -158,6 +163,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
function shortNumber (number) {
|
||||
if (Math.round(number) != number) return number;
|
||||
number = Number.parseInt(number);
|
||||
if (Number.isNaN(number)) return number;
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
|
||||
while (number >= 1000 || number <= -1000) {
|
||||
pos++;
|
||||
number = number / 1000;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos];
|
||||
}
|
||||
|
||||
$('#graph').change(function() {
|
||||
$('form#realgraph').submit();
|
||||
});
|
||||
|
@ -1 +1,49 @@
|
||||
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE treport_content ADD COLUMN `recursion` TINYINT(1) default NULL;
|
||||
|
||||
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
|
||||
ALTER TABLE tagente_modulo ALTER COLUMN `parent_module_id` SET default 0;
|
||||
|
||||
-- Changes for the 'service like status' feature (Carrefour)
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT '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_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_template_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
COMMIT;
|
16
pandora_console/extras/mr/21.sql
Normal file
16
pandora_console/extras/mr/21.sql
Normal file
@ -0,0 +1,16 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tservice` ADD COLUMN `is_favourite` tinyint(1) NOT NULL default 0;
|
||||
UPDATE tservice SET `is_favourite` = 1 WHERE `name` REGEXP '^[_|.|\[|\(]';
|
||||
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
|
||||
|
||||
COMMIT;
|
7
pandora_console/extras/mr/22.sql
Normal file
7
pandora_console/extras/mr/22.sql
Normal file
@ -0,0 +1,7 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||
|
||||
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
COMMIT;
|
@ -341,13 +341,18 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
`id` int(10) NOT NULL auto_increment primary key,
|
||||
`server_name` text default '',
|
||||
`server_url` text default '',
|
||||
`dbuser` text default '',
|
||||
`dbpass` text default '',
|
||||
`dbhost` text default '',
|
||||
`dbport` text default '',
|
||||
`dbname` text default '',
|
||||
`server_name` text,
|
||||
`server_url` text,
|
||||
`dbuser` text,
|
||||
`dbpass` text,
|
||||
`dbhost` text,
|
||||
`dbport` text,
|
||||
`dbname` text,
|
||||
`meta_dbuser` text,
|
||||
`meta_dbpass` text,
|
||||
`meta_dbhost` text,
|
||||
`meta_dbport` text,
|
||||
`meta_dbname` text,
|
||||
`auth_token` text default '',
|
||||
`id_group` int(10) unsigned NOT NULL default 0,
|
||||
`api_password` text NOT NULL,
|
||||
@ -1175,13 +1180,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 19);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 22);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '726');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
@ -1213,6 +1218,9 @@ UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WH
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `user_comment` text NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1222,13 +1230,14 @@ ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REF
|
||||
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
|
||||
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` DROP COLUMN `flash_chart`;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagente_modulo`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1270,12 +1279,15 @@ ALTER TABLE `tservice` ADD COLUMN `quiet` tinyint(1) NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `cascade_protection` tinyint(1) NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL default 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `is_favourite` tinyint(1) NOT NULL default 0;
|
||||
UPDATE tservice SET `is_favourite` = 1 WHERE `name` REGEXP '^[_|.|\[|\(]';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
|
||||
ALTER TABLE tlayout ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^\\[';
|
||||
|
||||
@ -1291,6 +1303,7 @@ ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0
|
||||
ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL default "analogic_1";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
@ -1728,6 +1741,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template_data`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1765,3 +1780,34 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
|
@ -198,8 +198,12 @@ echo "<div class='modalgobutton gopandora'>
|
||||
<script>
|
||||
|
||||
$(".cerrar").click(function(){
|
||||
$("#alert_messages").hide();
|
||||
$( "#opacidad" ).remove();
|
||||
$("#alert_messages")
|
||||
.css('opacity', 0)
|
||||
.hide();
|
||||
$( "#opacidad" )
|
||||
.css('opacity', 0)
|
||||
.remove();
|
||||
});
|
||||
|
||||
$(".gopandora").click(function(){
|
||||
|
@ -72,38 +72,49 @@ config_check();
|
||||
$table->width = "100%";
|
||||
$table->styleTable = 'margin: auto; margin-top: 0px;';
|
||||
$table->rowclass[0] = '';
|
||||
$table->data[0][11] = ui_print_help_tip (__("Blank characters are used as AND conditions"), true);
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
|
||||
$acl_head_search = true;
|
||||
if ($config["acl_enterprise"] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql("SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')");
|
||||
}
|
||||
else {
|
||||
if (strlen($config['search_keywords']) == 0)
|
||||
if ($acl_head_search) {
|
||||
$table->data[0][11] = ui_print_help_tip (__("Blank characters are used as AND conditions"), true);
|
||||
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
}
|
||||
else {
|
||||
if (strlen($config['search_keywords']) == 0)
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
else
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords']))
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else if (strlen($config['search_keywords']) == 0)
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
$search_bar .= "value='" . $config['search_keywords'] . "'";
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
//$search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$table->data[0]['searchbar'] = $search_bar;
|
||||
}
|
||||
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords']))
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else if (strlen($config['search_keywords']) == 0)
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else
|
||||
$search_bar .= "value='" . $config['search_keywords'] . "'";
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
//$search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$table->data[0]['searchbar'] = $search_bar;
|
||||
|
||||
// Servers check
|
||||
$servers = array();
|
||||
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
|
||||
|
@ -70,9 +70,10 @@ switch ($login_screen) {
|
||||
$logo_link = 'index.php';
|
||||
$logo_title = __('Refresh');
|
||||
break;
|
||||
$splash_title = __('Splash login');
|
||||
}
|
||||
|
||||
$splash_title = __('Splash login');
|
||||
|
||||
$url = '?login=1';
|
||||
//These variables come from index.php
|
||||
if (!empty ($page) && !empty ($sec)) {
|
||||
@ -303,7 +304,7 @@ echo '</div>';
|
||||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($process_error_message == '' && $mail != "") {
|
||||
if (!isset($process_error_message) && isset($mail)) {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
@ -315,13 +316,13 @@ if ($process_error_message == '' && $mail != "") {
|
||||
echo '<p>' . __('An email has been sent to your email address') . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
else if ($process_error_message != '') {
|
||||
else if (isset($process_error_message)) {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
@ -333,7 +334,7 @@ else if ($process_error_message != '') {
|
||||
echo '<p>' . $process_error_message . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
html_print_submit_button("Ok", 'reset_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
@ -341,7 +342,7 @@ else if ($process_error_message != '') {
|
||||
}
|
||||
|
||||
|
||||
if ($correct_reset_pass_process != "") {
|
||||
if (isset($correct_reset_pass_process)) {
|
||||
echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
@ -353,7 +354,7 @@ if ($correct_reset_pass_process != "") {
|
||||
echo '<p>' . $correct_reset_pass_process . '</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button("Ok", 'final_process_correct_button', false);
|
||||
html_print_submit_button("Ok", 'final_process_correct_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
@ -92,8 +92,8 @@ echo '<div id="login_id_dialog" title="' .
|
||||
|
||||
if ($zone_selected == "") {
|
||||
if ($config["timezone"] != "") {
|
||||
list($zone) = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone;
|
||||
$zone_array = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone_array[0];
|
||||
}
|
||||
else {
|
||||
$zone_selected = 'Europe';
|
||||
@ -102,7 +102,7 @@ echo '<div id="login_id_dialog" title="' .
|
||||
|
||||
$timezones = timezone_identifiers_list();
|
||||
foreach ($timezones as $timezone) {
|
||||
if (strpos($timezone, $zone_selected) !== false) {
|
||||
if (strpos($timezone, $zone_selected) !== false) {
|
||||
$timezone_country = preg_replace('/^.*\//', '', $timezone);
|
||||
$timezone_n[$timezone] = $timezone_country;
|
||||
}
|
||||
@ -195,8 +195,9 @@ $("#language").click(function () {
|
||||
{"page": "general/login_required",
|
||||
"change_language": change_language},
|
||||
function (data) {}
|
||||
);
|
||||
location.reload();
|
||||
).done(function () {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -210,6 +210,7 @@ if (!empty($all_data)) {
|
||||
echo '<div id="activity">';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = "databox data";
|
||||
$table->width = '100%'; //Don't specify px
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
@ -274,7 +275,12 @@ if (!empty($all_data)) {
|
||||
. human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[3] = $session_ip_origen;
|
||||
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
|
||||
$data[4] = '<div >' . io_safe_output($description) . '</div>';
|
||||
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);
|
||||
}
|
||||
|
@ -106,8 +106,6 @@ $form .= html_print_table($table, true);
|
||||
$form .= '</form>';
|
||||
ui_toggle($form, __("Filter"), "", false);
|
||||
|
||||
// ui_toggle(graphic_user_activity(400, 150), __("Chart"));
|
||||
|
||||
$filter = "1=1";
|
||||
|
||||
if (!empty($filter_type)) {
|
||||
@ -235,7 +233,7 @@ foreach ($result as $row) {
|
||||
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
|
||||
. ui_print_timestamp($row["utimestamp"], true);
|
||||
$data[3] = $row["ip_origen"];
|
||||
$data[4] = $row["descripcion"];
|
||||
$data[4] = io_safe_output($row["descripcion"]);
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));
|
||||
|
@ -479,6 +479,7 @@ $table->data[3][1] .= __('Autodisable mode') . ' ' .
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[4][0] = __('Status');
|
||||
$table->data[4][1] = __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[4][1] .= __('Enabled') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
@ -541,7 +541,7 @@ if (!empty($interfaces_list)) {
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
@ -207,11 +207,6 @@ if ($create_agent) {
|
||||
$agent_creation_error = __('No agent alias specified');
|
||||
$agent_created_ok = 0;
|
||||
}
|
||||
/*elseif (agents_get_agent_id ($nombre_agente)) {
|
||||
$agent_creation_error =
|
||||
__('There is already an agent in the database with this name');
|
||||
$agent_created_ok = 0;
|
||||
}*/
|
||||
else {
|
||||
if($alias_as_name){
|
||||
$sql = 'SELECT nombre FROM tagente WHERE nombre = "' . $alias . '"';
|
||||
@ -760,7 +755,7 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$old_interval = db_get_value('intervalo', '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');
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
@ -860,11 +855,21 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values,$server_name));
|
||||
|
||||
if ($old_interval != $intervalo) {
|
||||
enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo));
|
||||
|
||||
# Update the configuration files
|
||||
if ($old_values['intervalo'] != $intervalo) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'interval', $intervalo)
|
||||
);
|
||||
}
|
||||
|
||||
if ($old_values['disabled'] != $disabled) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'standby', $disabled ? "1" : "0")
|
||||
);
|
||||
}
|
||||
|
||||
if($tpolicy_group_old){
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
|
||||
@ -919,8 +924,9 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
ui_print_success_message (__('Successfully updated'));
|
||||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit("Agent management",
|
||||
"Updated agent $alias", false, false, $info);
|
||||
"Updated agent $unsafe_alias", false, false, $info);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1421,7 +1427,7 @@ if ($update_module) {
|
||||
$edit_module = true;
|
||||
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try update module '$name' for agent " . $agent["alias"]);
|
||||
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"]));
|
||||
}
|
||||
else {
|
||||
if ($prediction_module == 3) {
|
||||
@ -1439,7 +1445,7 @@ if ($update_module) {
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
|
||||
db_pandora_audit("Agent management",
|
||||
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
|
||||
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1580,7 +1586,7 @@ if ($create_module) {
|
||||
$edit_module = true;
|
||||
$moduletype = $id_module;
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try added module '$name' for agent ".$agent["alias"]);
|
||||
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]));
|
||||
}
|
||||
else {
|
||||
if ($prediction_module == 3) {
|
||||
@ -1598,7 +1604,7 @@ if ($create_module) {
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
|
||||
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1713,12 +1719,18 @@ if ($delete_module) { // DELETE agent module !
|
||||
ui_print_error_message(__('There was a problem deleting the module'));
|
||||
}
|
||||
else {
|
||||
ui_print_success_message(__('Module deleted succesfully'));
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
location="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'";
|
||||
alert("'.__('Module deleted succesfully').'");
|
||||
</script>';
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
|
||||
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"]));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// MODULE DUPLICATION
|
||||
@ -1748,11 +1760,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit("Agent management",
|
||||
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
|
||||
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
|
||||
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1760,13 +1772,15 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||
// =====================
|
||||
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', array($id_agente, $enable_module));
|
||||
db_pandora_audit("Module management", 'Enable ' . $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);
|
||||
db_pandora_audit("Module management", 'Fail to enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
@ -1775,13 +1789,15 @@ if ($enable_module) {
|
||||
|
||||
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', array($id_agente, $disable_module));
|
||||
db_pandora_audit("Module management", 'Disable ' . $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);
|
||||
db_pandora_audit("Module management", 'Fail to disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
@ -1936,11 +1952,11 @@ switch ($tab) {
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
height: 240,
|
||||
width: 600,
|
||||
title: 'Changing the module name of a satellite agent',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be <br> altered manually. Unless you are absolutely certain of <br> the process, do not alter these names.</p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be altered manually. Unless you are absolutely certain of the process, do not alter these names.</p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
@ -1970,11 +1986,11 @@ switch ($tab) {
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 280,
|
||||
width: 670,
|
||||
height: 240,
|
||||
width: 650,
|
||||
title: 'Changing snmp module name',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features <br> associated with this module, such as network maps, <br> interface graphs or other network modules, may no longer <br> work. If you are not completely sure of the process, please <br> do not change the name of the module. </p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features associated with this module, such as network maps, interface graphs or other network modules, may no longer work. If you are not completely sure of the process, please do not change the name of the module. </p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
|
@ -43,6 +43,7 @@ echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters
|
||||
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
|
||||
echo __('Search') . ' ' .
|
||||
html_print_input_text ('search_string', $search_string, '', 15, 255, true);
|
||||
html_print_input_hidden ('search', 1);
|
||||
echo "</td>";
|
||||
echo "<td class='datos' style='width:10%'>";
|
||||
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
|
||||
@ -138,7 +139,7 @@ if (($policy_page) || (isset($agent))) {
|
||||
echo '</td>';
|
||||
}
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
echo __("Type");
|
||||
echo __("<p>Type</p>");
|
||||
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
|
||||
html_print_input_hidden ('edit_module', 1);
|
||||
echo '</td>';
|
||||
@ -312,7 +313,7 @@ $selectIntervalUp = '';
|
||||
$selectIntervalDown = '';
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
$selected = 'border: 1px solid black;';
|
||||
$selected = '';
|
||||
|
||||
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
|
||||
|
||||
@ -423,9 +424,11 @@ foreach ($order as $ord) {
|
||||
$limit = (int) $config["block_size"];
|
||||
$offset = (int) get_parameter ('offset');
|
||||
|
||||
$params = implode(',',
|
||||
$params = ($checked)
|
||||
? "tagente_modulo.*, tmodule_group.*"
|
||||
: implode(',',
|
||||
array(
|
||||
'id_agente_modulo',
|
||||
'tagente_modulo.id_agente_modulo',
|
||||
'id_tipo_modulo',
|
||||
'descripcion',
|
||||
'nombre',
|
||||
@ -452,80 +455,46 @@ $search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities);
|
||||
|
||||
$where_tags = tags_get_acl_tags($config['id_user'], 0, 'AR', 'module_condition', 'AND', 'tagente_modulo');
|
||||
// Tags acl
|
||||
$agent_tags = tags_get_user_applied_agent_tags($id_agente);
|
||||
if ($agent_tags !== true) {
|
||||
$where_tags = " AND ttag_module.id_tag IN (" . implode(',', $agent_tags) . ")";
|
||||
}
|
||||
|
||||
$paginate_module = false;
|
||||
if (isset($config['paginate_module']))
|
||||
$paginate_module = $config['paginate_module'];
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "postgresql":
|
||||
if ($paginate_module) {
|
||||
$limit_sql = " LIMIT $limit OFFSET $offset ";
|
||||
}
|
||||
else {
|
||||
$limit_sql = '';
|
||||
}
|
||||
case "mysql":
|
||||
if ($paginate_module) {
|
||||
if (!isset($limit_sql)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$limit_sql = '';
|
||||
}
|
||||
if ($checked) {
|
||||
$sql = sprintf("SELECT *
|
||||
FROM tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE %s %s %s %s %s",
|
||||
$basic_where, $where, $where_tags, $order_sql, $limit_sql);
|
||||
}
|
||||
else {
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE %s %s %s %s %s",
|
||||
$params, $basic_where, $where, $where_tags, $order_sql, $limit_sql);
|
||||
}
|
||||
|
||||
|
||||
$modules = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array();
|
||||
if ($paginate_module) {
|
||||
$set['limit'] = $limit;
|
||||
$set['offset'] = $offset;
|
||||
}
|
||||
|
||||
if ($checked) {
|
||||
$sql = sprintf("SELECT *
|
||||
FROM tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tmodule_group.id_mg = tagente_modulo.id_module_group
|
||||
WHERE %s %s %s %s",
|
||||
$basic_where, $where, $where_tags, $order_sql);
|
||||
}
|
||||
else {
|
||||
$sql = sprintf("SELECT %s
|
||||
FROM tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tmodule_group.id_mg = tagente_modulo.id_module_group
|
||||
WHERE %s %s %s %s",
|
||||
$params, $basic_where, $where, $where_tags, $order_sql);
|
||||
}
|
||||
|
||||
$modules = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
break;
|
||||
if ($paginate_module) {
|
||||
if (!isset($limit_sql)) {
|
||||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$limit_sql = '';
|
||||
}
|
||||
$sql = sprintf("SELECT tagente_modulo.*, tmodule_group.*
|
||||
FROM tagente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
LEFT JOIN ttag_module
|
||||
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
WHERE %s %s %s
|
||||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
%s %s",
|
||||
$basic_where, $where, $where_tags,
|
||||
$order_sql, $limit_sql
|
||||
);
|
||||
|
||||
$sql_total_modules = sprintf("SELECT count(*)
|
||||
$modules = db_get_all_rows_sql($sql);
|
||||
|
||||
$sql_total_modules = sprintf(
|
||||
"SELECT count(DISTINCT(tagente_modulo.id_agente_modulo))
|
||||
FROM tagente_modulo
|
||||
WHERE %s %s %s", $basic_where, $where, $where_tags);
|
||||
LEFT JOIN ttag_module
|
||||
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
WHERE %s %s %s", $basic_where, $where, $where_tags
|
||||
);
|
||||
|
||||
$total_modules = db_get_value_sql($sql_total_modules);
|
||||
|
||||
@ -578,7 +547,8 @@ $table->head[7] = __('Warn');
|
||||
|
||||
|
||||
$table->head[8] = __('Action');
|
||||
$table->head[9] = '<span title="' . __('Delete') . '">' . __('D.') . '</span>';
|
||||
$table->head[9] = '<span title="' . __('Delete') . '">' . __('Del.') . '</span>'.
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
|
||||
$table->rowstyle = array();
|
||||
$table->style = array ();
|
||||
@ -638,7 +608,7 @@ foreach ($modules as $module) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
$table->colspan[$i - 1][0] = 10;
|
||||
else
|
||||
$table->colspan[$i - 1][0] = 8;
|
||||
$table->colspan[$i - 1][0] = 9;
|
||||
|
||||
$data = array ();
|
||||
}
|
||||
@ -809,12 +779,13 @@ foreach ($modules as $module) {
|
||||
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
// Delete module
|
||||
$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
$data[9] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
|
||||
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[9] .= html_print_image ('images/cross.png', true,
|
||||
array ('title' => __('Delete')));
|
||||
$data[9] .= '</a> ';
|
||||
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
@ -838,17 +809,32 @@ if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready (function () {
|
||||
$(document).ready (function () {
|
||||
|
||||
$('[id^=checkbox-id_delete]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('[id^=checkbox-id_delete]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-id_delete]').parent().parent().addClass('checkselected');
|
||||
$("[name^=id_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-id_delete]').parent().parent().removeClass('checkselected');
|
||||
$("[name^=id_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function change_mod_filter() {
|
||||
var checked = $("#checkbox-status_hierachy_mode").is(":checked");
|
||||
|
@ -34,6 +34,11 @@ if (is_ajax ()) {
|
||||
|
||||
// Decrypt passwords in the component.
|
||||
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
||||
|
||||
$component['str_warning'] = io_safe_output($component['str_warning']);
|
||||
$component['str_critical'] = io_safe_output($component['str_critical']);
|
||||
$component['warning_inverse'] = (bool)$component['warning_inverse'];
|
||||
$component['critical_inverse'] = (bool)$component['critical_inverse'];
|
||||
|
||||
echo io_json_mb_encode ($component);
|
||||
return;
|
||||
|
@ -160,7 +160,7 @@ else{
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended ('name',
|
||||
io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
io_safe_input(html_entity_decode($name, ENT_QUOTES, "UTF-8")), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
//$table_simple->data[0][1] = html_print_input_text ('name',
|
||||
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
|
||||
|
||||
@ -189,9 +189,23 @@ $table_simple->data[0][3] .= html_print_select_from_sql ('SELECT id_mg, name FRO
|
||||
|
||||
$in_policy = strstr($page, "policy_modules");
|
||||
if (!$in_policy) {
|
||||
// Cannot select the current module to be itself parent
|
||||
$module_parent_filter = $id_agent_module
|
||||
? array("tagente_modulo.id_agente_modulo" => "<>$id_agent_module")
|
||||
: "";
|
||||
$table_simple->data[1][0] = __('Module parent');
|
||||
$table_simple->data[1][1] .= html_print_select_from_sql ('SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ' . $id_agente . ' ORDER BY nombre',
|
||||
'parent_module_id', $parent_module_id, '', __('Not assigned'), '0', true, false, true);
|
||||
$modules_can_be_parent = agents_get_modules($id_agente, false, $module_parent_filter);
|
||||
// If the user cannot have access to parent module, only print the name
|
||||
if ($parent_module_id != 0 && !in_array($parent_module_id, array_keys($modules_can_be_parent))) {
|
||||
$table_simple->data[1][1] = db_get_value(
|
||||
'nombre', 'tagente_modulo', 'id_agente_modulo', $parent_module_id
|
||||
);
|
||||
} else {
|
||||
$table_simple->data[1][1] = html_print_select (
|
||||
$modules_can_be_parent, 'parent_module_id', $parent_module_id, '',
|
||||
__('Not assigned'), '0', true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' ' . ui_print_help_icon ('module_type', true);
|
||||
|
@ -71,7 +71,7 @@ push_table_simple ($data, 'plugin_1');
|
||||
$data = array ();
|
||||
$data[0] = 'macro_desc';
|
||||
$data[0] .= ui_print_help_tip ('macro_help', true);
|
||||
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 255, true);
|
||||
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 1024, true);
|
||||
$table_simple->colspan['macro_field'][1] = 3;
|
||||
$table_simple->rowstyle['macro_field'] = 'display:none';
|
||||
|
||||
@ -93,10 +93,10 @@ if (!empty($macros)) {
|
||||
$m_hide = $m['hide'];
|
||||
|
||||
if ($m_hide) {
|
||||
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 255, true);
|
||||
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
|
||||
}
|
||||
else {
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true,
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
$table_simple->colspan['macro'.$m['macro']][1] = 3;
|
||||
|
@ -179,9 +179,23 @@ if ($create_action) {
|
||||
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No name specified');
|
||||
}
|
||||
|
||||
if ($id_alert_command == "") {
|
||||
$messageAction = __('No command specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($update_action) {
|
||||
|
@ -307,9 +307,22 @@ if ($create_command) {
|
||||
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No name specified');
|
||||
}
|
||||
|
||||
if ($command == "") {
|
||||
$messageAction = __('No command specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,6 +70,7 @@ if (! $id_agente) {
|
||||
|
||||
$table->data[0][0] = __('Module');
|
||||
$modules = array ();
|
||||
|
||||
if ($id_agente)
|
||||
$modules = agents_get_modules ($id_agente, false, array("delete_pending" => 0));
|
||||
|
||||
@ -136,21 +137,25 @@ if (check_acl ($config['id_user'], 0, "LM")) {
|
||||
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
|
||||
|
||||
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
|
||||
html_print_table ($table);
|
||||
if (!isset($step) || $step!=5) {
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
if($id_cluster){
|
||||
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
|
||||
if (!isset($step) || $step!=5) {
|
||||
if($id_cluster){
|
||||
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
|
||||
html_print_input_hidden ('create_alert', 1);
|
||||
echo '</div></form>';
|
||||
}
|
||||
|
||||
|
||||
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
|
||||
html_print_input_hidden ('create_alert', 1);
|
||||
echo '</div></form>';
|
||||
|
||||
ui_require_css_file ('cluetip');
|
||||
ui_require_jquery_file ('cluetip');
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
@ -218,7 +223,7 @@ $(document).ready (function () {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (data);
|
||||
$("#value", $value).append (parseInt(data));
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
@ -102,16 +102,8 @@ if ($groups_user === false) {
|
||||
$groups_id = implode(',', array_keys($groups_user));
|
||||
|
||||
$form_filter .= "<tr>";
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||
break;
|
||||
case "oracle":
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id)");
|
||||
break;
|
||||
}
|
||||
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||
$arrayActions = array();
|
||||
if (is_array($temp)) {
|
||||
foreach ($temp as $actionElement) {
|
||||
@ -186,23 +178,10 @@ if ($searchFlag) {
|
||||
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
|
||||
if (strlen(trim($moduleName)) > 0)
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
|
||||
//if ($agentID != -1)
|
||||
//$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $agentID . ")";
|
||||
if (strlen(trim($agentName)) > 0) {
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||
break;
|
||||
case "oracle":
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||
break;
|
||||
}
|
||||
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
|
||||
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
|
||||
WHERE t1.alias LIKE '" . trim($agentName) . "')";
|
||||
}
|
||||
if ($actionID != -1 && $actionID != '')
|
||||
$where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
||||
@ -212,17 +191,7 @@ if ($searchFlag) {
|
||||
$where .= " AND talert_template_modules.standby = " . $standby;
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$id_agents = array_keys ($agents);
|
||||
break;
|
||||
case "oracle":
|
||||
$id_agents = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$id_agents = array_keys ($agents);
|
||||
|
||||
$total = agents_get_alerts_simple ($id_agents, false,
|
||||
false, $where, false, false, false, true);
|
||||
@ -645,7 +614,7 @@ foreach ($simple_alerts as $alert) {
|
||||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
@ -704,19 +673,32 @@ foreach ($simple_alerts as $alert) {
|
||||
// To manage alert is necessary LW permissions in the agent group
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
$data[4] .= '</a>';
|
||||
$is_cluster = (bool)get_parameter('id_cluster');
|
||||
if (!$is_cluster) {
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
}
|
||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
|
||||
if ($is_cluster) {
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
||||
$data[4] .= '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
|
@ -47,6 +47,7 @@ $add_action = (bool) get_parameter ('add_action');
|
||||
$update_action = (bool) get_parameter ('update_action');
|
||||
$delete_action = (bool) get_parameter ('delete_action');
|
||||
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||
$update_alert = (bool) get_parameter ('update_alert'); ////
|
||||
$disable_alert = (bool) get_parameter ('disable_alert');
|
||||
$enable_alert = (bool) get_parameter ('enable_alert');
|
||||
$standbyon_alert = (bool) get_parameter ('standbyon_alert');
|
||||
@ -67,10 +68,32 @@ $standby = get_parameter('standby','');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$messageAction = '';
|
||||
|
||||
if ($update_alert) {
|
||||
|
||||
$id_alert_agent_module = (int) get_parameter ('id_alert_update');
|
||||
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
$values_upd = array();
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_agent_module'] = $id_agent_module;
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_alert_template'] = $id_alert_template;
|
||||
|
||||
$id = alerts_update_alert_agent_module ($id_alert_agent_module, $values_upd);
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully updated'), __('Could not be updated'), '', true);
|
||||
|
||||
}
|
||||
|
||||
if ($create_alert) {
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
|
||||
if (db_get_value_sql("SELECT COUNT(id)
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = " . $id_agent_module . "
|
||||
@ -81,7 +104,7 @@ if ($create_alert) {
|
||||
}
|
||||
else {
|
||||
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
|
||||
|
||||
|
||||
$alert_template_name = db_get_value ("name",
|
||||
"talert_templates","id", $id_alert_template);
|
||||
$module_name = db_get_value ("nombre",
|
||||
@ -103,9 +126,24 @@ if ($create_alert) {
|
||||
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully created'), __('Could not be created'), '', true);
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($id_alert_template == "") {
|
||||
$messageAction = __('No template specified');
|
||||
}
|
||||
|
||||
if ($id_agent_module == "") {
|
||||
$messageAction = __('No module specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully created'), $messageAction, '', true);
|
||||
|
||||
|
||||
if ($id !== false) {
|
||||
$action_select = get_parameter('action_select');
|
||||
|
||||
@ -116,6 +154,7 @@ if ($create_alert) {
|
||||
$values['module_action_threshold'] =
|
||||
(int)get_parameter ('module_action_threshold');
|
||||
|
||||
|
||||
alerts_add_alert_agent_module_action ($id, $action_select, $values);
|
||||
}
|
||||
}
|
||||
|
@ -112,8 +112,14 @@ if ($create_special_day) {
|
||||
$values = array();
|
||||
$values['id_group'] = (string) get_parameter ('id_group');
|
||||
$values['description'] = (string) get_parameter ('description');
|
||||
|
||||
list($year, $month, $day) = explode("-", $date);
|
||||
|
||||
|
||||
$array_date = explode("-", $date);
|
||||
|
||||
$year = $array_date[0];
|
||||
$month = $array_date[1];
|
||||
$day = $array_date[2];
|
||||
|
||||
if ($year == '*') {
|
||||
# '0001' means every year.
|
||||
$year = '0001';
|
||||
@ -130,6 +136,7 @@ if ($create_special_day) {
|
||||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||
if ($date_check == $date) {
|
||||
$result = '';
|
||||
$messageAction = __('Could not be created, it already exists');
|
||||
}
|
||||
else {
|
||||
$result = alerts_create_alert_special_day ($date, $same_day, $values);
|
||||
@ -143,10 +150,16 @@ if ($create_special_day) {
|
||||
else {
|
||||
db_pandora_audit("Command management", "Fail try to create special day", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($update_special_day) {
|
||||
@ -158,20 +171,25 @@ if ($update_special_day) {
|
||||
$description = (string) get_parameter ('description');
|
||||
$id_group = (string) get_parameter ('id_group');
|
||||
$id_group_orig = (string) get_parameter ('id_group_orig');
|
||||
|
||||
list($year, $month, $day) = explode("-", $date);
|
||||
|
||||
$array_date = explode("-", $date);
|
||||
|
||||
$year = $array_date[0];
|
||||
$month = $array_date[1];
|
||||
$day = $array_date[2];
|
||||
|
||||
if ($year == '*') {
|
||||
# '0001' means every year.
|
||||
$year = '0001';
|
||||
$date = $year . '-' . $month . '-' . $day;
|
||||
}
|
||||
|
||||
|
||||
$values = array ();
|
||||
$values['date'] = $date;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['same_day'] = $same_day;
|
||||
$values['description'] = $description;
|
||||
|
||||
|
||||
if (!checkdate ($month, $day, $year)) {
|
||||
$result = '';
|
||||
}
|
||||
@ -183,6 +201,7 @@ if ($update_special_day) {
|
||||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||
if ($date_check == $date) {
|
||||
$result = '';
|
||||
$messageAction = __('Could not be updated, it already exists');
|
||||
}
|
||||
else {
|
||||
$result = alerts_update_alert_special_day ($id, $values);
|
||||
@ -202,9 +221,15 @@ if ($update_special_day) {
|
||||
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be updated');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully updated'),
|
||||
__('Could not be updated'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($delete_special_day) {
|
||||
|
@ -82,7 +82,7 @@ $table_details->data[] = $data;
|
||||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
@ -428,9 +428,21 @@ if ($create_template) {
|
||||
json_encode($values));
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No template name specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
|
||||
|
||||
/* Go to previous step in case of error */
|
||||
if ($result === false)
|
||||
$step = $step - 1;
|
||||
|
@ -188,7 +188,7 @@ foreach ($fields_available as $key=>$available) {
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<b>' . __('Fields available').'</b>';
|
||||
$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', 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('images/darrowright.png', true,
|
||||
array('id' => 'right', 'title' => __('Add fields to select'))) .
|
||||
@ -201,7 +201,7 @@ $table->data[1][1] .= '<br><br><br><br><a href="javascript:">' .
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>' . __('Fields selected') . '</b>';
|
||||
$table->data[1][2] = html_print_select($result_selected,
|
||||
'fields_selected[]', true, '', '', '', true, true, false, '', false, 'width: 300px');
|
||||
'fields_selected[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
|
||||
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
@ -223,6 +223,7 @@ $(document).ready (function () {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -234,11 +235,13 @@ $(document).ready (function () {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
$('#fields_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
@ -65,6 +65,9 @@ if ($id) {
|
||||
$group_rep = $filter['group_rep'];
|
||||
$date_from = str_replace("-","/",$filter['date_from']);
|
||||
$date_to = str_replace("-","/",$filter['date_to']);
|
||||
$source = $filter['source'];
|
||||
$id_extra = $filter['id_extra'];
|
||||
$user_comment = $filter['user_comment'];
|
||||
|
||||
$tag_with_json = $filter['tag_with'];
|
||||
$tag_with_json_clean = io_safe_output($tag_with_json);
|
||||
@ -130,6 +133,9 @@ if ($update || $create) {
|
||||
$group_rep = get_parameter('group_rep', '');
|
||||
$date_from = get_parameter('date_from', '');
|
||||
$date_to = get_parameter('date_to', '');
|
||||
$source = get_parameter('source');
|
||||
$id_extra = get_parameter('id_extra');
|
||||
$user_comment = get_parameter('user_comment');
|
||||
|
||||
$tag_with_base64 = get_parameter('tag_with', json_encode(array()));
|
||||
$tag_with_json = io_safe_input(base64_decode($tag_with_base64));
|
||||
@ -158,6 +164,9 @@ if ($update || $create) {
|
||||
'tag_without' => $tag_without_json,
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'source' => $source,
|
||||
'id_extra' => $id_extra,
|
||||
'user_comment' => $user_comment,
|
||||
'filter_only_alert' => $filter_only_alert);
|
||||
}
|
||||
|
||||
@ -390,6 +399,15 @@ if (!is_metaconsole()) {
|
||||
$text_module, false, true, '', array(), true, $id_agent_module);
|
||||
}
|
||||
|
||||
$table ->data[22][0] = '<b>' . __('Source') . '</b>';
|
||||
$table ->data[22][1] = html_print_input_text ('source', $source, '', 35, 255, true);
|
||||
|
||||
$table ->data[23][0] = '<b>' . __('Extra ID') . '</b>';
|
||||
$table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true);
|
||||
|
||||
$table ->data[24][0] = '<b>' . __('Comment') . '</b>';
|
||||
$table ->data[24][1] = html_print_input_text ('user_comment', $user_comment, '', 35, 255, true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=edit_filter&pure='.$config['pure'].'">';
|
||||
html_print_table ($table);
|
||||
|
||||
|
@ -111,7 +111,7 @@ $table->head[2] = __('Event type');
|
||||
$table->head[3] = __('Event status');
|
||||
$table->head[4] = __('Severity');
|
||||
$table->head[5] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
@ -178,12 +178,32 @@ echo "</div>";
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$(".check_delete").prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
$("input[name=all_delete]").css("margin-left", "32px");
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -151,10 +151,13 @@ $table->head[] = __("Login Function");
|
||||
$table->head[] = __("Agent operation tab");
|
||||
$table->head[] = __("Agent godmode tab");
|
||||
$table->head[] = __("Operation");
|
||||
|
||||
/*
|
||||
$table->width = array();
|
||||
$table->width[] = '30%';
|
||||
$table->width[] = '30%';
|
||||
*/
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
|
||||
$table->align = array();
|
||||
$table->align[] = 'left';
|
||||
|
@ -32,39 +32,38 @@ if (is_ajax ()) {
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$get_group_json = (bool) get_parameter ('get_group_json');
|
||||
$get_group_agents = (bool) get_parameter ('get_group_agents');
|
||||
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
|
||||
|
||||
|
||||
if ($get_group_json) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
|
||||
|
||||
if ($id_group == 0) {
|
||||
$group = array('id_grupo' => 0,
|
||||
'nombre' => 'All',
|
||||
'nombre' => 'All',
|
||||
'icon' => 'world',
|
||||
'parent' => 0,
|
||||
'disabled' => 0,
|
||||
'custom_id' => null);
|
||||
|
||||
echo json_encode ($group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$group = db_get_row ('tgrupo', 'id_grupo', $id_group);
|
||||
|
||||
|
||||
echo json_encode ($group);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($get_group_agents) {
|
||||
ob_clean();
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
@ -86,33 +85,33 @@ if (is_ajax ()) {
|
||||
$serialized = (bool)get_parameter('serialized', false);
|
||||
$serialized_separator = (string)get_parameter('serialized_separator', "|");
|
||||
$force_serialized = (bool)get_parameter('force_serialized', false);
|
||||
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Alert Management");
|
||||
echo json_encode (false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( https_is_running() ) {
|
||||
header('Content-type: application/json');
|
||||
}
|
||||
|
||||
|
||||
if ($filter_agents_json != '') {
|
||||
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
|
||||
}
|
||||
|
||||
|
||||
if ($all_agents) {
|
||||
$filter['all_agents'] = true;
|
||||
}
|
||||
else {
|
||||
$filter['disabled'] = $disabled;
|
||||
}
|
||||
|
||||
|
||||
if ($search != '') {
|
||||
$filter['string'] = $search;
|
||||
}
|
||||
|
||||
|
||||
if ($status_agents != AGENT_STATUS_ALL) {
|
||||
$filter['status'] = $status_agents;
|
||||
}
|
||||
@ -120,10 +119,8 @@ if (is_ajax ()) {
|
||||
# Juanma (22/05/2014) Fix: If remove void agents setted
|
||||
$_sql_post = ' 1=1 ';
|
||||
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\'';
|
||||
$filter[$_sql_post] = '1';
|
||||
|
||||
}
|
||||
|
||||
$id_groups_get_agents = $id_group;
|
||||
@ -192,7 +189,7 @@ if (is_ajax ()) {
|
||||
|
||||
$agents = $all_agents_array;
|
||||
}
|
||||
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
@ -208,36 +205,68 @@ if (is_ajax ()) {
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! check_acl($config['id_user'], 0, "AW")) {
|
||||
if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Group Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||
$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'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_tree'>" .
|
||||
html_print_image(
|
||||
"images/gm_massive_operations.png",
|
||||
true,
|
||||
array (
|
||||
"title" => __('Tree Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$buttons['groups'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_groups'>" .
|
||||
html_print_image(
|
||||
"images/group.png",
|
||||
true,
|
||||
array(
|
||||
"title" => __('Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$tab = (string)get_parameter('tab', 'groups');
|
||||
|
||||
// Marks correct tab
|
||||
switch ($tab) {
|
||||
case 'tree':
|
||||
$buttons['tree']['active'] = true;
|
||||
break;
|
||||
case 'groups':
|
||||
default:
|
||||
$buttons['groups']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
|
||||
agents_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
||||
echo '<div class="notify">';
|
||||
echo __("Edit or delete groups can cause problems with synchronization");
|
||||
echo '</div>';
|
||||
|
||||
} else {
|
||||
ui_print_page_header (
|
||||
__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, $buttons
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
ui_print_page_header (__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, "");
|
||||
$sec = 'gagente';
|
||||
|
||||
}
|
||||
|
||||
|
||||
$create_group = (bool) get_parameter ('create_group');
|
||||
$update_group = (bool) get_parameter ('update_group');
|
||||
@ -258,7 +287,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
$other = (string) get_parameter ('other');
|
||||
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
|
||||
$propagate = (bool) get_parameter('propagate');
|
||||
|
||||
|
||||
/*Check if name field is empty*/
|
||||
if ($name != "") {
|
||||
if (!$check) {
|
||||
@ -275,7 +304,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
'other' => $other,
|
||||
'password' => io_safe_input($group_pass)
|
||||
);
|
||||
|
||||
|
||||
$result = db_process_sql_insert('tgrupo', $values);
|
||||
if ($result) {
|
||||
ui_print_success_message(__('Group successfully created'));
|
||||
@ -309,7 +338,7 @@ if ($update_group) {
|
||||
$description = (string) get_parameter ('description');
|
||||
$contact = (string) get_parameter ('contact');
|
||||
$other = (string) get_parameter ('other');
|
||||
|
||||
|
||||
/*Check if name field is empty*/
|
||||
if ( $name != "") {
|
||||
switch ($config["dbtype"]) {
|
||||
@ -332,7 +361,7 @@ if ($update_group) {
|
||||
else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Group successfully updated'));
|
||||
}
|
||||
@ -344,19 +373,19 @@ if ($update_group) {
|
||||
/* Delete group */
|
||||
if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
|
||||
|
||||
$usedGroup = groups_check_used($id_group);
|
||||
|
||||
|
||||
if (!$usedGroup['return']) {
|
||||
$group = db_get_row_filter('tgrupo',
|
||||
array('id_grupo' => $id_group));
|
||||
|
||||
|
||||
db_process_sql_update('tgrupo',
|
||||
array('parent' => $group['parent']), array('parent' => $id_group));
|
||||
|
||||
|
||||
$result = db_process_sql_delete('tgroup_stat',
|
||||
array('id_group' => $id_group));
|
||||
|
||||
|
||||
$result = db_process_sql_delete('tgrupo',
|
||||
array('id_grupo' => $id_group));
|
||||
}
|
||||
@ -364,136 +393,272 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
ui_print_error_message(
|
||||
sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables'])));
|
||||
}
|
||||
|
||||
|
||||
if ($result && (!$usedGroup['return'])) {
|
||||
ui_print_success_message(__('Group successfully deleted'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_print_error_message(__('There was a problem deleting group'));
|
||||
}
|
||||
}
|
||||
db_clean_cache();
|
||||
|
||||
if ($create_group || $delete_group || $update_group) {
|
||||
$groups = users_get_groups ($config['id_user'], "AR", true, true, null, 'id_grupo', false);
|
||||
$groups = groups_get_groups_tree_recursive($groups);
|
||||
} else {
|
||||
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
|
||||
if($tab == 'tree'){
|
||||
echo html_print_image('images/spinner.gif', true,
|
||||
array('class' => "loading_tree",
|
||||
'style' => 'display: none;'));
|
||||
echo "<div id='tree-controller-recipient'></div>";
|
||||
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
|
||||
$all_parents = array();
|
||||
$groups_count = 0;
|
||||
$sons = array();
|
||||
|
||||
$groups_count = count($groups);
|
||||
|
||||
foreach ($groups as $k => $g) {
|
||||
if ($g['parent'] != 0) {
|
||||
$all_parents[$g['parent']] = $g['parent'];
|
||||
}
|
||||
}
|
||||
krsort($all_parents);
|
||||
foreach ($all_parents as $parent) {
|
||||
foreach ($groups as $k => $g) {
|
||||
if ($g['parent'] == $parent) {
|
||||
$sons[$g['parent']][] = $g;
|
||||
unset($groups[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($groups)) {
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('ID');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Description');
|
||||
$table->head[5] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[2] = 'left';
|
||||
$table->align[5] = 'left';
|
||||
$table->size[4] = '30%';
|
||||
$table->size[5] = '10%';
|
||||
$table->data = array ();
|
||||
|
||||
else{
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$limit = $offset + $config['block_size'];
|
||||
|
||||
|
||||
|
||||
$pagination = ui_pagination($groups_count,
|
||||
false, 0, $config['block_size'], true, 'offset', false);
|
||||
|
||||
$n = -1;
|
||||
$iterator = 0;
|
||||
$branch_classes = array();
|
||||
foreach ($groups as $group) {
|
||||
$n++;
|
||||
|
||||
// Only print the page range
|
||||
if ($n < $offset || $n >= $limit) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$symbolBranchs = ' symbol_branch_' . $group['parent'];
|
||||
|
||||
$has_children = isset($sons[$group['id_grupo']]);
|
||||
$data = groups_get_group_to_list($group, $groups_count, $symbolBranchs, $has_children);
|
||||
array_push ($table->data, $data);
|
||||
$table->rowstyle[$iterator] = '';
|
||||
if ($group['id_grupo'] != 0) {
|
||||
$branch_classes[$group['id_grupo']] = ' branch_0';
|
||||
$table->rowclass[$iterator] = 'parent_' . $group['parent'] . ' branch_0';
|
||||
}
|
||||
$iterator++;
|
||||
|
||||
groups_print_group_sons($group, $sons, $branch_classes,
|
||||
$groups_count, $table, $iterator, $symbolBranchs);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
|
||||
echo $form;
|
||||
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
FROM tgrupo t
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[0] = '3%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '5%';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$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'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
}
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
echo $pagination;
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
echo $pagination;
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, "PM")) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
|
||||
echo '<div class="action-buttons" style="width:100%;">';
|
||||
html_print_submit_button (__('Create group'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file("TreeController", "include/javascript/tree/");
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$tab = "group_edition";
|
||||
|
||||
?>
|
||||
|
||||
<?php if (!is_metaconsole()){ ?>
|
||||
<script type="text/javascript" src="include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php }else{ ?>
|
||||
<script type="text/javascript" src="../../include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function showBranch(parent) {
|
||||
display = $('.parent_' + parent).css('display');
|
||||
|
||||
if (display != 'none') {
|
||||
$('.symbol_' + parent).html('+');
|
||||
$('.parent_' + parent).css('display', 'none');
|
||||
|
||||
//Close the child branch too
|
||||
$('.branch_' + parent).css('display', 'none');
|
||||
$('.symbol_branch_' + parent).html('+');
|
||||
}
|
||||
else {
|
||||
$('.symbol_' + parent).html('-');
|
||||
$('.parent_' + parent).css('display', '');
|
||||
}
|
||||
}
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
parameters['type'] = "<?php echo $tab; ?>";
|
||||
parameters['filter'] = {};
|
||||
parameters['filter']['searchGroup'] = '';
|
||||
parameters['filter']['searchAgent'] = '';
|
||||
parameters['filter']['statusAgent'] = '';
|
||||
parameters['filter']['searchModule'] = '';
|
||||
parameters['filter']['statusModule'] = '';
|
||||
parameters['filter']['groupID'] = '';
|
||||
parameters['filter']['tagID'] = '';
|
||||
parameters['filter']['searchHirearchy'] = 1;
|
||||
parameters['filter']['show_not_init_agents'] = 1;
|
||||
parameters['filter']['show_not_init_modules'] = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
|
||||
treeController.init({
|
||||
recipient: $("div#tree-controller-recipient"),
|
||||
//detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }),
|
||||
page: parameters['page'],
|
||||
emptyMessage: "<?php echo __('No data found'); ?>",
|
||||
foundMessage: "<?php echo __('Found groups'); ?>",
|
||||
tree: data.tree,
|
||||
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
|
||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
filter: parameters['filter'],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "<?php echo __('Total agents'); ?>",
|
||||
modules: "<?php echo __('Total modules'); ?>",
|
||||
none: "<?php echo __('Total'); ?>"
|
||||
},
|
||||
alerts: {
|
||||
agents: "<?php echo __('Fired alerts'); ?>",
|
||||
modules: "<?php echo __('Fired alerts'); ?>",
|
||||
none: "<?php echo __('Fired alerts'); ?>"
|
||||
},
|
||||
critical: {
|
||||
agents: "<?php echo __('Critical agents'); ?>",
|
||||
modules: "<?php echo __('Critical modules'); ?>",
|
||||
none: "<?php echo __('Critical'); ?>"
|
||||
},
|
||||
warning: {
|
||||
agents: "<?php echo __('Warning agents'); ?>",
|
||||
modules: "<?php echo __('Warning modules'); ?>",
|
||||
none: "<?php echo __('Warning'); ?>"
|
||||
},
|
||||
unknown: {
|
||||
agents: "<?php echo __('Unknown agents'); ?>",
|
||||
modules: "<?php echo __('Unknown modules'); ?>",
|
||||
none: "<?php echo __('Unknown'); ?>"
|
||||
},
|
||||
not_init: {
|
||||
agents: "<?php echo __('Not init agents'); ?>",
|
||||
modules: "<?php echo __('Not init modules'); ?>",
|
||||
none: "<?php echo __('Not init'); ?>"
|
||||
},
|
||||
ok: {
|
||||
agents: "<?php echo __('Normal agents'); ?>",
|
||||
modules: "<?php echo __('Normal modules'); ?>",
|
||||
none: "<?php echo __('Normal'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
</script>
|
||||
|
@ -48,7 +48,7 @@ if ($create_profiles) {
|
||||
// If the profile doesnt exist, we create it
|
||||
if ($profile_data === false) {
|
||||
db_pandora_audit("User management",
|
||||
"Added profile for user ".io_safe_input($user));
|
||||
"Added profile for user ".io_safe_output($user));
|
||||
$return = profile_create_user_profile ($user, $profile, $group);
|
||||
if ($return !== false) {
|
||||
$n_added ++;
|
||||
|
@ -1,249 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 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
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access massive tag addition");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_tags.php');
|
||||
|
||||
function process_manage_add ($id_agents, $modules, $id_tags) {
|
||||
|
||||
if (empty ($id_agents) || $id_agents[0] == 0) {
|
||||
ui_print_error_message(__('No agents selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($modules)) {
|
||||
ui_print_error_message(__('No modules selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($id_tags)) {
|
||||
ui_print_error_message(__('No tags selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$modules_id = array();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($modules) == 1 && $modules[0] == '0') {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$modules_temp = agents_get_modules($id_agent);
|
||||
foreach ($modules_temp as $id_module => $name_module) {
|
||||
$modules_id[] = $id_module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$conttotal = 0;
|
||||
$contsuccess = 0;
|
||||
foreach ($modules_id as $id_module) {
|
||||
$err_count = tags_insert_module_tag($id_module, $id_tags);
|
||||
|
||||
if ($err_count == 0) {
|
||||
$contsuccess ++;
|
||||
}
|
||||
|
||||
$conttotal ++;
|
||||
}
|
||||
|
||||
if ($contsuccess > 0) {
|
||||
db_pandora_audit("Massive management", "Add tags", false, false,
|
||||
"");
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to add tags",
|
||||
false, false, "");
|
||||
}
|
||||
|
||||
ui_print_result_message ($contsuccess > 0,
|
||||
__('Successfully added') . "(" . $contsuccess . "/" . $conttotal . ")",
|
||||
__('Could not be added'));
|
||||
|
||||
}
|
||||
|
||||
$id_agents = get_parameter ('id_agents');
|
||||
$id_tags = get_parameter ('id_tags');
|
||||
$modules = get_parameter ('module');
|
||||
|
||||
$add = (bool) get_parameter_post ('add');
|
||||
|
||||
if ($add) {
|
||||
process_manage_add ($id_agents, $modules, $id_tags);
|
||||
}
|
||||
|
||||
$groups = users_get_groups ();
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
|
||||
$return_all_group = false;
|
||||
else
|
||||
$return_all_group = true;
|
||||
|
||||
$table->id = 'add_table';
|
||||
$table->width = '98%';
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '40%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '40%';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(false, "AW",
|
||||
$return_all_group, 'id_group', 0, '', 'Select', -1, true, false,
|
||||
true, '', false, 'width:180px;');
|
||||
|
||||
$table->data[1][0] = __('Agents');
|
||||
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
|
||||
$table->data[1][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[1][0] .= '</span>';
|
||||
|
||||
$agents = agents_get_group_agents(
|
||||
array_keys(users_get_groups ($config["id_user"], "AW", false)));
|
||||
$table->data[1][1] = html_print_select ($agents,
|
||||
'id_agents[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
|
||||
|
||||
$table->data[1][2] = __('Modules');
|
||||
$table->data[1][2] .= '<span id="module_loading" class="invisible">';
|
||||
$table->data[1][2] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[1][2] .= '</span>';
|
||||
$table->data[1][3] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
|
||||
html_print_select (array(), 'module[]', '', false, '', '', true, true, false, '', false, 'width:180px;');
|
||||
|
||||
|
||||
$table->data[2][0] = __('Tags');
|
||||
$tags = tags_get_all_tags();
|
||||
$table->data[2][1] = html_print_select ($tags,
|
||||
'id_tags[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
|
||||
|
||||
|
||||
echo '<form method="post"
|
||||
id="form_tags"
|
||||
action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_tags">';
|
||||
html_print_table ($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
html_print_input_hidden ('add', 1);
|
||||
|
||||
html_print_submit_button (__('Add'), 'go', false, 'class="sub add"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
// TODO: Change to iu_print_error system
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
//Hack to translate text "none" in PHP to javascript
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
|
||||
ui_require_jquery_file ('form');
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$("#checkbox-recursion").click(function () {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
|
||||
$("#id_group").change (function () {
|
||||
var $select = $("#id_agents").enable ();
|
||||
$("#agent_loading").show ();
|
||||
$("option", $select).remove ();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/massive/massive_add_alerts",
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_agents").append (options);
|
||||
$("#agent_loading").hide ();
|
||||
$select.enable ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#id_group").value = "0";
|
||||
|
||||
$("#id_group").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
$("#id_group").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
$("#id_agents").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
$("#id_agents").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
$("#module").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
$("#module").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_agents").trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
@ -52,6 +52,8 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
|
||||
global $config;
|
||||
|
||||
$status_module = (int) get_parameter ('status_module');
|
||||
|
||||
if (empty ($module_name)) {
|
||||
ui_print_error_message(__('No module selected'));
|
||||
return false;
|
||||
@ -76,144 +78,18 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1))
|
||||
$filter_for_module_deletion = false;
|
||||
else
|
||||
$filter_for_module_deletion = sprintf('nombre IN ("%s")', implode('","', $module_name));
|
||||
$filter_for_module_deletion = sprintf('tagente_modulo.nombre IN ("%s")', implode('","', $module_name));
|
||||
|
||||
if ($config['dbtype'] == "oracle") {
|
||||
$all_agent_modules = false;
|
||||
if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1)) {
|
||||
$all_agent_modules = true;
|
||||
}
|
||||
$names_to_long = array();
|
||||
$i = 0;
|
||||
foreach ($module_name as $name) {
|
||||
if (strlen($name) > 30) {
|
||||
$original_names[] = $module_name[$i];
|
||||
unset($module_name[$i]);
|
||||
$names_to_long[] = substr($name, 0, 28) . "%";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$modules = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE";
|
||||
$modules .= sprintf(" id_agente IN (%s)", implode(",", $id_agents));
|
||||
if (!empty($module_name) && (!$all_agent_modules)) {
|
||||
$modules .= sprintf(" AND nombre IN ('%s')", implode("','", $module_name));
|
||||
}
|
||||
$modules = db_get_all_rows_sql($modules);
|
||||
$modules2 = "";
|
||||
if (!empty($names_to_long) && (!$all_agent_modules)) {
|
||||
$modules2 = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE";
|
||||
$modules2 .= sprintf(" id_agente IN (%s) AND (", implode(",", $id_agents));
|
||||
$j = 0;
|
||||
foreach ($names_to_long as $name) {
|
||||
if ($j == 0) {
|
||||
$modules2 .= "nombre LIKE ('" . $name . "')";
|
||||
}
|
||||
else {
|
||||
$modules2 .= " OR nombre LIKE ('" . $name . "')";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
$modules2 .= ")";
|
||||
$modules2 = db_get_all_rows_sql($modules2);
|
||||
$modules = array_merge($modules, $modules2);
|
||||
}
|
||||
$all_names = array();
|
||||
foreach ($modules as $module) {
|
||||
$all_modules[] = $module['id_agente_modulo'];
|
||||
$all_names[] = $module['nombre'];
|
||||
}
|
||||
$modules = $all_modules;
|
||||
$modules = array_unique($modules);
|
||||
if (!empty($names_to_long) && (!$all_agent_modules)) {
|
||||
$j = 0;
|
||||
foreach ($all_names as $name) {
|
||||
if (strlen($name) > 30) {
|
||||
if (!in_array($name, $original_names)) {
|
||||
unset($modules[$j]);
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
$filter_for_module_deletion, true);
|
||||
}
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
$filter_for_module_deletion, true);
|
||||
}
|
||||
else {
|
||||
if ($config['dbtype'] == "oracle") {
|
||||
$all_agent_modules = false;
|
||||
$names_to_long = array();
|
||||
if (($module_name[0] == "0") and (is_array($module_name)) and (count($module_name) == 1)) {
|
||||
$all_agent_modules = true;
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($module_name as $name) {
|
||||
if (strlen($name) > 30) {
|
||||
$original_names[] = $module_name[$i];
|
||||
unset($module_name[$i]);
|
||||
$names_to_long[] = substr($name, 0, 28) . "%";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$modules = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE";
|
||||
$any_agent = false;
|
||||
if ($id_agents == null) {
|
||||
$any_agent = true;
|
||||
}
|
||||
if (!empty($id_agents)) {
|
||||
$modules .= sprintf(" id_agente IN (%s)", implode(",", $id_agents));
|
||||
$agents_selected = true;
|
||||
}
|
||||
if (!empty($module_name) && (!$all_agent_modules)) {
|
||||
if ($any_agent) {
|
||||
$modules .= sprintf(" nombre IN ('%s')", implode("','", $module_name));
|
||||
}
|
||||
else {
|
||||
$modules .= sprintf(" AND nombre IN ('%s')", implode("','", $module_name));
|
||||
}
|
||||
}
|
||||
$modules = db_get_all_rows_sql($modules);
|
||||
if (!empty($names_to_long) && (!$all_agent_modules)) {
|
||||
$modules2 = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE";
|
||||
$modules2 .= sprintf(" id_agente IN (%s) AND (", implode(",", $id_agents));
|
||||
$j = 0;
|
||||
foreach ($names_to_long as $name) {
|
||||
if ($j == 0) {
|
||||
$modules2 .= "nombre LIKE ('" . $name . "')";
|
||||
}
|
||||
else {
|
||||
$modules2 .= " OR nombre LIKE ('" . $name . "')";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
$modules2 .= ")";
|
||||
$modules2 = db_get_all_rows_sql($modules2);
|
||||
$modules = array_merge($modules, $modules2);
|
||||
}
|
||||
$all_names = array();
|
||||
foreach ($modules as $module) {
|
||||
$all_modules[] = $module['id_agente_modulo'];
|
||||
$all_names[] = $module['nombre'];
|
||||
}
|
||||
$modules = $all_modules;
|
||||
$modules = array_unique($modules);
|
||||
if (!empty($names_to_long) && (!$all_agent_modules)) {
|
||||
$j = 0;
|
||||
foreach ($all_names as $name) {
|
||||
if (strlen($name) > 30) {
|
||||
if (!in_array($name, $original_names)) {
|
||||
unset($modules[$j]);
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($status_module != -1) {
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||
sprintf('tagente_modulo.nombre IN ("%s") AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true);
|
||||
} else {
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
'tagente_modulo.nombre IN ("' . implode('","',$module_name) . '")', true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,12 +108,7 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
}
|
||||
|
||||
$count_deleted_modules = count($modules);
|
||||
if ($config['dbtype'] == "oracle") {
|
||||
$success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules)));
|
||||
}
|
||||
else {
|
||||
$success = modules_delete_agent_module ($modules);
|
||||
}
|
||||
$success = modules_delete_agent_module ($modules);
|
||||
|
||||
if (! $success) {
|
||||
ui_print_error_message(
|
||||
@ -254,8 +125,6 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
}
|
||||
|
||||
$module_type = (int) get_parameter ('module_type');
|
||||
$idGroupMassive = (int) get_parameter('id_group_massive');
|
||||
$idAgentMassive = (int) get_parameter('id_agent_massive');
|
||||
$group_select = get_parameter('groups_select');
|
||||
|
||||
$delete = (bool) get_parameter_post ('delete');
|
||||
@ -277,9 +146,7 @@ if ($delete) {
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id(io_safe_output($agent_name));
|
||||
}
|
||||
$agents_ = $agents_select;
|
||||
$modules_ = $module_name;
|
||||
break;
|
||||
case 'agents':
|
||||
@ -362,60 +229,40 @@ $groups = users_get_groups ();
|
||||
|
||||
$agents = agents_get_group_agents (array_keys (users_get_groups ()),
|
||||
false, "none");
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
|
||||
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
|
||||
'id_agente' => array_keys ($agents),
|
||||
'disabled' => 0,
|
||||
'order' => 'ttipo_modulo.nombre'),
|
||||
array ('DISTINCT(id_tipo)',
|
||||
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'));
|
||||
break;
|
||||
case "oracle":
|
||||
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
|
||||
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
|
||||
'id_agente' => array_keys ($agents),
|
||||
'disabled' => 0,
|
||||
'order' => 'ttipo_modulo.nombre'),
|
||||
array ('ttipo_modulo.id_tipo',
|
||||
'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description'));
|
||||
break;
|
||||
case "postgresql":
|
||||
$module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo',
|
||||
array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
|
||||
'id_agente' => array_keys ($agents),
|
||||
'disabled' => 0,
|
||||
'order' => 'description'),
|
||||
array ('DISTINCT(id_tipo)',
|
||||
'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description'));
|
||||
break;
|
||||
}
|
||||
$module_types = db_get_all_rows_filter (
|
||||
'tagente_modulo,ttipo_modulo',
|
||||
array (
|
||||
'tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo',
|
||||
'id_agente' => array_keys ($agents),
|
||||
'disabled' => 0,
|
||||
'order' => 'ttipo_modulo.nombre'
|
||||
), array (
|
||||
'DISTINCT(id_tipo)',
|
||||
'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description'
|
||||
)
|
||||
);
|
||||
|
||||
if ($module_types === false)
|
||||
$module_types = array ();
|
||||
|
||||
$types = '';
|
||||
$types = array();
|
||||
foreach ($module_types as $type) {
|
||||
$types[$type['id_tipo']] = $type['description'];
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->data = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
|
||||
|
||||
|
||||
$table->data['selection_mode'][0] = __('Selection mode');
|
||||
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
|
||||
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
|
||||
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
|
||||
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
|
||||
|
||||
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
||||
$table->data['form_modules_1'][0] = __('Module type');
|
||||
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
|
||||
@ -428,9 +275,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types, 'module_type', ''
|
||||
'width:100%');
|
||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||
html_print_checkbox_extended("force_type", 'type', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
|
||||
|
||||
'style="margin-right: 40px;"', true, '');
|
||||
|
||||
$modules = array ();
|
||||
if ($module_type != '') {
|
||||
@ -439,9 +284,8 @@ if ($module_type != '') {
|
||||
else {
|
||||
$filter = false;
|
||||
}
|
||||
|
||||
$names = agents_get_modules (array_keys ($agents),
|
||||
'DISTINCT(nombre)', $filter, false);
|
||||
'DISTINCT(tagente_modulo.nombre)', $filter, false);
|
||||
foreach ($names as $name) {
|
||||
$modules[$name['nombre']] = $name['nombre'];
|
||||
}
|
||||
@ -542,6 +386,9 @@ echo '</form>';
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
ui_require_jquery_file ('form');
|
||||
//Hack to translate text "none" in PHP to javascript
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo '<span id ="select_agent_first_text" style="display: none;">' . __('Please, select an agent first') . '</span>';
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
|
||||
if ($selection_mode == 'modules') {
|
||||
|
@ -1,305 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 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
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "AW")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access massive tag deletion");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_tags.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$get_agents = (bool)get_parameter('get_agents', false);
|
||||
$get_modules = (bool)get_parameter('get_modules', false);
|
||||
|
||||
if ($get_agents) {
|
||||
$id_tag = (int)get_parameter('id_tag', 0);
|
||||
|
||||
$agents = tags_get_agents($id_tag);
|
||||
|
||||
if (!empty($agents)) {
|
||||
$temp = array();
|
||||
foreach ($agents as $id_agent) {
|
||||
$temp[$id_agent] = agents_get_name($id_agent);
|
||||
}
|
||||
$agents = $temp;
|
||||
}
|
||||
|
||||
echo json_encode($agents);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_modules) {
|
||||
$id_tag = (int)get_parameter('id_tag', 0);
|
||||
$id_agents = (array)get_parameter('id_agents', array());
|
||||
|
||||
if (!empty($id_agents)) {
|
||||
|
||||
foreach ($id_agents as $key => $id) {
|
||||
$id_agents[$key] = (int)$id;
|
||||
}
|
||||
|
||||
$data = db_get_all_rows_sql("
|
||||
SELECT nombre
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (" . implode(',', $id_agents) . ")
|
||||
AND id_agente_modulo IN (
|
||||
SELECT t1.id_agente_modulo
|
||||
FROM ttag_module t1
|
||||
WHERE id_tag = " . $id_tag . "
|
||||
AND id_policy_module = 0)
|
||||
GROUP BY nombre;");
|
||||
|
||||
if (empty($data)) {
|
||||
echo json_encode(array());
|
||||
}
|
||||
else {
|
||||
$modules = array();
|
||||
foreach ($data as $row) {
|
||||
$modules[] = $row['nombre'];
|
||||
}
|
||||
|
||||
echo json_encode($modules);
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo json_encode(array());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function process_manage_delete ($id_agents, $modules, $id_tag) {
|
||||
|
||||
if (empty ($id_agents) || $id_agents[0] == 0) {
|
||||
ui_print_error_message(__('No agents selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($modules) || $modules[0] == "0") {
|
||||
ui_print_error_message(__('No modules selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty ($id_tag)) {
|
||||
ui_print_error_message(__('No tag selected'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$modules_id = array();
|
||||
foreach ($modules as $module) {
|
||||
$data = db_get_all_rows_sql("
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre = '" . $module . "'
|
||||
AND id_agente IN (" . implode(",", $id_agents) . ")
|
||||
");
|
||||
|
||||
if (empty($data)) {
|
||||
$data = array();
|
||||
}
|
||||
|
||||
foreach ($data as $row) {
|
||||
$modules_id[$row['id_agente_modulo']] = $row['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
|
||||
$conttotal = 0;
|
||||
$contsuccess = 0;
|
||||
foreach ($modules_id as $id_module) {
|
||||
$success = tags_remove_tag($id_tag, $id_module);
|
||||
|
||||
if ($success) {
|
||||
$contsuccess ++;
|
||||
}
|
||||
|
||||
$conttotal ++;
|
||||
}
|
||||
|
||||
if ($contsuccess > 0) {
|
||||
db_pandora_audit("Massive management", "Delete tags", false, false,
|
||||
"");
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Massive management", "Fail try to delete tags",
|
||||
false, false, "");
|
||||
}
|
||||
|
||||
ui_print_result_message ($contsuccess > 0,
|
||||
__('Successfully deleted') . "(" . $contsuccess . "/" . $conttotal . ")",
|
||||
__('Could not be deleted'));
|
||||
|
||||
}
|
||||
|
||||
$id_agents = get_parameter ('id_agents');
|
||||
$id_tag = (int)get_parameter ('id_tag');
|
||||
$modules = get_parameter ('modules');
|
||||
|
||||
$delete = (bool) get_parameter_post ('delete');
|
||||
|
||||
if ($delete) {
|
||||
process_manage_delete ($id_agents, $modules, $id_tag);
|
||||
}
|
||||
|
||||
$groups = users_get_groups ();
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
|
||||
$return_all_group = false;
|
||||
else
|
||||
$return_all_group = true;
|
||||
|
||||
$table->id = 'add_table';
|
||||
$table->width = '98%';
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold; vertical-align:top';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '40%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '40%';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
$table->data[0][0] = __('Tags');
|
||||
$tags = tags_get_all_tags();
|
||||
$table->data[0][1] = html_print_select ($tags,
|
||||
'id_tag', '', '', '', '', true, false, true, '', false, 'min-width:180px;');
|
||||
|
||||
$table->data[1][0] = __('Agents');
|
||||
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
|
||||
$table->data[1][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[1][0] .= '</span>';
|
||||
$table->data[1][1] = html_print_select (array(),
|
||||
'id_agents[]', '', '', '', '', true, true, true, '', false, 'min-width:180px;');
|
||||
|
||||
$table->data[2][0] = __('Modules');
|
||||
$table->data[2][0] .= '<span id="modules_loading" class="invisible">';
|
||||
$table->data[2][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[2][0] .= '</span>';
|
||||
$table->data[2][1] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
|
||||
html_print_select (array(), 'modules[]', '', false, '', '', true, true, false, '', false, 'min-width:180px;');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<form method="post"
|
||||
id="form_tags"
|
||||
action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_tags">';
|
||||
html_print_table ($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
html_print_input_hidden ('delete', 1);
|
||||
|
||||
html_print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
// TODO: Change to iu_print_error system
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
//Hack to translate text "none" in PHP to javascript
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
|
||||
ui_require_jquery_file ('form');
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$("#id_tag").change(function() {
|
||||
|
||||
$("#agent_loading").show();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/massive/massive_delete_tags",
|
||||
"get_agents" : 1,
|
||||
"id_tag" : this.value,
|
||||
},
|
||||
function (data, status) {
|
||||
$("#id_agents").empty();
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
if (options == "") {
|
||||
$("#id_agents").append(
|
||||
"<option value=\"0\"><?php echo __('None');?></option>");
|
||||
}
|
||||
else {
|
||||
$("#id_agents").append (options);
|
||||
}
|
||||
$("#agent_loading").hide ();
|
||||
|
||||
$("#id_agents").trigger('change');
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
//~ $("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
$("#id_agents").change(function() {
|
||||
//Fill modules
|
||||
|
||||
|
||||
$("#modules_loading").show();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/massive/massive_delete_tags",
|
||||
"get_modules" : 1,
|
||||
"id_tag": $("#id_tag").val(),
|
||||
"id_agents[]" : $("#id_agents").val(),
|
||||
},
|
||||
function (data, status) {
|
||||
$("#modules").empty();
|
||||
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
options += "<option value=\""+value+"\">"+value+"</option>";
|
||||
});
|
||||
if (options == "") {
|
||||
$("#modules").append(
|
||||
"<option value=\"0\"><?php echo __('None');?></option>");
|
||||
}
|
||||
else {
|
||||
$("#modules").append (options);
|
||||
}
|
||||
$("#modules_loading").hide ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$("#id_tag").trigger('change');
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
@ -30,6 +30,7 @@ require_once ('include/functions_modules.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once ('include/functions_users.php');
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
|
||||
@ -136,8 +137,11 @@ if ($update_agents) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
$group_old = false;
|
||||
if($values['id_grupo']){
|
||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
||||
$disabled_old = false;
|
||||
if($values['id_grupo'] || isset($values['disabled'])){
|
||||
$values_old = db_get_row_filter('tagente', array('id_agente' => $id_agent), array('id_grupo', 'disabled'));
|
||||
if ($values_old['id_grupo']) $group_old = $values_old['id_grupo'];
|
||||
if (isset($values['disabled'])) $disabled_old = $values_old['disabled'];
|
||||
}
|
||||
|
||||
$result = db_process_sql_update ('tagente',
|
||||
@ -149,7 +153,14 @@ if ($update_agents) {
|
||||
// Force an update of the agent cache.
|
||||
$result_metaconsole = agent_update_from_cache($id_agent,$values,$server_name);
|
||||
}
|
||||
|
||||
|
||||
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agent, 'standby', $values['disabled'])
|
||||
);
|
||||
}
|
||||
|
||||
if($group_old || $result){
|
||||
if ($group_old && $group_old != null) {
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
@ -327,6 +338,7 @@ $agents = agents_get_group_agents (array_keys ($groups));
|
||||
|
||||
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
|
||||
WHERE id_agente = " . $id_parent);
|
||||
if ($modules === false) $modules = array();
|
||||
|
||||
$modules_values = array();
|
||||
$modules_values[0] = __('Any');
|
||||
@ -421,7 +433,9 @@ $table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extende
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[2][0] = __('Status');
|
||||
$table->data[2][1] = __('No change').' '.html_print_radio_button_extended ("disabled", -1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled').' '.html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Remote configuration
|
||||
|
@ -47,17 +47,21 @@ $update = (bool) get_parameter_post ('update');
|
||||
if ($update) {
|
||||
$agents_ = '';
|
||||
if ($selection_mode == 'modules') {
|
||||
|
||||
$agents_ = array();
|
||||
|
||||
$force = get_parameter('force_type', false);
|
||||
|
||||
if ($agents_select == false) {
|
||||
$agents_select = array();
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id($agent_name);
|
||||
}
|
||||
|
||||
$modules_ = $module_name;
|
||||
|
||||
}
|
||||
else if ($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
@ -75,6 +79,7 @@ if ($update) {
|
||||
// If the option to select all of one group or module type is checked
|
||||
if ($force) {
|
||||
if ($force == 'type') {
|
||||
|
||||
$type_condition = '';
|
||||
if ($module_type != 0)
|
||||
$type_condition = "AND tam.id_tipo_modulo = $module_type";
|
||||
@ -141,12 +146,11 @@ if ($update) {
|
||||
else {
|
||||
// Standard procedure
|
||||
foreach ($agents_ as $agent_) {
|
||||
|
||||
|
||||
if ($modules_ == false)
|
||||
$modules_ = array();
|
||||
|
||||
foreach ($modules_ as $module_) {
|
||||
|
||||
$result = process_manage_edit ($module_, $agent_, $modules_selection_mode);
|
||||
$count++;
|
||||
$success += (int)$result;
|
||||
@ -267,7 +271,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types,
|
||||
|
||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||
html_print_checkbox_extended ("force_type", 'type', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
'style="margin-right: 40px;"', true, '');
|
||||
|
||||
$modules = array ();
|
||||
if ($module_type != '') {
|
||||
@ -278,7 +282,7 @@ else {
|
||||
}
|
||||
|
||||
$names = agents_get_modules (array_keys ($agents),
|
||||
'DISTINCT(nombre)', $filter, false);
|
||||
'DISTINCT(tagente_modulo.nombre)', $filter, false);
|
||||
foreach ($names as $name) {
|
||||
$modules[$name['nombre']] = $name['nombre'];
|
||||
}
|
||||
@ -331,6 +335,7 @@ $table->data['form_modules_2'][2] .= html_print_select (
|
||||
'all' => __('Show all agents')),
|
||||
'agents_selection_mode',
|
||||
'common', false, '', '', true);
|
||||
|
||||
$table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]',
|
||||
$agents_select, false, __('None'), 0, true, true, false);
|
||||
|
||||
@ -704,6 +709,7 @@ echo '</form>';
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
//Hack to translate text "none" in PHP to javascript
|
||||
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||
echo '<span id ="select_agent_first_text" style="display: none;">' . __('Please, select an agent first') . '</span>';
|
||||
ui_require_jquery_file ('pandora.controls');
|
||||
|
||||
if ($selection_mode == 'modules') {
|
||||
@ -1540,12 +1546,14 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
$update_tags = get_parameter('id_tag', false);
|
||||
|
||||
if (array_search(0, $agents_select) !== false) {
|
||||
|
||||
//Apply at All agents.
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
$filter_modules,
|
||||
array ('id_agente_modulo'));
|
||||
}
|
||||
else {
|
||||
|
||||
if ($module_name == "0") {
|
||||
//Any module
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
@ -1559,7 +1567,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
array ('id_agente_modulo'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($modules === false)
|
||||
return false;
|
||||
|
||||
@ -1575,16 +1584,16 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
}
|
||||
$modules = $modules_to_delete;
|
||||
}
|
||||
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
$result = modules_update_agent_module(
|
||||
$module['id_agente_modulo'], $values, true, $update_tags);
|
||||
|
||||
if (is_error($result)) {
|
||||
|
||||
|
||||
if (is_error($result))
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -193,7 +193,7 @@ $table->class = 'databox data';
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
@ -250,12 +250,31 @@ enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop('checked')) {
|
||||
$(".check_delete").prop('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -568,8 +568,7 @@ $table->head[3] = __('Description');
|
||||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size = array ();
|
||||
$table->size[1] = '75px';
|
||||
$table->size[6] = '80px';
|
||||
@ -650,12 +649,30 @@ enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop("checked")) {
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -125,7 +125,7 @@ $table->data[4][1] .= html_print_input_text ('max_warning', $max_warning,
|
||||
'', 5, 15, true) . '</span>';
|
||||
$table->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').' </em> ';
|
||||
$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
||||
'', 5, 15, true) . '</span>';
|
||||
'', 5, 64, true) . '</span>';
|
||||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
@ -142,7 +142,7 @@ $table->data[5][1] .= html_print_input_text ('max_critical', $max_critical,
|
||||
'', 5, 15, true) . '</span>';
|
||||
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
||||
$table->data[5][1] .= html_print_input_text ('str_critical', $str_critical,
|
||||
'', 5, 15, true) . '</span>';
|
||||
'', 5, 64, true) . '</span>';
|
||||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true);
|
||||
|
||||
|
@ -34,7 +34,7 @@ push_table_row ($data, 'plugin_1');
|
||||
$data = array ();
|
||||
$data[0] = 'macro_desc';
|
||||
$data[0] .= ui_print_help_tip ('macro_help', true);
|
||||
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 255, true);
|
||||
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 1024, true);
|
||||
$table->colspan['macro_field'][1] = 3;
|
||||
$table->rowstyle['macro_field'] = 'display:none';
|
||||
|
||||
@ -51,9 +51,9 @@ if (!empty($macros)) {
|
||||
$data[0] .= ui_print_help_tip ($m['help'], true);
|
||||
}
|
||||
if ($m['hide'] == 1) {
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 15, 60, true);
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true);
|
||||
} else {
|
||||
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 15, 60, true);
|
||||
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
|
||||
}
|
||||
$table->colspan['macro'.$m['macro']][1] = 3;
|
||||
$table->rowclass['macro'.$m['macro']] = 'macro_field';
|
||||
|
@ -239,16 +239,33 @@ echo '</div></form>';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// If you click on the input type checkbox with id checkbox-all_delete
|
||||
$('#checkbox-all_delete').click(function() {
|
||||
// If selected (if the checked property equals true)
|
||||
if ($(this).prop('checked')) {
|
||||
// Select each input that has the class .check_delete
|
||||
$('.check_delete').prop('checked', true);
|
||||
} else {
|
||||
// deselect every input that has the class .check_delete
|
||||
$('.check_delete').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
// If you click on the input type checkbox with id checkbox-all_delete
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
// If selected (if the checked property equals true)
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
// Select each input that has the class .check_delete
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
// deselect every input that has the class .check_delete
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -119,8 +119,7 @@ $table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
@ -174,12 +173,30 @@ enterprise_hook('close_meta_frame');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").attr('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -195,7 +195,8 @@ if ($add_module) {
|
||||
"')");
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
||||
|
||||
$order = $order['field_order'];
|
||||
foreach($id_agent_modules as $id_agent_module){
|
||||
$order++;
|
||||
@ -207,8 +208,13 @@ if ($add_module) {
|
||||
}
|
||||
|
||||
if ($delete_module) {
|
||||
$id_graph = get_parameter('id');
|
||||
|
||||
$deleteGraph = get_parameter('delete');
|
||||
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
|
||||
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
|
||||
db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
|
||||
|
||||
}
|
||||
|
||||
if ($change_weight) {
|
||||
|
@ -66,7 +66,6 @@ if ($enterpriseEnable) {
|
||||
}
|
||||
|
||||
$subsection = reporting_enterprise_add_graph_template_subsection('', $buttons);
|
||||
reporting_enterprise_select_graph_template_tab();
|
||||
|
||||
$buttons['graph_container'] = array('active' => true,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
|
||||
|
@ -168,8 +168,7 @@ if (!empty ($graphs)) {
|
||||
$op_column = true;
|
||||
$table->align[4] = 'left';
|
||||
$table->head[4] = __('Op.') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[4] = '90px';
|
||||
}
|
||||
$table->data = array ();
|
||||
@ -236,13 +235,29 @@ else {
|
||||
|
||||
$("input[name=all_delete]").css("margin-left", "32px");
|
||||
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop("checked")) {
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
}
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -1087,6 +1087,34 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
|
||||
if ((empty($agents2)) || $agents2 == -1) $agents = array();
|
||||
|
||||
$agents_select = array();
|
||||
if (is_array($id_agents) || is_object($id_agents)){
|
||||
foreach ($id_agents as $id) {
|
||||
foreach ($agents2 as $key => $a) {
|
||||
if ($key == (int)$id) {
|
||||
$agents_select[$key] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
html_print_select($agents2, 'id_agents3[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||
echo "<span id='spinner_hack' style='display:none;'>" . html_print_image('images/spinner.gif', true) . "</span>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="agents_modules_row" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$all_agent_log = agents_get_agents(false,array('id_agente','alias'));
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
|
||||
// $agents = agents_get_group_agents($group);
|
||||
if ((empty($agents2)) || $agents2 == -1) $agents = array();
|
||||
|
||||
@ -1101,7 +1129,6 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||
}
|
||||
}
|
||||
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||
echo "<span id='spinner_hack' style='display:none;'>" . html_print_image('images/spinner.gif', true) . "</span>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -2862,6 +2889,7 @@ function chooseType() {
|
||||
$("#row_percentil").hide();
|
||||
$("#log_help_tip").css("visibility", "hidden");
|
||||
$("#agents_row").hide();
|
||||
$("#agents_modules_row").hide();
|
||||
$("#select_agent_modules").hide();
|
||||
$("#modules_row").hide();
|
||||
$("#row_show_summary_group").hide();
|
||||
@ -3328,7 +3356,7 @@ function chooseType() {
|
||||
$("#row_group").show();
|
||||
$("#row_module_group").show();
|
||||
$("#select_agent_modules").show();
|
||||
$("#agents_row").show();
|
||||
$("#agents_modules_row").show();
|
||||
$("#modules_row").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
@ -3499,7 +3527,7 @@ function set_last_value_period() {
|
||||
}
|
||||
|
||||
function source_change_agents() {
|
||||
$("#id_agents2").empty();
|
||||
$("#id_agents3").empty();
|
||||
$("#spinner_hack").show();
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
@ -3508,7 +3536,7 @@ function source_change_agents() {
|
||||
},
|
||||
function (data, status) {
|
||||
for (var clave in data) {
|
||||
$("#id_agents2").append('<option value="'+clave+'">'+data[clave]+'</option>');
|
||||
$("#id_agents3").append('<option value="'+clave+'">'+data[clave]+'</option>');
|
||||
}
|
||||
$("#spinner_hack").hide();
|
||||
},
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user