Merge branch 'develop' into ent-5620-nuevo-compilador-para-backend

This commit is contained in:
Ramon Novoa 2021-05-05 17:23:29 +02:00
commit e40014444f
195 changed files with 25341 additions and 20666 deletions

View File

@ -46,4 +46,3 @@ Pandora FMS is a monitoring tool that not only measures if a parameter is right
<br />
<br />
![screenshot 4](http://wolf359.artica.es/public_images/pandora6.0sp3-sample-visual-console.png)

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
@ -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.753, 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.753, 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.753, 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.753, 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.753, 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.753, 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.753
# 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.753, 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.753
# 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.753, 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.753
# 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.753
# 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.753
# 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.753, 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.753, 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.753-210407
Version: 7.0NG.754-210504
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.753-210407"
pandora_version="7.0NG.754-210504"
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.753"
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.753" 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.753" 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.753</string>
<key>CFBundleGetInfoString</key> <string>7.0NG.753 Pandora FMS Agent uninstaller for MacOS by Artica ST on Aug 2020</string>
<key>CFBundleShortVersionString</key> <string>7.0NG.753</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.753, 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.753, 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.753, 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.753, 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.753, 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.753, 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.753, 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.753';
use constant AGENT_BUILD => '210407';
use constant AGENT_VERSION => '7.0NG.754';
use constant AGENT_BUILD => '210504';
# 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.753
%define release 210407
%define version 7.0NG.754
%define release 210504
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.753
%define release 210407
%define version 7.0NG.754
%define release 210504
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.753"
PI_BUILD="210407"
PI_VERSION="7.0NG.754"
PI_BUILD="210504"
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.753
# 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.753}
{Pandora FMS Windows Agent v7.0NG.754}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210407}
{210504}
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.753(Build 210407)")
#define PANDORA_VERSION ("7.0NG.754(Build 210504)")
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.753(Build 210407))"
VALUE "ProductVersion", "(7.0NG.754(Build 210504))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.753-210407
Version: 7.0NG.754-210504
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.753-210407"
pandora_version="7.0NG.754-210504"
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

@ -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,9 +1096,14 @@ function resource_registration_extension_main()
}
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
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);
}
}
extensions_add_godmode_menu_option(__('Resource registration'), 'PM', 'gagente', '', 'v1r1');

View File

@ -1,6 +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
@ -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

@ -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.'"';
@ -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

@ -1072,6 +1072,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

@ -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'];
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);
@ -458,44 +470,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 {
@ -467,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) {
@ -675,13 +683,20 @@ 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')) {
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>';
}
}
array_push($table->data, $data);
}

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'];
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,6 +426,7 @@ foreach ($templates as $template) {
);
$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);
@ -439,6 +439,7 @@ foreach ($templates as $template) {
['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,9 +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')) {
if (!$disabled) {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
@ -356,15 +371,12 @@ if ($is_central_policies_on_node === false) {
false,
'class="sub upd"'
);
}
} else {
html_print_input_hidden('update_action', 1);
html_print_submit_button(
__('Update'),
'create',
false,
'class="sub upd"'
);
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

@ -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,12 +140,17 @@ switch ($action) {
$map_connection_list,
$layer_list
);
if ($idMap) {
$mapCreatedOk = true;
$next_action = 'update_saved';
} else {
$next_action = 'save_new';
$mapCreatedOk = false;
}
} else {
$next_action = 'save_new';
$mapCreatedOk = false;
}
ui_print_result_message(
$mapCreatedOk,
@ -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);
@ -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);

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>';
@ -219,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';
@ -242,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);
@ -332,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

