Merge branch 'develop' into 'ent-6858-Goliat-opensource'

# Conflicts:
#   pandora_console/extras/delete_files/delete_files.txt
This commit is contained in:
José González 2021-05-11 13:11:51 +00:00
commit 5aa5e9eab4
302 changed files with 31139 additions and 22827 deletions

View File

@ -0,0 +1,169 @@
#!/bin/bash
#export PANDORA_SERVER_IP='newdemos.artica.es' && curl -sSL http://firefly.artica.es/projects/pandora_deploy_agent.sh | bash
# define variables
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2021012801'
LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log"
# Ansi color code variables
red="\e[0;91m"
green="\e[0;92m"
bold="\e[1m"
cyan="\e[0;36m"
yellow="\e[0;33m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
echo -e "${cyan}$msg...${reset}"
$cmd &>> $LOGFILE
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[[ $3 ]] && echo "$3 "
echo "Error installing Pandora FMS Agent for detailed error please check log: $LOGFILE"
rm -rf $HOME/pandora_deploy_tmp &>> $LOGFILE
exit 1
else
echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}"
return 0
fi
}
check_cmd_status () {
if [ $? -ne 0 ]; then
echo -e "${red}Fail${reset}"
[ "$1" ] && echo "$1"
echo "Error installing Pandora FMS Agent for detailed error please check log: $LOGFILE"
rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE
exit 1
else
echo -e "${green}OK${reset}"
return 0
fi
}
check_repo_connection () {
execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
}
check_root_permissions () {
echo -en "${cyan}Checking root account... ${reset}"
if [ "$(whoami)" != "root" ]; then
echo -e "${red}Fail${reset}"
echo "Please use a root account or sudo for installing PandoraFMS"
echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE"
exit 1
else
echo -e "${green}OK${reset}"
fi
}
install_autodiscover () {
local arch=$1
wget https://pandorafms.com/library/wp-content/uploads/2020/04/autodiscover-linux.zip
unzip autodiscover-linux.zip
chmod +x $arch/autodiscover
mv -f $arch/autodiscover /etc/pandora/plugins/autodiscover
}
## Main
echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
# Check OS.
OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
[[ $OS == 'debian' ]] && OS_RELEASE=$OS
# initialice logfile
execute_cmd "echo 'Starting community deployment' > $LOGFILE" "All installer activity is logged on $LOGFILE"
echo "Community installer version: $S_VERSION" >> $LOGFILE
# Pre checks
echo -en "${cyan}Checking compatible OS... ${reset}"
[[ $OS_RELEASE ]]
check_cmd_status "Error not compatible OS, $OS"
# Root permisions
check_root_permissions
# Connectivity
check_repo_connection
# Execute tools check
execute_cmd "grep --version" 'Checking needed tools: grep'
execute_cmd "sed --version" 'Checking needed tools: sed'
# Creating working directory
rm -rf $HOME/pandora_deploy_tmp/ &>> $LOGFILE
mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE
execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp"
# Downloading and installing packages
if [[ $OS_RELEASE == 'rhel fedora' ]] || [[ $OS_RELEASE == 'centos rhel fedora' ]]; then
yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset}
yum install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset}
fi
if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos'
execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Instaling agent dependencies'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
fi
# Configuring Agente
[[ $PANDORA_SERVER_IP ]] && sed -i "s/^server_ip.*$/server_ip $PANDORA_SERVER_IP/g" $PANDORA_AGENT_CONF
[[ $PANDORA_REMOTE_CONFIG ]] && sed -i "s/^remote_config.*$/remote_config $PANDORA_REMOTE_CONFIG/g" $PANDORA_AGENT_CONF
[[ $PANDORA_GROUP ]] && sed -i "s/^group.*$/group $PANDORA_GROUP/g" $PANDORA_AGENT_CONF
[[ $PANDORA_DEBUG ]] && sed -i "s/^debug.*$/debug $PANDORA_DEBUG/g" $PANDORA_AGENT_CONF
[[ $PANDORA_AGENT_NAME ]] && sed -i "s/^#agent_name.*$/agent_name $PANDORA_AGENT_NAME/g" $PANDORA_AGENT_CONF
[[ $PANDORA_AGENT_ALIAS ]] && sed -i "s/^#agent_alias.*$/agent_alias $PANDORA_AGENT_ALIAS/g" $PANDORA_AGENT_CONF
[[ $PANDORA_SECONDARY_GROUPS ]] && sed -i "s/^# secondary_groups.*$/secondary_groups $PANDORA_SECONDARY_GROUPS/g" $PANDORA_AGENT_CONF
[[ $TIMEZONE ]] && ln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime
#installing autodiscover
arch=$(uname -m)
case $arch in
x86_64)
execute_cmd 'install_autodiscover x86_64' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
x86)
execute_cmd 'install_autodiscover x84' "installing service autodiscover on $arch" 'Error unable to install autodiscovery'
;;
armv7l)
echo -e "${cyan}Skiping autodiscover installation arch $arch not suported${reset}"
;;
*)
echo -e "${yellow}Skiping autodiscover installation arch $arch not suported${reset}"
;;
esac
#Starting pandora agent daemon.
execute_cmd '/etc/init.d/pandora_agent_daemon restart' 'Starting Pandora Agent'
cd
execute_cmd 'rm -rf $HOME/pandora_deploy_tmp' 'Cleaning up temporay files'
echo -e "${green}PandoraFMS Agent installed and running, sending data to: $PANDORA_SERVER_IP${reset}"

View File

@ -117,7 +117,7 @@ check_pre_pandora
check_repo_connection
# Systemd
execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
execute_cmd "systemctl status" "Checking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8'
# Check memomry greather or equal to 2G
execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -ge 1700000 ]" 'Checking memory (required: 2 GB)'
@ -247,7 +247,15 @@ server_dependencies=" \
perl-Time-HiRes \
nfdump \
net-snmp-utils \
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm"
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
perl(XML::Simple) \
perl(Geo::IP) \
perl(IO::Socket::INET6) \
perl(XML::Twig) \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# SDK VMware perl dependencies
@ -262,10 +270,10 @@ vmware_dependencies=" \
execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies"
# Instant client Oracle
oracle_dependencier=" \
oracle_dependencies=" \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \
https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client"
execute_cmd "yum install -y $oracle_dependencies" "Installing Oracle Instant client"
# Disabling SELINUX and firewalld
setenforce 0
@ -475,7 +483,7 @@ net.core.optmem_max = 81920
EO_KO
execute_cmd "sysctl --system" "Applying Kernel optimization"
[ -d /dev/lxd/ ] || execute_cmd "sysctl --system" "Applying Kernel optimization"
# Fix pandora_server.{log,error} permissions to allow Console check them
chown pandora:apache /var/log/pandora

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.752
# Version 7.0NG.754
# 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
# Foundation; either version 2 of the Licence or any later version

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.752-210324
Version: 7.0NG.754-210511
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.752-210324"
pandora_version="7.0NG.754-210511"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -24,7 +24,7 @@ fi
if [ "$#" -ge 2 ]; then
VERSION="$2"
else
VERSION="7.0NG.752"
VERSION="7.0NG.754"
fi
# Path for the generated DMG file

View File