@ -46,7 +46,7 @@ if (is_metaconsole() === true) {
}
if (is_ajax() === true) {
if (check_acl($config['id_user'], 0, 'AR') === false) {
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;
@ -63,7 +63,7 @@ if (is_ajax() === true) {
$group = [
'id_grupo' => 0,
'nombre' => 'None',
'icon' => '',
'icon' => 'world',
'parent' => 0,
'disabled' => 0,
'custom_id' => null,
@ -72,7 +72,7 @@ if (is_ajax() === true) {
return;
}
if (check_acl($config['id_user'], $id_group, 'AR') === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -114,7 +114,7 @@ if (is_ajax() === true) {
);
$force_serialized = (bool) get_parameter('force_serialized', false);
if (check_acl($config['id_user'], $id_group, 'AR') === false) {
if ((bool) check_acl($config['id_user'], $id_group, 'AR') === false) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -177,7 +177,9 @@ if (is_ajax() === true) {
$agents_aux = [];
foreach ($agents as $key => $value) {
if (preg_match('/'.$search.'/', io_safe_output($value)) === true) {
if (empty($search) === true) {
$agents_aux[$key] = $value;
} else if (preg_match('/'.$search.'/', io_safe_output($value)) === true) {
$agents_aux[$key] = $value;
}
}
@ -263,15 +265,9 @@ if (is_ajax() === true) {
$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',
@ -279,9 +275,9 @@ if ($tab != 'credbox' && ! check_acl(
);
include 'general/noaccess.php';
return;
} else if ($tab == 'credbox'
&& check_acl($config['id_user'], 0, 'UM') === false
&& check_acl($config['id_user'], 0, 'PM') === false
} 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',
@ -380,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') === true)) {
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');
@ -391,6 +387,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM') === true)) {
$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');
@ -415,6 +412,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM') === true)) {
'propagate' => $propagate,
'other' => $other,
'password' => io_safe_input($group_pass),
'max_agents' => $max_agents,
];
$result = db_process_sql_insert('tgrupo', $values);
@ -448,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)) {
@ -481,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(
@ -504,7 +504,7 @@ if ($update_group) {
}
// Delete group.
if (($delete_group) && (check_acl($config['id_user'], 0, 'PM') === true)) {
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);

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%';

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'];
@ -222,7 +222,10 @@ if ($delete_layout || $copy_layout) {
'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;

View File

@ -3739,6 +3739,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);

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

@ -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

@ -279,25 +279,25 @@ 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(
$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(
).':</td><td><input id="type" type="hidden" name="type" value="OSM" />'.html_print_input_text(
'url',
$mapConnectionDataUrl,
'',
45,
90,
true
).'</td>'.'</tr>'.'</table>';
).'</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,56 +305,98 @@ $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>';
$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) {
@ -383,7 +425,7 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
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"');
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>";
@ -472,7 +514,7 @@ $optionsConnectionOSMTable = '<table class="databox" border="0" cellpadding="4"
);
html_print_table($table);
echo '<div class="action-buttons w90p left">';
echo '<div class="action-buttons w90p float-left">';
html_print_submit_button(__('Save'), '', false, 'class="sub save wand"');
echo '</div>';
echo '</form>';
@ -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

@ -834,7 +834,7 @@ echo '</form>';
// AJAX call to check API connection.
$.ajax({
type: "GET",
type: "POST",
url: url,
dataType: "json",
data: data

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

@ -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

@ -260,9 +260,8 @@ 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) {
@ -272,8 +271,9 @@ if (isset($_GET['user_del'])) {
);
}
// Restore the db connection
// Restore the db connection.
metaconsole_restore_db();
}
// Log to the metaconsole too
if ($result) {

View File

@ -713,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(
@ -868,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'].'\')">';
@ -1046,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';
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -257,6 +257,11 @@ if ($save_event_filter) {
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter(
'id_filter',
'tevent_filter',
@ -305,6 +310,10 @@ if ($update_event_filter) {
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]';
}
@ -371,6 +380,13 @@ if ($get_filter_values) {
}
}
if (is_metaconsole()) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
}
@ -402,6 +418,8 @@ if ($load_filter_modal) {
);
echo '<div id="load-filter-select" class="load-filter-modal">';
echo '<form method="post" id="form_load_filter">';
$table = new StdClass;
$table->id = 'load_filter_form';
$table->width = '100%';
@ -441,13 +459,15 @@ if ($load_filter_modal) {
__('Load filter'),
'load_filter',
false,
'class="sub upd" onclick="load_form_filter();"',
'class="sub upd"',
true
);
$data[1] .= html_print_input_hidden('load_filter', 1, true);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
echo '</form>';
echo '</div>';
?>
<script type="text/javascript">
@ -460,7 +480,8 @@ function show_filter() {
width: 450
});
}
//aki
function load_form_filter() {
jQuery.post (
"<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
@ -471,7 +492,6 @@ function load_form_filter() {
},
function (data) {
jQuery.each (data, function (i, val) {
console.log(val);
if (i == 'id_name')
$("#hidden-id_name").val(val);
if (i == 'id_group'){
@ -517,6 +537,10 @@ function load_form_filter() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
if (i == 'server_name')
$("#select2-server_id-container").text(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'date_to')
@ -747,7 +771,8 @@ function save_new_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {
$("#info_box").hide();
@ -817,7 +842,8 @@ function save_update_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {
@ -1381,6 +1407,12 @@ if ($get_extended_event) {
'EW',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'ER',
$event['clean_tags'],
$childrens_ids
)))
) {
$tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image(
@ -1444,6 +1476,12 @@ if ($get_extended_event) {
'EW',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'ER',
$event['clean_tags'],
$childrens_ids
)))
) {
$responses = events_page_responses($event);
@ -1465,15 +1503,21 @@ if ($get_extended_event) {
$related = events_page_related($event, $server);
}
$connected = true;
if ($meta) {
metaconsole_connect($server);
if (metaconsole_connect($server) === NOERR) {
$connected = true;
} else {
$connected = false;
}
}
if ($connected === true) {
$custom_fields = events_page_custom_fields($event);
$custom_data = events_page_custom_data($event);
}
if ($meta) {
if ($meta && $connected === true) {
metaconsole_restore_db();
}

View File

@ -55,8 +55,9 @@ $api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$raw_decode = (bool) get_parameter('raw_decode', false);
$other = parseOtherParameter($otherSerialize, $otherMode);
$other = parseOtherParameter($otherSerialize, $otherMode, $raw_decode);
$apiPassword = io_output_password(
db_get_value_filter(
'value',

View File

@ -2085,7 +2085,13 @@ class AgentWizard extends HTML
$tmp->ip_target($this->targetIp);
$tmp->id_modulo(MODULE_PLUGIN);
if (empty($candidate['macros']) === true) {
if ($this->wizardSection === 'snmp_interfaces_explorer'
&& empty($candidate['macros']) === true
) {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
} else {
$fieldsPlugin = db_get_value_sql(
sprintf(
'SELECT macros FROM tplugin WHERE id=%d',
@ -2115,10 +2121,6 @@ class AgentWizard extends HTML
$tmp->id_plugin($infoMacros['server_plugin']);
$tmp->macros(json_encode($fieldsPlugin));
} else {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
}
}
}
@ -4313,15 +4315,6 @@ class AgentWizard extends HTML
'form="form-create-modules"'
);
// Execution type module.
$data[6] .= html_print_input_hidden(
'module-execution_type-'.$uniqueId,
$module['execution_type'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
// WMI Query class.
$data[6] .= html_print_input_hidden(
'module-query_class-'.$uniqueId,

View File

@ -1727,7 +1727,10 @@ class NetworkMap
$item['image_height'] = 0;
if (empty($node['style']['image']) === false) {
$item['image_url'] = ui_get_full_url(
$node['style']['image']
$node['style']['image'],
false,
false,
false
);
$image_size = getimagesize(
$config['homedir'].'/'.$node['style']['image']
@ -2837,13 +2840,7 @@ class NetworkMap
*/
public function loadSimpleInterface()
{
$output = '<div id="open_version_dialog" class="invisible">';
$output .= __(
'In the Open version of %s can not be edited nodes or map',
get_product_name()
);
$output .= '</div>';
$output = '';
$output .= '<div id="dialog_node_edit" class="invisible" title="';
$output .= __('Edit node').'">';
$output .= '<div class="left w100p">';
@ -2893,6 +2890,12 @@ class NetworkMap
$id = 'dialog_node_edit';
if (!enterprise_installed()) {
$id = 'open_version_dialog';
$output = '<div id="open_version" style="display: none" title="'.__('Warning').'">';
$output .= '<div class="center mrgn_top_20px w90p font_13px">'.__(
'In the Open version of %s can not be edited nodes or map',
get_product_name()
);
$output .= '</div></div>';
}
$output .= '<div id="'.$id.'" class="invisible" title="';
@ -3391,7 +3394,7 @@ class NetworkMap
&& isset($this->useTooltipster)
&& $this->useTooltipster == true
) {
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
$output = '<script type="text/javascript" src="'.ui_get_full_url(
'include/javascript/d3.3.5.14.js'
).'" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.ui_get_full_url(
@ -3443,13 +3446,35 @@ class NetworkMap
$networkmap['filter']['l2_network_interfaces'] = 1;
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="';
$output .= ui_get_full_url(
'include/javascript/d3.3.5.14.js',
false,
false,
false
);
$output .= '" charset="utf-8"></script>';
if (isset($this->map['__simulated']) === false) {
// Load context menu if manageable networkmap.
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'include/javascript/jquery.contextMenu.js"></script>';
$output .= '<script type="text/javascript" src="';
$output .= ui_get_full_url(
'include/javascript/jquery.contextMenu.js',
false,
false,
false
);
$output .= '" charset="utf-8"></script>';
}
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'include/javascript/functions_pandora_networkmap.js"></script>';
$output .= '<script type="text/javascript" src="';
$output .= ui_get_full_url(
'include/javascript/functions_pandora_networkmap.js',
false,
false,
false
);
$output .= '" charset="utf-8"></script>';
// Open networkconsole_id div.
$output .= '<div id="networkconsole_'.$networkmap['id'].'"';

View File

@ -20,8 +20,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC210407';
$pandora_version = 'v7.0NG.753';
$build_version = 'PC210504';
$pandora_version = 'v7.0NG.754';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -626,6 +626,7 @@ define('DISCOVERY_APP_SAP', 10);
define('DISCOVERY_APP_DB2', 11);
define('DISCOVERY_APP_MICROSOFT_SQL_SERVER', 12);
define('DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE', 13);
define('DISCOVERY_CLOUD_AWS_S3', 14);
// Force task build tmp results.
define('DISCOVERY_REVIEW', 0);

View File

@ -2252,12 +2252,16 @@ function check_login($output=true)
return true;
}
} else {
include_once $config['homedir'].'/mobile/include/db.class.php';
include_once $config['homedir'].'/mobile/include/system.class.php';
include_once $config['homedir'].'/mobile/include/user.class.php';
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
$user = User::getInstance();
$id_user = $user->getIdUser();
if (is_user($id_user)) {
$_SESSION['id_usuario'] = $id_user;
$config['id_user'] = $id_user;
return true;
}
}
@ -2853,7 +2857,11 @@ function can_user_access_node()
{
global $config;
static $userinfo;
if ($userinfo === null) {
$userinfo = get_user_info($config['id_user']);
}
if (is_metaconsole()) {
return $userinfo['is_admin'] == 1 ? 1 : $userinfo['metaconsole_access_node'];

View File

@ -1,27 +1,38 @@
<?php
// 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 Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Agents
* Agents Functions.
*
* @category Agents functions.
* @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.
* ============================================================================
*/
// Begin.
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
use PandoraFMS\Enterprise\RCMDFile as RCMDFile;
use PandoraFMS\Event;
/**
@ -203,11 +214,13 @@ function agents_create_agent(
$values=false,
$alias_as_name=false
) {
if (empty($name)) {
global $config;
if (empty($name) === true) {
return false;
}
if (empty($id_group) && (int) $id_group != 0) {
if (empty($id_group) === true && (int) $id_group !== 0) {
return false;
}
@ -216,11 +229,11 @@ function agents_create_agent(
$interval = false;
}
if (empty($interval)) {
if (empty($interval) === true) {
return false;
}
if (! is_array($values)) {
if (is_array($values) === false) {
$values = [];
}
@ -229,17 +242,22 @@ function agents_create_agent(
$values['id_grupo'] = $id_group;
$values['intervalo'] = $interval;
if (!empty($ip_address)) {
if (empty($ip_address) === false) {
$values['direccion'] = $ip_address;
}
// Check if group has limit or overrides the agent limit.
if (group_allow_more_agents($id_group, true, 'create') === false) {
return false;
}
$id_agent = db_process_sql_insert('tagente', $values);
if ($id_agent === false) {
return false;
}
// Create address for this agent in taddress.
if (!empty($ip_address)) {
if (empty($ip_address) === false) {
agents_add_address($id_agent, $ip_address);
}
@ -1084,6 +1102,7 @@ function agents_common_modules($id_agent, $filter=false, $indexed=true, $get_not
* @param string $separator Only in metaconsole. Separator for the serialized data. By default |.
* @param boolean $add_alert_bulk_op //TODO documentation
* @param boolean $force_serialized. If the agent has not id_server (typically in node) put 0 as <server_id>.
* @param boolean $meta_fields If true, then id_agente is returned instead id_tagente.
*
* @return array An array with all agents in the group or an empty array
*/
@ -1096,7 +1115,8 @@ function agents_get_group_agents(
$serialized=false,
$separator='|',
$add_alert_bulk_op=false,
$force_serialized=false
$force_serialized=false,
$meta_fields=false
) {
global $config;
@ -1268,11 +1288,19 @@ function agents_get_group_agents(
if (is_metaconsole()) {
$table_name = 'tmetaconsole_agent ta LEFT JOIN tmetaconsole_agent_secondary_group tasg ON ta.id_agente = tasg.id_agent';
if ($meta_fields === true) {
$fields = [
'id_agente',
'alias',
'ta.id_tmetaconsole_setup AS id_server',
];
} else {
$fields = [
'ta.id_tagente AS id_agente',
'alias',
'ta.id_tmetaconsole_setup AS id_server',
];
}
} else {
$table_name = 'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent';
@ -3253,6 +3281,7 @@ function agents_get_agent_custom_field($agent_id, $custom_field_name)
* @param boolean $selection Show common (false) or all modules (true).
* @param boolean $return Return (false) or dump to output (true).
* @param boolean $index_by_name Use module name as key.
* @param boolean $pure_return Return as retrieved from DB.
*
* @return array With modules or null if error.
*/
@ -3261,7 +3290,8 @@ function select_modules_for_agent_group(
$id_agents,
$selection,
$return=true,
$index_by_name=false
$index_by_name=false,
$pure_return=false
) {
global $config;
$agents = (empty($id_agents)) ? [] : implode(',', $id_agents);
@ -3341,6 +3371,10 @@ function select_modules_for_agent_group(
return;
}
if ($pure_return === true) {
return $modules;
}
$modules_array = [];
foreach ($modules as $value) {
if ($index_by_name) {
@ -3841,6 +3875,70 @@ function agents_get_last_status_change($id_agent)
}
/**
* Checks if group allow more agents due itself limitation.
*
* @param integer $id_group Id of the group.
* @param boolean $generateEvent If true and the check fails, will generate an event.
* @param string $action Action for perform (only if generateEvent is true).
*
* @return boolean True if allow more agents.
*/
function group_allow_more_agents(
int $id_group,
bool $generateEvent=false,
string $action='create'
):bool {
global $config;
$groupMaxAgents = (int) db_get_value('max_agents', 'tgrupo', sprintf('id_grupo = %d', $id_group));
$groupCountAgents = (int) db_get_num_rows(sprintf('SELECT nombre FROM tagente WHERE id_grupo = "%s"', $id_group));
// If `max_agents` is not defined or the count of agents in the group is below of max agents allowed.
$output = ($groupMaxAgents === 0 || $groupCountAgents < $groupMaxAgents);
if ($output === false && $generateEvent === true) {
// Get the group name.
$groupName = db_get_value(
'nombre',
'tgrupo',
'id_grupo',
$id_group
);
// New event.
$evt = new Event;
// Set parameters.
$evt->evento(
sprintf(
'Agent cannot be %sd due to the maximum agent limit for group %s',
$action,
$groupName
)
);
$evt->id_grupo($id_group);
$evt->id_agente(0);
$evt->id_agentmodule(0);
$evt->id_usuario($config['id_user']);
$evt->estado(EVENT_STATUS_NEW);
$evt->event_type(EVENTS_SYSTEM);
$evt->criticity(EVENT_CRIT_WARNING);
$evt->timestamp(date('Y-m-d H:i:s'));
$evt->utimestamp(time());
$evt->data(0);
$evt->source('agent_creation');
// Any fields are only available in meta.
if (is_metaconsole() === true) {
$evt->id_source_event(0);
}
// Save the event.
$evt->save();
}
return $output;
}
/**
* Return the list of agents for a planned downtime
*
@ -3850,7 +3948,7 @@ function agents_get_last_status_change($id_agent)
*
* @return array
*/
function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str)
function get_planned_downtime_agents_list($id_downtime, $filter_cond, $id_groups_str):array
{
$agents = [];

View File

@ -448,10 +448,11 @@ function alerts_delete_alert_action($id_alert_action)
* Clone an alert action.
*
* @param int Id of the original alert action
* @param int Agent group id if it wants to be changed when clone.
*
* @return mixed Id of the cloned action or false in case of fail.
*/
function alerts_clone_alert_action($id_alert_action)
function alerts_clone_alert_action($id_alert_action, $id_group)
{
$id_alert_action = safe_int($id_alert_action, 1);
if (empty($id_alert_action)) {
@ -464,6 +465,10 @@ function alerts_clone_alert_action($id_alert_action)
return false;
}
if ($id_group != '') {
$action['id_group'] = $id_group;
}
unset($action['id']);
return alerts_create_alert_action($action['name'].' '.__('copy'), $action['id_alert_command'], $action);
@ -1130,10 +1135,11 @@ function alerts_get_alert_template_field3_recovery($id_alert_template)
* Duplicates an alert template.
*
* @param int Id of an alert template.
* @param int Agent group id if it wants to be changed when duplicate.
*
* @return mixed Duplicates an alert template or false if something goes wrong.
*/
function alerts_duplicate_alert_template($id_alert_template)
function alerts_duplicate_alert_template($id_alert_template, $id_group)
{
$template = alerts_get_alert_template($id_alert_template);
@ -1141,6 +1147,10 @@ function alerts_duplicate_alert_template($id_alert_template)
return false;
}
if ($id_group != '') {
$template['id_group'] = $id_group;
}
$name = io_safe_input(__('Copy of').' ').$template['name'];
$type = $template['type'];

View File

@ -45,9 +45,10 @@ use PandoraFMS\Enterprise\Cluster;
*
* @param string $other
* @param mixed $otherType
* @param boolean $rawDecode Decode string in which the sequences with percent (%) signs followed by two hex digits have been replaced with literal characters.
* @return mixed
*/
function parseOtherParameter($other, $otherType)
function parseOtherParameter($other, $otherType, $rawDecode)
{
switch ($otherType) {
case 'url_encode':
@ -65,12 +66,12 @@ function parseOtherParameter($other, $otherType)
'data' => explode($separator, $other),
];
foreach ($returnVar['data'] as $index => $element) {
$returnVar['data'][$index] = urldecode($element);
$returnVar['data'][$index] = $rawDecode ? rawurldecode($element) : urldecode($element);
}
} else {
$returnVar = [
'type' => 'string',
'data' => urldecode($other),
'data' => $rawDecode ? rawurldecode($other) : urldecode($other),
];
}
break;
@ -1478,6 +1479,12 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
return;
}
// Check if group allow more agents or have limit stablished.
if (group_allow_more_agents($idGroup, true, 'update') === false) {
returnError('Agent cannot be updated due to the maximum agent limit for this group');
return;
}
// Check selected parent
if ($idParent != 0) {
$parentCheck = agents_check_access_agent($idParent);
@ -1675,10 +1682,12 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
// Check if agent exists (BUG WC-50518-2).
if ($alias == '' && $alias_as_name === 0) {
returnError('No agent alias specified');
} else if (agents_get_agent_id($server_name)) {
} else if (agents_get_agent_id($nombre_agente)) {
returnError('The agent name already exists in DB.');
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
returnError('The group does not exist.');
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
returnError('Agent cannot be created due to the maximum agent limit for this group');
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
returnError('The OS does not exist.');
} else if ($server_name === false) {
@ -8402,6 +8411,7 @@ function api_set_create_group($id, $thrash1, $other, $thrash3)
$values['custom_id'] = $safe_other_data[5];
$values['contact'] = $safe_other_data[6];
$values['other'] = $safe_other_data[7];
$values['max_agents'] = $safe_other_data[8];
$id_group = groups_create_group($group_name, $values);
@ -8481,7 +8491,8 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
$disabled = $other['data'][5];
$custom_id = $other['data'][6];
$contact = $other['data'][7];
$other = $other['data'][8];
$otherData = $other['data'][8];
$maxAgents = $other['data'][9];
$return = db_process_sql_update(
'tgrupo',
@ -8494,7 +8505,8 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3)
'disabled' => $disabled,
'custom_id' => $custom_id,
'contact' => $contact,
'other' => $other,
'other' => $otherData,
'max_agents' => $maxAgents,
],
['id_grupo' => $id_group]
);

View File

@ -200,8 +200,20 @@ function config_update_config()
$error_update[] = __('Use cert.');
}
if (!config_update_value('attachment_store', (string) get_parameter('attachment_store'))) {
$attachment_store = (string) get_parameter('attachment_store');
if (file_exists($attachment_store) === false
|| is_writable($attachment_store) === false
) {
$error_update[] = __('Attachment store');
$error_update[] .= __(
"Path doesn't exists or is not writable"
);
} else {
if (config_update_value('attachment_store', $attachment_store) === false) {
$error_update[] = __(
'Attachment store.'
);
}
}
if (!config_update_value('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API'))) {
@ -1645,8 +1657,12 @@ function config_update_config()
$integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']);
if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) {
if (empty($_SERVER['HTTPS']) === false) {
$integria_hostname = 'https://'.$integria_hostname;
} else {
$integria_hostname = 'http://'.$integria_hostname;
}
}
if (!config_update_value('integria_hostname', $integria_hostname)) {
$error_update[] = __('integria API hostname');
@ -3358,6 +3374,32 @@ function config_user_set_custom_config()
}
}
if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) {
if ((int) $userinfo['id_skin'] === 1) {
$config['style'] = 'pandora';
}
if ((int) $userinfo['id_skin'] === 2) {
$config['style'] = 'pandora_black';
}
}
$skin = get_parameter('skin', false);
$sec2_aux = get_parameter('sec2');
if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) {
$id_user_aux = get_parameter('id');
if ($id_user_aux == $config['id_user']) {
if ((int) $skin === 1 || (int) $skin === 0) {
$config['style'] = 'pandora';
}
if ((int) $skin === 2) {
$config['style'] = 'pandora_black';
}
}
}
if (defined('METACONSOLE')) {
$config['metaconsole_access'] = $userinfo['metaconsole_access'];
}

View File

@ -697,6 +697,33 @@ function cron_list_table()
$args = unserialize($task['args']);
break;
case 'cron_task_generate_csv_log':
if ($manage_pandora) {
$data[0] = '<a href="'.$url;
$data[0] .= 'force_run=1&id_user_task='.$task['id'].'">';
$data[0] .= html_print_image(
'images/target.png',
true,
[
'title' => __('Force run'),
'class' => 'invert_filter',
]
);
$data[0] .= '</a>';
} else {
$data[0] = '';
}
$data[1] = $task['id_usuario'];
$data[2] = db_get_value(
'name',
'tuser_task',
'id',
$task['id_user_task']
);
$args = unserialize($task['args']);
break;
default:
// Ignore.
break;

View File

@ -133,9 +133,14 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
continue;
}
$all_graph = db_get_all_rows_in_table('tgraph', 'name');
if ($all_graph !== false) {
$all_graphs = array_merge($all_graphs, $all_graph);
$tmp_graphs = db_get_all_rows_in_table('tgraph', 'name');
if ($tmp_graphs !== false) {
foreach ($tmp_graphs as $g) {
$g['id_tgraph'] = $g['id_graph'];
$g['id_graph'] = $connection['id'].'|'.$g['id_graph'];
$g['name'] = $g['name'].' ('.$connection['server_name'].')';
$all_graphs[] = $g;
}
}
metaconsole_restore_db();
@ -168,10 +173,15 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
$graphs[$graph['id_graph']] = $graph['name'];
} else {
$graphs[$graph['id_graph']] = $graph;
$id_graph = 'id_graph';
if ((bool) is_metaconsole() === true) {
$id_graph = 'id_tgraph';
}
$graphsCount = db_get_value_sql(
'SELECT COUNT(id_gs)
FROM tgraph_source
WHERE id_graph = '.$graph['id_graph']
WHERE id_graph = '.$graph[$id_graph]
);
$graphs[$graph['id_graph']]['graphs_count'] = $graphsCount;
}

View File

@ -712,6 +712,7 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* @param boolean $validatedEvents If true, evaluate validated events.
* @param boolean $recursiveGroups If true, filtered groups and their children
* will be search.
* @param boolean $nodeConnected Already connected to node (uses tevento).
*
* @return array Events.
* @throws Exception On error.
@ -727,7 +728,8 @@ function events_get_all(
$return_sql=false,
$having='',
$validatedEvents=false,
$recursiveGroups=true
$recursiveGroups=true,
$nodeConnected=false
) {
global $config;
@ -1017,7 +1019,10 @@ function events_get_all(
);
}
$table = events_get_events_table(is_metaconsole(), $history);
$table = events_get_events_table(
(is_metaconsole() && $nodeConnected === false),
$history
);
$tevento = sprintf(
' %s te',
$table
@ -1028,7 +1033,7 @@ function events_get_all(
$tagente_table = 'tagente';
$tagente_field = 'id_agente';
$conditionMetaconsole = '';
if (is_metaconsole()) {
if (is_metaconsole() && $nodeConnected === false) {
$tagente_table = 'tmetaconsole_agent';
$tagente_field = 'id_tagente';
$conditionMetaconsole = ' AND ta.id_tmetaconsole_setup = te.server_id ';
@ -1075,7 +1080,7 @@ function events_get_all(
);
}
if (is_metaconsole()) {
if (is_metaconsole() && $nodeConnected === false) {
// Id source event.
if (!empty($filter['id_source_event'])) {
$sql_filters[] = sprintf(
@ -1087,8 +1092,15 @@ function events_get_all(
// User comment.
if (!empty($filter['user_comment'])) {
// For filter field.
$sql_filters[] = sprintf(
' AND lower(te.user_comment) like lower("%%%s%%") ',
io_safe_input($filter['user_comment'])
);
// For show comments on event details.
$sql_filters[] = sprintf(
' OR lower(te.user_comment) like lower("%%%s%%") ',
$filter['user_comment']
);
}
@ -1239,7 +1251,7 @@ function events_get_all(
// Query_table.
'',
// Meta.
is_metaconsole(),
is_metaconsole() && $nodeConnected === false,
// Childrens_ids.
[],
// Force_group_and_tag.
@ -1265,7 +1277,7 @@ function events_get_all(
// Query_table.
'',
// Meta.
is_metaconsole(),
is_metaconsole() && $nodeConnected === false,
// Childrens_ids.
[],
// Force_group_and_tag.
@ -1291,7 +1303,7 @@ function events_get_all(
// Query_table.
'',
// Meta.
is_metaconsole(),
is_metaconsole() && $nodeConnected === false,
// Childrens_ids.
[],
// Force_group_and_tag.
@ -1312,7 +1324,7 @@ function events_get_all(
// Module search.
$agentmodule_join = 'LEFT JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
if (is_metaconsole()) {
if (is_metaconsole() && $nodeConnected === false) {
$agentmodule_join = '';
} else if (!empty($filter['module_search'])) {
$agentmodule_join = 'INNER JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
@ -1339,7 +1351,7 @@ function events_get_all(
}
$extra = '';
if (is_metaconsole()) {
if (is_metaconsole() && $nodeConnected === false) {
$extra = ', server_id';
}
@ -1405,7 +1417,7 @@ function events_get_all(
}
$server_join = '';
if (is_metaconsole()) {
if (is_metaconsole() && $nodeConnected === false) {
$server_join = ' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id';
if (!empty($filter['server_id'])) {
@ -3001,15 +3013,11 @@ function events_get_agent(
) {
global $config;
if (!is_numeric($date)) {
if (is_numeric($date) === false) {
$date = time_w_fixed_tz($date);
}
if (is_metaconsole() && $events_group === false) {
$id_server = true;
}
if (empty($date)) {
if (empty($date) === true) {
$date = get_system_time();
}
@ -3144,7 +3152,7 @@ function events_get_agent(
}
}
if (is_metaconsole() && $id_server) {
if (is_metaconsole() === true && empty($id_server) === false) {
$sql_where .= ' AND server_id = '.$id_server;
}
@ -3161,7 +3169,7 @@ function events_get_agent(
} else {
return events_get_events_no_grouped(
$sql_where,
(is_metaconsole() === true && $id_server === false) ? true : false,
(is_metaconsole() === true && empty($id_server) === false) ? true : false,
$history
);
}
@ -3664,6 +3672,20 @@ function events_page_responses($event, $childrens_ids=[])
);
}
if ((tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'EM',
$event['clean_tags'],
$childrens_ids
)) || (tags_checks_event_acl(
$config['id_user'],
$event['id_grupo'],
'EW',
$event['clean_tags'],
$childrens_ids
))
) {
$table_responses->data[] = $data;
// Comments.
@ -3680,6 +3702,7 @@ function events_page_responses($event, $childrens_ids=[])
);
$table_responses->data[] = $data;
}
if (tags_checks_event_acl(
$config['id_user'],
@ -3723,7 +3746,7 @@ function events_page_responses($event, $childrens_ids=[])
['id_group' => $id_groups]
);
if (empty($event_responses)) {
if (empty($event_responses) || (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM'))) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$responses = [];
@ -4293,6 +4316,12 @@ function events_page_details($event, $server='')
$serverstring = '';
}
$table_class = 'table_modal_alternate';
if ($config['style'] === 'pandora_black') {
$table_class = 'black_table_modal_alternate';
}
// Details.
$table_details = new stdClass;
$table_details->width = '100%';
@ -4300,7 +4329,7 @@ function events_page_details($event, $server='')
$table_details->head = [];
$table_details->cellspacing = 0;
$table_details->cellpadding = 0;
$table_details->class = 'table_modal_alternate';
$table_details->class = $table_class;
/*
* Useless switch.

View File

@ -971,7 +971,7 @@ function gis_save_map(
]
);
// Angent
if ((isset($layer['layer_agent_list'])) and (count($layer['layer_agent_list']) > 0)) {
if ((isset($layer['layer_agent_list'])) && (count($layer['layer_agent_list']) > 0)) {
foreach ($layer['layer_agent_list'] as $agent) {
db_process_sql_insert(
'tgis_map_layer_has_tagente',
@ -984,7 +984,7 @@ function gis_save_map(
}
// Group
if ((isset($layer['layer_group_list'])) and (count($layer['layer_group_list']) > 0)) {
if ((isset($layer['layer_group_list'])) && (count($layer['layer_group_list']) > 0)) {
foreach ($layer['layer_group_list'] as $group) {
db_process_sql_insert(
'tgis_map_layer_groups',
@ -1386,55 +1386,55 @@ function gis_validate_map_data(
echo "<style type='text/css'>";
// validateMap
// ValidateMap.
if ($map_name == '') {
echo 'input[name=map_name] {background: #FF5050;}';
$invalidFields['map_name'] = true;
}
// validate zoom level
// Validate zoom level.
if (($map_zoom_level == '') || ($map_zoom_level > $map_levels_zoom)) {
echo 'input[name=map_zoom_level] {background: #FF5050;}';
$invalidFields['map_zoom_level'] = true;
}
// validate map_initial_longitude
// Validate map_initial_longitude.
if ($map_initial_longitude == '') {
echo 'input[name=map_initial_longitude] {background: #FF5050;}';
$invalidFields['map_initial_longitude'] = true;
}
// validate map_initial_latitude
// Validate map_initial_latitude.
if ($map_initial_latitude == '') {
echo 'input[name=map_initial_latitude] {background: #FF5050;}';
$invalidFields['map_initial_latitude'] = true;
}
// validate map_initial_altitude
// Validate map_initial_altitude.
if ($map_initial_altitude == '') {
echo 'input[name=map_initial_altitude] {background: #FF5050;}';
$invalidFields['map_initial_altitude'] = true;
}
// validate map_default_longitude
// Validate map_default_longitude.
if ($map_default_longitude == '') {
echo 'input[name=map_default_longitude] {background: #FF5050;}';
$invalidFields['map_default_longitude'] = true;
}
// validate map_default_latitude
// Validate map_default_latitude.
if ($map_default_latitude == '') {
echo 'input[name=map_default_latitude] {background: #FF5050;}';
$invalidFields['map_default_latitude'] = true;
}
// validate map_default_altitude
// Validate map_default_altitude.
if ($map_default_altitude == '') {
echo 'input[name=map_default_altitude] {background: #FF5050;}';
$invalidFields['map_default_altitude'] = true;
}
// validate map_default_altitude
// Validate map_default_altitude.
if ($map_connection_list == '') {
$invalidFields['map_connection_list'] = true;
}

View File

@ -1530,6 +1530,11 @@ function graphic_combined_module(
}
$long_index = '';
if ($config['style'] === 'pandora_black') {
$background_color = '#222';
$params['legend_color'] = '#fff';
}
switch ($params_combined['stacked']) {
default:
case CUSTOM_GRAPH_STACKED_LINE:
@ -3677,16 +3682,9 @@ function graph_custom_sql_graph(
}
}
if ($id != null) {
$historical_db = db_get_value_sql(
'SELECT historical_db from treport_content where id_rc ='.$content['id_rc']
);
} else {
$historical_db = $content['historical_db'];
}
if ($report_content['external_source'] != '') {
$sql = io_safe_output($report_content['external_source']);
if ($content['external_source'] != '') {
$sql = io_safe_output($content['external_source']);
} else {
$sql = db_get_row(
'treport_custom_sql',

View File

@ -577,6 +577,14 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
$group['parent'] = 0;
}
if (is_array($tree[$group['parent']]) === false) {
$str = $tree[$group['parent']];
$tree[$group['parent']] = [
'nombre' => $tree[$group['parent']],
'id_grupo' => $group['parent'],
];
}
$tree[$group['parent']]['hash_branch'] = 1;
$tree[$group['parent']]['branch'][$key] = &$tree[$key];
}
@ -756,14 +764,18 @@ function groups_create_group($group_name, $rest_values)
$values = array_merge($rest_values, $array_tmp);
if (!isset($values['propagate'])) {
if (isset($values['propagate']) === false) {
$values['propagate'] = 0;
}
if (!isset($values['disabled'])) {
if (isset($values['disabled']) === false) {
$values['disabled'] = 0;
}
if (isset($values['max_agents']) === false) {
$values['max_agents'] = 0;
}
$check = db_get_value('nombre', 'tgrupo', 'nombre', $group_name);
if (!$check) {

View File

@ -717,7 +717,9 @@ function html_print_select(
$message='',
$select_all=false,
$simple_multiple_options=false,
$required=false
$required=false,
$truncate_size=false,
$select2_enable=true
) {
$output = "\n";
@ -853,6 +855,18 @@ function html_print_select(
$output .= ' style="'.$option_style[$value].'"';
}
if ($truncate_size !== false) {
$output .= ' Title="'.$optlabel.'"';
$optlabel = ui_print_truncate_text(
$optlabel,
$truncate_size,
false,
true,
false
);
}
if ($optlabel === '') {
$output .= '>None</option>';
} else {
@ -868,10 +882,42 @@ function html_print_select(
$output .= '</select>';
if ($modal && !enterprise_installed()) {
$output .= "
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
";
}
$select2 = 'select2.min';
if ($config['style'] === 'pandora_black') {
$select2 = 'select2_dark.min';
}
if ($multiple === false && $select2_enable === true) {
if (is_ajax()) {
$output .= '<script src="';
$output .= ui_get_full_url(
'include/javascript/select2.min.js',
false,
false,
false
);
$output .= '" type="text/javascript"></script>';
$output .= '<link rel="stylesheet" href="';
$output .= ui_get_full_url(
'include/styles/'.$select2.'.css',
false,
false,
false
);
$output .= '"/>';
} else {
ui_require_css_file($select2);
ui_require_javascript_file('select2.min');
}
$output .= '<script>$("#'.$id.'").select2();</script>';
}
if ($return) {
return $output;
}
@ -1351,7 +1397,29 @@ function html_print_select_multiple_modules_filtered(array $data):string
$output .= '<div>';
// Agent.
$agents = agents_get_group_agents($data['mGroup']);
$agents = agents_get_group_agents(
// Id_group.
$data['mGroup'],
// Search.
false,
// Case.
'lower',
// NoACL.
false,
// ChildGroups.
false,
// Serialized.
false,
// Separator.
'|',
// Add_alert_bulk_op.
false,
// Force_serialized.
false,
// Meta_fields.
$data['mMetaFields']
);
if ((empty($agents)) === true || $agents == -1) {
$agents = [];
}
@ -1475,7 +1543,7 @@ function html_print_select_from_sql(
$disabled=false,
$style=false,
$size=false,
$trucate_size=GENERIC_SIZE_TEXT,
$truncate_size=GENERIC_SIZE_TEXT,
$class='',
$required=false
) {
@ -1490,13 +1558,7 @@ function html_print_select_from_sql(
foreach ($result as $row) {
$id = array_shift($row);
$value = array_shift($row);
$fields[$id] = ui_print_truncate_text(
$value,
$trucate_size,
false,
true,
false
);
$fields[$id] = $value;
}
return html_print_select(
@ -1523,7 +1585,8 @@ function html_print_select_from_sql(
// Simple_multiple_options.
false,
// Required.
$required
$required,
$truncate_size
);
}
@ -1876,7 +1939,7 @@ function html_print_extended_select_for_time(
html_print_select(
$units,
$uniq_name.'_units',
1,
'60',
''.$script,
$nothing,
$nothing_value,
@ -2953,7 +3016,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
if ($modal && !enterprise_installed()) {
$output .= "
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version' ><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
";
}
@ -3445,7 +3508,7 @@ function html_print_radio_button_extended(
if ($modal && !enterprise_installed()) {
$output .= "
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
<div id='".$message."' class='publienterprise publicenterprise_div' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
";
}
@ -4379,6 +4442,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
return '';
}
enterprise_include_once('include/functions_metaconsole.php');
if ($config['style'] === 'pandora_black') {
$style = 'style="color: white"';
}
@ -5030,9 +5095,14 @@ function html_print_autocomplete_users_from_integria(
) {
global $config;
$user_icon = 'images/user_green.png';
if ($config['style'] === 'pandora_black') {
$user_icon = 'images/header_user.png';
}
ob_start();
$attrs = ['style' => 'background: url(images/user_green.png) no-repeat right;'];
$attrs = ['style' => 'background: url('.$user_icon.') no-repeat right;'];
if ($required) {
$attrs['required'] = 'required';
@ -5225,9 +5295,17 @@ function html_print_select_search(
$required=false,
$dropdownAutoWidth=false
) {
global $config;
$output = '';
ui_require_css_file('select2.min');
$select2_css = 'select2.min';
if ($config['style'] === 'pandora_black') {
$select2_css = 'select2_dark.min';
}
ui_require_css_file($select2_css);
ui_require_javascript_file('select2.min');
if ($name === null) {

View File

@ -69,8 +69,8 @@ function integriaims_tabs($active_tab, $view=false)
}
if ($view) {
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit ticket')]).'</a>';
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/operation.png', true, ['title' => __('View ticket')]).'</a>';
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit ticket'), 'class' => 'invert_filter']).'</a>';
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/operation.png', true, ['title' => __('View ticket'), 'class' => 'invert_filter']).'</a>';
// When the current page is the View page.
if (!$active_tab) {
$view_tab['active'] = true;

View File

@ -152,7 +152,6 @@ function menu_print_menu(&$menu)
$first_sub_sec2 = '';
foreach ($main['sub'] as $subsec2 => $sub) {
// hd($sub, true);
$count_sub++;
// Init some variables.

View File

@ -706,7 +706,7 @@ function modules_create_agent_module(
}
// Update module status count if the module is not created disabled.
if (!isset($values['disabled']) || $values['disabled'] == 0) {
if ((!isset($values['disabled']) || $values['disabled'] == 0) && $values['id_modulo'] > 0) {
if ($status == 0) {
db_process_sql(
'UPDATE tagente

View File

@ -31,6 +31,7 @@ require_once 'functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_groups.php';
enterprise_include_once('include/functions_networkmap.php');
enterprise_include_once('include/functions_metaconsole.php');
// Check if a node descends from a given node
function networkmap_is_descendant($node, $ascendant, $parents)
@ -1228,7 +1229,7 @@ function networkmap_get_networkmap($id_networkmap, $filter=false, $fields=false,
* @param array Extra filter.
* @param array Fields to get.
*
* @return Networkmap with the given id. False if not available or readable.
* @return array Networkmap with the given id. False if not available or readable.
*/
function networkmap_get_networkmaps(
$id_user=null,
@ -1243,10 +1244,16 @@ function networkmap_get_networkmaps(
$id_user = $config['id_user'];
}
// Configure filters
// Configure filters.
$where = [];
$where['type'] = MAP_TYPE_NETWORKMAP;
$where['id_group'] = array_keys(users_get_groups($id_user, 'AR', $return_all_group));
$where['id_group'] = array_keys(
users_get_groups(
$id_user,
'AR',
$return_all_group
)
);
if (!empty($type)) {
$where['subtype'] = $type;
}
@ -1256,7 +1263,30 @@ function networkmap_get_networkmaps(
$where['order'][1]['field'] = 'name';
$where['order'][1]['order'] = 'ASC';
if ((bool) is_metaconsole() === true) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $key => $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$tmp_maps = db_get_all_rows_filter('tmap', $where);
if ($tmp_maps !== false) {
foreach ($tmp_maps as $g) {
$g['id_t'] = $g['id'];
$g['id'] = $connection['id'].'_'.$g['id'];
$g['name'] = $g['name'].' ('.$connection['server_name'].')';
$networkmaps_raw[] = $g;
}
}
metaconsole_restore_db();
}
} else {
$networkmaps_raw = db_get_all_rows_filter('tmap', $where);
}
if (empty($networkmaps_raw)) {
return [];
}

View File

@ -239,7 +239,7 @@ function get_notification_source_targets(int $id_source, ?string $subtype=null)
}
$filter = sprintf(
' AND ns.`subtype_blacklist` NOT LIKE "%%%s%%"',
' AND (ns.`subtype_blacklist` IS NULL OR ns.`subtype_blacklist` NOT LIKE "%%%s%%") ',
$subtype
);
}

View File

@ -5644,7 +5644,7 @@ function reporting_value($report, $content, $type, $pdf=false)
);
}
$label = (isset($content['name'])) ? $content['name'] : '';
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
if ($label != '') {
$label = reporting_label_macro(
$items_label,
@ -8587,7 +8587,7 @@ function reporting_general($report, $content)
if (!is_numeric($data_res[$index])) {
$return['data'][$name_agent][$mod_name] = $data_res[$index];
} else {
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
}
}
break;
@ -8608,7 +8608,7 @@ function reporting_general($report, $content)
if ($change_min) {
$return['min']['value'] = $val;
$return['min']['formated_value'] = format_for_graph($val, 2, '.', ',', $divisor, $unit);
$return['min']['formated_value'] = format_for_graph($val, 2, '.', ',', $divisor, ' '.$unit);
$return['min']['agent'] = $ag_name;
$return['min']['module'] = $mod_name;
}
@ -8624,7 +8624,7 @@ function reporting_general($report, $content)
if ($change_max) {
$return['max']['value'] = $val;
$return['max']['formated_value'] = format_for_graph($val, 2, '.', ',', $divisor, $unit);
$return['max']['formated_value'] = format_for_graph($val, 2, '.', ',', $divisor, ' '.$unit);
$return['max']['agent'] = $ag_name;
$return['max']['module'] = $mod_name;
}
@ -8650,7 +8650,7 @@ function reporting_general($report, $content)
if ($change_min) {
$return['min']['value'] = $data_res[$index];
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
$return['min']['agent'] = $ag_name;
$return['min']['module'] = $mod_name;
}
@ -8666,7 +8666,7 @@ function reporting_general($report, $content)
if ($change_max) {
$return['max']['value'] = $data_res[$index];
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
$return['max']['agent'] = $ag_name;
$return['max']['module'] = $mod_name;
}
@ -8800,7 +8800,7 @@ function reporting_general($report, $content)
$data['formated_value'][] = $val;
} else {
$data['value'][] = $val;
$data['formated_value'][] = format_for_graph($val, 2, '.', ',', $divisor, $units[$i]);
$data['formated_value'][] = format_for_graph($val, 2, '.', ',', $divisor, ' '.$units[$i]);
}
}
}
@ -8829,7 +8829,7 @@ function reporting_general($report, $content)
$data['formated_value'] = $d;
} else {
$data['value'] = $d;
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, $units[$i]);
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, ' '.$units[$i]);
}
}
}
@ -9170,6 +9170,7 @@ function reporting_simple_graph(
$return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name;
$return['description'] = $description;
$return['label'] = $label;
$return['date'] = reporting_get_date_text(
$report,
$content
@ -9211,7 +9212,8 @@ function reporting_simple_graph(
$params = [
'agent_module_id' => $content['id_agent_module'],
'period' => $content['period'],
'title' => $label,
'title' => $title,
'label' => $label,
'pure' => false,
'date' => $report['datetime'],
'only_image' => $only_image,
@ -10343,7 +10345,7 @@ function reporting_get_stats_alerts($data, $links=false)
*/
if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) {
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' ><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='alertagentmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
$tdata[3] = html_print_image(
@ -10500,7 +10502,7 @@ function reporting_get_stats_agents_monitors($data)
*/
if ($data['total_agents'] > 500 && !enterprise_installed()) {
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='Community version' ><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='agentsmodal' class='publienterprise' title='".__('Enterprise version not installed')."'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true);
@ -10514,7 +10516,7 @@ function reporting_get_stats_agents_monitors($data)
*/
if ($data['total_agents']) {
if (($data['monitor_checks'] / $data['total_agents'] > 100) && !enterprise_installed()) {
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' ><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
}
}
@ -12828,7 +12830,7 @@ function reporting_get_stats_servers()
$tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec </span>';
if ($server_performance['total_remote_modules'] > 10000 && !enterprise_installed()) {
$tdata[4] = "<div id='remotemodulesmodal' class='publienterprise left' title='Community version'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[4] = "<div id='remotemodulesmodal' class='publienterprise left' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
} else {
$tdata[4] = '&nbsp;';
}
@ -12903,7 +12905,7 @@ function reporting_get_stats_servers()
$tdata[1] = '<span class="big_data" id="total_events">'.html_print_image('images/spinner.gif', true).'</span>';
if (isset($system_events) && $system_events > 50000 && !enterprise_installed()) {
$tdata[2] = "<div id='monitoreventsmodal' class='publienterprise left' title='Community version'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
$tdata[2] = "<div id='monitoreventsmodal' class='publienterprise left' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
} else {
$tdata[3] = '&nbsp;';
}

View File

@ -130,17 +130,24 @@ function html_do_report_info($report)
$date_today = date($config['date_format']);
$date_today = preg_split('/[\s,]+/', io_safe_output($date_today));
$date_today = __($date_today[0]).' '.$date_today[1].' '.$date_today[2].' '.$date_today[3].' '.$date_today[4];
$html = '<div class="report_info" style="background: '.$background_color.'"><table>
<tr>
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
</tr>
<tr>
<td><b>'.__('Report date').': </b></td>';
$date_before = date($config['date_format'], $report['datetime']);
$date_before = preg_split('/[\s,]+/', io_safe_output($date_before));
$date_before = __($date_before[0]).' '.$date_before[1].' '.$date_before[2].' '.$date_before[3].' '.$date_before[4];
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
} else {
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
$html .= '<td>'.__('Items period before').' <b>'.$date_before.'</b></td>';
}
$html .= '</tr>

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