@ -19,11 +19,11 @@
<choice id="com.pandorafms.pandorafms_src" visible="false">
<pkg-ref id="com.pandorafms.pandorafms_src"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.752" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_src" version="7.0NG.754" onConclusion="none">pandorafms_src.pdk</pkg-ref>
<choice id="com.pandorafms.pandorafms_uninstall" visible="true" customLocation="/Applications">
<pkg-ref id="com.pandorafms.pandorafms_uninstall"/>
</choice>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.752" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<pkg-ref id="com.pandorafms.pandorafms_uninstall" version="7.0NG.754" onConclusion="none">pandorafms_uninstall.pdk</pkg-ref>
<!-- <installation-check script="check()" />
<script>
<![CDATA[

View File

@ -5,9 +5,9 @@
<key>CFBundleIconFile</key> <string>pandorafms.icns</string>
<key>CFBundleIdentifier</key> <string>com.pandorafms.pandorafms_uninstall</string>
<key>CFBundleVersion</key> <string>7.0NG.752</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.752 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.752</string>
<key>CFBundleVersion</key> <string>7.0NG.754</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.754 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.754</string>
<key>NSPrincipalClass</key><string>NSApplication</string>
<key>NSMainNibFile</key><string>MainMenu</string>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -592,7 +592,6 @@ BEGIN {
my ($self) = @_;
if ($YAML == 0) {
$self->set_last_error('Cannot use commands without YAML dependency, please install it.');
return;
}
@ -1015,8 +1014,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210324';
use constant AGENT_VERSION => '7.0NG.754';
use constant AGENT_BUILD => '210511';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -4030,6 +4029,14 @@ if ($Conf{'proxy_mode'}) {
}
}
# Advice if YAML::Tiny is allowed in this system
eval {
eval 'require YAML::Tiny;1' or die('YAML::Tiny lib not found, commands feature won\'t be available');
};
if ($@) {
log_message ('error', 'Cannot use commands without YAML dependency, please install it.');
}
# Add the plugins directory to the PATH
$ENV{'PATH'} .= ":$ConfDir/plugins";

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.752
%define release 210324
%define version 7.0NG.754
%define release 210511
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.752
%define release 210324
%define version 7.0NG.754
%define release 210511
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210324"
PI_VERSION="7.0NG.754"
PI_BUILD="210511"
OS_NAME=`uname -s`
FORCE=0
@ -166,7 +166,7 @@ uninstall () {
rm -f $DESTDIR/etc/newsyslog.d/pandora_agent.conf
# Remove systemd service if exists
if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
if [ `command -v systemctl` ]
then
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
rm -f $PANDORA_AGENT_SERVICE
@ -482,7 +482,7 @@ install () {
fi
# Create systemd service
if [ `systemctl --v 2> /dev/null | grep systemd | wc -l` != 0 ]
if [ `command -v systemctl` ]
then
echo "Creating systemd service for pandora_agent_daemon"

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2021 Artica Soluciones Tecnologicas
# Version 7.0NG.752
# Version 7.0NG.754
# 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
# Foundation; either version 2 of the Licence or any later version

View File

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

View File

@ -81,6 +81,7 @@ Pandora_Module::Pandora_Module (string name) {
this->module_ff_type = "";
this->module_alert_template = "";
this->module_crontab = "";
this->module_wait_timeout = 500;
}
/**
@ -1722,3 +1723,18 @@ Pandora_Module::isIntensive () {
return true;
}
/**
* Set the WaitForSingleObject timeout.
*
* @param timeout Timeout in milliseconds.
*/
void
Pandora_Module::setWaitTimeout (int timeout) {
if (timeout < 0) {
return;
}
this->module_wait_timeout = timeout;
}

View File

@ -216,6 +216,7 @@ namespace Pandora_Modules {
string getDataOutput (Pandora_Data *data);
void cleanDataList ();
int module_wait_timeout;
public:
Pandora_Module (string name);
virtual ~Pandora_Module ();
@ -231,6 +232,7 @@ namespace Pandora_Modules {
int getInterval ();
int getIntensiveInterval ();
void setTimeout (int timeout);
void setWaitTimeout (int timeout);
int getTimeout ();
string getSave ();
bool getAsync ();

View File

@ -172,7 +172,7 @@ Pandora_Module_Exec::run () {
string output;
int tickbase = GetTickCount();
while ( (dwRet = WaitForSingleObject (pi.hProcess, 500)) != WAIT_ABANDONED ) {
while ( (dwRet = WaitForSingleObject (pi.hProcess, this->module_wait_timeout)) != WAIT_ABANDONED ) {
PeekNamedPipe (out_read, buffer, BUFSIZE, &read, &avail, NULL);
if (avail > 0) {
ReadFile (out_read, buffer, BUFSIZE, &read, NULL);
@ -180,11 +180,6 @@ Pandora_Module_Exec::run () {
output += (char *) buffer;
}
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
if (dwRet == WAIT_OBJECT_0) {
break;
} else if(this->getTimeout() < GetTickCount() - tickbase) {
@ -220,6 +215,10 @@ Pandora_Module_Exec::run () {
}
// Command output mode
else if (!output.empty()) {
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
this->setOutput (output);
} else {
this->setOutput ("");
@ -471,4 +470,3 @@ void Pandora_Module_Exec::changeOutputEncoding(string * string_change){
}
}

View File

@ -124,6 +124,7 @@ using namespace Pandora_Strutils;
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
string
parseLine (string line, string token) {
@ -178,7 +179,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding, module_alert_template, module_ff_type;
string macro;
string macro, module_wait_timeout;
Pandora_Module *module;
bool numeric;
Module_Type type;
@ -260,6 +261,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_alert_template = "";
module_user_session = "";
macro = "";
module_wait_timeout = "";
stringtok (tokens, definition, "\n");
@ -291,6 +293,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
if (module_proc == "") {
module_proc = parseLine (line, TOKEN_PROC);
}
@ -1130,6 +1135,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != "") {
module->setTimeout (atoi (module_timeout.c_str ()));
}
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name,
@ -1230,6 +1238,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != ""){
module->setTimeout(atoi(module_timeout.c_str()));
}
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_ping != "") {
if (module_ping_count == "") {
module_ping_count = "1";

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.752(Build 210324)")
#define PANDORA_VERSION ("7.0NG.754(Build 210511)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.752(Build 210324))"
VALUE "ProductVersion", "(7.0NG.754(Build 210511))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.752-210324
Version: 7.0NG.754-210511
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -61,7 +61,7 @@ if (isset($config['console_log_enabled']) === true
ini_set('error_log', $config['homedir'].'/log/console.log');
} else {
ini_set('log_errors', 0);
ini_set('error_log', 0);
ini_set('error_log', null);
}
// Sometimes input is badly retrieved from caller...

View File

@ -686,7 +686,7 @@ function mainAgentsModules()
echo '<tr>';
echo "<th width='140px' class='right pdd_r_10px'>".__('Agents').' / '.__('Modules').'</th>';
echo "<th width='140px' class='pdd_r_10px lign_right'>".__('Agents').' / '.__('Modules').'</th>';
if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block);

View File

@ -196,6 +196,7 @@ function mainModuleGroups()
ON ta.id_agente = tam.id_agente
WHERE ta.disabled = 0
AND tam.disabled = 0
AND tam.id_modulo <> 0
AND tam.delete_pending = 0
AND ta.id_grupo IN (%s)
GROUP BY tam.id_agente_modulo

View File

@ -1096,8 +1096,13 @@ function resource_registration_extension_main()
}
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
process_upload_xml($xml);
if ($xml === false) {
ui_print_error_message(
__('Error uploading resource. Check if the selected file is a valid resource template in .ptr format')
);
} else {
process_upload_xml($xml);
}
}

View File

@ -83,4 +83,7 @@ pandora_console/enterprise/godmode/agentes/module_manager_editor_web.php
pandora_console/enterprise/include/ajax/web_server_module_debug.php
pandora_console/enterprise/include/class/WebServerModuleDebug.class.php
pandora_console/enterprise/include/styles/WebServerModuleDebug.css
include/lib/WSManager.php
include/lib/WebSocketServer.php
include/lib/WebSocketUser.php
operation/network/network_explorer.php

View File

@ -0,0 +1,36 @@
START TRANSACTION;
ALTER TABLE `tgrupo` ADD COLUMN `max_agents` int(10) NOT NULL DEFAULT 0;
ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DEFAULT '';
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
ALTER TABLE `treport_content_template` MODIFY `external_source` MEDIUMTEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `agent` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_usuario` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `evento` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `module` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `alert` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `user_comment` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_tag` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `name` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `group_recursion` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring&#x20;Event";
UPDATE `tskin` SET `name` = 'Default&#x20;theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
UPDATE `tskin` SET `name` = 'Black&#x20;theme' , `relative_path` = 'Black&#x20;theme' , `description` = 'Black&#x20;theme' WHERE `id` = 2;
UPDATE `tevent_rule` SET `criticity` = NULL, `operator_criticity` = NULL WHERE `criticity` = 99;
UPDATE `tevent_rule` SET `id_grupo` = NULL, `operator_id_grupo` = NULL WHERE `id_grupo` = 0;
UPDATE `tevent_rule` SET `id_tag` = NULL, `operator_id_tag` = NULL WHERE `id_tag` = 0;
UPDATE `tevent_rule` SET `operator_criticity` = '==' WHERE `criticity` != 99 AND `criticity` IS NOT NULL AND `criticity` != '';
UPDATE `tevent_rule` SET `operator_id_grupo` = '==' WHERE `id_grupo` != 0 AND `id_grupo` IS NOT NULL AND `id_grupo` != '';
UPDATE `tevent_rule` SET `operator_id_tag` = '==' WHERE `id_tag` != 0 AND `id_tag` IS NOT NULL AND `id_tag` != '';
COMMIT;

View File

@ -565,6 +565,9 @@ CREATE TABLE IF NOT EXISTS `tskin` (
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UPDATE `tskin` SET `name` = 'Default&#x20;theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
UPDATE `tskin` SET `name` = 'Black&#x20;theme' , `relative_path` = 'Black&#x20;theme' , `description` = 'Black&#x20;theme' WHERE `id` = 2;
-- ---------------------------------------------------------------------
-- Table `tpolicy_queue`
-- ---------------------------------------------------------------------
@ -625,6 +628,22 @@ ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` enum('','unknown','alert_fi
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` int(4) unsigned DEFAULT NULL;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` mediumint(4) DEFAULT NULL;
ALTER TABLE `tevent_rule` MODIFY COLUMN `agent` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_usuario` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_grupo` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `evento` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `event_type` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `module` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `alert` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `criticity` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `user_comment` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `id_tag` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `name` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `group_recursion` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_content` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_source` TEXT;
ALTER TABLE `tevent_rule` MODIFY COLUMN `log_agent` TEXT;
UPDATE `tevent_rule` SET `operator_agent` = "REGEX" WHERE `agent` != '';
UPDATE `tevent_rule` SET `operator_id_usuario` = "REGEX" WHERE `id_usuario` != '';
UPDATE `tevent_rule` SET `operator_id_grupo` = "REGEX" WHERE `id_grupo` > 0;
@ -811,7 +830,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`description` mediumtext,
`text_agent` text,
`text` TEXT,
`external_source` Text,
`external_source` mediumtext,
`treport_custom_sql_id` INTEGER UNSIGNED default 0,
`header_definition` TinyText default NULL,
`column_separator` TinyText default NULL,
@ -1487,6 +1506,7 @@ ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tusuario`
@ -1741,6 +1761,7 @@ ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NUL
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` MODIFY `external_source` MEDIUMTEXT;
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
@ -2501,6 +2522,7 @@ CREATE TABLE `tnotification_source_group_user` (
-- Add alert command 'Generate notification'
-- ----------------------------------------------------------------------
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate&#x20;Notification','Internal&#x20;type','This&#x20;command&#x20;allows&#x20;you&#x20;to&#x20;send&#x20;an&#x20;internal&#x20;notification&#x20;to&#x20;any&#x20;user&#x20;or&#x20;group.',1,'[\"Destination&#x20;user\",\"Destination&#x20;group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Event&#x20;type\",\"Source\",\"Agent&#x20;name&#x20;or&#x20;_agent_\",\"Event&#x20;severity\",\"ID&#x20;extra\",\"Tags&#x20;separated&#x20;by&#x20;commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring&#x20;Event";
-- ----------------------------------------------------------------------
-- Update message references and pre-configure notifications
@ -2519,7 +2541,7 @@ INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Di
-- ----------------------------------------------------------------------
-- Add column in table `tagent_custom_fields`
-- ----------------------------------------------------------------------
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` TEXT NOT NULL DEFAULT '';
-- ----------------------------------------------------------------------
-- Add column in table `tnetflow_filter`
@ -2848,6 +2870,12 @@ UPDATE twidget SET description='Show a visual console' WHERE class_name='MapsMad
UPDATE twidget SET description='Clock' WHERE class_name='ClockWidget';
UPDATE twidget SET description='Group status' WHERE class_name='SystemGroupStatusWidget';
--
-- Modifies tgrupo table.
--
ALTER TABLE tgrupo ADD COLUMN max_agents int(10) NOT NULL DEFAULT 0;
-- ----------------------------------------------------------------------
-- Table `tnode_relations`
-- ----------------------------------------------------------------------

View File

@ -53,8 +53,8 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
<?php
if (check_acl($config['id_user'], 0, 'PM')) {
echo "<div id='create_master_window' class='invisible'></div>";
echo "<div id='msg' class='invisible'></div>";
echo "<div id='create_master_window' style='display: none'></div>";
echo "<div id='msg' style='display: none'></div>";
?>
<input onclick="show_create_ha_cluster();" type="submit" class="button_task ui_toggle" value="<?php echo __('Add new node'); ?>" />
<?php

View File

@ -24,6 +24,14 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'],
return;
}
\ui_print_page_header(
__('Monitoring').' &raquo; '.__('Clusters'),
'images/chart.png',
false,
'',
false
);
ui_require_css_file('first_task');
?>
<?php

View File

@ -15,14 +15,14 @@ global $config;
check_login();
ui_require_css_file('first_task');
?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no planned downtime defined yet.') ]); ?>
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no scheduled downtime defined yet.') ]); ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
<?php echo html_print_image('images/first_task/icono_grande_visualconsole.png', true, ['title' => __('Scehduled Downtime')]); ?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task">
<h3> <?php echo __('Create Scheduled Downtime'); ?></h3><p id="description_task">
<?php
echo __(
"%s contains a scheduled downtime management system.
@ -34,7 +34,7 @@ ui_require_css_file('first_task');
?>
</p>
<form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
<input type="submit" class="button_task" value="<?php echo __('Create Scheduled Downtime'); ?>" />
</form>
</div>
</div>

View File

@ -931,24 +931,19 @@ foreach ($fields as $field) {
}
if ($field['combo_values'] !== '') {
$data_field[1] = html_print_select(
$combo_values,
'customvalue_'.$field['id_field'],
$custom_value,
'',
__('None'),
'',
true,
false,
false,
'',
false,
false,
false,
false,
false,
'',
false
$data_field[1] = html_print_input(
[
'type' => 'select_search',
'fields' => $combo_values,
'name' => 'customvalue_'.$field['id_field'],
'selected' => $custom_value,
'nothing' => __('None'),
'nothing_value' => '',
'return' => true,
'sort' => false,
'size' => '400px',
'dropdownAutoWidth' => true,
]
);
};
@ -1009,9 +1004,9 @@ echo '<div class="action-buttons agent_manager" style="width: '.$table->width.'"
// The context help about the learning mode.
if ($modo == 0) {
echo "<span id='modules_not_learning_mode_context_help pdd_r_10px' '>";
echo "<span id='modules_not_learning_mode_context_help' class='pdd_r_10px'>";
} else {
echo "<span id='modules_not_learning_mode_context_help invisible'>";
echo "<span id='modules_not_learning_mode_context_help' class='invisible'>";
}
echo clippy_context_help('modules_not_learning_mode');

View File

@ -37,6 +37,8 @@ require_once $config['homedir'].'/include/functions_cron.php';
ui_require_javascript_file('encode_decode_base64');
ui_require_css_file('agent_manager');
use PandoraFMS\Event;
check_login();
// Get tab parameter to check ACL in each tabs.
@ -229,6 +231,9 @@ if ($create_agent) {
if ($alias == '') {
$agent_creation_error = __('No agent alias specified');
$agent_created_ok = 0;
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
$agent_creation_error = __('Agent cannot be created due to the maximum agent limit for this group');
$agent_created_ok = 0;
} else {
if ($alias_as_name) {
$sql = 'SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"';
@ -400,7 +405,7 @@ if ($id_agente) {
// Module tab.
$moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/module.png',
'images/gm_modules.png',
true,
[
'title' => __('Modules'),
@ -416,7 +421,7 @@ if ($id_agente) {
// Alert tab.
$alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/bell.png',
'images/gm_alerts.png',
true,
[
'title' => __('Alerts'),
@ -1034,6 +1039,8 @@ if ($update_agent) {
if ($grupo <= 0) {
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
} else if (group_allow_more_agents($grupo, true, 'update') === false) {
ui_print_error_message(__('Agent cannot be updated due to the maximum agent limit for this group'));
} else if ($exists_ip) {
ui_print_error_message(__('Duplicate main IP address'));
} else {

View File

@ -33,7 +33,7 @@ if ($id_field) {
$name = $field['name'];
$display_on_front = $field['display_on_front'];
$is_password_type = $field['is_password_type'];
$combo_values = $field['combo_values'];
$combo_values = $field['combo_values'] ? $field['combo_values'] : '';
$is_combo_enable = $config['is_combo_enable'];
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
} else {
@ -116,12 +116,12 @@ $table->data[4][0] = __('Combo values').ui_print_help_tip(
__('Set values separated by comma'),
true
);
$table->data[4][1] = html_print_input_text(
$table->data[4][1] = html_print_textarea(
'combo_values',
3,
65,
io_safe_output($combo_values),
'',
35,
200,
true
);
@ -144,7 +144,7 @@ echo '</form>';
<script>
$(document).ready (function () {
if($('input[type=hidden][name=update_field]').val() == 1 && $('input[type=text][name=combo_values]').val() != ''){
if($('input[type=hidden][name=update_field]').val() == 1 && $('#textarea_combo_values').val() != ''){
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
$('#configure_field-4').show();
$('input[type=checkbox][name=is_password_type]').change(function (e) {
@ -155,7 +155,7 @@ $(document).ready (function () {
e.preventDefault();
});
$('input[type=checkbox][name=is_combo_enable]').change(function (e) {
if($('input[type=text][name=combo_values]').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){
if($('#textarea_combo_values').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){
dialog_message("#message_set_combo");
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
$('#configure_field-4').show();

View File

@ -746,9 +746,9 @@ if ($agents !== false) {
if ($in_planned_downtime) {
ui_print_help_tip(
__('Agent in planned downtime'),
__('Agent in scheduled downtime'),
false,
$config['image']['minireloj_16']
'images/minireloj-16.png'
);
echo '</em>';

View File

@ -1130,6 +1130,7 @@ foreach ($modules as $module) {
[
'alt' => __('Enable module'),
'title' => __('Enable module'),
'class' => 'invert_filter_important',
]
).'</a>';
} else {

View File

@ -115,7 +115,12 @@ function add_component_selection($id_network_component_type)
'',
'---'.__('Manual setup').'---',
0,
true
true,
false,
true,
'',
false,
'width: 460px; '
);
$data[1] .= '</span>';
$data[1] .= ' <span id="component_loading" class="invisible">';
@ -1357,12 +1362,11 @@ $(document).ready (function () {
jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) {
tag_name = $(value).html();
if (tag_name != <?php echo "'".__('None')."'"; ?>) {
id_tag = $(value).attr('value');
$("select[name='id_tag_selected[]']").append($("<option></option>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("select[name='id_tag_selected[]']").append(value);
$("#id_tag_available").find("option[value='" + id_tag + "']").remove();
$("#id_tag_selected").find("option[value='']").remove();
if($("#id_tag_available option").length == 0) {
$("select[name='id_tag_available[]']").append($("<option></option>").val('').html('<i><?php echo __('None'); ?></i>'));
$("select[name='id_tag_available[]']").append(value);
}
}
});
@ -1373,11 +1377,11 @@ $(document).ready (function () {
tag_name = $(value).html();
if (tag_name != <?php echo "'".__('None')."'"; ?>) {
id_tag = $(value).attr('value');
$("select[name='id_tag_available[]']").append($("<option>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("select[name='id_tag_available[]']").append(value);
$("#id_tag_selected").find("option[value='" + id_tag + "']").remove();
$("#id_tag_available").find("option[value='']").remove();
if($("#id_tag_selected option").length == 0) {
$("select[name='id_tag_selected[]']").append($("<option></option>").val('').html('<i><?php echo __('None'); ?></i>'));
$("select[name='id_tag_selected[]']").append(value);
}
}
});

View File

@ -64,7 +64,7 @@ $buttons = [
// Header.
ui_print_page_header(
__('Planned Downtime'),
__('Scheduled Downtime'),
'images/gm_monitoring.png',
false,
'',
@ -308,12 +308,12 @@ if ($create_downtime || $update_downtime) {
);
} else {
ui_print_error_message(
__('Each planned downtime must have a different name')
__('Each scheduled downtime must have a different name')
);
}
} else {
ui_print_error_message(
__('Planned downtime must have a name')
__('Scheduled downtime must have a name')
);
}
} else if ($update_downtime) {
@ -345,7 +345,7 @@ if ($create_downtime || $update_downtime) {
$values = [];
if (trim(io_safe_output($name)) == '') {
ui_print_error_message(
__('Planned downtime must have a name')
__('Scheduled downtime must have a name')
);
}
@ -1489,14 +1489,14 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(this).css ("width", "180px");
});
// Warning message about the problems caused updating a past planned downtime
// Warning message about the problems caused updating a past scheduled downtime
var type_execution = "<?php echo $type_execution; ?>";
var datetime_from = <?php echo json_encode(strtotime($once_date_from.' '.$once_time_from)); ?>;
var datetime_now = <?php echo json_encode($utimestamp); ?>;
var create = <?php echo json_encode($create); ?>;
if (!create && (type_execution == 'periodically' || (type_execution == 'once' && datetime_from < datetime_now))) {
$("input#submit-updbutton, input#submit-add_item, table#list a").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you edit this planned downtime, the data of future SLA reports may be altered'); ?>")) {
if (!confirm("<?php echo __('WARNING: If you edit this scheduled downtime, the data of future SLA reports may be altered'); ?>")) {
e.preventDefault();
}
});

View File

@ -196,5 +196,5 @@ if (!empty($downtimes)) {
echo chr(13);
}
} else {
echo '<div class="nf">'.__('No planned downtime').'</div>';
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
}

View File

@ -44,7 +44,7 @@ if ($migrate_malformed) {
if ($migration_result['status'] == false) {
ui_print_error_message(
__('An error occurred while migrating the malformed planned downtimes').'. '.__('Please run the migration again or contact with the administrator')
__('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
);
echo '<br>';
}
@ -80,7 +80,7 @@ if ($stop_downtime) {
$result = planned_downtimes_stop($downtime);
if ($result === false) {
ui_print_error_message(__('An error occurred stopping the planned downtime'));
ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
} else {
echo $result['message'];
}
@ -103,7 +103,7 @@ if ($delete_downtime) {
// The downtime shouldn't be running!!
if ($downtime['executed']) {
ui_print_error_message(__('This planned downtime is running'));
ui_print_error_message(__('This scheduled downtime is running'));
} else {
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
@ -362,7 +362,7 @@ else if (!$downtimes) {
echo '</form>';
// Info message.
echo '<div class="nf">'.__('No planned downtime').'</div>';
echo '<div class="nf">'.__('No scheduled downtime').'</div>';
echo '<div class="action-buttons w100p" >';
@ -572,13 +572,13 @@ $(document).ready (function () {
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("a#delete_downtime").click(function (e) {
if (!confirm("<?php echo __('WARNING: If you delete this planned downtime, it will not be taken into account in future SLA reports'); ?>")) {
if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
e.preventDefault();
}
});
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
if (confirm("<?php echo __('WARNING: There are malformed scheduled downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
}
}

View File

@ -27,8 +27,6 @@ if (! check_acl($config['id_user'], 0, 'AR')
return;
}
$update = get_parameter('upd_button', '');
$default = (int) get_parameter('default', 0);
@ -49,7 +47,7 @@ if ($default != 0) {
'value' => $status_monitor_fields,
];
// update 'status_monitor_fields' in tconfig table to keep the value at update.
// Update 'status_monitor_fields' in tconfig table to keep the value at update.
$result = db_process_sql_update(
'tconfig',
$values,
@ -67,7 +65,7 @@ $fields_selected = explode(',', $config['status_monitor_fields']);
$result_selected = [];
// show list of fields selected.
// Show list of fields selected.
if ($fields_selected[0] != '') {
foreach ($fields_selected as $field_selected) {
switch ($field_selected) {
@ -239,7 +237,7 @@ $(document).ready (function () {
if(selected_fields_total === current_fields_size){
display_confirm_dialog(
"<?php echo '<span class="transform_none">'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
"<?php echo __('Confirm'); ?>",
"<?php echo __('Cancel'); ?>",
function () {

View File

@ -61,6 +61,11 @@ if (defined('METACONSOLE')) {
$sec = 'galertas';
}
$can_edit_all = false;
if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$can_edit_all = true;
}
// Header.
if (defined('METACONSOLE')) {
alerts_meta_print_header();
@ -79,30 +84,13 @@ if ($copy_action) {
$al_action = alerts_get_alert_action($id);
if (!check_acl_restricted_all($config['id_user'], $al_action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
if ($al_action !== false) {
// If user tries to copy an action with group=ALL.
if ($al_action['id_group'] == 0) {
// Then must have "PM" access privileges.
if (! check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
// If user who doesn't have permission to modify group all tries to copy an action with group=ALL.
if ($can_edit_all == false && $al_action['id_group'] == 0) {
$al_action['id_group'] = users_get_first_group(false, 'LM', false);
} else {
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
if ($can_edit_all == true || check_acl($config['id_user'], 0, 'PM')) {
$own_groups = array_keys(
users_get_groups($config['id_user'], 'LM')
);
@ -125,7 +113,7 @@ if ($copy_action) {
}
}
$result = alerts_clone_alert_action($id);
$result = alerts_clone_alert_action($id, $al_action['id_group']);
if ($result) {
db_pandora_audit(
@ -397,10 +385,9 @@ foreach ($actions as $action) {
$data = [];
if (check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
} else {
$data[0] = $action['name'];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
if ($action['id_group'] == 0 && $can_edit_all == false) {
$data[0] .= ui_print_help_tip(__('You cannot edit this action, You don\'t have the permission to edit All group.'), true);
}
$data[1] = $action['command_name'];
@ -420,7 +407,7 @@ foreach ($actions as $action) {
$data[4] = '';
if (is_central_policies_on_node() === false
&& check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')
&& check_acl($config['id_user'], $action['id_group'], 'LM')
) {
$table->cellclass[] = [
3 => 'action_buttons',
@ -430,10 +417,35 @@ foreach ($actions as $action) {
$id_action = $action['id'];
$text_confirm = __('Are you sure?');
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="copy_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="delete_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data[3] = '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.$text_confirm.'\')) return false;">';
$data[3] .= html_print_input_hidden('copy_action', 1, true);
$data[3] .= html_print_input_hidden('id', $id_action, true);
$data[3] .= html_print_input_image(
'dup',
'images/copy.png',
1,
'',
true,
['title' => __('Duplicate')]
);
$data[3] .= '</form> ';
if ($action['id_group'] != 0 || $can_edit_all == true) {
$data[4] = '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.$text_confirm.'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_action', 1, true);
$data[4] .= html_print_input_hidden('id', $id_action, true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
1,
'',
true,
['title' => __('Delete')]
);
$data[4] .= '</form> ';
} else {
$data[4] = '';
}
}
array_push($table->data, $data);
@ -457,45 +469,3 @@ if (is_central_policies_on_node() === false) {
}
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function copy_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"copy_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
function delete_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"delete_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
</script>

View File

@ -28,12 +28,6 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
exit;
}
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin($config['id_user'])) {
echo "<div id='message_permissions' title='".__('Permissions warning')."' style='display:none;'>";
echo "<p style='text-align: center;font-weight: bold;'>".__('Command management is limited to administrator users or user profiles with permissions over Pandora FMS management').'</p>';
echo '</div>';
}
if (is_metaconsole()) {
$sec = 'advanced';
} else {
@ -46,6 +40,8 @@ $create_command = (bool) get_parameter('create_command');
$delete_command = (bool) get_parameter('delete_command');
$copy_command = (bool) get_parameter('copy_command');
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands';
if (is_ajax()) {
$get_alert_command = (bool) get_parameter('get_alert_command');
if ($get_alert_command) {
@ -465,6 +461,20 @@ if (is_ajax()) {
return;
}
// This check should be after ajax. Because, ajax will be called from configure_alert_action.
if (!check_acl($config['id_user'], 0, 'PM') && !is_user_admin(
$config['id_user
']
)
) {
echo "<div id='message_permissions' title='".__('Permissions warning')."' s
tyle='display:none;'>";
echo "<p style='text-align: center;font-weight: bold; margin: 15px'>".__(
'Command management is limited to administrator users or user profiles with permissions PM'
).'</p>';
echo '</div>';
}
enterprise_hook('open_meta_frame');
if ($update_command) {
@ -634,6 +644,12 @@ if ($commands === false) {
$commands = [];
}
// Pagination.
$total_commands = count($commands);
$offset = (int) get_parameter('offset');
$limit = (int) $config['block_size'];
$commands = array_slice($commands, $offset, $limit);
foreach ($commands as $command) {
$data = [];
@ -667,21 +683,35 @@ foreach ($commands as $command) {
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.
if ($is_central_policies_on_node === false && !$command['internal'] && check_acl_restricted_all($config['id_user'], $command['id_group'], 'LM')) {
$data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
if (check_acl($config['id_user'], 0, 'PM') || is_user_admin(
$config['id_user
']
)
) {
$data['action'] = '<span class="inline_flex">';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$data['action'] .= '</span>';
$data['action'] .= '</span>';
}
}
array_push($table->data, $data);
}
if (count($table->data) > 0) {
ui_pagination($total_commands, $url);
if (isset($data) === true && count($table->data) > 0) {
html_print_table($table);
ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
ui_print_info_message(
[
'no_close' => true,
'message' => __('No alert commands configured'),
]
);
}
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {

View File

@ -882,9 +882,11 @@ foreach ($simple_alerts as $alert) {
['title' => __('Add action')]
);
} else {
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']);
$data[4] .= '</a>';
if ((int) $alert['id_policy_alerts'] === 0) {
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']);
$data[4] .= '</a>';
}
}
}

View File

@ -401,17 +401,16 @@ foreach ($templates as $template) {
$data = [];
if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'&pure='.$pure.'">'.$template['name'].'</a>';
} else {
$data[0] = $template['name'];
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'&pure='.$pure.'">'.$template['name'].'</a>';
if (!check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[0] .= ui_print_help_tip(__('You cannot edit this alert template, You don\'t have the permission to edit All group.'), true);
}
$data[1] = ui_print_group_icon($template['id_group'], true);
$data[3] = alerts_get_alert_templates_type_name($template['type']);
if (is_central_policies_on_node() === false
&& check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')
&& check_acl($config['id_user'], $template['id_group'], 'LM')
) {
$table->cellclass[][4] = 'action_buttons';
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" class="float-left inline_line">';
@ -427,18 +426,20 @@ foreach ($templates as $template) {
);
$data[4] .= '</form> ';
$data[4] .= '<form method="post" class="float-right inline_line" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_template', 1, true);
$data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
1,
'',
true,
['title' => __('Delete')]
);
$data[4] .= '</form> ';
if (check_acl_restricted_all($config['id_user'], $template['id_group'], 'LM')) {
$data[4] .= '<form method="post" class="float-right inline_line" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$data[4] .= html_print_input_hidden('delete_template', 1, true);
$data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
1,
'',
true,
['title' => __('Delete')]
);
$data[4] .= '</form> ';
}
} else {
$data[4] = '';
}

View File

@ -58,7 +58,7 @@ if (defined('METACONSOLE')) {
if ($al_action !== false) {
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
if ($own_info['is_admin'] || check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
} else {
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
@ -91,8 +91,15 @@ if ($al_action !== false) {
true
);
}
$is_in_group = true;
}
if (!$is_in_group && $al_action['id_group'] != 0) {
db_pandora_audit('ACL Violation', 'Trying to access unauthorized alert action configuration');
include 'general/noaccess.php';
exit;
}
$is_central_policies_on_node = is_central_policies_on_node();
@ -102,6 +109,11 @@ if ($is_central_policies_on_node === true) {
);
}
$disabled = !$is_in_group;
$disabled_attr = '';
if ($disabled) {
$disabled_attr = 'disabled="disabled"';
}
$name = '';
$id_command = '';
@ -116,15 +128,6 @@ if ($id) {
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
$create_wu_integria = $action['create_wu_integria'];
if (!check_acl_restricted_all($config['id_user'], $action['id_group'], 'LM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
}
// Hidden div with help hint to fill with javascript.
@ -175,7 +178,7 @@ $table->data[0][1] = html_print_input_text(
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
if (io_safe_output($name) == 'Monitoring Event') {
@ -194,7 +197,7 @@ $own_info = get_user_info($config['id_user']);
$return_all_group = false;
if (users_can_manage_group_all('LW') === true) {
if (users_can_manage_group_all('LW') === true || $disabled) {
$return_all_group = true;
}
@ -211,7 +214,7 @@ $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false,
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
).'</div>';
$table->colspan[1][1] = 2;
@ -245,11 +248,11 @@ $table->data[2][1] = html_print_select_from_sql(
true,
false,
false,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[2][1] .= ' ';
if ($is_central_policies_on_node === false
&& check_acl($config['id_user'], 0, 'PM')
&& check_acl($config['id_user'], 0, 'PM') && !$disabled
) {
$table->data[2][1] .= __('Create Command');
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
@ -272,7 +275,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
false,
true,
'',
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
false,
'',
false,
@ -304,11 +307,21 @@ $table->data[5][2] = html_print_textarea(
true
);
$table->data[6][0] = __('Create workunit on recovery').ui_print_help_tip(
// Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table->data[$integriaIdName][0] = __('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
true
);
$table->data[6][1] = html_print_checkbox_switch_extended('create_wu_integria', 1, $create_wu_integria, false, '', '', true);
$table->data[$integriaIdName][1] = html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = html_print_image(
@ -328,17 +341,21 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][1] .= html_print_input_hidden(
'field'.$i.'_value',
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
true
true,
'',
$disabled_attr
);
$table->data['field'.$i][2] .= html_print_input_hidden(
'field'.$i.'_recovery_value',
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
true
true,
'',
$disabled_attr
);
}
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&pure='.$pure.'">';
$table_html = html_print_table($table, true);
echo $table_html;
@ -346,18 +363,7 @@ if ($is_central_policies_on_node === false) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id) {
html_print_input_hidden('id', $id);
if ($al_action['id_group'] == 0) {
// Then must have "PM" access privileges.
if (check_acl($config['id_user'], 0, 'PM')) {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
'create',
false,
'class="sub upd"'
);
}
} else {
if (!$disabled) {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
@ -365,6 +371,12 @@ if ($is_central_policies_on_node === false) {
false,
'class="sub upd"'
);
} else {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions">';
html_print_submit_button(__('Back'), 'back', false, 'class="sub upd"');
echo '</form>';
echo '</div>';
}
} else {
html_print_input_hidden('create_action', 1);
@ -391,6 +403,7 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
$(document).ready (function () {
var original_command;
var origicommand_descriptionnal_command;
var integriaWorkUnitName = "<?php echo $integriaIdName; ?>";
if (<?php echo (int) $id_command; ?>) {
original_command = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_command($id_command)))); ?>";
@ -592,6 +605,13 @@ $(document).ready (function () {
}
// Allow create workunit if Integria IMS Ticket is selected.
if (data['id'] == '14') {
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
} else {
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
}
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
// Change the selected group
@ -608,6 +628,7 @@ $(document).ready (function () {
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';
var disabled = '';
var field_row = data["fields_rows"][i];
var $table_macros_field = $('#table_macros-field' + i);
@ -623,6 +644,7 @@ $(document).ready (function () {
== ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled');
}
if (($("[name=field" + i + "_recovery_value]").attr('id'))
@ -689,6 +711,10 @@ $(document).ready (function () {
$('#help_alert_macros_hint').html());
}
if (disabled) {
$("[name=field" + i + "_value]").attr('disabled','disabled');
$("[name=field" + i + "_recovery_value]").attr('disabled','disabled');
}
$table_macros_field.show();
}

View File

@ -38,7 +38,6 @@ $step = (int) get_parameter('step', 1);
// We set here the number of steps.
define('LAST_STEP', 3);
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
if ($duplicate_template) {
$source_id = (int) get_parameter('source_id');
$a_template = alerts_get_alert_template($source_id);
@ -52,19 +51,14 @@ if (defined('METACONSOLE')) {
$sec = 'galertas';
}
$can_edit_all = false;
if (check_acl_restricted_all($config['id_user'], 0, 'LM')) {
$can_edit_all = true;
}
if ($a_template !== false) {
// If user tries to duplicate/edit a template with group=ALL
if ($a_template['id_group'] == 0) {
if (users_can_manage_group_all('LM') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
);
include 'general/noaccess.php';
exit;
}
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
@ -146,7 +140,12 @@ if ($a_template !== false) {
if ($duplicate_template) {
$source_id = (int) get_parameter('source_id');
$id = alerts_duplicate_alert_template($source_id);
// If user doesn't have the permission to access All group and source template is All group, then group is changed to the first group of user.
if ($can_edit_all == false && a_template['id_group'] == 0) {
$a_template['id_group'] = users_get_first_group(false, 'LM', false);
}
$id = alerts_duplicate_alert_template($source_id, $a_template['id_group']);
if ($id) {
db_pandora_audit('Template alert management', 'Duplicate alert template '.$source_id.' clone to '.$id);
@ -386,6 +385,14 @@ $create_alert = (bool) get_parameter('create_alert');
$create_template = (bool) get_parameter('create_template');
$update_template = (bool) get_parameter('update_template');
$disabled = false;
if (!$create_alert && !$create_template) {
// When user edits a template with All group, user must have "LM" access privileges againt All group.
if ($a_template['id_group'] == 0 && !$can_edit_all) {
$disabled = true;
}
}
$name = '';
$description = '';
$type = '';
@ -602,7 +609,7 @@ if ($step == 2) {
1,
$monday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Tue');
$table->data[0][1] .= html_print_checkbox(
@ -610,7 +617,7 @@ if ($step == 2) {
1,
$tuesday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Wed');
$table->data[0][1] .= html_print_checkbox(
@ -618,7 +625,7 @@ if ($step == 2) {
1,
$wednesday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Thu');
$table->data[0][1] .= html_print_checkbox(
@ -626,7 +633,7 @@ if ($step == 2) {
1,
$thursday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Fri');
$table->data[0][1] .= html_print_checkbox(
@ -634,7 +641,7 @@ if ($step == 2) {
1,
$friday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Sat');
$table->data[0][1] .= html_print_checkbox(
@ -642,7 +649,7 @@ if ($step == 2) {
1,
$saturday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][1] .= __('Sun');
$table->data[0][1] .= html_print_checkbox(
@ -650,7 +657,7 @@ if ($step == 2) {
1,
$sunday,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[0][2] = __('Use special days list');
@ -659,7 +666,7 @@ if ($step == 2) {
1,
$special_day,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[1][0] = __('Time from');
@ -680,7 +687,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[1][2] = __('Time to');
$table->data[1][3] = html_print_input_text(
@ -700,7 +707,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->colspan['threshold'][1] = 3;
@ -716,7 +723,7 @@ if ($step == 2) {
false,
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[3][0] = __('Min. number of alerts');
@ -737,7 +744,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[3][2] = __('Reset counter for non-sustained alerts');
@ -750,7 +757,7 @@ if ($step == 2) {
1,
$min_alerts_reset_counter,
true,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
'',
false,
$create_template == 1 ? 'checked=checked' : ''
@ -774,7 +781,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[4][2] = __('Disable event');
@ -783,7 +790,7 @@ if ($step == 2) {
1,
$disable_event,
true,
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[5][0] = __('Default action');
@ -811,7 +818,7 @@ if ($step == 2) {
true,
false,
false,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
false,
false,
0
@ -833,7 +840,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'class="invisible"').'>';
$table->data[6][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
@ -886,7 +893,8 @@ if ($step == 2) {
'',
5,
255,
true
true,
$disabled
);
$table->colspan['min'][1] = 3;
@ -897,7 +905,8 @@ if ($step == 2) {
'',
5,
255,
true
true,
$disabled
);
$table->colspan['max'][1] = 3;
@ -940,7 +949,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->colspan[0][1] = 2;
@ -966,7 +975,7 @@ if ($step == 2) {
0,
'',
false,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
"removeTinyMCE('textarea_field".$i."')",
'',
true
@ -979,7 +988,7 @@ if ($step == 2) {
0,
'',
true,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
"addTinyMCE('textarea_field".$i."')",
'',
true
@ -995,7 +1004,7 @@ if ($step == 2) {
'class="fields" min-height-40px',
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
// Recovery.
@ -1007,7 +1016,7 @@ if ($step == 2) {
0,
'',
false,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
"removeTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1020,7 +1029,7 @@ if ($step == 2) {
0,
'',
true,
$is_central_policies_on_node,
($is_central_policies_on_node | $disabled),
"addTinyMCE('textarea_field".$i."_recovery')",
'',
true
@ -1036,7 +1045,7 @@ if ($step == 2) {
'class="fields min-height-40px"',
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
}
} else {
@ -1093,7 +1102,7 @@ if ($step == 2) {
'',
'',
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
@ -1103,8 +1112,12 @@ if ($step == 2) {
$return_all_group = false;
if (users_can_manage_group_all('LM') === true) {
if (users_can_manage_group_all('LM') === true || $disabled) {
$return_all_group = true;
} else {
if ($id_group == 0) {
$id_group = users_get_first_group(false, 'LM', false);
}
}
$table->data[0][1] .= '&nbsp;';
@ -1121,7 +1134,7 @@ if ($step == 2) {
false,
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
).'</div>';
@ -1134,7 +1147,7 @@ if ($step == 2) {
'',
true,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
$table->data[2][0] = __('Priority');
@ -1149,7 +1162,7 @@ if ($step == 2) {
false,
false,
'',
$is_central_policies_on_node
($is_central_policies_on_node | $disabled)
);
if (defined('METACONSOLE')) {
@ -1186,16 +1199,6 @@ if ($id) {
html_print_input_hidden('create_template', 1);
}
$disabled = false;
if (!$create_alert && !$create_template) {
if ($a_template['id_group'] == 0) {
// then must have "PM" access privileges
if (! check_acl($config['id_user'], 0, 'PM')) {
$disabled = true;
}
}
}
if (!$disabled) {
if ($is_central_policies_on_node === false) {
if ($step >= LAST_STEP) {

View File

@ -200,11 +200,7 @@ $table->data[5] = $data;
if ($event_response_id == 0) {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=create_response&amp;pure='.$config['pure'].'">';
html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right">';
} else {
echo '<div class="w100p right">';
}
echo '<div class="w100p right_align">';
html_print_submit_button(__('Create'), 'create_response_button', false, ['class' => 'sub next']);
echo '</div>';
@ -212,11 +208,7 @@ if ($event_response_id == 0) {
} else {
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=list&action=update_response&amp;pure='.$config['pure'].'">';
html_print_table($table);
if (!defined('METACONSOLE')) {
echo '<div class="w100p right">';
} else {
echo '<div class="w100p right">';
}
echo '<div class="w100p right_align">';
html_print_submit_button(__('Update'), 'update_response_button', false, ['class' => 'sub next']);
echo '</div>';

View File

@ -86,7 +86,7 @@ foreach ($event_responses as $response) {
html_print_table($table);
echo '<div class="w100p right">';
echo '<div class="w100p right_align">';
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">';
html_print_submit_button(
__('Create response'),

View File

@ -44,7 +44,7 @@ $sec2 = safe_url_extraclean($sec2);
$sec = get_parameter_get('sec');
$sec = safe_url_extraclean($sec);
// Layers
// Layers.
$layer_ids = get_parameter('layer_ids', []);
$layers = get_parameter('layers', []);
$layer_list = [];
@ -84,9 +84,10 @@ switch ($action) {
$map_default_latitude = get_parameter('map_default_latitude');
$map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom');
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
foreach ($map_connection_list_temp as $index => $value) {
@ -99,14 +100,14 @@ switch ($action) {
$map_connection_default = get_parameter('map_connection_default');
$map_connection_list = [];
foreach ($map_connection_list_temp as $idMapConnection) {
foreach ($listConnectionTemp as $idMapConnection) {
$default = 0;
if ($map_connection_default == $idMapConnection) {
if ($map_connection_default == $idMapConnection['id_tmap_connection']) {
$default = 1;
}
$map_connection_list[] = [
'id_conection' => $idMapConnection,
'id_conection' => $idMapConnection['id_tmap_connection'],
'default' => $default,
];
}
@ -124,7 +125,7 @@ switch ($action) {
$map_levels_zoom
);
if (empty($invalidFields) && get_parameter('map_connection_list') != '') {
if (empty($invalidFields)) {
$idMap = gis_save_map(
$map_name,
$map_initial_longitude,
@ -139,8 +140,13 @@ switch ($action) {
$map_connection_list,
$layer_list
);
$mapCreatedOk = true;
$next_action = 'update_saved';
if ($idMap) {
$mapCreatedOk = true;
$next_action = 'update_saved';
} else {
$next_action = 'save_new';
$mapCreatedOk = false;
}
} else {
$next_action = 'save_new';
$mapCreatedOk = false;
@ -168,7 +174,7 @@ switch ($action) {
$map_group_id = '';
$map_connection_list = [];
$layer_list = [];
$map_levels_zoom = 0;
$map_levels_zoom = 16;
break;
case 'edit_map':
@ -188,9 +194,12 @@ switch ($action) {
$map_default_latitude = get_parameter('map_default_latitude');
$map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom');
$map_levels_zoom = get_parameter('map_levels_zoom', 16);
$map_connection_list_temp = explode(',', get_parameter('map_connection_list'));
$listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection');
foreach ($map_connection_list_temp as $index => $value) {
$cleanValue = trim($value);
if ($cleanValue == '') {
@ -201,14 +210,14 @@ switch ($action) {
$map_connection_default = get_parameter('map_connection_default');
$map_connection_list = [];
foreach ($map_connection_list_temp as $idMapConnection) {
foreach ($listConnectionTemp as $idMapConnection) {
$default = 0;
if ($map_connection_default == $idMapConnection) {
if ($map_connection_default == $idMapConnection['id_tmap_connection']) {
$default = 1;
}
$map_connection_list[] = [
'id_conection' => $idMapConnection,
'id_conection' => $idMapConnection['id_tmap_connection'],
'default' => $default,
];
}
@ -226,7 +235,7 @@ switch ($action) {
$map_levels_zoom
);
if (empty($invalidFields) && get_parameter('map_connection_list') != '') {
if (empty($invalidFields)) {
// TODO
gis_update_map(
$idMap,
@ -263,7 +272,7 @@ switch ($action) {
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&map_id='.$idMap.'&action='.$next_action;
$buttons['gis_maps_list'] = [
'active' => true,
'active' => false,
'text' => '<a href="index.php?sec=godgismaps&sec2=operation/gis_maps/gis_map">'.html_print_image(
'images/list.png',
true,
@ -275,7 +284,7 @@ $buttons['gis_maps_list'] = [
];
if ($idMap) {
$buttons['view_gis'] = [
'active' => true,
'active' => false,
'text' => '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$idMap.'">'.html_print_image(
'images/op_gis.png',
true,
@ -457,7 +466,7 @@ $table->data[1][0] = __('Add Map connection').$iconError;
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'>
<tr>
<td >
".html_print_select($listConnection, 'map_connection', '', '', '', '0', true)."
".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
</td>
<td >
<a href='javascript: addConnectionMap();'>".html_print_image(
@ -504,7 +513,11 @@ $table->data[2][1] = html_print_select_groups(
);
$table->data[3][0] = __('Default zoom');
$table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden('map_levels_zoom', $map_levels_zoom, true);
$table->data[3][1] = html_print_input_text('map_zoom_level', $map_zoom_level, '', 2, 4, true).html_print_input_hidden(
'map_levels_zoom',
$map_levels_zoom,
true
);
$table->data[4][0] = __('Center Latitude').':';
$table->data[4][1] = html_print_input_text('map_initial_latitude', $map_initial_latitude, '', 8, 8, true);
@ -536,7 +549,7 @@ $table->valign[1] = 'top';
$table->data = [];
$table->data[0][0] = '<h4>'.__('List of layers').'</h4>';
$table->data[0][1] = '<divclass="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add"', true).'</div>';
$table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>';
$table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>';
$table->data[1][1] = '<div id="form_layer" class="invisible">
@ -571,6 +584,9 @@ $params['hidden_input_idagent_name'] = 'agent_id';
$params['input_name'] = 'agent_alias';
$params['value'] = '';
$params['javascript_function_action_after_select'] = 'active_button_add_agent';
$params['javascript_is_function_select'] = true;
$params['disabled_javascript_on_blur_function'] = false;
$table->data[1][1] .= ui_print_agent_autocomplete_input($params);
@ -585,7 +601,7 @@ $table->data[1][1] .= '</td>
</td>
</tr>';
// Group items
// Group items.
$group_select = html_print_select_groups($config['id_user'], 'AR', false, 'layer_group_id', '', '', '', 0, true);
$params = [];
$params['return'] = true;
@ -597,8 +613,10 @@ $params['input_name'] = 'agent_alias_for_data';
$params['value'] = '';
$params['javascript_function_action_after_select'] = 'toggleAddGroupBtn';
$params['selectbox_group'] = 'layer_group_id';
// Filter by group
$params['disabled_javascript_on_blur_function'] = true;
$params['javascript_is_function_select'] = true;
// Filter by group.
$params['disabled_javascript_on_blur_function'] = false;
$agent_for_group_input = ui_print_agent_autocomplete_input($params);
$add_group_btn = html_print_button(__('Add'), 'add_group', true, '', 'class="sub add"', true);
@ -972,15 +990,7 @@ function getAgentRow (layerId, agentId, agentAlias) {
var $deleteCol = $("<td />");
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>");
var $removeBtn = $('<a class="delete_row" href="javascript:;">
<?php
echo html_print_image(
'images/cross.png',
true,
['class' => 'invert_filter']
);
?>
</a>');
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']); ?> </a>');
$removeBtn.click(function (event) {
var $layerRow = $("tr#layer_row_" + layerId);

View File

@ -1,16 +1,32 @@
<?php
/**
* Configure agent groups.
*
* @category Agents group management.
* @package Pandora FMS
* @subpackage User interface.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Begin.
global $config;
check_login();
@ -27,7 +43,7 @@ require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('meta/include/functions_agents_meta.php');
// Init vars
// Default values.
$icon = '';
$name = '';
$id_parent = 0;
@ -39,6 +55,7 @@ $skin = 0;
$contact = '';
$other = '';
$description = '';
$max_agents = 0;
$create_group = (bool) get_parameter('create_group');
$id_group = (int) get_parameter('id_group');
@ -62,6 +79,7 @@ if ($id_group) {
$description = $group['description'];
$contact = $group['contact'];
$other = $group['other'];
$max_agents = $group['max_agents'];
} else {
ui_print_error_message(__('There was a problem loading group'));
echo '</table>';
@ -149,12 +167,12 @@ if ($id_group) {
$table->data[2][1] .= html_print_select_groups(
false,
'AR',
true,
false,
'id_parent',
$id_parent,
'',
'',
'',
__('None'),
-1,
true,
false,
true,
@ -174,7 +192,9 @@ if ($id_group) {
'name' => 'id_parent',
'selected' => $id_parent,
'return' => true,
'returnAllGroup' => true,
'returnAllGroup' => false,
'nothing' => __('None'),
'nothing_value' => -1,
]
);
$table->data[2][1] .= '</div>';
@ -182,7 +202,7 @@ if ($id_group) {
if ($acl_parent) {
$table->data[2][1] .= ' <span id="parent_preview">';
$table->data[2][1] .= html_print_image('images/groups_small/'.groups_get_icon($id_parent).'.png', true);
$table->data[2][1] .= html_print_image('images/groups_small/'.( $id_parent != 0 ? groups_get_icon($id_parent) : 'without_group').'.png', true);
$table->data[2][1] .= '</span>';
}
@ -217,11 +237,14 @@ $table->data[$i][0] = __('Other').ui_print_help_tip(__('Information accessible t
$table->data[$i][1] = html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true);
$i++;
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) {
$table->data[9][0] = __('Skin');
$table->data[9][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true);
}
// $isFunctionSkins = enterprise_include_once('include/functions_skins.php');
// if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) {
// $table->data[10][0] = __('Skin');
// $table->data[10][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true);
// }
$table->data[$i][0] = __('Max agents allowed').'&nbsp;'.ui_print_help_tip(__('Set the maximum of agents allowed for this group. 0 is unlimited.'), true);
$table->data[$i][1] = html_print_input_text('max_agents', $max_agents, '', 10, 255, true);
$i++;
if (defined('METACONSOLE')) {
$sec = 'advanced';
@ -240,6 +263,7 @@ if (isset($config['metaconsole_node_id']) && $config['metaconsole_node_id'] > 0)
echo '<form name="grupo" method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/group_list&pure='.$config['pure'].'"'.$confirm_bottom.' >';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel"');
if ($id_group) {
html_print_input_hidden('update_group', 1);
html_print_input_hidden('id_group', $id_group);
@ -330,5 +354,8 @@ function parent_changed () {
$(document).ready (function () {
$('#icon').change (icon_changed);
$('#id_parent').change (parent_changed);
$('#button-button_back').on('click', function(){
window.location = '<?php echo ui_get_full_url('index.php?sec='.$sec.'&sec2=godmode/groups/group_list'); ?>';
});
});
</script>

View File

@ -39,14 +39,14 @@ require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_users.php';
if (is_metaconsole()) {
if (is_metaconsole() === true) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_hook('open_meta_frame');
}
if (is_ajax()) {
if (! check_acl($config['id_user'], 0, 'AR')) {
if (is_ajax() === true) {
if ((bool) check_acl($config['id_user'], 0, 'AR') === false) {
db_pandora_audit('ACL Violation', 'Trying to access Group Management');
include 'general/noaccess.php';
return;
@ -56,13 +56,13 @@ if (is_ajax()) {
$get_group_agents = (bool) get_parameter('get_group_agents');
$get_is_disabled = (bool) get_parameter('get_is_disabled');
if ($get_group_json) {
if ($get_group_json === true) {
$id_group = (int) get_parameter('id_group');
if ($id_group == 0) {
if ($id_group === 0 || $id_group === -1) {
$group = [
'id_grupo' => 0,
'nombre' => 'All',
'nombre' => 'None',
'icon' => 'world',
'parent' => 0,
'disabled' => 0,
@ -72,7 +72,7 @@ if (is_ajax()) {
return;
}
if (! check_acl($config['id_user'], $id_group, 'AR')) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -87,7 +87,7 @@ if (is_ajax()) {
return;
}
if ($get_group_agents) {
if ($get_group_agents === true) {
ob_clean();
$id_group = (int) get_parameter('id_group');
$disabled = (int) get_parameter('disabled', 0);
@ -108,10 +108,13 @@ if (is_ajax()) {
// (by default and for compatibility show void agents).
$show_void_agents = (int) get_parameter('show_void_agents', 1);
$serialized = (bool) get_parameter('serialized', false);
$serialized_separator = (string) get_parameter('serialized_separator', '|');
$serialized_separator = (string) get_parameter(
'serialized_separator',
'|'
);
$force_serialized = (bool) get_parameter('force_serialized', false);
if (! check_acl($config['id_user'], $id_group, 'AR')) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -120,12 +123,15 @@ if (is_ajax()) {
return;
}
if (https_is_running()) {
if (https_is_running() === true) {
header('Content-type: application/json');
}
if ($filter_agents_json != '') {
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
$filter['id_agente'] = json_decode(
io_safe_output($filter_agents_json),
true
);
}
if ($all_agents) {
@ -142,7 +148,6 @@ if (is_ajax()) {
$filter['status'] = $status_agents;
}
// Juanma (22/05/2014) Fix: If remove void agents set.
$_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\'';
@ -172,7 +177,9 @@ if (is_ajax()) {
$agents_aux = [];
foreach ($agents as $key => $value) {
if (preg_match('/'.$search.'/', io_safe_output($value))) {
if (empty($search) === true) {
$agents_aux[$key] = $value;
} else if (preg_match('/'.$search.'/', io_safe_output($value)) === true) {
$agents_aux[$key] = $value;
}
}
@ -197,7 +204,10 @@ if (is_ajax()) {
'id_tmetaconsole_setup' => $agent_info[0],
]
);
} else if ($serialized && !is_metaconsole() && $force_serialized) {
} else if ($serialized
&& is_metaconsole() === false
&& $force_serialized
) {
$agent_info = explode($serialized_separator, $k);
$agent_disabled = db_get_value_filter(
'disabled',
@ -233,10 +243,14 @@ if (is_ajax()) {
return;
}
if ($get_is_disabled) {
if ($get_is_disabled === true) {
$index = get_parameter('id_agent');
$agent_disabled = db_get_value_filter('disabled', 'tagente', ['id_agente' => $index]);
$agent_disabled = db_get_value_filter(
'disabled',
'tagente',
['id_agente' => $index]
);
$return['disabled'] = $agent_disabled;
$return['id_agent'] = $index;
@ -251,15 +265,9 @@ if (is_ajax()) {
$tab = (string) get_parameter('tab', 'groups');
if ($tab != 'credbox' && ! check_acl(
$config['id_user'],
0,
'PM'
) && ! check_acl(
$config['id_user'],
0,
'AW'
)
if ($tab !== 'credbox'
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
&& (bool) check_acl($config['id_user'], 0, 'AW') === false
) {
db_pandora_audit(
'ACL Violation',
@ -267,9 +275,9 @@ if ($tab != 'credbox' && ! check_acl(
);
include 'general/noaccess.php';
return;
} else if ($tab == 'credbox'
&& !check_acl($config['id_user'], 0, 'UM')
&& !check_acl($config['id_user'], 0, 'PM')
} else if ($tab === 'credbox'
&& (bool) check_acl($config['id_user'], 0, 'UM') === false
&& (bool) check_acl($config['id_user'], 0, 'PM') === false
) {
db_pandora_audit(
'ACL Violation',
@ -339,7 +347,7 @@ switch ($tab) {
}
// Header.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
agents_meta_print_header();
echo '<div class="notify">';
echo __('Edit or delete groups can cause problems with synchronization');
@ -368,7 +376,7 @@ $delete_group = (bool) get_parameter('delete_group');
$pure = get_parameter('pure', 0);
// Create group.
if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
if (($create_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
$id_parent = (int) get_parameter('id_parent');
@ -379,6 +387,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$description = (string) get_parameter('description');
$contact = (string) get_parameter('contact');
$other = (string) get_parameter('other');
$max_agents = (int) get_parameter('max_agents', 0);
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$propagate = (bool) get_parameter('propagate');
@ -403,6 +412,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
'propagate' => $propagate,
'other' => $other,
'password' => io_safe_input($group_pass),
'max_agents' => $max_agents,
];
$result = db_process_sql_insert('tgrupo', $values);
@ -436,6 +446,7 @@ if ($update_group) {
$description = (string) get_parameter('description');
$contact = (string) get_parameter('contact');
$other = (string) get_parameter('other');
$max_agents = (int) get_parameter('max_agents', 0);
$aviable_name = true;
if (preg_match('/script/i', $name)) {
@ -460,7 +471,7 @@ if ($update_group) {
$values = [
'nombre' => $name,
'icon' => empty($icon) ? '' : substr($icon, 0, -4),
'parent' => $id_parent,
'parent' => $id_parent == -1 ? 0 : $id_parent,
'disabled' => !$alerts_enabled,
'custom_id' => $custom_id,
'id_skin' => $skin,
@ -469,6 +480,7 @@ if ($update_group) {
'propagate' => $propagate,
'other' => $other,
'password' => io_safe_input($group_pass),
'max_agents' => $max_agents,
];
$result = db_process_sql_update(
@ -492,7 +504,7 @@ if ($update_group) {
}
// Delete group.
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
if (($delete_group) && ((bool) check_acl($config['id_user'], 0, 'PM') === true)) {
$id_group = (int) get_parameter('id_group');
$usedGroup = groups_check_used($id_group);
@ -508,28 +520,42 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$success_nodes = [];
$error_nodes = [];
// Check if the group can be deleted or not.
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$result_exist_group = db_get_row_filter('tgrupo', ['nombre' => $group_name, 'id_grupo' => $id_group]);
if ($result_exist_group !== false) {
$used_group = groups_check_used($id_group);
// Save the names of the nodes that are empty and can be deleted, and those that cannot.
if (!$used_group['return']) {
$success_nodes[] .= $server['server_name'];
$success_counter++;
} else {
$error_nodes[] .= $server['server_name'];
$error_counter++;
if (isset($servers) === true
&& is_array($servers) === true
) {
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$result_exist_group = db_get_row_filter(
'tgrupo',
[
'nombre' => $group_name,
'id_grupo' => $id_group,
]
);
if ($result_exist_group !== false) {
$used_group = groups_check_used($id_group);
// Save the names of the nodes that are empty
// and can be deleted, and those that cannot.
if (!$used_group['return']) {
$success_nodes[] .= $server['server_name'];
$success_counter++;
} else {
$error_nodes[] .= $server['server_name'];
$error_counter++;
}
}
}
}
metaconsole_restore_db();
metaconsole_restore_db();
}
}
if ($error_counter > 0) {
ui_print_error_message(
__('The group %s could not be deleted because it is not empty in the nodes', $group_name).': '.implode(', ', $error_nodes)
__(
'The group %s could not be deleted because it is not empty in the nodes',
$group_name
).': '.implode(', ', $error_nodes)
);
$errors_meta = true;
} else {
@ -540,60 +566,80 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
$success_deleting = [];
$error_connecting_node = [];
// Delete the group in the nodes.
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$group = db_get_row_filter(
'tgrupo',
['id_grupo' => $id_group]
);
if (isset($servers) === true
&& is_array($servers) === true
) {
foreach ($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$group = db_get_row_filter(
'tgrupo',
['id_grupo' => $id_group]
);
db_process_sql_update(
'tgrupo',
['parent' => $group['parent']],
['parent' => $id_group]
);
db_process_sql_update(
'tgrupo',
['parent' => $group['parent']],
['parent' => $id_group]
);
db_process_sql_delete(
'tgroup_stat',
['id_group' => $id_group]
);
db_process_sql_delete(
'tgroup_stat',
['id_group' => $id_group]
);
$result = db_process_sql_delete(
'tgrupo',
['id_grupo' => $id_group]
);
$result = db_process_sql_delete(
'tgrupo',
['id_grupo' => $id_group]
);
if ($result === false) {
$error_deleting[] .= $server['server_name'];
$error_deleting_counter++;
if ($result === false) {
$error_deleting[] .= $server['server_name'];
$error_deleting_counter++;
} else {
$success_deleting[] .= $server['server_name'];
$success_deleting_counter++;
}
} else {
$success_deleting[] .= $server['server_name'];
$success_deleting_counter++;
$error_deleting_counter++;
$error_connecting_node[] .= $server['server_name'];
}
} else {
$error_deleting_counter++;
$error_connecting_node[] .= $server['server_name'];
}
metaconsole_restore_db();
metaconsole_restore_db();
}
}
// If the group could not be deleted in any node, do not delete it in meta.
// If the group could not be deleted in any node,
// do not delete it in meta.
if ($error_deleting_counter > 0) {
$errors_meta = true;
if (!empty($error_connecting_node)) {
ui_print_error_message(__('Error connecting to %s', implode(', ', $error_connecting_node).'. The group has not been deleted in the metaconsole.'));
if (empty($error_connecting_node) === false) {
ui_print_error_message(
__(
'Error connecting to %s',
implode(
', ',
$error_connecting_node
).'. The group has not been deleted in the metaconsole.'
)
);
}
if (!empty($error_deleting)) {
if (empty($error_deleting) === false) {
ui_print_error_message(
__('The group has not been deleted in the metaconsole due to an error in the node database').': '.implode(', ', $error_deleting)
__(
'The group has not been deleted in the metaconsole due to an error in the node database'
).': '.implode(', ', $error_deleting)
);
}
}
if ($success_deleting_counter > 0) {
ui_print_success_message(__('The group %s has been deleted in the nodes', $group_name).': '.implode(', ', $success_deleting));
ui_print_success_message(
__(
'The group %s has been deleted in the nodes',
$group_name
).': '.implode(', ', $success_deleting)
);
}
}
}
@ -624,12 +670,17 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
if ($result && (!$usedGroup['return'])) {
ui_print_success_message(__('Group successfully deleted'));
} else {
ui_print_error_message(__('There was a problem deleting group'));
ui_print_error_message(
__('There was a problem deleting group')
);
}
}
} else {
ui_print_error_message(
sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables']))
sprintf(
__('The group is not empty. It is use in %s.'),
implode(', ', $usedGroup['tables'])
)
);
}
}
@ -662,14 +713,14 @@ if ($tab == 'tree') {
$search = (string) get_parameter('search', '');
$block_size = $config['block_size'];
if (!empty($search)) {
if (empty($search) === false) {
$search_name = 'AND t.nombre LIKE "%'.$search.'%"';
}
if (!users_can_manage_group_all('AR')) {
if (users_can_manage_group_all('AR') === false) {
$user_groups_acl = users_get_groups(false, 'AR');
$groups_acl = implode(',', $user_groups_ACL);
if (empty($groups_acl)) {
$groups_acl = implode('","', $user_groups_acl);
if (empty($groups_acl) === true) {
return ui_print_info_message(
[
'no_close' => true,
@ -678,13 +729,20 @@ if ($tab == 'tree') {
);
}
$acl = 'AND t.id_grupo IN ('.$groups_acl.')';
$acl = 'AND t.nombre IN ("'.$groups_acl.'")';
}
$form = "<form method='post' action=''>";
$form .= "<table class='databox filters bolder' width='100%'>";
$form .= '<tr><td>'.__('Search').'&nbsp;';
$form .= html_print_input_text('search', $search, '', 100, 100, true);
$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>';
@ -713,7 +771,7 @@ if ($tab == 'tree') {
$groups = db_get_all_rows_sql($groups_sql);
if (!empty($groups)) {
if (empty($groups) === false) {
// Count all groups for pagination only saw user and filters.
$groups_sql_count = sprintf(
'SELECT count(*)
@ -799,7 +857,7 @@ if ($tab == 'tree') {
]
).'</a>';
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
} else {
$confirm_message = __('Are you sure?');
@ -841,11 +899,16 @@ if ($tab == 'tree') {
'pagination-bottom'
);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);
ui_print_info_message(
[
'no_close' => true,
'message' => __('There are no defined groups'),
]
);
}
}
if (check_acl($config['id_user'], 0, 'PM')) {
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group">';
echo '<div class="action-buttons w100p">';
html_print_submit_button(__('Create group'), 'crt', false, 'class="sub next"');
@ -860,7 +923,7 @@ $tab = 'group_edition';
?>
<?php if (!is_metaconsole()) { ?>
<?php if (is_metaconsole() === false) { ?>
<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>
@ -900,7 +963,6 @@ $tab = 'group_edition';
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'); ?>",

View File

@ -506,7 +506,7 @@ $id_os = 0;
$server_name = 0;
$description = '';
echo '<div id="form_agents" class="invisible">';
echo '<div id="form_agents" style="display:none">';
$table = new StdClass();
$table->width = '100%';
@ -819,24 +819,17 @@ foreach ($fields as $field) {
}
if ($field['combo_values'] !== '') {
$data[1] = html_print_select(
$combo_values,
'customvalue_'.$field['id_field'],
$custom_value,
'',
__('No change'),
'',
true,
false,
false,
'',
false,
false,
false,
false,
false,
'',
false
$data[1] = html_print_input(
[
'type' => 'select_search',
'fields' => $combo_values,
'name' => 'customvalue_'.$field['id_field'],
'selected' => $custom_value,
'nothing' => __('No change'),
'nothing_value' => '',
'return' => true,
'sort' => false,
]
);
};

View File

@ -46,7 +46,7 @@ if (defined('METACONSOLE')) {
$sec = 'gmodules';
}
if (is_management_allowed() === true) {
if (is_management_allowed() === true || is_metaconsole()) {
$create = (bool) get_parameter('create');
$update = (bool) get_parameter('update');
$delete = (bool) get_parameter('delete');
@ -125,7 +125,7 @@ if ($delete) {
['id_sg' => $id]
);
if (($result !== false) and ($result1 !== false)) {
if (($result !== false) && ($result1 !== false)) {
$result = true;
} else {
$result = false;
@ -187,7 +187,7 @@ if ($multiple_delete) {
);
}
if (($id || $new) && !$delete && !$multiple_delete && is_management_allowed() === true) {
if (($id || $new) && !$delete && !$multiple_delete && (is_management_allowed() === true || is_metaconsole())) {
include_once 'manage_nc_groups_form.php';
return;
}
@ -230,7 +230,7 @@ $table->class = 'info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name');
if (is_management_allowed() === true) {
if (is_management_allowed() === true || is_metaconsole()) {
$table->head[1] = __('Action');
}
@ -262,15 +262,15 @@ foreach ($groups as $group) {
}
$table->cellclass[][1] = 'action_buttons';
if (is_management_allowed() === true) {
if (is_management_allowed() === true || is_metaconsole()) {
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
}
array_push($table->data, $data);
}
if (is_management_allowed() === false) {
if (is_management_allowed() === false && !is_metaconsole()) {
ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.'));
}
@ -278,7 +278,7 @@ if (isset($data)) {
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_nc_groups'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
if (is_management_allowed() === true) {
if (is_management_allowed() === true || is_metaconsole()) {
echo "<div class='pdd_l_10px float-right mrgn_btn_15px'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
@ -289,7 +289,7 @@ if (isset($data)) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined component groups') ]);
}
if (is_management_allowed() === true) {
if (is_management_allowed() === true || is_metaconsole()) {
echo '<form method="post" action='.$url.'>';
echo '<div class="float-right">';
html_print_input_hidden('new', 1);

View File

@ -568,71 +568,19 @@ if ($id || $new_component
return;
}
$url = ui_get_url_refresh(
[
'offset' => false,
'id' => false,
'create_component' => false,
'update_component' => false,
'delete_component' => false,
'id_network_component' => false,
'upd' => false,
'crt' => false,
'type' => false,
'name' => false,
'description' => false,
'max' => false,
'min' => false,
'tcp_send' => false,
'tcp_rcv' => false,
'tcp_port' => false,
'snmp_oid' => false,
'snmp_community' => false,
'id_module_group' => false,
'module_interval' => false,
'id_group' => false,
'plugin_user' => false,
'plugin_pass' => false,
'plugin_parameter' => false,
'macros' => false,
'max_timeout' => false,
'max_retries' => false,
'id_modulo' => false,
'id_plugin' => false,
'history_data' => false,
'dynamic_interval' => false,
'dynamic_max' => false,
'dynamic_min' => false,
'dynamic_two_tailed' => false,
'min_warning' => false,
'max_warning' => false,
'str_warning' => false,
'min_critical' => false,
'max_critical' => false,
'str_critical' => false,
'ff_event' => false,
'id_component_type' => false,
'critical_instructions' => false,
'warning_instructions' => false,
'unknown_instructions' => false,
'critical_inverse' => false,
'warning_inverse' => false,
'id_category' => false,
'tags' => false,
'ff_event_normal' => false,
'ff_event_warning' => false,
'ff_event_critical' => false,
'each_ff' => false,
'ff_type' => false,
]
);
$search_id_group = (int) get_parameter('search_id_group');
$search_string = (string) get_parameter('search_string');
if (!empty($search_string)) {
$search_string = trim($search_string, '&#x20;');
}
$url = ui_get_url_refresh(
[
'offset' => false,
'search_string' => $search_string,
'search_id_group' => $search_id_group,
],
true,
false
);
$table = new stdClass();
$table->width = '100%';

View File

@ -357,7 +357,7 @@ if (defined('METACONSOLE')) {
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_button(__('Go back'), 'go_back', false, 'history.go(-1);', 'class="sub cancel"');
html_print_button(__('Go back'), 'go_back', false, '', 'class="sub cancel"');
html_print_input_hidden('id_component_type', $id_component_type);
if ($id) {
html_print_input_hidden('update_component', 1);
@ -376,6 +376,11 @@ ui_require_javascript_file('pandora_modules');
?>
<script language="JavaScript" type="text/javascript">
<!--
$('#button-go_back').click(function () {
window.location.href = "<?php echo ui_get_full_url('index.php?sec=templates&sec2=godmode/modules/manage_network_components'); ?>";
});
function type_change () {
// type 1-4 - Generic_xxxxxx
if ((document.component.type.value > 0) && (document.component.type.value < 5)) {

View File

@ -194,22 +194,22 @@ if ($delete_layout || $copy_layout) {
}
if ($copy_layout) {
// Number of inserts
// Number of inserts.
$ninsert = (int) 0;
// Return from DB the source layout
// Return from DB the source layout.
$layout_src = db_get_all_rows_filter(
'tlayout',
['id' => $id_layout]
);
// Name of dst
// Name of dst.
$name_dst = get_parameter(
'name_dst',
$layout_src[0]['name'].' copy'
);
// Create the new Console
// Create the new Console.
$idGroup = $layout_src[0]['id_group'];
$background = $layout_src[0]['background'];
$height = $layout_src[0]['height'];
@ -217,12 +217,15 @@ if ($delete_layout || $copy_layout) {
$visualConsoleName = $name_dst;
$values = [
'name' => $visualConsoleName,
'id_group' => $idGroup,
'background' => $background,
'height' => $height,
'width' => $width,
'name' => $visualConsoleName,
'id_group' => $idGroup,
'background' => $background,
'height' => $height,
'width' => $width,
'background_color' => $layout_src[0]['background_color'],
'is_favourite' => $layout_src[0]['is_favourite'],
];
$result = db_process_sql_insert('tlayout', $values);
$idNewVisualConsole = $result;
@ -515,9 +518,9 @@ if (!$maps && !is_metaconsole()) {
if ($maps) {
if (!is_metaconsole()) {
echo '<div class="action-buttons w100p right">';
echo '<div class="action-buttons w100p right_align">';
} else {
echo '<div class="w100p right_align">';
echo '<div class="w100p right right_align mrgn_btn_20px">';
}
}

View File

@ -3283,7 +3283,7 @@ function print_SLA_list($width, $action, $idItem=null)
echo '</tbody>';
?>
<tbody id="sla_template">
<tr id="row" class="datos invisible">
<tr id="row" class="datos" style="display: none">
<td class="sla_list_agent_col agent_name"></td>
<td class="sla_list_module_col module_name"></td>
<?php
@ -3326,6 +3326,9 @@ function print_SLA_list($width, $action, $idItem=null)
<input id="hidden-id_agent_sla" name="id_agent_sla" value="" type="hidden">
<input id="hidden-id_server" name="id_server" value="" type="hidden">
<?php
// Set autocomplete image.
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black') ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
// Params for agent autocomplete input.
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'agent_sla';
@ -3335,6 +3338,8 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_sla';
$params['add_none_module'] = false;
$params['check_only_empty_javascript_on_blur_function'] = true;
$params['icon_image'] = $autocompleteImage;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
@ -3370,6 +3375,7 @@ function print_SLA_list($width, $action, $idItem=null)
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module_failover';
$params['add_none_module'] = false;
$params['icon_image'] = $autocompleteImage;
if ($meta) {
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
@ -3687,7 +3693,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
?>
<tbody id="general_template">
<tr id="row" class="datos invisible">
<tr id="row" class="datos" style="display: none">
<td class="agent_name"></td>
<td class="module_name"></td>
<?php
@ -3739,6 +3745,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
$params['use_input_id_server'] = true;
$params['input_id_server_id'] = 'hidden-id_server';
$params['disabled_javascript_on_blur_function'] = true;
$params['javascript_is_function_select'] = true;
}
ui_print_agent_autocomplete_input($params);
@ -4733,8 +4740,10 @@ function addSLARow() {
var serviceId = $("select#id_service>option:selected").val();
var serviceName = $("select#id_service>option:selected").text();
if (((idAgent != '') && (slaMin != '') && (slaMax != '')
&& (slaLimit != '')) || serviceId != '') {
if ((((idAgent != '') && (idAgent > 0))
&& ((idModule != '') && (idModule > 0)))
|| serviceId != null)
{
if (nameAgent != '') {
//Truncate nameAgent
var params = [];
@ -4891,6 +4900,7 @@ function addSLARow() {
$("input[name=id_agent_failover]").val('');
$("input[name=id_server]").val('');
$("input[name=agent_sla]").val('');
$("input[name=agent_sla]").css("background","url('<?php echo $autocompleteImage; ?>') right center no-repeat")
$("input[name=agent_failover]").val('');
$("#id_agent_module_sla").empty();
$("#id_agent_module_sla").attr('disabled', 'true');

View File

@ -664,7 +664,7 @@ if (defined('METACONSOLE')) {
if (check_acl($config['id_user'], 0, 'RM')) {
html_print_input_hidden('ids_items_to_delete', '');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right"');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete right mrgn_btn_15px"');
}
echo '</div>';

View File

@ -742,7 +742,7 @@ switch ($action) {
}
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM')) {
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM') || check_acl($config['id_user'], 0, 'RR')) {
$return_all_group = true;
} else {
$return_all_group = false;

View File

@ -122,10 +122,10 @@ if ($action == 'new') {
src="">';
} else {
if (defined('METACONSOLE')) {
$table->data[0][2] = '<img id="imagen2"
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="../../images/console/background/'.$background.'">';
} else {
$table->data[0][2] = '<img id="imagen2"
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
src="images/console/background/'.$background.'">';
}

View File

@ -85,7 +85,7 @@ visual_map_editor_print_item_palette($visualConsole['id'], $background);
if (!defined('METACONSOLE')) {
echo '<div id="frame_view" class="frame_view_meta">';
} else {
echo '<div id="frame_view" class="frame_view_node">';
echo '<div id="frame_view" class="frame_view_node mrgn_top_meta_35px">';
}
echo '<div id="background" class="" style="top:0px;

View File

@ -20,10 +20,13 @@ require_once $config['homedir'].'/include/functions_visual_map.php';
require_once $config['homedir'].'/include/functions_agents.php';
enterprise_include_once('include/functions_visual_map.php');
// Retrieve the visual console id
// Retrieve the visual console id.
set_unless_defined($idVisualConsole, 0);
// Set default
// Set default.
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
if (empty($idVisualConsole) === true) {
$idVisualConsole = get_parameter('id_visualmap', 0);
}
if (!defined('METACONSOLE')) {
$action_name_parameter = 'action';
@ -792,10 +795,10 @@ if ($config['legacy_vc']) {
$buttons['view'] = [
'active' => false,
'text' => '<a href="'.$url_view.'">'.html_print_image('images/operation.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'</a>',
'text' => '<a href="'.$url_view.'">'.html_print_image('images/eye.png', true, ['title' => __('View'), 'class' => 'invert_filter']).'</a>',
];
if ($action == 'new' || $idVisualConsole === false) {
if ($idVisualConsole === false) {
$buttons = ['data' => $buttons['data']];
// Show only the data tab
// If it is a fail try, reset the values
@ -822,7 +825,7 @@ if ($statusProcessInDB !== null) {
echo $statusProcessInDB['message'];
}
// The source code for PAINT THE PAGE
// The source code for PAINT THE PAGE.
switch ($activeTab) {
case 'wizard':
include_once $config['homedir'].'/godmode/reporting/visual_console_builder.wizard.php';

View File

@ -16,7 +16,7 @@ global $config;
check_login();
// Visual console required.
if (empty($visualConsole)) {
if (empty($visualConsole) === true) {
db_pandora_audit(
'ACL Violation',
'Trying to access report builder'

View File

@ -278,26 +278,26 @@ if ($mapConnectionData != null) {
}
}
// Open Street Map Connection.
$optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.htmlentities(
__('Tile Server URL'),
ENT_QUOTES,
'UTF-8'
).':</td>'.'<td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
45,
90,
true
).'</td>'.'</tr>'.'</table>';
// Open Street Map Connection.
$optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.htmlentities(
__('Tile Server URL'),
ENT_QUOTES,
'UTF-8'
).':</td><td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
45,
90,
true
).'</td></tr></table>';
// Google Maps Connection.
$gmaps_types['G_PHYSICAL_MAP'] = __('Google Physical');
$gmaps_types['G_HYBRID_MAP'] = __('Google Hybrid');
$gmaps_types['G_SATELITE_MAP'] = __('Google Satelite');
// TODO: Use label tags for the forms.
$optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%">'.'<tr class="row_0">'.'<td>'.__('Google Map Type').':</td>'.'<td><input id="type" type="hidden" name="type" value="Gmap" />'.trim(
$optionsConnectionGmapTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="90%"><tr class="row_0"><td>'.__('Google Map Type').':</td><td><input id="type" type="hidden" name="type" value="Gmap" />'.trim(
html_print_select(
$gmaps_types,
'gmap_type',
@ -305,181 +305,223 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
'',
'',
0,
true
true,
false,
true,
'',
false,
false,
false,
false,
false,
'',
false,
false,
false,
false,
false
)
).'</td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Google Maps Key').':</td>'.'</tr>'.'<tr class="row_3">'.'<td colspan="2">'.html_print_input_text(
).'</td></tr><tr class="row_2"><td>'.__('Google Maps Key').':</td></tr><tr class="row_3"><td colspan="2">'.html_print_input_text(
'gmap_key',
$gmap_key,
'',
90,
128,
true
).'</td>'.'</tr>'.'</table>';
).'</td></tr></table>';
// Image Map Connection.
$optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('Image URL').':</td>'.'<td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text(
$optionsConnectionImageTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.__('Image URL').':</td><td colspan="3"><input id="type" type="hidden" name="type" value="Static_Image" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
45,
90,
true
).'</td>'.'</tr>'.'<tr class="row_1">'.'<td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td>'.'</tr>'.'<tr class="row_2">'.'<td>'.__('Left').':</td>'.'<td>'.html_print_input_text(
).'</td></tr><tr class="row_1"><td colspan="4"><strong>'.__('Corners of the area of the image').':</strong></td></tr><tr class="row_2"><td>'.__('Left').':</td><td>'.html_print_input_text(
'bb_left',
$bb_left,
'',
25,
25,
true
).'</td>'.'<td>'.__('Bottom').':</td>'.'<td>'.html_print_input_text(
).'</td><td>'.__('Bottom').':</td><td>'.html_print_input_text(
'bb_bottom',
$bb_bottom,
'',
25,
25,
true
).'</td>'.'</tr>'.'<tr class="row_3">'.'<td>'.__('Right').':</td>'.'<td>'.html_print_input_text(
).'</td></tr><tr class="row_3"><td>'.__('Right').':</td><td>'.html_print_input_text(
'bb_right',
$bb_right,
'',
25,
25,
true
).'</td>'.'<td>'.__('Top').':</td>'.'<td>'.html_print_input_text(
).'</td><td>'.__('Top').':</td><td>'.html_print_input_text(
'bb_top',
$bb_top,
'',
25,
25,
true
).'</td>'.'</tr>'.'<tr class="row_4">'.'<td colspan="4"><strong>'.__('Image Size').':</strong></td>'.'</tr>'.'<tr class="row_5">'.'<td>'.__('Width').':</td>'.'<td>'.html_print_input_text('image_width', $image_width, '', 25, 25, true).'</td>'.'<td>'.__('Height').':</td>'.'<td>'.html_print_input_text('image_height', $image_height, '', 25, 25, true).'</td>'.'</tr>'.'</table>';
).'</td></tr><tr class="row_4"><td colspan="4"><strong>'.__('Image Size').':</strong></td></tr><tr class="row_5"><td>'.__('Width').':</td><td>'.html_print_input_text(
'image_width',
$image_width,
'',
25,
25,
true
).'</td><td>'.__('Height').':</td><td>'.html_print_input_text(
'image_height',
$image_height,
'',
25,
25,
true
).'</td></tr></table>';
// WMS Server Connection.
$optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%">'.'<tr class="row_0">'.'<td>'.__('WMS Server URL').'</td>'.'<td>'.'<input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text('url', $mapConnectionDataUrl, '', 90, 255, true).'</td>'.'</tr>'.'<tr class="row_1">'.'<td>'.__('Layers').'</td>'.'<td>'.html_print_input_text('layers', $layers, '', 90, 255, true).'</td>'.'</tr>'.'</table>';
// WMS Server Connection.
$optionsConnectionWMSTable = '<table class="databox" border="0" cellpadding="4" cellspacing="4" width="50%"><tr class="row_0"><td>'.__('WMS Server URL').'</td><td><input id="type" type="hidden" name="type" value="WMS" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
90,
255,
true
).'</td></tr><tr class="row_1"><td>'.__('Layers').'</td><td>'.html_print_input_text(
'layers',
$layers,
'',
90,
255,
true
).'</td></tr></table>';
if ($mapConnectionData != null) {
switch ($mapConnection_type) {
case 'OSM':
$optionsConnectionTypeTable = $optionsConnectionOSMTable;
break;
if ($mapConnectionData != null) {
switch ($mapConnection_type) {
case 'OSM':
$optionsConnectionTypeTable = $optionsConnectionOSMTable;
break;
case 'Gmap':
$optionsConnectionTypeTable = $optionsConnectionGmapTable;
break;
case 'Gmap':
$optionsConnectionTypeTable = $optionsConnectionGmapTable;
break;
case 'Static_Image':
$optionsConnectionTypeTable = $optionsConnectionImageTable;
break;
case 'Static_Image':
$optionsConnectionTypeTable = $optionsConnectionImageTable;
break;
case 'WMS':
$optionsConnectionTypeTable = $optionsConnectionWMSTable;
break;
case 'WMS':
$optionsConnectionTypeTable = $optionsConnectionWMSTable;
break;
default:
// Default.
break;
default:
// Default.
break;
}
}
}
echo "<div id='form_map_connection_type'>".$optionsConnectionTypeTable.'</div>';
echo "<div id='form_map_connection_type'>".$optionsConnectionTypeTable.'</div>';
echo '<h4>'.__('Preview to select the center of the map and the default position of an agent without gis data').'</h4><br>';
html_print_button(__('Load preview map'), 'button_refresh', false, 'refreshMapView();', 'class="sub"');
echo '<br /><br />';
echo "<div id='map' class='map_gis_step2'></div>";
echo '<h4>'.__('Preview to select the center of the map and the default position of an agent without gis data').'</h4><br>';
html_print_button(__('Load preview map'), 'button_refresh', false, 'refreshMapView();', 'class="sub next"');
echo '<br /><br />';
echo "<div id='map' class='map_gis_step2'></div>";
$table->width = '60%';
$table->data = [];
$table->width = '60%';
$table->data = [];
// $table->colspan[0][3] = 3;
$table->data[0][0] = '';
$table->data[0][1] = __('Map Center');
$table->data[0][2] = __('Default position for agents without GIS data');
// $table->colspan[0][3] = 3;
$table->data[0][0] = '';
$table->data[0][1] = __('Map Center');
$table->data[0][2] = __('Default position for agents without GIS data');
$table->data[1][0] = __('Change in the map');
$table->data[1][1] = html_print_radio_button_extended(
'radio_button',
1,
'',
1,
false,
'changeSetManualPosition(true, false)',
'',
true
);
$table->data[1][2] = html_print_radio_button_extended(
'radio_button',
2,
'',
0,
false,
'changeSetManualPosition(false, true)',
'',
true
);
$table->data[1][0] = __('Change in the map');
$table->data[1][1] = html_print_radio_button_extended(
'radio_button',
1,
'',
1,
false,
'changeSetManualPosition(true, false)',
'',
true
);
$table->data[1][2] = html_print_radio_button_extended(
'radio_button',
2,
'',
0,
false,
'changeSetManualPosition(false, true)',
'',
true
);
$table->data[2][0] = __('Latitude');
$table->data[2][1] = html_print_input_text(
'center_latitude',
$mapConnection_centerLatitude,
'',
10,
10,
true
);
$table->data[2][2] = html_print_input_text(
'default_latitude',
$mapConnection_defaultLatitude,
'',
10,
10,
true
);
$table->data[2][0] = __('Latitude');
$table->data[2][1] = html_print_input_text(
'center_latitude',
$mapConnection_centerLatitude,
'',
10,
10,
true
);
$table->data[2][2] = html_print_input_text(
'default_latitude',
$mapConnection_defaultLatitude,
'',
10,
10,
true
);
$table->data[3][0] = __('Longitude');
$table->data[3][1] = html_print_input_text(
'center_longitude',
$mapConnection_centerLongitude,
'',
10,
10,
true
);
$table->data[3][2] = html_print_input_text(
'default_longitude',
$mapConnection_defaultLongitude,
'',
10,
10,
true
);
$table->data[3][0] = __('Longitude');
$table->data[3][1] = html_print_input_text(
'center_longitude',
$mapConnection_centerLongitude,
'',
10,
10,
true
);
$table->data[3][2] = html_print_input_text(
'default_longitude',
$mapConnection_defaultLongitude,
'',
10,
10,
true
);
$table->data[4][0] = __('Altitude');
$table->data[4][1] = html_print_input_text(
'center_altitude',
$mapConnection_centerAltitude,
'',
10,
10,
true
);
$table->data[4][2] = html_print_input_text(
'default_altitude',
$mapConnection_defaultAltitude,
'',
10,
10,
true
);
html_print_table($table);
$table->data[4][0] = __('Altitude');
$table->data[4][1] = html_print_input_text(
'center_altitude',
$mapConnection_centerAltitude,
'',
10,
10,
true
);
$table->data[4][2] = html_print_input_text(
'default_altitude',
$mapConnection_defaultAltitude,
'',
10,
10,
true
);
html_print_table($table);
echo '<div class="action-buttons w90p left">';
html_print_submit_button(__('Save'), '', false, 'class="sub save wand"');
echo '</div>';
echo '</form>';
echo '<div class="action-buttons w90p float-left">';
html_print_submit_button(__('Save'), '', false, 'class="sub save wand"');
echo '</div>';
echo '</form>';
ui_require_javascript_file('OpenLayers/OpenLayers');
ui_require_javascript_file('openlayers.pandora');
?>
ui_require_javascript_file('OpenLayers/OpenLayers');
ui_require_javascript_file('openlayers.pandora');
?>
<script type="text/javascript">
var setCenter = true;
var centerPoint = null;
@ -649,7 +691,6 @@ function selMapConnectionType() {
$('#form_map_connection_type').html('<?php echo $optionsConnectionOSMTable; ?>').hide();
break;
case 'Gmap':
// TODO: Validate there is a key, and use it
$('#form_map_connection_type').html('<?php echo $optionsConnectionGmapTable; ?>').hide();
break;
case 'Static_Image':

View File

@ -29,7 +29,10 @@
// Load global vars.
global $config;
require_once 'include/config.php';
require_once $config['homedir'].'/include/config.php';
require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Core\Config;
check_login();
@ -41,6 +44,9 @@ if (! check_acl($config['id_user'], 0, 'PM')
return;
}
// Load needed resources.
ui_require_css_file('setup.multicolumn');
$update_config = get_parameter('update_config', 0);
if ($update_config == 1 && $config['history_db_enabled'] == 1) {
if (! isset($config['history_db_connection'])
@ -388,44 +394,11 @@ if ($config['history_db_enabled'] == 1) {
);
}
$config_history = false;
if ($config['history_db_connection']) {
$history_connect = mysql_db_process_sql(
'DESCRIBE tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if ($history_connect !== false) {
$config_history_array = mysql_db_process_sql(
'SELECT * FROM tconfig',
'affected_rows',
$config['history_db_connection'],
false
);
if (isset($config_history_array) && is_array($config_history_array)) {
foreach ($config_history_array as $key => $value) {
$config_history[$value['token']] = $value['value'];
$config_history = true;
}
}
} else {
echo ui_print_error_message(
__('The tconfig table does not exist in the historical database')
);
}
}
if ($config_history === false) {
$config_history = [];
$config_history['days_purge'] = 180;
$config_history['days_compact'] = 120;
$config_history['step_compact'] = 1;
$config_history['event_purge'] = 180;
$config_history['string_purge'] = 180;
}
$config_history['days_purge'] = Config::get('days_purge', 180, true);
$config_history['days_compact'] = Config::get('days_compact', 120, true);
$config_history['step_compact'] = Config::get('step_compact', 1, true);
$config_history['event_purge'] = Config::get('event_purge', 180, true);
$config_history['string_purge'] = Config::get('string_purge', 180, true);
$table_historical = new StdClass();
$table_historical->width = '100%';
@ -679,7 +652,7 @@ $table_other->data[16][1] = html_print_input_text(
echo '<form id="form_setup" method="post">';
echo '<fieldset>';
echo '<fieldset class="full-column">';
echo '<legend>'.__('Database maintenance status').' '.ui_print_help_icon('database_maintenance_status_tab', true).'</legend>';
html_print_table($table_status);
echo '</fieldset>';

View File

@ -337,6 +337,18 @@ if (isset($config['error_config_update_config'])) {
ui_print_success_message(__('Correct update the setup options'));
}
if (is_array($config['error_config_update_config']['errors']) === true) {
foreach ($config['error_config_update_config']['errors'] as $msg) {
ui_print_error_message($msg);
}
}
if (is_array($config['error_config_update_config']['warnings']) === true) {
foreach ($config['error_config_update_config']['warnings'] as $msg) {
ui_print_warning_message($msg);
}
}
unset($config['error_config_update_config']);
}

View File

@ -420,7 +420,7 @@ $table->data[$i++][1] = html_print_select(
$config['past_planned_downtimes'] = isset(
$config['past_planned_downtimes']
) ? $config['past_planned_downtimes'] : 1;
$table->data[$i][0] = __('Allow create planned downtimes in the past');
$table->data[$i][0] = __('Allow create scheduled downtimes in the past');
$table->data[$i++][1] = html_print_checkbox_switch(
'past_planned_downtimes',
1,

View File

@ -282,7 +282,7 @@ $table_remote->data['integria_pass'] = $row;
// Integria hostname.
$row = [];
$row['name'] = __('API Hostname');
$row['name'] = __('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true);
$row['control'] = html_print_input_text('integria_hostname', $config['integria_hostname'], '', 30, 100, true);
$table_remote->data['integria_hostname'] = $row;
@ -329,22 +329,20 @@ $row['control'] = html_print_input_text(
true,
false,
false
).ui_print_help_icon('alert_macros', true);
);
$table_alert_settings->data['custom_response_incident_title'] = $row;
// Alert incident description.
$row = [];
$row['name'] = __('Description');
$row['control'] = html_print_input_text(
$row['name'] = __('Ticket body');
$row['control'] = html_print_textarea(
'incident_content',
7,
25,
$config['incident_content'],
'',
50,
100,
true,
false,
false
).ui_print_help_icon('alert_macros', true);
true
);
$table_alert_settings->data['custom_response_incident_content'] = $row;
// Alert default group.
@ -452,22 +450,21 @@ $row['control'] = html_print_input_text(
true,
false,
false
).ui_print_help_icon('response_macros', true);
);
$table_cr_settings->data['custom_response_incident_title'] = $row;
// Custom response incident description.
$row = [];
$row['name'] = __('Description');
$row['control'] = html_print_input_text(
$row['name'] = __('Ticket body');
$row['control'] = html_print_textarea(
'cr_incident_content',
7,
25,
$config['cr_incident_content'],
'',
50,
100,
true,
false,
false
).ui_print_help_icon('response_macros', true);
true
);
$table_cr_settings->data['custom_response_incident_content'] = $row;
// Custom response default group.
@ -599,7 +596,7 @@ if ($has_connection != false) {
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset>';
echo '<legend>'.__('Alert default values').'</legend>';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings);
@ -609,7 +606,7 @@ if ($has_connection != false) {
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset>';
echo '<legend>'.__('Event custom response default values').'</legend>';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings);
@ -834,7 +831,7 @@ echo '</form>';
// AJAX call to check API connection.
$.ajax({
type: "GET",
type: "POST",
url: url,
dataType: "json",
data: data

File diff suppressed because it is too large Load Diff

View File

@ -585,133 +585,21 @@ if ($update_alert || $duplicate_alert) {
// Duplicate alert snmp
if ($duplicate_alert) {
$sql = sprintf(
'insert into talert_snmp (
id_alert, al_field1, al_field2, al_field3,
al_field4, al_field5, al_field6, al_field7,
al_field8, al_field9, al_field10, al_field11,
al_field12, al_field13, al_field14, al_field15,
al_field16, al_field17, al_field18, al_field19,
al_field20, description, alert_type, agent, custom_oid,
oid, time_threshold, times_fired, last_fired,
max_alerts, min_alerts, internal_counter, priority,
'.db_escape_key_identifier('_snmp_f1_').',
'.db_escape_key_identifier('_snmp_f2_').',
'.db_escape_key_identifier('_snmp_f3_').',
'.db_escape_key_identifier('_snmp_f4_').',
'.db_escape_key_identifier('_snmp_f5_').',
'.db_escape_key_identifier('_snmp_f6_').',
'.db_escape_key_identifier('_snmp_f7_').',
'.db_escape_key_identifier('_snmp_f8_').',
'.db_escape_key_identifier('_snmp_f9_').',
'.db_escape_key_identifier('_snmp_f10_').',
'.db_escape_key_identifier('_snmp_f11_').',
'.db_escape_key_identifier('_snmp_f12_').',
'.db_escape_key_identifier('_snmp_f13_').',
'.db_escape_key_identifier('_snmp_f14_').',
'.db_escape_key_identifier('_snmp_f15_').',
'.db_escape_key_identifier('_snmp_f16_').',
'.db_escape_key_identifier('_snmp_f17_').',
'.db_escape_key_identifier('_snmp_f18_').',
'.db_escape_key_identifier('_snmp_f19_').',
'.db_escape_key_identifier('_snmp_f20_').",
trap_type, single_value, position, disable_event, id_group,
order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8,
order_9, order_10, order_11, order_12, order_13, order_14, order_15,
order_16, order_17, order_18, order_19, order_20)
VALUES
(%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s',
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
'%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d,
%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
$id_alert,
$al_field1,
$al_field2,
$al_field3,
$al_field4,
$al_field5,
$al_field6,
$al_field7,
$al_field8,
$al_field9,
$al_field10,
$al_field11,
$al_field12,
$al_field13,
$al_field14,
$al_field15,
$al_field16,
$al_field17,
$al_field18,
$al_field19,
$al_field20,
$description,
$alert_type,
$source_ip,
$custom_value,
$oid,
$time_threshold,
$times_fired,
$last_fired,
$max_alerts,
$min_alerts,
$internal_counter,
$priority,
$custom_oid_data_1,
$custom_oid_data_2,
$custom_oid_data_3,
$custom_oid_data_4,
$custom_oid_data_5,
$custom_oid_data_6,
$custom_oid_data_7,
$custom_oid_data_8,
$custom_oid_data_9,
$custom_oid_data_10,
$custom_oid_data_11,
$custom_oid_data_12,
$custom_oid_data_13,
$custom_oid_data_14,
$custom_oid_data_15,
$custom_oid_data_16,
$custom_oid_data_17,
$custom_oid_data_18,
$custom_oid_data_19,
$custom_oid_data_20,
$trap_type,
$single_value,
$position,
$disable_event,
$group,
$order_1,
$order_2,
$order_3,
$order_4,
$order_5,
$order_6,
$order_7,
$order_8,
$order_9,
$order_10,
$order_11,
$order_12,
$order_13,
$order_14,
$order_15,
$order_16,
$order_17,
$order_18,
$order_19,
$order_20
);
$result = db_process_sql($sql);
$values_duplicate = $alert;
if (!empty($values_duplicate)) {
unset($values_duplicate['id_as']);
$result = db_process_sql_insert('talert_snmp', $values_duplicate);
if (!$result) {
if (!$result) {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as");
ui_print_error_message(__('There was a problem duplicating the alert'));
} else {
db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as");
ui_print_success_message(__('Successfully Duplicate'));
}
} else {
db_pandora_audit('SNMP management', "Fail try to duplicate snmp alert #$id_as");
ui_print_error_message(__('There was a problem duplicating the alert'));
} else {
db_pandora_audit('SNMP management', "Duplicate snmp alert #$id_as");
ui_print_success_message(__('Successfully Duplicate'));
}
}

View File

@ -66,6 +66,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_local_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -83,6 +84,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_policy_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -272,6 +274,7 @@ if (!empty($result)) {
function ($counter, $server) use ($tag_id) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_modules_count($tag_id);
metaconsole_restore_db();
}
return $counter;

View File

@ -77,6 +77,7 @@ is not working on the metaconsole and there is no time to fix it -->
var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n";
var updating = "<?php echo __('Updating'); ?>\n";
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied.'); ?>\n";
var mr_available = "<?php echo __('Minor release available'); ?>\n";
var package_available = "<?php echo __('New package available'); ?>\n";
@ -93,7 +94,7 @@ is not working on the metaconsole and there is no time to fix it -->
var mr_available_header = "<?php echo __('There are db changes'); ?>\n";
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n";
var text3_mr_file = "<?php echo __('Scheduled downtime'); ?>\n";
var language = "<?php echo $config['language']; ?>";
var docsUrl = (language === "es")

View File

@ -1111,7 +1111,9 @@ if ($dashboards === false) {
}
}
$home_screen .= '<div id="show_db" style="display: none; width: 100%;">';
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$home_screen .= '</div>';
$layouts = visual_map_get_user_layouts($config['id_user'], true);
@ -1124,6 +1126,7 @@ if ($layouts === false) {
}
}
$home_screen .= '<div id="show_vc" style="display: none; width: 100%;">';
$home_screen .= html_print_select(
$layouts_aux,
'visual_console',
@ -1133,6 +1136,8 @@ $home_screen .= html_print_select(
'',
true
);
$home_screen .= '</div>';
$home_screen .= html_print_input_text(
'data_section',
$user_info['data_section'],
@ -1664,46 +1669,64 @@ function show_data_section () {
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "inline-grid");
break;
case <?php echo "'".'Visual console'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "");
$("#show_vc").css("display", "inline-grid");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Event list'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Group view'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Tactical view'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Alert detail'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'External link'."'"; ?>:
$("#text-data_section").css("display", "");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Other'."'"; ?>:
$("#text-data_section").css("display", "");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
case <?php echo "'".'Default'."'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
$("#show_vc").css("display", "none");
$("#show_db").css("display", "none");
break;
}
}

View File

@ -233,8 +233,7 @@ if (defined('METACONSOLE')) {
$disable_user = get_parameter('disable_user', false);
if (isset($_GET['user_del'])) {
if ((bool) get_parameter('user_del', false) === true) {
// delete user
$id_user = get_parameter('delete_user', 0);
// Only allow delete user if is not the actual user
@ -260,21 +259,21 @@ if (isset($_GET['user_del'])) {
if (defined('METACONSOLE') && isset($_GET['delete_all'])) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console
metaconsole_connect($server);
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
}
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
// Restore the db connection.
metaconsole_restore_db();
}
// Restore the db connection
metaconsole_restore_db();
// Log to the metaconsole too
if ($result) {
db_pandora_audit(
@ -312,13 +311,13 @@ if (isset($_GET['user_del'])) {
$result = false;
}
if ($disable_user == 1) {
if ($disable_user === 1) {
ui_print_result_message(
$result,
__('Successfully disabled'),
__('There was a problem disabling user')
);
} else {
} else if ($disable_user === 0) {
ui_print_result_message(
$result,
__('Successfully enabled'),
@ -440,17 +439,21 @@ if (!defined('METACONSOLE')) {
$table->valign[6] = 'top';
}
$group_um = users_get_groups_UM($config['id_user']);
$info1 = [];
$user_is_admin = users_is_admin();
// Is admin or has group permissions all.
if ($user_is_admin || isset($group_um[0])) {
if ($user_is_admin) {
$info1 = get_users($order);
} else {
foreach ($group_um as $group => $value) {
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
$group_um = users_get_groups_UM($config['id_user']);
// 0 is the group 'all'.
if (isset($group_um[0])) {
$info1 = get_users($order);
} else {
foreach ($group_um as $group => $value) {
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
}
}
}
@ -558,7 +561,7 @@ foreach ($info as $user_id => $user_info) {
$iterator++;
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.$user_id.'</a>';
$data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
} else {
$data[0] = $user_id;
}
@ -591,10 +594,10 @@ foreach ($info as $user_id => $user_info) {
$data[4] .= '<div class="text_end">';
foreach ($user_profiles as $row) {
if ($total_profile <= 5) {
$data[4] .= "<div class='left'>";
$data[4] .= "<div class='float-left'>";
$data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / </div>';
$data[4] .= "<div class='left pdd_l_5px'>";
$data[4] .= "<div class='float-left pdd_l_5px'>";
$data[4] .= groups_get_name($row['id_grupo'], true);
$data[4] .= '</div>';
@ -638,19 +641,126 @@ foreach ($info as $user_id => $user_info) {
$table->cellclass[][6] = 'action_buttons';
$data[6] = '';
if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
if (!isset($user_info['not_delete'])) {
// Disable / Enable user.
if (isset($user_info['not_delete']) === false) {
if ($user_info['disabled'] == 0) {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=1&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable'), 'class' => 'invert_filter']).'</a>';
$toDoString = __('Disable');
$toDoAction = '1';
$toDoImage = 'images/lightbulb.png';
} else {
$data[6] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;disable_user=0&pure='.$pure.'&amp;id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
$toDoString = __('Enable');
$toDoAction = '0';
$toDoImage = 'images/lightbulb_off.png';
}
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'id',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'disable_user',
$toDoAction,
true
);
$data[6] .= html_print_input_image(
'submit_disable_enable',
$toDoImage,
'',
'',
true,
[
'data-title' => $toDoString,
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
}
$data[6] .= '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'&amp;id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit'), 'class' => 'invert_filter']).'</a>';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && !isset($user_info['not_delete'])) {
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
if (defined('METACONSOLE')) {
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['class' => 'invert_filter', 'title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
// Edit user.
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
$data[6] .= html_print_input_hidden(
'id_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'edit_user',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_edit_user',
'images/config.png',
'',
'padding:0',
true,
[
'data-title' => __('Edit'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && isset($user_info['not_delete']) === false) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_user',
'images/cross.png',
'',
'padding:0',
true,
[
'data-title' => __('Delete'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
if (is_metaconsole() === true) {
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&amp;sec2=godmode/users/user_list&amp;pure='.$pure.'" class="inline">';
$data[6] .= html_print_input_hidden(
'delete_user',
$user_info['id_user'],
true
);
$data[6] .= html_print_input_hidden(
'user_del',
'1',
true
);
$data[6] .= html_print_input_hidden(
'delete_all',
'1',
true
);
$data[6] .= html_print_input_image(
'submit_delete_all',
'images/cross_double.png',
'',
'',
true,
[
'data-title' => __('Delete from all consoles'),
'data-use_title_for_force_title' => '1',
'class' => 'forced_title no-padding',
]
);
$data[6] .= '</form>';
}
} else {
$data[6] .= '';

View File

@ -515,19 +515,21 @@ class DiscoveryTaskList extends HTML
}
// Task name.
$table->headstyle[1] .= 'min-width: 150px; width: 300px;';
$table->headstyle[1] .= 'min-width: 170px; width: 300px;';
// Server Name.
$table->headstyle[2] .= 'min-width: 130px; width: 400px;';
// Name.
$table->headstyle[4] .= 'min-width: 100px; width: 400px;';
$table->headstyle[4] .= 'min-width: 100px; width: 350px;';
// Status.
$table->headstyle[5] .= 'min-width: 50px; width: 100px;';
$table->headstyle[5] .= 'min-width: 70px; width: 190px;';
// Task type.
$table->headstyle[6] .= 'min-width: 200px; width: 200px;';
$table->headstyle[6] .= 'min-width: 190px; width: 200px;';
// Progress.
$table->headstyle[7] .= 'min-width: 50px; width: 150px;';
$table->headstyle[7] .= 'min-width: 60px; width: 150px;';
// Updated at.
$table->headstyle[8] .= 'min-width: 50px; width: 150px;';
// Operations.
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
$table->headstyle[9] .= 'min-width: 150px; width: 250px;';
if (check_acl($config['id_user'], 0, 'AW')) {
$table->head[0] = __('Force');
@ -711,6 +713,19 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.Cloud.Aws.RDS');
break;
case DISCOVERY_CLOUD_AWS_S3:
// Discovery Cloud S3.
$data[6] = html_print_image(
'images/op_network.png',
true,
[
'title' => __('Discovery Cloud S3'),
'class' => 'invert_filter',
]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.Cloud.Aws.S3');
break;
case DISCOVERY_APP_MYSQL:
// Discovery Applications MySQL.
$data[6] = html_print_image(
@ -850,7 +865,7 @@ class DiscoveryTaskList extends HTML
$data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[9] .= html_print_image(
'images/eye.png',
'images/operation.png',
true,
[
'title' => __('View summary'),
@ -866,6 +881,7 @@ class DiscoveryTaskList extends HTML
&& $task['type'] != DISCOVERY_APP_DB2
&& $task['type'] != DISCOVERY_APP_SAP
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
&& $task['type'] != DISCOVERY_CLOUD_AWS_S3
) {
if (check_acl($config['id_user'], 0, 'MR')) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
@ -1022,7 +1038,9 @@ class DiscoveryTaskList extends HTML
*/
public function getTargetWiz($task, $script=false)
{
if ($script !== false) {
if ($script !== false
|| (int) $task['type'] === DISCOVERY_HOSTDEVICES_CUSTOM
) {
switch ($script['type']) {
case DISCOVERY_SCRIPT_APP_VMWARE:
return 'wiz=app&mode=vmware&page=0';
@ -1042,6 +1060,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AZURE_COMPUTE:
return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0';
case DISCOVERY_CLOUD_AWS_S3:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0';
default:
return 'wiz=cloud';
}
@ -1489,6 +1510,9 @@ class DiscoveryTaskList extends HTML
$simple_data[] = $tmp;
if (is_array($data['modules'])) {
// Alphabetically sort.
ksort($data['modules'], (SORT_STRING | SORT_FLAG_CASE));
$simple_data = array_merge(
$simple_data,
array_reduce(

View File

@ -809,7 +809,7 @@ class HostDevices extends Wizard
'name' => 'interval_manual_defined',
'return' => true,
],
'extra' => '<div id="interval_manual_container"><div class="time_selection_container">'.ui_print_help_tip(
'extra' => '<div id="interval_manual_container"><div class="time_selection_container mrgn_top_20px">'.ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).html_print_extended_select_for_time(
@ -898,7 +898,7 @@ class HostDevices extends Wizard
],
[
'label' => '<b>'.__('Networks (current)').':</b>'.ui_print_help_tip(
__('Plese upload a new file to overwrite this content.'),
__('Please upload a new file to overwrite this content.'),
true
),
'arguments' => [

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

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