Merge remote-tracking branch 'origin/develop' into ent-5266-modulos-host-alive-se-ejecutan-y-obtienen-datos-sin-tener-ip-configurada

This commit is contained in:
fbsanchez 2020-11-18 12:02:17 +01:00
commit 952de36aab
168 changed files with 8102 additions and 2258 deletions

View File

@ -0,0 +1,145 @@
![Image of Pandora FMS](https://pandorafms.org/wp-content/uploads/2016/06/logo_pandora_community.png)
Pandora FMS is a __monitoring solution__ that provides unparalleled flexibility for IT to address both immediate and unforeseen operational issues, including infrastructure and IT processes.
It uniquely enables business and IT to adapt to changing needs through a flexible and rapid approach to IT and business deployment.
For community support you can visit our forums at [forums.pandorafms.org](http://forums.pandorafms.org). Check out our community website at [pandorafms.org](http://pandorafms.org), and if you need sales information or/and professional support, visit [pandorafms.com](http://pandorafms.com).
# Pandora FMS full stack based on Centos 8
## Try it
You can try it on a cloud env for 4 hours using play with docker just click in the icon bellow, wait for the pulling image and the containers will be up and running automatically
If you want to open the console just click on the port 8080 on the upside and will be redirected to the pandora consola.
[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/rafaelameijeiras/PandoraFMS/master/pandorafms_community/docker-compose-official.yml)
https://www.youtube.com/watch?v=Hw2P6hHQpeI
Note: could take a couple of minutes for the console to be ready so if you click in the 8080 port and nothing and have a blank page wait a little and reload the page
## Usage
```
docker run --name Pandora_new %container_name% --rm \
-p %local_httpd_port%:80 \
-p %local_tentacle_port%:41121 \
-e DBHOST=%Mysql_Server_IP% \
-e DBNAME=%database_name% \
-e DBUSER=%Mysql_user% \
-e DBPASS=%Mysql_pass% \
-e DBPORT=%Mysql_port% \
-e INSTANCE_NAME=%server name% \
-ti pandorafms-open-stack-el8
```
Example:
```
docker run --name Pandora_new --rm \
-p 8081:80 \
-p 41125:41121 \
-e DBHOST=192.168.80.45 \
-e DBNAME=pandora_demos_1 \
-e DBUSER=pandora \
-e DBPASS=pandora \
-e DBPORT=3306 \
-e INSTANCE_NAME=pandora201 \
-ti pandorafms-open-stack-el8
```
### Integrated database for PandoraFMS container
There is a preconfigured database image in this repo to connect the Pandora environment so you can up the database and then point the pandora container to the database.
Example:
```
docker run --name Pandora_DB \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=pandora \
-e MYSQL_DATABASE=pandora \
-e MYSQL_USER=pandora \
-e MYSQL_PASSWORD=pandora \
-d pandorafms/pandorafms-percona-base
```
This creates a Percona mysql docker and a database called Pandora with grants to the pandora user (optional) and the credentials for root user.
In this example we expose the 3306 for database connection.
Using this configuration (getting the container ip from DB container ip) you can execute the next container Pandora pointing to it:
```
docker run --name Pandora_new --rm \
-p 8081:80 \
-p 41125:41121 \
-e DBHOST=<percona container ip> \
-e DBNAME=pandora \
-e DBUSER=pandora \
-e DBPASS=pandora \
-e DBPORT=3306 \
-e INSTANCE_NAME=pandora_inst \
-ti pandorafms/pandorafms-open-stack-el8
```
### Docker Compose Stack
if you want to run an easy to deploy stack you may use the docker-compose.yml file
```
version: '3.1'
services:
db:
image: pandorafms/pandorafms-percona-base
restart: always
#command: ["mysqld", "--innodb-buffer-pool-size=900M"]
environment:
MYSQL_ROOT_PASSWORD: pandora
MYSQL_DATABASE: pandora
MYSQL_USER: pandora
MYSQL_PASSWORD: pandora
networks:
- pandora
pandora:
image: pandorafms/pandorafms-open-stack-el8:latest
restart: always
depends_on:
- db
environment:
MYSQL_ROOT_PASSWORD: pandora
DBHOST: db
DBNAME: pandora
DBUSER: pandora
DBPASS: pandora
DBPORT: 3306
INSTANCE_NAME: pandora01
PUBLICURL: ""
SLEEP: 5
RETRIES: 10
networks:
- pandora
ports:
- "8080:80"
- "41121:41121"
- "162:162/udp"
- "9995:9995/udp"
networks:
pandora:
```
just by running: `docker-compose -f <docker-compose-file> up`
## Important Parameters:
* __INSTANCE_NAME__: Pandora Server name
* __DBHOST__: DB host IP to MySQL engine
* __DBNAME__: The name of the database. If your user have enough permissions to create databases, the container will create it in case automatically if didn't exist
* __DBUSER__: The user to connect MySQL engine.
* __DBPASS__: User password to connect MySQL engine.
* __DBPORT__: The port to connect MySQL engine. by default 33306
* __PUBLICURL__: Define a public URL. Useful when Pandora is used behind a reverse proxy
* __SLEEP__: Time to wait between retries
* __RETRIES__: How many times Pandora will try to connect to MySQL engine before fail.
Note1: the SLEEP and RETRIES variables will be used to wait for database container to fully start, if you are in a slower system maybe you will need to increase these variables values, in this example will wait 5 seconds for the database container to be up and retries 3 times.

View File

@ -0,0 +1,257 @@
#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/
#docker push pandorafms/pandorafms-open-base-el8
FROM centos:8
RUN dnf install -y --setopt=tsflags=nodocs \
epel-release \
dnf-utils \
http://rpms.remirepo.net/enterprise/remi-release-8.rpm
RUN dnf module reset -y php && dnf module install -y php:remi-7.3
RUN dnf config-manager --set-enabled PowerTools
# Install console
RUN dnf install -y --setopt=tsflags=nodocs \
php \
php-mcrypt \php-cli \
php-gd \
php-curl \
php-session \
php-mysqlnd \
php-ldap \
php-zip \
php-zlib \
php-fileinfo \
php-gettext \
php-snmp \
php-mbstring \
php-pecl-zip \
php-xmlrpc \
libxslt \
wget \
php-xml \
httpd \
mod_php \
atk \
avahi-libs \
cairo \
cups-libs \
fribidi \
gd \
gdk-pixbuf2 \
ghostscript \
graphite2 \
graphviz \
gtk2 \
harfbuzz \
hicolor-icon-theme \
hwdata \
jasper-libs \
lcms2 \
libICE \
libSM \
libXaw \
libXcomposite \
libXcursor \
libXdamage \
libXext \
libXfixes \
libXft \
libXi \
libXinerama \
libXmu \
libXrandr \
libXrender \
libXt \
libXxf86vm \
libcroco \
libdrm \
libfontenc \
libglvnd \
libglvnd-egl \
libglvnd-glx \
libpciaccess \
librsvg2 \
libthai \
libtool-ltdl \
libwayland-client \
libwayland-server \
libxshmfence \
mesa-libEGL \
mesa-libGL \
mesa-libgbm \
mesa-libglapi \
pango \
pixman \
nfdump \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-misc \
poppler-data \
php-yaml; yum clean all
RUN mkdir -p /run/php-fpm/ ; chown -R root:apache /run/php-fpm/
# not installed perl-Net-Telnet gtk-update-icon-cach ghostscript-fonts
# Install server
RUN dnf install -y --setopt=tsflags=nodocs \
GeoIP \
GeoIP-GeoLite-data \
dwz \
efi-srpm-macros \
ghc-srpm-macros \
go-srpm-macros \
ocaml-srpm-macros \
openblas-srpm-macros \
perl \
perl-Algorithm-Diff \
perl-Archive-Tar \
perl-Archive-Zip \
perl-Attribute-Handlers \
perl-B-Debug \
perl-CPAN \
perl-CPAN-Meta \
perl-CPAN-Meta-Requirements \
perl-CPAN-Meta-YAML \
perl-Compress-Bzip2 \
perl-Config-Perl-V \
perl-DBD-MySQL \
perl-DBI \
perl-DB_File \
perl-Data-Dump \
perl-Data-OptList \
perl-Data-Section \
perl-Devel-PPPort \
perl-Devel-Peek \
perl-Devel-SelfStubber \
perl-Devel-Size \
perl-Digest-HMAC \
perl-Digest-SHA \
perl-Encode-Locale \
perl-Encode-devel \
perl-Env \
perl-ExtUtils-CBuilder \
perl-ExtUtils-Command \
perl-ExtUtils-Embed \
perl-ExtUtils-Install \
perl-ExtUtils-MM-Utils \
perl-ExtUtils-MakeMaker \
perl-ExtUtils-Manifest \
perl-ExtUtils-Miniperl \
perl-ExtUtils-ParseXS \
perl-File-Fetch \
perl-File-HomeDir \
perl-File-Listing \
perl-File-Which \
perl-Filter \
perl-Filter-Simple \
perl-Geo-IP \
perl-HTML-Parser \
perl-HTML-Tagset \
perl-HTML-Tree \
perl-HTTP-Cookies \
perl-HTTP-Date \
perl-HTTP-Message \
perl-HTTP-Negotiate \
perl-IO-HTML \
perl-IO-Socket-INET6 \
perl-IO-Zlib \
perl-IO-stringy \
perl-IPC-Cmd \
perl-IPC-SysV \
perl-IPC-System-Simple \
perl-JSON \
perl-JSON-PP \
perl-LWP-MediaTypes \
perl-Locale-Codes \
perl-Locale-Maketext \
perl-Locale-Maketext-Simple \
perl-MRO-Compat \
perl-Math-BigInt \
perl-Math-BigInt-FastCalc \
perl-Math-BigRat \
perl-Memoize \
perl-Module-Build \
perl-Module-CoreList \
perl-Module-CoreList-tools \
perl-Module-Load \
perl-Module-Load-Conditional \
perl-Module-Loaded \
perl-Module-Metadata \
perl-NTLM \
perl-Net-HTTP \
perl-Net-Ping \
perl-NetAddr-IP \
perl-Package-Generator \
perl-Params-Check \
perl-Params-Util \
perl-Perl-OSType \
perl-PerlIO-via-QuotedPrint \
perl-Pod-Checker \
perl-Pod-Html \
perl-Pod-Parser \
perl-SelfLoader \
perl-Socket6 \
perl-Software-License \
perl-Sub-Exporter \
perl-Sub-Install \
perl-Sys-Syslog \
perl-Test \
perl-Test-Harness \
perl-Test-Simple \
perl-Text-Balanced \
perl-Text-Diff \
perl-Text-Glob \
perl-Text-Template \
perl-Thread-Queue \
perl-Time-Piece \
perl-TimeDate \
perl-Try-Tiny \
perl-Unicode-Collate \
perl-WWW-RobotRules \
perl-XML-NamespaceSupport \
perl-XML-Parser \
perl-XML-SAX \
perl-XML-SAX-Base \
perl-XML-Simple \
perl-XML-Twig \
perl-autodie \
perl-bignum \
perl-devel \
perl-encoding \
perl-experimental \
perl-inc-latest \
perl-libnetcfg \
perl-libwww-perl \
perl-local-lib \
perl-open \
perl-perlfaq \
perl-srpm-macros \
perl-utils \
perl-version \
python-srpm-macros \
python3-pyparsing \
python3-rpm-macros \
qt5-srpm-macros \
redhat-rpm-config \
rust-srpm-macros \
systemtap-sdt-devel \
perl-TermReadKey \
perl \
perl-DBD-MySQL \
perl-DBI \
initscripts \
net-tools \
nmap-ncat \
nmap \
net-snmp-utils \
sudo \
http://firefly.artica.es/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm
RUN dnf install -y supervisor crontabs mysql http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm --setopt=tsflags=nodocs
EXPOSE 80 443 41121 162/udp

View File

@ -0,0 +1,112 @@
#!/bin/bash
VERSION=$1
ENT="$HOME/code/pandora_enterprise"
OPEN="$HOME/code/pandorafms"
OS="Centos"
ARCH="x86_64"
EL="el7"
EXT="demo"
TARGET_URL="http://atlantis.artica.es"
DOCKER_PATH="$OPEN/extras/docker/centos8/"
OSTACK_IMAGE="pandorafms/pandorafms-open-stack-el8"
OBASE_IMAGE="pandorafms/pandorafms-open-base-el8"
PERCONA_IMAGE="pandorafms/pandorafms-percona-base"
function help {
echo "To excute the builder you must declare 4 parameters: the version image, upload (push) tokens, build base (rebuild centos base image), build percona (rebuild percona base image)"
echo ""
echo "$0 <version> [ <push 0|1> ] [<build base 0|1>] [<build percona 0|1>]"
echo "Ex creates a local image from 749 packages : $0 749 0 1 1"
}
if [ "$1" == "" ] || [ "$1" == "-h" ] ; then
help
exit
fi
if [ "$2" == "1" ]; then
UPDATE="1"
fi
if [ "$3" == "1" ]; then
BASEBUILD="1"
fi
if [ "$4" == "1" ]; then
DBBUILD="1"
fi
#Defining packages urls
oconsoleurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_console-7.0NG.$VERSION.noarch.rpm
oserverurl=$TARGET_URL/Releases/7.0NG.$VERSION/$OS/noarch/pandorafms_server-7.0NG.$VERSION.noarch.rpm
url=$(curl -I -s $TARGET_URL/Releases/7.0NG.$VERSION/ 2> /dev/null | grep "200 OK" | wc -l)
# log in into docker acount to acces private repo.
# docker login -u $DOCKERUSER -p$DOCKERPASS
Check athlantis is reachable
if [ "$url" -lt 1 ] ; then
echo "$url Athlantis unreachable ..."
exit
fi
echo "Start"
# Removing old packages
cd $DOCKER_PATH/pandora-stack/sources
rm -rf ./pandorafms_*
# Downloading new packages
wget $oconsoleurl
wget $oserverurl
if [ "$BASEBUILD" == 1 ] ; then
# Open Base image
echo "building Base el8 image"
cd $DOCKER_PATH/base
docker build -t $OBASE_IMAGE:$VERSION -f $DOCKER_PATH/base/Dockerfile $DOCKER_PATH/base
echo "Taging Open stack el8 latest image before upload"
docker tag $OBASE_IMAGE:$VERSION $OBASE_IMAGE:latest
echo -e ">>>> \n"
fi
if [ "$DBBUILD" == 1 ] ; then
# Percona image
echo "building Percona image"
cd $OPEN/extras/docker/percona
docker build -t $PERCONA_IMAGE:latest -f $OPEN/extras/docker/percona/Dockerfile $OPEN/extras/docker/percona
echo -e ">>>> \n"
fi
#Open Stack image
echo "building Open el8 image"
cd $DOCKER_PATH/pandora-stack
docker build -t $OSTACK_IMAGE:$VERSION -f $DOCKER_PATH/pandora-stack/Dockerfile $DOCKER_PATH/pandora-stack
echo "Taging Open base latest image before upload"
docker tag $OSTACK_IMAGE:$VERSION $OSTACK_IMAGE:latest
echo -e ">>>> \n"
# Upload images
if [ "$UPDATE" == 1 ] ; then
if [ "$BASEBUILD" == 1 ] ; then
#Open base Images
echo "Uploading Open $OBASE_IMAGE:$VERSION . . ."
docker push $OBASE_IMAGE:$VERSION
docker push $OBASE_IMAGE:latest
fi
if [ "$DBBUILD" == 1 ] ; then
#Open base Images
echo "Uploading percona $PERCONA_IMAGE:latest . . ."
docker push $PERCONA_IMAGE:latest
fi
#Open Stack Images
echo "Uploading Open $OSTACK_IMAGE:$VERSION . . ."
docker push $OSTACK_IMAGE:$VERSION
docker push $OSTACK_IMAGE:latest
fi

View File

@ -0,0 +1,43 @@
# Use root/example as user/password credentials
# este compose incluye la base de datos en otro docker y levanta aplicacion y DB juntos
version: '3.1'
services:
db:
image: pandorafms/pandorafms-percona-base
restart: always
#command: ["mysqld", "--innodb-buffer-pool-size=900M"]
environment:
MYSQL_ROOT_PASSWORD: pandora
MYSQL_DATABASE: pandora
MYSQL_USER: pandora
MYSQL_PASSWORD: pandora
networks:
- pandora
pandora:
image: pandorafms/pandorafms-open-stack-el8:latest
restart: always
depends_on:
- db
environment:
MYSQL_ROOT_PASSWORD: pandora
DBHOST: db
DBNAME: pandora
DBUSER: pandora
DBPASS: pandora
DBPORT: 3306
INSTANCE_NAME: pandora01
PUBLICURL: ""
SLEEP: 5
RETRIES: 10
networks:
- pandora
ports:
- "8080:80"
- "41121:41121"
- "162:162/udp"
- "9995:9995/udp"
networks:
pandora:

View File

@ -0,0 +1,24 @@
#docker build -t pandorafms/pandorafms-open-stack-el8:$VERSION -f $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/pandora-stack/
FROM pandorafms/pandorafms-open-base-el8
ENV DBNAME=pandora
ENV DBUSER=pandora
ENV DBPASS=pandora
ENV DBHOST=pandora
ENV DBPORT=3306
ENV SLEEP=5
ENV RETRIES=1
ENV OPEN=1
ENV LC_ALL=C
RUN rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime
COPY ./sources /opt/pandora
# Install the Pandora console
RUN dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm ; yum clean all
EXPOSE 80 443 41121 162/udp 9995/udp
CMD sh /opt/pandora/init_pandora.sh

View File

@ -0,0 +1,5 @@
# exclude packages
demos/
*.tar*
*.rpm
phantomjs

View File

@ -0,0 +1,336 @@
#!/bin/bash
#
# Prepares environment and launchs Pandora FMS
#
# Global vars
#
PANDORA_CONSOLE=/var/www/html/pandora_console
PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_SERVER_BIN=/usr/bin/pandora_server
PANDORA_HA_BIN=/usr/bin/pandora_ha
PANDORA_TABLES_MIN=160
#
# Check database
#
function db_check {
# Check DB
echo -n ">> Checking dbengine connection: "
for i in `seq $RETRIES`; do
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A`
if [ $? -ne 0 ]; then
echo -n "retriying DB conection in $SLEEP seconds: "
sleep $SLEEP
else
break
fi
done
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A`
if [ $? -eq 0 ]; then
echo "OK"
echo -n ">> Checking database connection: "
r=`echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME`
if [ $? -eq 0 ]; then
echo "OK"
return 0
fi
echo -n ">> Cannot connect to $DBNAME, trying to create: "
r=`echo "create database $DBNAME" | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST`
if [ $? -eq 0 ]; then
echo "OK"
return 0
fi
echo "Cannot create database $DBNAME on $DBUSER@$DBHOST:$DBPORT"
return 1
fi
if [ "$DEBUG" == "1" ]; then
echo "Command: [echo 'select 1' | mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME]"
echo "Output: [$r]"
traceroute $DBHOST
nmap $DBHOST -v -v -p $DBPORT
fi
return 1
}
# Load database
#
function db_load {
# Load DB
echo -n ">> Checking database state:"
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l`
if [ "$DEBUG" == "1" ]; then
echo "Command: [mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST -A $DBNAME -s -e 'show tables'| wc -l]"
echo "Output: [$r]"
fi
if [ "$r" -ge "$PANDORA_TABLES_MIN" ]; then
echo 'OK. Already exists, '$r' tables detected'
return 0
fi
echo 'Empty database detected';
# Needs to be loaded.
echo -n "- Loading database schema: "
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql`
if [ $? -ne 0 ]; then
echo "mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql"
echo "ERROR"
echo "$r"
return 1;
fi
echo "OK"
echo -n "- Loading database data: "
r=`mysql -u$DBUSER -p$DBPASS -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql`
if [ $? -ne 0 ]; then
echo "ERROR"
echo $r
return 2;
fi
echo "OK"
# Loaded.
return 0
}
#
# Prepare & start Pandora FMS Console
#
function console_prepare {
CONSOLE_PATH=/var/www/html/pandora_console
echo ">> Preparing console"
# Delete install and license files.
mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done
rm -f $CONSOLE_PATH/enterprise/PandoraFMS_Enteprise_Licence.txt
# Configure console.
cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F
<?php
\$config["dbtype"] = "mysql";
\$config["dbname"]="$DBNAME";
\$config["dbuser"]="$DBUSER";
\$config["dbpass"]="$DBPASS";
\$config["dbhost"]="$DBHOST";
\$config["homedir"]="/var/www/html/pandora_console";
\$config["homeurl"]="/pandora_console";
error_reporting(0);
\$ownDir = dirname(__FILE__) . '/';
include (\$ownDir . "config_process.php");
EO_CONFIG_F
# enable allow override
cat > /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
EO_CONFIG_F
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
EOF_INDEX
echo "- Fixing permissions"
chmod 600 $CONSOLE_PATH/include/config.php
chown -R apache. $CONSOLE_PATH
# prepare php.ini
sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini
echo "- Setting Public URL: $PUBLICURL"
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)
[[ ! "$q" ]] && mysql -u $DBUSER -p$DBPASS $DBNAME -P$DBPORT -h$DBHOST -sNe "INSERT INTO tconfig (token,value) VALUES ('public_url',\"$PUBLICURL\");"
mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "UPDATE tconfig SET value=\"$PUBLICURL\" WHERE token=\"public_url\";"
#touch $CONSOLE_PATH/pandora_console.log
#chown apache. $CONSOLE_PATH/pandora_console.log
}
function check_mr {
## geting MR + Package
CMR=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'MR'")
CPK=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select value from tconfig where token = 'current_package_enterprise'")
DPK=$(grep pandora_version $PANDORA_CONSOLE/include/config_process.php | awk '{print $3}' | tr -d "'" | tr -d ";" | cut -d . -f 3)
DMR=$(ls $PANDORA_CONSOLE/extras/mr/ | sort -n | tail -1 | cut -d . -f 1)
if [[ $DMR -gt $CMR ]]; then
echo ">> Fixing DB: MR: $CMR Current Package: $CPK Desired MR: $DMR"
cd $PANDORA_CONSOLE/extras/mr/
for i in $(ls | sort -n); do
cat $i | mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST
done
cd -
echo ">> Updating DB: MR: $CMR Current Package: $CPK Desired MR: $DMR"
mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DMR where token = 'MR';"
mysql -u $DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "update tconfig set value = $DPK where token = 'current_package_enterprise';"
fi
}
function server_prepare {
sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF
sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF
sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF
sed -i -e "s/^#servername.*/servername $INSTANCE_NAME/g" $PANDORA_SERVER_CONF
echo "pandora_service_cmd /etc/init.d/pandora_server" >> $PANDORA_SERVER_CONF
# prepare snmptrapd
cat > /etc/snmp/snmptrapd.conf << EOF
authCommunity log public
disableAuthorization yes
EOF
## Enable WUX
if [ "$WUX_SERVER" == "1" ] && [ "$WUX_HOST" ]; then
if [ ! $WUX_PORT ]; then
WUX_PORT=4444
fi
echo "Enabling WUX server HOST=$WUX_HOST PORT=$WUX_PORT"
sed -i -r "s/#?wuxserver.*/wuxserver 1/g" $PANDORA_SERVER_CONF
sed -i -r "s/#?wux_host.*/wux_host $WUX_HOST/g" $PANDORA_SERVER_CONF
sed -i -r "s/#?wux_port.*/wux_port $WUX_PORT/g" $PANDORA_SERVER_CONF
fi
}
##
## MAIN
##
if [ "$DBUSER" == "" ] || [ "$DBPASS" == "" ] || [ "$DBNAME" == "" ] || [ "$DBHOST" == "" ]; then
echo "Required environemntal variables DBUSER, DBPASS, DBNAME, DBHOST"
exit 1
fi
if [ "$DBPORT" == "" ]; then
DBPORT=3306
fi
echo "" > /opt/pandora/crontasks || touch /opt/pandora/crontasks
#install pandora packages
echo "-> Istalling pandorafms"
cd /opt/pandora
useradd pandora
if [[ $OPEN != 1 ]]; then
# install enterprise
dnf install -y /opt/pandora/pandorafms_console*.rpm
tar xvfz /opt/pandora/pandorafms_server_*tar* && cd pandora_server && ./pandora_server_installer --install ; rm -rf /opt/pandora/pandora_server
[[ -e /var/www/html/pandora_console/include/config.php ]] || yum reinstall -y /opt/pandora/pandorafms*.rpm
PANDORA_BIN="pandora_ha"
PANDORA_EXEC="/usr/bin/pandora_ha /etc/pandora/pandora_server.conf"
else
install only open
dnf install -y /opt/pandora/pandorafms_console-*.rpm /opt/pandora/pandorafms_server-*.rpm
dnf reinstall -y /opt/pandora/pandorafms_server-*.rpm
[[ -e /var/www/html/pandora_console/include/config.php ]] || dnf reinstall -y /opt/pandora/pandorafms_console-*.rpm
PANDORA_BIN="pandora_server"
PANDORA_EXEC="/usr/bin/pandora_server /etc/pandora/pandora_server.conf"
fi
db_check && db_load
# Sync to MC.
if [ "$META_DBNAME" != "" ] && [ "$META_DBHOST" != "" ]; then
if [ "$META_DBPORT" == "" ]; then
META_DBPORT=3306
fi
register_mc
fi
check_mr
console_prepare
server_prepare
echo ">> Enable oracle env file cron: "
cat > /etc/pandora/pandora_server.env << 'EOF_ENV'
#!/bin/bash
VERSION=19.8
export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib
export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64
EOF_ENV
echo ">> Enable discovery cron: "
#while true ; do wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/pandora_console.log && sleep 60 ; done &
echo "*/5 * * * * wget -q -O - --no-check-certificate http://localhost/pandora_console/enterprise/cron.php >> /var/www/html/pandora_console/log/cron.log" >> /opt/pandora/crontasks
echo ">> Enable pandora_db cron: "
/usr/bin/perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf
#while true ; do sleep 1h && /usr/bin/pandora_db /etc/pandora/pandora_server.conf; done &
echo "0 */1 * * * /usr/bin/pandora_db /etc/pandora/pandora_server.conf" >> /opt/pandora/crontasks
echo ">> Loading crontab tasks"
crontab -r
crontab /opt/pandora/crontasks && crontab -l
ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -F '/' '{print "-> Go to http://"$1"/pandora_console to manage this server"}'
# Check and launch supervisord
echo ">> Starting process: Running supervisord"
# Create supervisor.conf
cat > /etc/supervisord.conf << EOF_CON
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
nodaemon=true
loglevel = debug
[program:php-fpm]
command=/usr/sbin/php-fpm -F
riredirect_stderr=true
[program:httpd]
command=/usr/sbin/apachectl -DFOREGROUND
riredirect_stderr=true
[program:tentacle]
command=/etc/init.d/tentacle_serverd restart
[program:$PANDORA_BIN]
command=$PANDORA_EXEC
riredirect_stderr=true
[program:cron]
command=crond -n
[group:allservices]
programs=httpd,cron,php-fpm,$PANDORA_BIN,tentacle
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
EOF_CON
# execute supervisor
touch /var/log/pandora/pandora_server.log ; tail -F /var/log/pandora/* &
su - -c supervisord

View File

@ -0,0 +1,31 @@
#docker build -t pandorafms/pandorafms-percona-base -f $HOME/code/pandorafms/extras/docker/percona/Dockerfile $HOME/code/pandorafms/extras/docker/percona
FROM percona:5.7
RUN echo -e '#PandoraFMS configuration \n\
[mysqld] \n\
max_allowed_packet = 64M \n\
innodb_buffer_pool_size = 500M \n\
innodb_lock_wait_timeout = 90 \n\
innodb_file_per_table \n\
innodb_flush_log_at_trx_commit = 0 \n\
innodb_flush_method = O_DIRECT \n\
innodb_log_file_size = 64M \n\
innodb_log_buffer_size = 16M \n\
innodb_io_capacity = 100 \n\
thread_cache_size = 8 \n\
thread_stack = 256K \n\
max_connections = 100 \n \n\
key_buffer_size=4M \n\
read_buffer_size=128K \n\
read_rnd_buffer_size=128K \n\
sort_buffer_size=128K \n\
join_buffer_size=4M \n\n\
query_cache_type = 1 \n\
query_cache_size = 64M \n\
query_cache_min_res_unit = 2k \n\
query_cache_limit = 256K \n\n\
sql_mode="" ' > /etc/my.cnf.d/pandora.cnf
EXPOSE 3306

View File

@ -0,0 +1,50 @@
![Image of Pandora FMS](https://pandorafms.org/wp-content/uploads/2016/06/logo_pandora_community.png)
# Pandora FMS database container
This container image is designed for optimal performance using Pandora FMS.
Is based on the official Percona database image turned to get the maximum performance on PandoraFMS
## Official Gitgub repo
Dockerfiles and more info in our official repository: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/percona
## USAGE
Similar to the official percona image:
Example:
```
docker run --name Pandora_DB \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=pandora \
-e MYSQL_DATABASE=pandora \
-e MYSQL_USER=pandora \
-e MYSQL_PASSWORD=pandora \
-d pandorafms/pandorafms-percona-base
```
## Environment Variables
When you start the percona image, you can adjust the configuration of the instance by passing one or more environment variables on the docker run command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup.
__MYSQL_ROOT_PASSWORD__ : This variable is mandatory and specifies the password that will be set for the root superuser account. In the above example, it was set to my-secret-pw.
__MYSQL_ROOT_HOST__ : By default, root can connect from anywhere. This option restricts root connections to be from the specified host only. Also localhost can be used here for the local-only root access.
__MYSQL_DATABASE__ :
This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this database.
__MYSQL_USER, MYSQL_PASSWORD__ :These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created.
Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the MYSQL_ROOT_PASSWORD variable.
__MYSQL_ALLOW_EMPTY_PASSWORD__ : This is an optional variable. Set to yes to allow the container to be started with a blank password for the root user. NOTE: Setting this variable to yes is not recommended unless you really know what you are doing, since this will leave your instance completely unprotected, allowing anyone to gain complete superuser access.
__MYSQL_RANDOM_ROOT_PASSWORD__ : This is an optional variable. Set to yes to generate a random initial password for the root user (using pwgen). The generated root password will be printed to stdout (GENERATED ROOT PASSWORD: .....).
__MYSQL_ONETIME_PASSWORD__ : Sets root (not the user specified in MYSQL_USER!) user as expired once init is complete, forcing a password change on first login. NOTE: This feature is supported on MySQL 5.6+ only. Using this option on MySQL 5.5 will throw an appropriate error during initialization.
__MYSQL_INITDB_SKIP_TZINFO__ : At first run MySQL automatically loads from the local system the timezone information needed for the CONVERT_TZ() function. If it's is not what is intended, this option disables timezone loading.
__INIT_TOKUDB__ : Tuns on TokuDB Engine. It can be activated only when transparent huge pages (THP) are disabled.
__INIT_ROCKSDB__ : Tuns on RocksDB Engine.

View File

@ -143,7 +143,7 @@ done
# Darwin dmg installer files # Darwin dmg installer files
echo "Updating DARWIN DMG files..." echo "Updating DARWIN DMG files..."
sed -i -e "/VERSION/s/=.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER" sed -i -e "/VERSION/s/=\"7.0NG.*/=\"$VERSION\"/" "$AGENT_DARWIN_BUILDER"
sed -i -r "s/(version=\").*(\"\s+onConclusion=)/\1$VERSION\2/g" "$AGENT_DARWIN_DISTR" sed -i -r "s/(version=\").*(\"\s+onConclusion=)/\1$VERSION\2/g" "$AGENT_DARWIN_DISTR"
sed -i -r "s/(CFBundleVersion<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" sed -i -r "s/(CFBundleVersion<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST"
sed -i -r "s/(CFBundleShortVersionString<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST" sed -i -r "s/(CFBundleShortVersionString<\/key>\s*<string>).*(<\/string>)/\1$VERSION\2/g" "$AGENT_DARWIN_PLIST"

View File

@ -1,20 +1,27 @@
FROM centos:centos7 FROM centos:centos8
MAINTAINER Pandora FMS Team <info@pandorafms.com> MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Add Pandora FMS agent installer # Add Pandora FMS agent installer
ADD unix /tmp/pandora_agent/unix ADD unix /opt/pandora/pandora_agent/unix
RUN export LC_ALL=C
RUN dnf install -y dnf-plugins-core; dnf config-manager --set-enabled PowerTools
# Install dependencies # Install dependencies
RUN yum -y install \ RUN dnf -y install \
epel-release \ epel-release \
unzip \ unzip \
perl \ perl \
python3 \ python3 \
sed \ sed \
"perl(Sys::Syslog)" perl-YAML-Tiny \
"perl(Sys::Syslog)" \
&& dnf clean all
# Install Pandora FMS agent # Install Pandora FMS agent
RUN cd /tmp/pandora_agent/unix \ RUN cd /opt/pandora/pandora_agent/unix \
&& chmod +x pandora_agent_installer \ && chmod +x pandora_agent_installer \
&& ./pandora_agent_installer --install && ./pandora_agent_installer --install
@ -41,8 +48,7 @@ if [ $TIMEZONE != "" ]; then\n \
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \ \tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
fi\n \ fi\n \
/etc/init.d/pandora_agent_daemon start\n \ /etc/init.d/pandora_agent_daemon start\n \
rm -f $0\n \ tail -F /var/log/pandora/pandora_agent.log' \
tail -f /var/log/pandora/pandora_agent.log' \
>> /entrypoint.sh && \ >> /entrypoint.sh && \
chmod +x /entrypoint.sh chmod +x /entrypoint.sh

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.749 # Version 7.0NG.750
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.749-201007 Version: 7.0NG.750-201118
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -22,9 +22,9 @@ fi
# DMG package version # DMG package version
if [ "$#" -ge 2 ]; then if [ "$#" -ge 2 ]; then
VERSION="7.0NG.749" VERSION="$2"
else else
VERSION="7.0NG.749" VERSION="7.0NG.750"
fi fi
# Path for the generated DMG file # Path for the generated DMG file
@ -37,7 +37,7 @@ fi
BUILD_DMG="$BUILD_PATH/build" BUILD_DMG="$BUILD_PATH/build"
BUILD_TMP="$BUILD_PATH/buildtmp" BUILD_TMP="$BUILD_PATH/buildtmp"
FULLNAME="7.0NG.749" FULLNAME="$DMGNAME-$VERSION.dmg"
echo "VERSION-"$VERSION" NAME-"$DMGNAME echo "VERSION-"$VERSION" NAME-"$DMGNAME
pushd . pushd .
cd $LOCALINST cd $LOCALINST

View File

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

View File

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

View File

@ -26,11 +26,13 @@ else
`/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf remote_config $REMOTECFG` `/usr/local/share/pandora_agent/inst_utilities/print_conf.pl /usr/local/share/pandora_agent/pandora_agent.conf remote_config $REMOTECFG`
# Create agent directories and files # Create agent directories and files
mkdir -p /usr/local/share/pandora_agent/collections mkdir -p /usr/local/bin/
mkdir -p /usr/local/share/pandora_agent/commands mkdir -p /usr/local/share/man/man1/
mkdir -p /usr/local/share/pandora_agent/collections/
mkdir -p /usr/local/share/pandora_agent/commands/
mkdir -p /etc/pandora/ mkdir -p /etc/pandora/
mkdir -p /var/spool/pandora/data_out mkdir -p /var/spool/pandora/data_out/
mkdir -p /var/log/pandora mkdir -p /var/log/pandora/
mv pandora_agent.conf /etc/pandora/ mv pandora_agent.conf /etc/pandora/
touch /var/log/pandora/pandora_agent.log touch /var/log/pandora/pandora_agent.log
@ -70,9 +72,9 @@ ln -s /usr/local/share/pandora_agent/collections /etc/pandora/collections
# Copy manuals # Copy manuals
cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1 cp -f man/man1/pandora_agent.1.gz /usr/local/share/man/man1/
chmod 644 /usr/local/share/man/man1/pandora_agent.1.gz chmod 644 /usr/local/share/man/man1/pandora_agent.1.gz
cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1 cp -f man/man1/tentacle_client.1.gz /usr/local/share/man/man1/
chmod 644 /usr/local/share/man/man1/tentacle_client.1.gz chmod 644 /usr/local/share/man/man1/tentacle_client.1.gz
# Create newsyslog entry # Create newsyslog entry

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,8 +54,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.749'; use constant AGENT_VERSION => '7.0NG.750';
use constant AGENT_BUILD => '201007'; use constant AGENT_BUILD => '201118';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.749 %define version 7.0NG.750
%define release 201007 %define release 201118
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.749 %define version 7.0NG.750
%define release 201007 %define release 201118
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.749 # Version 7.0NG.750
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.749(Build 201007)") #define PANDORA_VERSION ("7.0NG.750(Build 201118)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.749(Build 201007))" VALUE "ProductVersion", "(7.0NG.750(Build 201118))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.749-201007 Version: 7.0NG.750-201118
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -668,7 +668,7 @@ function mainAgentsModules()
if ($recursion) { if ($recursion) {
$filter_groups['id_grupo'] = array_merge( $filter_groups['id_grupo'] = array_merge(
$group_id, $group_id,
groups_get_id_recursive($group_id, true) groups_get_children_ids($group_id, true)
); );
} else { } else {
$filter_groups['id_grupo'] = $group_id; $filter_groups['id_grupo'] = $group_id;

View File

@ -86,7 +86,6 @@ function mainModuleGroups()
); );
$info = $tree_group->getArray(); $info = $tree_group->getArray();
$info = groupview_plain_groups($info); $info = groupview_plain_groups($info);
$counter = count($info);
$offset = get_parameter('offset', 0); $offset = get_parameter('offset', 0);
$agent_group_search = get_parameter('agent_group_search', ''); $agent_group_search = get_parameter('agent_group_search', '');
$module_group_search = get_parameter('module_group_search', ''); $module_group_search = get_parameter('module_group_search', '');
@ -134,6 +133,8 @@ function mainModuleGroups()
$ids_group = -1; $ids_group = -1;
} }
$counter = count($info);
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT); $condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT); $condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN); $condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);

View File

@ -92,7 +92,11 @@ function output_xml_report($id)
$group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']); $group = db_get_value('nombre', 'tgrupo', 'id_grupo', $report['id_group']);
echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n"; echo '<group><![CDATA['.io_safe_output($group)."]]></group>\n";
$items = db_get_all_rows_field_filter('treport_content', 'id_report', $report['id_report']); $items = db_get_all_rows_field_filter(
'treport_content',
'id_report',
$report['id_report']
);
foreach ($items as $item) { foreach ($items as $item) {
echo "<item>\n"; echo "<item>\n";
echo '<type>'.io_safe_output($item['type'])."</type>\n"; echo '<type>'.io_safe_output($item['type'])."</type>\n";

View File

@ -37,8 +37,16 @@ function insert_item_report($report_id, $values)
ui_print_result_message( ui_print_result_message(
$result, $result,
sprintf(__("Success add '%s' item in report '%s'."), $values['type'], $name), sprintf(
sprintf(__("Error create '%s' item in report '%s'."), $values['type'], $name) __("Success add '%s' item in report '%s'."),
$values['type'],
$name
),
sprintf(
__("Error create '%s' item in report '%s'."),
$values['type'],
$name
)
); );
} }
} }
@ -55,9 +63,12 @@ function process_upload_xml_report($xml, $group_filter=0)
$posible_name = $values['name']; $posible_name = $values['name'];
$exist = true; $exist = true;
$loops = 30; $loops = 30;
// Loops to exit or tries // Loops to exit or tries.
while ($exist && $loops > 0) { while ($exist && $loops > 0) {
$exist = (bool) db_get_row_filter('treport', ['name' => io_safe_input($posible_name)]); $exist = (bool) db_get_row_filter(
'treport',
['name' => io_safe_input($posible_name)]
);
if ($exist) { if ($exist) {
$loops--; $loops--;
@ -74,7 +85,7 @@ function process_upload_xml_report($xml, $group_filter=0)
); );
break; break;
} else if ($loops != 30) { } else if ($loops != 30) {
ui_print_error_message( ui_print_warning_message(
sprintf( sprintf(
__("Warning create '%s' report, the name exist, the report have a name %s."), __("Warning create '%s' report, the name exist, the report have a name %s."),
$reportElement->name, $reportElement->name,
@ -89,13 +100,22 @@ function process_upload_xml_report($xml, $group_filter=0)
break; break;
} }
$id_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $reportElement->group); if (isset($reportElement->group) === true
if ($id_group === false) { && empty($reportElement->group) === false
ui_print_error_message(__("Error the report haven't group.")); ) {
break; $id_group = db_get_value(
'id_grupo',
'tgrupo',
'nombre',
$reportElement->group
);
if ($id_group === false) {
ui_print_error_message(__("Error the report haven't group."));
break;
}
} }
if (isset($reportElement->description)) { if (isset($reportElement->description) === true) {
$values['description'] = $reportElement->description; $values['description'] = $reportElement->description;
} }
@ -108,9 +128,19 @@ function process_upload_xml_report($xml, $group_filter=0)
); );
if ($id_report) { if ($id_report) {
db_pandora_audit('Report management', 'Create report '.$id_report, false, false); db_pandora_audit(
'Report management',
'Create report '.$id_report,
false,
false
);
} else { } else {
db_pandora_audit('Report management', 'Fail to create report', false, false); db_pandora_audit(
'Report management',
'Fail to create report',
false,
false
);
break; break;
} }
@ -119,45 +149,52 @@ function process_upload_xml_report($xml, $group_filter=0)
$values = []; $values = [];
$values['id_report'] = $id_report; $values['id_report'] = $id_report;
if (isset($item['description'])) { if (isset($item['description']) === true) {
$values['description'] = io_safe_input($item['description']); $values['description'] = io_safe_input($item['description']);
} }
if (isset($item['period'])) { if (isset($item['period']) === true) {
$values['period'] = io_safe_input($item['period']); $values['period'] = io_safe_input($item['period']);
} }
if (isset($item['type'])) { if (isset($item['type']) === true) {
$values['type'] = io_safe_input($item['type']); $values['type'] = io_safe_input($item['type']);
} }
$agents_item = []; $agents_item = [];
if (isset($item['agent'])) { if (isset($item['agent']) === true) {
$agents = agents_get_agents( $agents = agents_get_agents(
['id_grupo' => $group_filter], ['id_grupo' => $group_filter],
[ [
'id_agente', 'id_agente',
'nombre', 'alias',
] ]
); );
$agent_clean = str_replace(['[', ']'], '', $item['agent']); $agent_clean = str_replace(
[
'[',
']',
],
'',
io_safe_output($item['agent'])
);
$regular_expresion = ($agent_clean != $item['agent']); $regular_expresion = ($agent_clean != $item['agent']);
foreach ($agents as $agent) { foreach ($agents as $agent) {
if ($regular_expresion) { if ($regular_expresion) {
if ((bool) preg_match('/'.$agent_clean.'/', io_safe_output($agent['nombre']))) { if ((bool) preg_match('/'.$agent_clean.'/', io_safe_output($agent['alias']))) {
$agents_item[$agent['id_agente']]['name'] = $agent['nombre']; $agents_item[$agent['id_agente']]['name'] = $agent['alias'];
} }
} else { } else {
if ($agent_clean == io_safe_output($agent['nombre'])) { if ($agent_clean == io_safe_output($agent['alias'])) {
$agents_item[$agent['id_agente']]['name'] = $agent['nombre']; $agents_item[$agent['id_agente']]['name'] = $agent['alias'];
} }
} }
} }
} }
if (isset($item['module'])) { if (isset($item['module']) === true) {
$module_clean = str_replace(['[', ']'], '', $item['module']); $module_clean = str_replace(['[', ']'], '', $item['module']);
$regular_expresion = ($module_clean != $item['module']); $regular_expresion = ($module_clean != $item['module']);

View File

@ -31,4 +31,6 @@ ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
ALTER TABLE `treport_template` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1; ALTER TABLE `treport_template` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
ALTER TABLE `treport_template` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1; ALTER TABLE `treport_template` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
UPDATE `tconfig` SET value = '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}' WHERE token = 'post_process_custom_values';
COMMIT; COMMIT;

View File

@ -1405,6 +1405,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', ''); INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', ''); INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', ''); INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tconfig_os` -- Table `tconfig_os`

View File

@ -114,6 +114,13 @@ foreach ($custom_fields as $field) {
} }
} }
// Connection lost alert.
ui_require_css_file('register', 'include/styles/', true);
ui_require_javascript_file('connection_check');
$conn_title = __('Connection with server has been lost');
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
// Get the custom icons. // Get the custom icons.
$docs_logo = ui_get_docs_logo(); $docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo(); $support_logo = ui_get_support_logo();
@ -450,7 +457,12 @@ if ($login_screen == 'logout') {
echo '<div class="content_message_alert">'; echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">'; echo '<div class="text_message_alert">';
echo '<h1>'.__('Logged out').'</h1>'; echo '<h1>'.__('Logged out').'</h1>';
echo '<p>'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'</p>'; if (empty($config['logout_msg']) === true) {
echo '<p>'.__('Your session has ended. Please close your browser window to close this %s session.', get_product_name()).'</p>';
} else {
echo '<p>'.__($config['logout_msg']).'</p>';
}
echo '</div>'; echo '</div>';
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-logout', false); html_print_submit_button('Ok', 'hide-login-logout', false);

View File

@ -148,7 +148,8 @@ if ($initial && users_is_admin()) {
config_wiz_modal( config_wiz_modal(
false, false,
true, true,
(($registration === true) ? 'show_registration_wizard()' : null) (($registration === true) ? 'show_registration_wizard()' : null),
true
); );
} }
@ -159,7 +160,8 @@ if (!$config['disabled_newsletter']) {
false, false,
// Launch only if not being launch from 'initial'. // Launch only if not being launch from 'initial'.
!$initial, !$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null) (($show_newsletter === false) ? 'force_run_newsletter()' : null),
true
); );
} else { } else {
if ($show_newsletter) { if ($show_newsletter) {
@ -167,7 +169,8 @@ if (!$config['disabled_newsletter']) {
newsletter_wiz_modal( newsletter_wiz_modal(
false, false,
// Launch only if not being call from 'registration'. // Launch only if not being call from 'registration'.
!$registration && !$initial !$registration && !$initial,
true
); );
} }
} }

View File

@ -149,7 +149,7 @@ if (is_ajax()) {
ui_require_javascript_file('openlayers.pandora'); ui_require_javascript_file('openlayers.pandora');
$new_agent = (bool) get_parameter('new_agent'); $new_agent = (empty($id_agente)) ? true : false;
if (! isset($id_agente) && ! $new_agent) { if (! isset($id_agente) && ! $new_agent) {
db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent'); db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent');
@ -1222,6 +1222,7 @@ ui_require_jquery_file('bgiframe');
$(document).ready (function() { $(document).ready (function() {
var $id_agent = '<?php echo $id_agente; ?>';
var previous_primary_group_select; var previous_primary_group_select;
$("#grupo").on('focus', function () { $("#grupo").on('focus', function () {
previous_primary_group_select = this.value; previous_primary_group_select = this.value;
@ -1276,12 +1277,14 @@ ui_require_jquery_file('bgiframe');
} }
}); });
paint_qrcode( if (typeof $id_agent !== 'undefined' && $id_agent !== '0') {
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>", paint_qrcode(
"#qr_code_agent_view", "<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
128, "#qr_code_agent_view",
128 128,
); 128
);
}
$("#text-agente").prop('readonly', true); $("#text-agente").prop('readonly', true);
}); });

View File

@ -408,7 +408,7 @@ if ($ag_group > 0) {
$ag_groups = []; $ag_groups = [];
$ag_groups = (array) $ag_group; $ag_groups = (array) $ag_group;
if ($recursion) { if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true); $ag_groups = groups_get_children_ids($ag_group, true);
} }
$user_groups_to_sql = implode(',', $ag_groups); $user_groups_to_sql = implode(',', $ag_groups);
@ -754,7 +754,6 @@ if (check_acl($config['id_user'], 0, 'AW')) {
// Create agent button. // Create agent button.
echo '<div style="text-align: right;">'; echo '<div style="text-align: right;">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1);
html_print_submit_button( html_print_submit_button(
__('Create agent'), __('Create agent'),
'crt-2', 'crt-2',

View File

@ -1340,115 +1340,117 @@ $(document).ready (function () {
var type_name_selected = type_names[type_selected]; var type_name_selected = type_names[type_selected];
var element = document.getElementById("module_type_help"); var element = document.getElementById("module_type_help");
var language = "<?php echo $config['language']; ?>" ; var language = "<?php echo $config['language']; ?>" ;
element.onclick = function (event) { if (typeof element !== 'undefined' && element !== null) {
if(type_name_selected == 'async_data' || element.onclick = function (event) {
type_name_selected == 'async_proc' || if(type_name_selected == 'async_data' ||
type_name_selected == 'async_string' || type_name_selected == 'async_proc' ||
type_name_selected == 'generic_proc'|| type_name_selected == 'async_string' ||
type_name_selected == 'generic_data' || type_name_selected == 'generic_proc'||
type_name_selected == 'generic_data_inc' || type_name_selected == 'generic_data' ||
type_name_selected == 'generic_data_inc_abs'|| type_name_selected == 'generic_data_inc' ||
type_name_selected == 'generic_data_string' || type_name_selected == 'generic_data_inc_abs'||
type_name_selected == 'keep_alive' type_name_selected == 'generic_data_string' ||
){ type_name_selected == 'keep_alive'
if (language == 'es'){ ){
window.open( if (language == 'es'){
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', window.open(
'_blank', 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
'width=800,height=600' '_blank',
); 'width=800,height=600'
} );
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_icmp' ||
type_name_selected == 'remote_icmp_proc'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_snmp_string' ||
type_name_selected == 'remote_snmp_proc' ||
type_name_selected == 'remote_snmp_inc' ||
type_name_selected == 'remote_snmp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_tcp_string' ||
type_name_selected == 'remote_tcp_proc' ||
type_name_selected == 'remote_tcp_inc' ||
type_name_selected == 'remote_tcp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'_blank',
'width=800,height=600'
);
} }
else{ else{
window.open( window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring', 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
'_blank', '_blank',
'width=800,height=600' 'width=800,height=600'
); );
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
type_name_selected == 'web_content_data' ||
type_name_selected == 'web_content_string'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'_blank',
'width=800,height=600'
);
} }
}
if(type_name_selected == 'remote_icmp' ||
type_name_selected == 'remote_icmp_proc'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_snmp_string' ||
type_name_selected == 'remote_snmp_proc' ||
type_name_selected == 'remote_snmp_inc' ||
type_name_selected == 'remote_snmp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_tcp_string' ||
type_name_selected == 'remote_tcp_proc' ||
type_name_selected == 'remote_tcp_inc' ||
type_name_selected == 'remote_tcp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
type_name_selected == 'web_content_data' ||
type_name_selected == 'web_content_string'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'_blank',
'width=800,height=600'
);
}
}
} }
} }

View File

@ -877,7 +877,7 @@ if ($id_downtime > 0) {
$filter_cond = ''; $filter_cond = '';
if ($filter_group > 0) { if ($filter_group > 0) {
if ($recursion) { if ($recursion) {
$rg = groups_get_id_recursive($filter_group, true); $rg = groups_get_children_ids($filter_group, true);
$filter_cond .= ' AND id_grupo IN ('; $filter_cond .= ' AND id_grupo IN (';
$i = 0; $i = 0;

View File

@ -131,7 +131,7 @@ if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[2][0] = __('Template'); $table->data[2][0] = __('Template');
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(false, ['id', 'name']); $templates = alerts_get_alert_templates(false, ['id', 'name']);
} else { } else {
$usr_groups = users_get_groups($config['id_user'], 'LW', true); $usr_groups = users_get_groups($config['id_user'], 'LW', true);

View File

@ -130,6 +130,15 @@ if ($update || $create) {
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', ''); $text_module = get_parameter('text_module', '');
$id_agent_module = (int) get_parameter('module_search_hidden'); $id_agent_module = (int) get_parameter('module_search_hidden');
if ($text_module === '') {
$text_module = io_safe_output(
db_get_value_filter(
'nombre',
'tagente_modulo',
['id_agente_modulo' => $id_agent_module]
)
);
}
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');

View File

@ -168,7 +168,15 @@ if ($id_group) {
} }
} else { } else {
$table->data[2][1] = '<div class="w250px inline">'; $table->data[2][1] = '<div class="w250px inline">';
$table->data[2][1] .= html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true); $table->data[2][1] .= html_print_input(
[
'type' => 'select_groups',
'name' => 'id_parent',
'selected' => $id_parent,
'return' => true,
'returnAllGroup' => true,
]
);
$table->data[2][1] .= '</div>'; $table->data[2][1] .= '</div>';
} }

View File

@ -40,7 +40,7 @@ if (is_ajax()) {
$keys_prefix = (string) get_parameter('keys_prefix', ''); $keys_prefix = (string) get_parameter('keys_prefix', '');
if ($recursion) { if ($recursion) {
$groups = groups_get_id_recursive($id_group, true); $groups = groups_get_children_ids($id_group, true);
} else { } else {
$groups = [$id_group]; $groups = [$id_group];
} }

View File

@ -548,7 +548,24 @@ $table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;'.html_print_select($modules, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true); $table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;'.html_print_select($modules, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true);
$table->data[1][0] = __('Group'); $table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $group, '', __('No change'), -1, true, false, true, '', false, 'width: 150px;'); $table->data[1][1] = '<div class="w290px inline">';
$table->data[1][1] .= html_print_select_groups(
false,
'AR',
false,
'group',
$group,
'',
__('No change'),
-1,
true,
false,
true,
'',
false,
'width: 150px;'
);
$table->data[1][1] .= '</div>';
$table->data[2][0] = __('Interval'); $table->data[2][0] = __('Interval');

View File

@ -258,7 +258,7 @@ if ($id_modulo === COMPONENT_TYPE_WIZARD) {
if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') { if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') {
// Search all parameters received with extra_fields. // Search all parameters received with extra_fields.
foreach ($_REQUEST as $parameter => $thisValue) { foreach ($_REQUEST as $parameter => $thisValue) {
// Extra fields (OIDs Macros or WMI Extra fields) // Extra fields (OIDs Macros or WMI Extra fields).
if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) { if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) {
$tmpParameter = explode('_', $parameter); $tmpParameter = explode('_', $parameter);
$extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter); $extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter);
@ -330,7 +330,7 @@ if ($create_component) {
if ($name && !$name_check) { if ($name && !$name_check) {
$id = network_components_create_network_component( $id = network_components_create_network_component(
strip_tags(io_safe_input($name), '<br>'), $name,
$type, $type,
$id_group, $id_group,
[ [
@ -431,7 +431,7 @@ if ($update_component) {
$id, $id,
[ [
'type' => $type, 'type' => $type,
'name' => strip_tags(io_safe_input($name, '<br>')), 'name' => $name,
'id_group' => $id_group, 'id_group' => $id_group,
'description' => $description, 'description' => $description,
'module_interval' => $module_interval, 'module_interval' => $module_interval,

View File

@ -386,121 +386,124 @@ $next_row++;
console.log(type_name_selected); console.log(type_name_selected);
var element = document.getElementById("module_type_help"); var element = document.getElementById("module_type_help");
var language = "<?php echo $config['language']; ?>" ; var language = "<?php echo $config['language']; ?>" ;
element.onclick = function (event) {
if(type_name_selected == 'async_data' || if (typeof element !== 'undefined' && element !== null) {
type_name_selected == 'async_proc' || element.onclick = function (event) {
type_name_selected == 'async_string' || if(type_name_selected == 'async_data' ||
type_name_selected == 'generic_proc'|| type_name_selected == 'async_proc' ||
type_name_selected == 'generic_data' || type_name_selected == 'async_string' ||
type_name_selected == 'generic_data_inc' || type_name_selected == 'generic_proc'||
type_name_selected == 'generic_data_inc_abs'|| type_name_selected == 'generic_data' ||
type_name_selected == 'generic_data_string' || type_name_selected == 'generic_data_inc' ||
type_name_selected == 'keep_alive' type_name_selected == 'generic_data_inc_abs'||
){ type_name_selected == 'generic_data_string' ||
if (language == 'es'){ type_name_selected == 'keep_alive'
window.open( ){
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos', if (language == 'es'){
'_blank', window.open(
'width=800,height=600' 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Operacion&printable=yes#Tipos_de_m.C3.B3dulos',
); '_blank',
} 'width=800,height=600'
else{ );
window.open( }
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules', else{
'_blank', window.open(
'width=800,height=600' 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Operations&printable=yes#Types_of_Modules',
); '_blank',
} 'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_icmp' ||
type_name_selected == 'remote_icmp_proc'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_snmp_string' ||
type_name_selected == 'remote_snmp_proc' ||
type_name_selected == 'remote_snmp_inc' ||
type_name_selected == 'remote_snmp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_tcp_string' ||
type_name_selected == 'remote_tcp_proc' ||
type_name_selected == 'remote_tcp_inc' ||
type_name_selected == 'remote_tcp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
type_name_selected == 'web_content_data' ||
type_name_selected == 'web_content_string'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'_blank',
'width=800,height=600'
);
}
}
}
} }
if(type_name_selected == 'remote_icmp' ||
type_name_selected == 'remote_icmp_proc'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_ICMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#ICMP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_snmp_string' ||
type_name_selected == 'remote_snmp_proc' ||
type_name_selected == 'remote_snmp_inc' ||
type_name_selected == 'remote_snmp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizando_con_m.C3.B3dulos_de_red_tipo_SNMP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#Monitoring_by_Network_Modules_with_SNMP',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_tcp_string' ||
type_name_selected == 'remote_tcp_proc' ||
type_name_selected == 'remote_tcp_inc' ||
type_name_selected == 'remote_tcp'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_remota&printable=yes#Monitorizaci.C3.B3n_TCP',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Remote_Monitoring&printable=yes#TCP_Monitoring',
'_blank',
'width=800,height=600'
);
}
}
if(type_name_selected == 'web_data' ||
type_name_selected == 'web_proc' ||
type_name_selected == 'web_content_data' ||
type_name_selected == 'web_content_string'
){
if(language == 'es'){
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Monitorizacion_web&printable=yes#Creaci.C3.B3n_de_m.C3.B3dulos_web',
'_blank',
'width=800,height=600'
);
}
else{
window.open(
'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Web_Monitoring&printable=yes#Creating_Web_Modules',
'_blank',
'width=800,height=600'
);
}
}
}
if (type_name_selected.match(/_string$/) == null) { if (type_name_selected.match(/_string$/) == null) {
// Numeric types // Numeric types

View File

@ -278,7 +278,7 @@ if ($ag_group > 0) {
$ag_groups = []; $ag_groups = [];
$ag_groups = (array) $ag_group; $ag_groups = (array) $ag_group;
if ($recursion) { if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true); $ag_groups = groups_get_children_ids($ag_group, true);
} }
} }

View File

@ -223,8 +223,9 @@ switch ($action) {
$server_name = $item['server_name']; $server_name = $item['server_name'];
// Metaconsole db connection. // Metaconsole db connection.
if ($meta && !empty($server_name)) { if ($meta && empty($server_name) === false) {
$connection = metaconsole_get_connection($server_name); $connection = metaconsole_get_connection($server_name);
$server_id = $connection['id'];
if (metaconsole_load_external_db($connection) != NOERR) { if (metaconsole_load_external_db($connection) != NOERR) {
continue; continue;
} }
@ -1383,8 +1384,7 @@ $class = 'databox filters';
html_print_input_hidden('id_agent', $idAgent); html_print_input_hidden('id_agent', $idAgent);
html_print_input_hidden('server_name', $server_name); html_print_input_hidden('server_name', $server_name);
html_print_input_hidden('server_id', $server_name); html_print_input_hidden('server_id', $server_id);
html_print_input_hidden('id_server', '');
$params = []; $params = [];
$params['show_helptip'] = false; $params['show_helptip'] = false;
@ -3744,6 +3744,16 @@ $(document).ready (function () {
$("#combo_group").change ( $("#combo_group").change (
function () { function () {
// Alert report group must show all matches when selecting All group
// ignoring 'recursion' option. #6497.
if ($("#combo_group").val() == 0) {
$('#checkbox-recursion').attr('disabled',true)
$('#checkbox-recursion').attr('checked','checked')
} else {
$('#checkbox-recursion').removeAttr('disabled')
}
$("#id_agents").html(''); $("#id_agents").html('');
$("#id_agents2").html(''); $("#id_agents2").html('');
$("#module").html(''); $("#module").html('');
@ -3772,6 +3782,7 @@ $(document).ready (function () {
); );
} }
); );
$("#combo_group").change();
$("#checkbox-recursion").change ( $("#checkbox-recursion").change (
function () { function () {

View File

@ -1380,11 +1380,12 @@ switch ($action) {
switch ($action) { switch ($action) {
case 'update': case 'update':
$values = []; $values = [];
$server_name = get_parameter('server_id'); $server_id = get_parameter('server_id', 0);
if (is_metaconsole() && $server_name != '') { if (is_metaconsole() === true
$id_meta = metaconsole_get_id_server($server_name); && empty($server_id) === false
) {
$connection = metaconsole_get_connection_by_id( $connection = metaconsole_get_connection_by_id(
$id_meta $server_id
); );
metaconsole_connect($connection); metaconsole_connect($connection);
$values['server_name'] = $connection['server_name']; $values['server_name'] = $connection['server_name'];
@ -1811,13 +1812,10 @@ switch ($action) {
'combo_modulegroup' 'combo_modulegroup'
); );
$values['id_group'] = get_parameter('combo_group'); $values['id_group'] = get_parameter('combo_group');
$values['server_name'] = get_parameter('server_name');
if ($values['server_name'] == '') { $values['server_name'] = get_parameter(
$values['server_name'] = get_parameter( 'combo_server'
'combo_server' );
);
}
if ((($values['type'] == 'custom_graph') if ((($values['type'] == 'custom_graph')
|| ($values['type'] == 'automatic_custom_graph')) || ($values['type'] == 'automatic_custom_graph'))
@ -1867,9 +1865,7 @@ switch ($action) {
); );
// If metaconsole is activated. // If metaconsole is activated.
if ($config['metaconsole'] == 1 if (is_metaconsole() === true) {
&& defined('METACONSOLE')
) {
if (($values['type'] == 'custom_graph') if (($values['type'] == 'custom_graph')
|| ($values['type'] == 'automatic_custom_graph') || ($values['type'] == 'automatic_custom_graph')
) { ) {
@ -2356,6 +2352,8 @@ switch ($action) {
break; break;
} }
hd($values['server_name']);
hd(2);
if ($values['server_name'] == '') { if ($values['server_name'] == '') {
$values['server_name'] = get_parameter( $values['server_name'] = get_parameter(
'combo_server' 'combo_server'

View File

@ -115,7 +115,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group, $return_all_group,
'ag_group', 'ag_group',
$ag_group, $ag_group,
'this.form.submit();', '',
'', '',
0, 0,
false, false,
@ -126,7 +126,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
); );
echo "</li></ul></li><li class='second_elements'><ul><li>"; echo "</li></ul></li><li class='second_elements'><ul><li>";
echo __('Group Recursion'); echo __('Group Recursion');
html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); html_print_checkbox('recursion', 1, $recursion, false, false, '');
echo '</li><li>'; echo '</li><li>';
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>"; echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
echo '</li></ul></li></ul>'; echo '</li></ul></li></ul>';
@ -143,7 +143,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$ag_groups = []; $ag_groups = [];
$ag_groups = (array) $ag_group; $ag_groups = (array) $ag_group;
if ($recursion) { if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true); $ag_groups = groups_get_children_ids($ag_group, true);
} }
} else if ($own_info['is_admin']) { } else if ($own_info['is_admin']) {
$returnAllGroups = 1; $returnAllGroups = 1;

View File

@ -140,7 +140,7 @@ if (isset($_GET['server'])) {
ui_print_error_message(__('There was a problem deleting the server')); ui_print_error_message(__('There was a problem deleting the server'));
} }
} else if (isset($_GET['update'])) { } else if (isset($_GET['update'])) {
$address = trim(get_parameter_post('address'), '&#x20;'); $address = trim(io_safe_output(get_parameter_post('address')), ' ');
$description = trim(get_parameter_post('description'), '&#x20;'); $description = trim(get_parameter_post('description'), '&#x20;');
$id_server = get_parameter_post('server'); $id_server = get_parameter_post('server');
$exec_proxy = get_parameter_post('exec_proxy'); $exec_proxy = get_parameter_post('exec_proxy');

View File

@ -91,8 +91,20 @@ foreach ($servers as $server) {
// Status // Status
$data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true); $data[1] = ui_print_status_image(STATUS_SERVER_OK, '', true);
if (($server['status'] == 0) || (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)) { if ($server['status'] == -1) {
$data[1] = ui_print_status_image(STATUS_SERVER_DOWN, '', true); $data[1] = ui_print_status_image(
STATUS_SERVER_CRASH,
__('Server has crashed.'),
true
);
} else if (($server['status'] == 0)
|| (($date - time_w_fixed_tz($server['keepalive'])) > ($server['server_keepalive']) * 2)
) {
$data[1] = ui_print_status_image(
STATUS_SERVER_DOWN,
__('Server is stopped.'),
true
);
} }
// Type // Type

View File

@ -59,18 +59,10 @@ global $config;
check_login(); check_login();
if (is_ajax()) { if (is_ajax()) {
enterprise_include_once('include/functions_cron.php');
$test_address = get_parameter('test_address', ''); $test_address = get_parameter('test_address', '');
$res = enterprise_hook( $res = send_test_email(
'send_email_attachment', $test_address
[
$test_address,
__('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'),
__('Testing Pandora FMS email'),
null,
]
); );
echo $res; echo $res;
@ -479,7 +471,6 @@ function show_email_test(id) {
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 175,
width: 450, width: 450,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,
@ -497,7 +488,11 @@ function perform_email_test () {
data: "page=godmode/setup/setup_general&test_address="+test_address, data: "page=godmode/setup/setup_general&test_address="+test_address,
dataType: "html", dataType: "html",
success: function(data) { success: function(data) {
$('#email_test_sent_message').show(); if (parseInt(data) === 1) {
$('#email_test_sent_message').show();
} else {
$('#email_test_failure_message').show();
}
}, },
error: function() { error: function() {
$('#email_test_failure_message').show(); $('#email_test_failure_message').show();

View File

@ -44,6 +44,13 @@ if (! check_acl($config['id_user'], 0, 'PM')
return; return;
} }
if (update_manager_verify_license_expired()) {
ui_print_error_message(
__('The license has expired. Please contact Artica at info@artica.es')
);
return;
}
$baseurl = ui_get_full_url(false, false, false, false); $baseurl = ui_get_full_url(false, false, false, false);
$current_package = db_get_value( $current_package = db_get_value(

View File

@ -94,6 +94,13 @@ if ($upload_max_filesize < $PHPupload_max_filesize_min) {
$php_settings_fine++; $php_settings_fine++;
} }
if (update_manager_verify_license_expired()) {
ui_print_error_message(
__('The license has expired. Please contact Artica at info@artica.es')
);
return;
}
// Verify registry. // Verify registry.
if (update_manager_verify_registration() === false) { if (update_manager_verify_registration() === false) {
ui_require_css_file('register'); ui_require_css_file('register');

View File

@ -1313,6 +1313,7 @@ $(document).ready (function () {
var img_delete = '<?php echo $delete_image; ?>'; var img_delete = '<?php echo $delete_image; ?>';
var id_user = '<?php echo io_safe_output($id); ?>'; var id_user = '<?php echo io_safe_output($id); ?>';
var is_metaconsole = '<?php echo $meta; ?>';
var data = []; var data = [];
$('input:image[name="add"]').click(function (e) { $('input:image[name="add"]').click(function (e) {
@ -1357,7 +1358,7 @@ $(document).ready (function () {
$('input:image[name="del"]').click(function (e) { $('input:image[name="del"]').click(function (e) {
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (rows <= 3) { if ((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) {
if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) { if (!confirm('<?php echo __('Deleting last profile will delete this user'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
return; return;
} }
@ -1379,21 +1380,39 @@ $(document).ready (function () {
success: function (data) { success: function (data) {
row.remove(); row.remove();
var rows = $("#table_profiles tr").length; var rows = $("#table_profiles tr").length;
if (rows <= 2) { if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) {
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>"); window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
} }
} }
}); });
}); });
$('#submit-crtbutton').click(function (e) { function checkProfiles(e) {
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; if ($('input[name="is_admin"]:checked').val() == 1) {
if (rows <= 2) { // Admin does not require profiles.
alert('<?php echo __('please add a profile'); ?>'); $('#user_profile_form').submit();
} else { } else {
this.form.submit(); if ($('#table_profiles tbody').children().length == 1) {
confirmDialog({
title: "<?php echo __('Warning'); ?>",
message: "<?php echo __('User will be created without profiles assigned and won\'t be able to log in, are you sure?'); ?>",
onAccept: function() {
$('#user_profile_form').submit();
}
});
} else {
$('#user_profile_form').submit();
}
} }
}
$('#submit-crtbutton').click(function (e) {
checkProfiles(e);
});
$('#submit-uptbutton').click(function (e) {
checkProfiles(e);
}); });
}); });

View File

@ -1170,6 +1170,380 @@ class HostDevices extends Wizard
]; ];
} }
// Input: SNMP enabled.
$form['inputs'][] = [
'label' => __('SNMP enabled'),
'arguments' => [
'name' => 'snmp_enabled',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['snmp_enabled'])) ? $this->task['snmp_enabled'] : 1,
'onclick' => 'extraSNMP();',
],
];
// SNMP CONFIGURATION.
$form['inputs'][] = [
'hidden' => 1,
'block_id' => 'snmp_extra',
'class' => 'indented',
'block_content' => [
[
'label' => __('SNMP version'),
'arguments' => [
'name' => 'snmp_version',
'fields' => [
'1' => 'v. 1',
'2c' => 'v. 2c',
'3' => 'v. 3',
],
'type' => 'select',
'script' => 'SNMPExtraShow(this.value)',
'selected' => $this->task['snmp_version'],
'return' => true,
],
],
],
];
// SNMP Options pack v1.
$form['inputs'][] = [
'hidden' => 1,
'block_id' => 'snmp_options_basic',
'class' => 'indented',
'block_content' => [
[
'label' => __('SNMP communities to try with').ui_print_help_tip(
__(
'You can specify several values, separated by commas, for example: public,mysecret,1234'
),
true
),
'arguments' => [
'name' => 'community',
'type' => 'text',
'value' => $this->task['snmp_community'],
'size' => 25,
'return' => true,
],
],
],
];
// SNMP Options pack v3.
$form['inputs'][] = [
'hidden' => 1,
'block_id' => 'snmp_options_v3',
'class' => 'indented',
'block_content' => [
[
'label' => '<b>'.__('Context').'</b>',
'arguments' => [
'name' => 'snmp_context',
'type' => 'text',
'value' => $this->task['snmp_community'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth user').'</b>',
'arguments' => [
'name' => 'snmp_auth_user',
'type' => 'text',
'value' => $this->task['snmp_auth_user'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth password').'</b>'.ui_print_help_tip(
__(
'The pass length must be eight character minimum.'
),
true
),
'arguments' => [
'name' => 'snmp_auth_pass',
'type' => 'password',
'value' => $this->task['snmp_auth_pass'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Privacy method').'</b>',
'arguments' => [
'name' => 'snmp_privacy_method',
'type' => 'select',
'fields' => [
'DES' => __('DES'),
'AES' => __('AES'),
],
'selected' => $this->task['snmp_privacy_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Privacy pass').'</b>'.ui_print_help_tip(
__(
'The pass length must be eight character minimum.'
),
true
),
'arguments' => [
'name' => 'snmp_privacy_pass',
'type' => 'password',
'value' => $this->task['snmp_privacy_pass'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Auth method').'</b>',
'arguments' => [
'name' => 'snmp_auth_method',
'type' => 'select',
'fields' => [
'MD5' => __('MD5'),
'SHA' => __('SHA'),
],
'selected' => $this->task['snmp_auth_method'],
'size' => 15,
'return' => true,
],
],
[
'label' => '<b>'.__('Security level').'</b>',
'arguments' => [
'name' => 'snmp_security_level',
'type' => 'select',
'fields' => [
'noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'),
'authPriv' => __('Auth and privacy method'),
],
'selected' => $this->task['snmp_security_level'],
'size' => 15,
'return' => true,
],
],
],
];
// Input: Enforce os detection.
$form['inputs'][] = [
'label' => __('OS detection'),
'arguments' => [
'name' => 'os_detect',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['os_detect'])) ? $this->task['os_detect'] : 1,
],
];
// Input: Name resolution.
$form['inputs'][] = [
'label' => __('Name resolution'),
'arguments' => [
'name' => 'resolve_names',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['resolve_names'])) ? $this->task['resolve_names'] : 1,
],
];
// Input: Parent detection.
$form['inputs'][] = [
'label' => __('Parent detection'),
'arguments' => [
'name' => 'parent_detection',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['parent_detection'])) ? $this->task['parent_detection'] : 1,
],
];
// Input: Parent recursion.
$form['inputs'][] = [
'label' => __('Parent recursion'),
'arguments' => [
'name' => 'parent_recursion',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['parent_recursion'])) ? $this->task['parent_recursion'] : 1,
],
];
// Input: VLAN enabled.
$form['inputs'][] = [
'label' => __('VLAN enabled'),
'arguments' => [
'name' => 'vlan_enabled',
'type' => 'switch',
'return' => true,
'value' => (isset($this->task['vlan_enabled'])) ? $this->task['vlan_enabled'] : 1,
],
];
// Input: WMI enabled.
$form['inputs'][] = [
'label' => __('WMI enabled'),
'arguments' => [
'name' => 'wmi_enabled',
'type' => 'switch',
'value' => (isset($this->task['wmi_enabled'])) ? $this->task['wmi_enabled'] : 0,
'return' => true,
'onclick' => 'toggleAuth();',
],
];
// AUTH CONFIGURATION.
$show_auth = false;
if ((isset($this->task['wmi_enabled']) && $this->task['wmi_enabled'] > 0)
|| (isset($this->task['rcmd_enabled']) && $this->task['rcmd_enabled'] > 0)
) {
$show_auth = true;
}
include_once $config['homedir'].'/include/class/CredentialStore.class.php';
$available_keys = CredentialStore::getKeys('CUSTOM');
if (check_acl($config['id_user'], 0, 'PM')) {
$link_to_cs = '<a class="ext_link" href="'.ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox'
).'" >';
$link_to_cs .= __('No credentials available').', ';
$link_to_cs .= strtolower(__('Manage credentials')).'</a>';
} else {
$link_to_cs = __('No credentials available');
}
if (count($available_keys) > 0) {
$form['inputs'][] = [
'block_id' => 'auth_block',
'class' => 'indented',
'hidden' => !$show_auth,
'block_content' => [
[
'label' => __('Credentials to try with'),
'arguments' => [
'type' => 'select',
'name' => 'auth_strings[]',
'fields' => CredentialStore::getKeys('CUSTOM'),
'selected' => explode(
',',
$this->task['auth_strings']
),
'multiple' => true,
'class' => 'select_multiple',
],
],
],
];
} else {
$form['inputs'][] = [
'block_id' => 'auth_block',
'class' => 'indented',
'hidden' => !$show_auth,
'block_content' => [
[
'label' => __('Credentials'),
'extra' => $link_to_cs,
],
],
];
}
ui_require_jquery_file('tag-editor.min');
ui_require_jquery_file('caret.min');
ui_require_css_file('jquery.tag-editor');
$form['js'] = '
$(\'#text-community\').tagEditor({
forceLowercase: false
});
function SNMPExtraShow(target) {
$("#snmp_options_basic").hide();
$("#snmp_options_v3").hide();
if (document.getElementsByName("snmp_enabled")[0].checked) {
$("#snmp_extra").show();
if (target == 3) {
$("#snmp_options_v3").show();
} else {
$("#snmp_options_basic").show();
}
}
}
function extraSNMP() {
if (document.getElementsByName("snmp_enabled")[0].checked) {
SNMPExtraShow($("#snmp_version").val());
$("#snmp_extra").show();
// Enable snmp dependant checks
if (!document.getElementsByName("parent_recursion")[0].checked)
$("input[name=parent_recursion]").click();
if (!document.getElementsByName("parent_detection")[0].checked)
$("input[name=parent_detection]").click();
if (!document.getElementsByName("resolve_names")[0].checked)
$("input[name=resolve_names]").click();
if (!document.getElementsByName("vlan_enabled")[0].checked)
$("input[name=vlan_enabled]").click();
} else {
// Hide unusable sections
$("#snmp_extra").hide();
$("#snmp_options_basic").hide();
$("#snmp_options_v3").hide();
// Disable snmp dependant checks
if (document.getElementsByName("parent_recursion")[0].checked)
$("input[name=parent_recursion]").click();
if (document.getElementsByName("parent_detection")[0].checked)
$("input[name=parent_detection]").click();
if (document.getElementsByName("resolve_names")[0].checked)
$("input[name=resolve_names]").click();
if (document.getElementsByName("vlan_enabled")[0].checked)
$("input[name=vlan_enabled]").click();
}
}
function toggleAuth() {
if (document.getElementsByName("wmi_enabled")[0].checked
|| (typeof document.getElementsByName("rcmd_enabled")[0] != "undefined"
&& document.getElementsByName("rcmd_enabled")[0].checked)
) {
$("#auth_block").show();
} else {
$("#auth_block").hide();
}
}
$(function() {
SNMPExtraShow($("#snmp_version").val());
});
';
if (enterprise_installed()) { if (enterprise_installed()) {
// Feature configuration. // Feature configuration.
$extra = enterprise_hook('hd_showextrainputs', [$this]); $extra = enterprise_hook('hd_showextrainputs', [$this]);
@ -1178,7 +1552,7 @@ class HostDevices extends Wizard
$form['inputs'], $form['inputs'],
$extra['inputs'] $extra['inputs']
); );
$form['js'] = $extra['js']; $form['js'] .= $extra['js'];
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -216,7 +216,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} else if ($search_agents && is_metaconsole()) { } else if ($search_agents && is_metaconsole()) {
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q'); $string = (string) get_parameter('q');
// q is what autocomplete plugin gives // Q is what autocomplete plugin gives.
$id_group = (int) get_parameter('id_group', -1); $id_group = (int) get_parameter('id_group', -1);
$addedItems = html_entity_decode((string) get_parameter('add')); $addedItems = html_entity_decode((string) get_parameter('add'));
$addedItems = json_decode($addedItems); $addedItems = json_decode($addedItems);
@ -236,6 +236,7 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
'alias', 'alias',
'direccion', 'direccion',
'id_tmetaconsole_setup AS id_server', 'id_tmetaconsole_setup AS id_server',
'server_name',
]; ];
$filter = []; $filter = [];
@ -254,36 +255,33 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
case 'enabled': case 'enabled':
$filter['disabled'] = 0; $filter['disabled'] = 0;
break; break;
default:
// Not possible.
break;
} }
if (!empty($id_agent)) { if (empty($id_agent) === false) {
$filter['id_agente'] = $id_agent; $filter['id_agente'] = $id_agent;
} }
if (!empty($string)) { if (empty($string) === false) {
// Get agents for only the alias. // Get agents for only the alias.
$filter_alias = $filter; $filter_alias = $filter;
switch ($config['dbtype']) { $filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
case 'mysql':
$filter_alias[] = '(alias COLLATE utf8_general_ci LIKE "%'.$string.'%")';
break;
case 'postgresql': $agents = db_get_all_rows_filter(
$filter_alias[] = '(alias LIKE \'%'.$string.'%\')'; 'tmetaconsole_agent',
break; $filter_alias,
$fields
);
case 'oracle':
$filter_alias[] = '(UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_alias, $fields);
if ($agents !== false) { if ($agents !== false) {
foreach ($agents as $agent) { foreach ($agents as $agent) {
$data[] = [ $data[] = [
'id' => $agent['id_agente'], 'id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']), 'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']), 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
'ip' => io_safe_output($agent['direccion']), 'ip' => io_safe_output($agent['direccion']),
'id_server' => $agent['id_server'], 'id_server' => $agent['id_server'],
'filter' => 'alias', 'filter' => 'alias',
@ -293,27 +291,20 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
// Get agents for only the name. // Get agents for only the name.
$filter_agents = $filter; $filter_agents = $filter;
switch ($config['dbtype']) { $filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
case 'mysql':
$filter_agents[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
break;
case 'postgresql': $agents = db_get_all_rows_filter(
$filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')'; 'tmetaconsole_agent',
break; $filter_agents,
$fields
);
case 'oracle':
$filter_agents[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_agents, $fields);
if ($agents !== false) { if ($agents !== false) {
foreach ($agents as $agent) { foreach ($agents as $agent) {
$data[] = [ $data[] = [
'id' => $agent['id_agente'], 'id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']), 'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']), 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
'ip' => io_safe_output($agent['direccion']), 'ip' => io_safe_output($agent['direccion']),
'id_server' => $agent['id_server'], 'id_server' => $agent['id_server'],
'filter' => 'agent', 'filter' => 'agent',
@ -321,29 +312,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the address // Get agents for only the address.
$filter_address = $filter; $filter_address = $filter;
switch ($config['dbtype']) { $filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
case 'mysql':
$filter_address[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
break;
case 'postgresql': $agents = db_get_all_rows_filter(
$filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')'; 'tmetaconsole_agent',
break; $filter_address,
$fields
);
case 'oracle':
$filter_address[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_address, $fields);
if ($agents !== false) { if ($agents !== false) {
foreach ($agents as $agent) { foreach ($agents as $agent) {
$data[] = [ $data[] = [
'id' => $agent['id_agente'], 'id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']), 'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']), 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
'ip' => io_safe_output($agent['direccion']), 'ip' => io_safe_output($agent['direccion']),
'id_server' => $agent['id_server'], 'id_server' => $agent['id_server'],
'filter' => 'address', 'filter' => 'address',
@ -351,29 +335,22 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
} }
} }
// Get agents for only the description // Get agents for only the description.
$filter_description = $filter; $filter_description = $filter;
switch ($config['dbtype']) { $filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
case 'mysql':
$filter_description[] = '(alias COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
break;
case 'postgresql': $agents = db_get_all_rows_filter(
$filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')'; 'tmetaconsole_agent',
break; $filter_description,
$fields
);
case 'oracle':
$filter_description[] = '(UPPER(alias) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = db_get_all_rows_filter('tmetaconsole_agent', $filter_description, $fields);
if ($agents !== false) { if ($agents !== false) {
foreach ($agents as $agent) { foreach ($agents as $agent) {
$data[] = [ $data[] = [
'id' => $agent['id_agente'], 'id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']), 'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']), 'alias' => io_safe_output($agent['alias']).' ('.io_safe_output($agent['server_name']).')',
'ip' => io_safe_output($agent['direccion']), 'ip' => io_safe_output($agent['direccion']),
'id_server' => $agent['id_server'], 'id_server' => $agent['id_server'],
'filter' => 'description', 'filter' => 'description',

View File

@ -114,7 +114,9 @@ if ($get_comments) {
sprintf( sprintf(
' HAVING max_id_evento = %d', ' HAVING max_id_evento = %d',
$event['id_evento'] $event['id_evento']
) ),
// True for show comments of validated events.
true
); );
if ($events !== false) { if ($events !== false) {
$event = $events[0]; $event = $events[0];
@ -331,17 +333,52 @@ if ($get_filter_values) {
if ($event_filter === false) { if ($event_filter === false) {
$event_filter = [ $event_filter = [
'status' => EVENT_NO_VALIDATED, 'status' => EVENT_NO_VALIDATED,
'event_view_hr' => $config['event_view_hr'], 'event_view_hr' => $config['event_view_hr'],
'group_rep' => 1, 'group_rep' => 1,
'tag_with' => [], 'tag_with' => [],
'tag_without' => [], 'tag_without' => [],
'history' => false, 'history' => false,
'module_search' => '',
'filter_only_alert' => '-1',
'user_comment' => '',
'id_extra' => '',
'id_user_ack' => '',
'date_from' => '',
'date_to' => '',
'severity' => '',
'event_type' => '',
'group_rep' => 0,
'id_group' => 0,
'id_group_filter' => 0,
'group_name' => 'All',
'text_agent' => '',
'id_agent' => 0,
'id_name' => 'None',
'filter_id' => 0,
]; ];
} else {
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
$a = array_keys(users_get_groups(false));
$event_filter['group_name'] = '';
foreach ($a as $key => $value) {
if ($value == $event_filter['id_group']) {
$event_filter['group_name'] = db_get_value('nombre', 'tgrupo', 'id_grupo', $event_filter['id_group_filter']);
if ($event_filter['group_name'] === false) {
$event_filter['group_name'] = __('All');
}
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
} }
$event_filter['search'] = io_safe_output($event_filter['search']); $event_filter['search'] = io_safe_output($event_filter['search']);
$event_filter['id_name'] = io_safe_output($event_filter['id_name']); $event_filter['id_name'] = io_safe_output($event_filter['id_name']);
$event_filter['text_agent'] = io_safe_output($event_filter['text_agent']);
$event_filter['source'] = io_safe_output($event_filter['source']);
$event_filter['tag_with'] = base64_encode( $event_filter['tag_with'] = base64_encode(
io_safe_output($event_filter['tag_with']) io_safe_output($event_filter['tag_with'])
); );
@ -353,7 +390,7 @@ if ($get_filter_values) {
} }
if ($load_filter_modal) { if ($load_filter_modal) {
$current = get_parameter('current_filter', ''); $current = db_get_value_filter('default_event_filter', 'tusuario', ['id_user' => $config['id_user']]);
$filters = events_get_event_filter_select(); $filters = events_get_event_filter_select();
$user_groups_array = users_get_groups_for_select( $user_groups_array = users_get_groups_for_select(
$config['id_user'], $config['id_user'],
@ -433,10 +470,12 @@ function load_form_filter() {
}, },
function (data) { function (data) {
jQuery.each (data, function (i, val) { jQuery.each (data, function (i, val) {
console.log(val);
if (i == 'id_name') if (i == 'id_name')
$("#hidden-id_name").val(val); $("#hidden-id_name").val(val);
if (i == 'id_group') if (i == 'id_group'){
$("#id_group").val(val); $('#id_group').val(val);
}
if (i == 'event_type') if (i == 'event_type')
$("#event_type").val(val); $("#event_type").val(val);
if (i == 'severity') { if (i == 'severity') {
@ -446,9 +485,9 @@ function load_form_filter() {
if (i == 'status') if (i == 'status')
$("#status").val(val); $("#status").val(val);
if (i == 'search') if (i == 'search')
$("#text-search").val(val); $('#text-search').val(val);
if (i == 'text_agent') if (i == 'text_agent')
$("#text_id_agent").val(val); $('input[name=text_agent]').val(val);
if (i == 'id_agent') if (i == 'id_agent')
$('input:hidden[name=id_agent]').val(val); $('input:hidden[name=id_agent]').val(val);
if (i == 'id_agent_module') if (i == 'id_agent_module')
@ -477,6 +516,15 @@ function load_form_filter() {
$("#text-user_comment").val(val); $("#text-user_comment").val(val);
if (i == 'id_source_event') if (i == 'id_source_event')
$("#text-id_source_event").val(val); $("#text-id_source_event").val(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'date_to')
$("#text-date_to").val(val);
if(i == 'module_search')
$('input[name=module_search]').val(val);
if(i == 'group_name')
$("#select2-id_group_filter-container").text(val);
}); });
reorder_tags_inputs(); reorder_tags_inputs();
// Update the info with the loaded filter // Update the info with the loaded filter
@ -1145,12 +1193,37 @@ if ($change_status) {
$event_ids = get_parameter('event_ids'); $event_ids = get_parameter('event_ids');
$new_status = get_parameter('new_status'); $new_status = get_parameter('new_status');
$return = events_change_status(explode(',', $event_ids), $new_status, $meta, $history); $return = events_change_status(
explode(',', $event_ids),
$new_status,
$meta,
$history
);
if ($return) { if ($return !== false) {
echo 'status_ok'; echo json_encode(
[
'status' => 'status_ok',
'user' => db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
),
]
);
} else { } else {
echo 'status_error'; echo json_encode(
[
'status' => 'status_error',
'user' => db_get_value(
'fullname',
'tusuario',
'id_user',
$config['id_user']
),
]
);
} }
return; return;

View File

@ -272,6 +272,12 @@ if ($install_package) {
"Update version: $version of ".$product_name.' by '.$config['id_user'] "Update version: $version of ".$product_name.' by '.$config['id_user']
); );
// An update have been applied, clean phantomjs cache.
config_update_value(
'clean_phantomjs_cache',
1
);
$return['status'] = 'success'; $return['status'] = 'success';
echo json_encode($return); echo json_encode($return);
return; return;

View File

@ -239,8 +239,7 @@ function process_user_login_remote($login, $pass, $api=false)
// Unknown authentication method // Unknown authentication method
default: default:
$config['auth_error'] = 'User not found in database $config['auth_error'] = 'User not found in database or incorrect password';
or incorrect password';
return false; return false;
break; break;
} }
@ -263,11 +262,6 @@ function process_user_login_remote($login, $pass, $api=false)
if ($config['autocreate_remote_users'] == 1) { if ($config['autocreate_remote_users'] == 1) {
if ($config['ad_save_password']) { if ($config['ad_save_password']) {
$update_credentials = change_local_user_pass_ldap($login, $pass); $update_credentials = change_local_user_pass_ldap($login, $pass);
if ($update_credentials) {
$config['auth_error'] = __('Your permissions have changed. Please, login again.');
return false;
}
} else { } else {
delete_user_pass_ldap($login); delete_user_pass_ldap($login);
} }
@ -288,11 +282,6 @@ function process_user_login_remote($login, $pass, $api=false)
if ($return === 'error_permissions') { if ($return === 'error_permissions') {
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
return false; return false;
} else {
if ($return === 'permissions_changed') {
$config['auth_error'] = __('Your permissions have changed. Please, login again.');
return false;
}
} }
} }
} else if ($config['auth'] === 'ldap') { } else if ($config['auth'] === 'ldap') {
@ -300,11 +289,6 @@ function process_user_login_remote($login, $pass, $api=false)
if ($config['autocreate_remote_users'] == 1) { if ($config['autocreate_remote_users'] == 1) {
if ($config['ldap_save_password']) { if ($config['ldap_save_password']) {
$update_credentials = change_local_user_pass_ldap($login, $pass); $update_credentials = change_local_user_pass_ldap($login, $pass);
if ($update_credentials) {
$config['auth_error'] = __('Your permissions have changed. Please, login again.');
return false;
}
} else { } else {
delete_user_pass_ldap($login); delete_user_pass_ldap($login);
} }
@ -326,11 +310,6 @@ function process_user_login_remote($login, $pass, $api=false)
if ($return === 'error_permissions') { if ($return === 'error_permissions') {
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
return false; return false;
} else {
if ($return === 'permissions_changed') {
$config['auth_error'] = __('Your permissions have changed. Please, login again.');
return false;
}
} }
} }
} }

View File

@ -41,6 +41,17 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_tags.php'; require_once $config['homedir'].'/include/functions_tags.php';
$data_raw = get_parameter('data');
$data_decoded = json_decode(base64_decode($data_raw), true);
if (json_last_error() === JSON_ERROR_NONE) {
$data = urldecode($data_decoded['data']);
$session_id = urldecode($data_decoded['session_id']);
$data_combined = urldecode($data_decoded['data_combined']);
$data_module_list = urldecode($data_decoded['data_module_list']);
$type_graph_pdf = urldecode($data_decoded['type_graph_pdf']);
$viewport_width = urldecode($data_decoded['viewport_width']);
}
/** /**
* Echo to stdout a PhantomJS callback call. * Echo to stdout a PhantomJS callback call.
@ -69,7 +80,7 @@ function echoPhantomCallback()
global $config; global $config;
// Try to initialize session using existing php session id. // Try to initialize session using existing php session id.
$user = new PandoraFMS\User(['phpsessionid' => $_REQUEST['session_id']]); $user = new PandoraFMS\User(['phpsessionid' => $session_id]);
if (check_login(false) === false) { if (check_login(false) === false) {
// Error handler. // Error handler.
?> ?>
@ -97,12 +108,12 @@ if (check_login(false) === false) {
} }
// Access granted. // Access granted.
$params = json_decode($_REQUEST['data'], true); $params = json_decode($data, true);
// Metaconsole connection to the node. // Metaconsole connection to the node.
$server_id = $params['server_id']; $server_id = $params['server_id'];
if (is_metaconsole() && !empty($server_id)) { if (is_metaconsole() === true && empty($server_id) === false) {
$server = metaconsole_get_connection_by_id($server_id); $server = metaconsole_get_connection_by_id($server_id);
// Error connecting. // Error connecting.
if (metaconsole_connect($server) !== NOERR) { if (metaconsole_connect($server) !== NOERR) {
@ -165,12 +176,12 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
$params['only_image'] = false; $params['only_image'] = false;
$params['menu'] = false; $params['menu'] = false;
$params_combined = json_decode($_REQUEST['data_combined'], true); $params_combined = json_decode($data_combined, true);
$module_list = json_decode($_REQUEST['data_module_list'], true); $module_list = json_decode($data_module_list, true);
$type_graph_pdf = $_REQUEST['type_graph_pdf']; $type_graph_pdf = $type_graph_pdf;
if (isset($params['vconsole']) === false || $params['vconsole'] === false) { if (isset($params['vconsole']) === false || $params['vconsole'] === false) {
$params['width'] = (int) $_REQUEST['viewport_width']; $params['width'] = (int) $viewport_width;
if ((isset($params['width']) === false if ((isset($params['width']) === false
|| ($params['width'] <= 0)) || ($params['width'] <= 0))
) { ) {

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Agent Wizard for SNMP and WMI * Agent Wizard for SNMP and WMI
* *
@ -273,7 +274,7 @@ class AgentWizard extends HTML
// Check access. // Check access.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'AR')) { if (!check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access event viewer' 'Trying to access event viewer'
@ -293,6 +294,29 @@ class AgentWizard extends HTML
$this->idAgent = get_parameter('id_agente', ''); $this->idAgent = get_parameter('id_agente', '');
$this->idPolicy = get_parameter('id', ''); $this->idPolicy = get_parameter('id', '');
$this->targetIp = get_parameter('targetIp', ''); $this->targetIp = get_parameter('targetIp', '');
if (!empty($this->idAgent)) {
$array_aux = db_get_all_rows_sql(
sprintf(
'SELECT ip FROM taddress ta
INNER JOIN taddress_agent taa ON taa.id_a = ta.id_a
WHERE taa.id_agent = %d',
$this->idAgent
)
);
if (!empty($array_aux)) {
$this->datalist = [];
foreach ($array_aux as $key => $value) {
$this->datalist[] = $value['ip'];
}
}
if (count($this->datalist) === 1 && $this->targetIp === '') {
$this->targetIp = $this->datalist[0];
}
}
$this->server = (int) get_parameter('server', '1'); $this->server = (int) get_parameter('server', '1');
if ($this->server !== 0) { if ($this->server !== 0) {
$this->serverType = (int) db_get_value( $this->serverType = (int) db_get_value(
@ -563,6 +587,18 @@ class AgentWizard extends HTML
], ],
]; ];
if (!empty($this->datalist)) {
$inputs[] = [
'id' => 'li_address_list',
'arguments' => [
'name' => 'address_list',
'type' => 'datalist',
'value' => $this->datalist,
'return' => true,
],
];
}
$inputs[] = [ $inputs[] = [
'label' => __('Target IP'), 'label' => __('Target IP'),
'id' => 'txt-targetIp', 'id' => 'txt-targetIp',
@ -573,6 +609,7 @@ class AgentWizard extends HTML
'class' => '', 'class' => '',
'value' => $this->targetIp, 'value' => $this->targetIp,
'return' => true, 'return' => true,
'list' => 'address_list',
], ],
]; ];
@ -865,7 +902,6 @@ class AgentWizard extends HTML
], ],
true true
); );
} }
@ -992,10 +1028,51 @@ class AgentWizard extends HTML
} }
if ($this->wizardSection === 'snmp_interfaces_explorer') { if ($this->wizardSection === 'snmp_interfaces_explorer') {
// First, try x64 interfaces. // Check if thereis x64 counters.
$this->interfacesx64 = true; $snmp_tmp = '.1.3.6.1.2.1.31.1.1.1.6';
$check_x64 = get_snmpwalk(
$this->targetIp,
$this->version,
$this->community,
$this->authUserV3,
$this->securityLevelV3,
$this->authMethodV3,
$this->authPassV3,
$this->privacyMethodV3,
$this->privacyPassV3,
0,
$snmp_tmp,
$this->targetPort,
$this->server,
$this->extraArguments
);
if ($check_x64) {
$this->interfacesx64 = true;
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
} else {
$this->interfacesx64 = false;
$oidExplore = '1.3.6.1.2.1.2.2.1.2';
}
// Explore interface names. // Explore interface names.
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1'; $oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
$receivedOid = get_snmpwalk(
$this->targetIp,
$this->version,
$this->community,
$this->authUserV3,
$this->securityLevelV3,
$this->authMethodV3,
$this->authPassV3,
$this->privacyMethodV3,
$this->privacyPassV3,
0,
$oidExplore,
$this->targetPort,
$this->server,
$this->extraArguments
);
} else { } else {
// Get the device PEN. // Get the device PEN.
$oidExplore = '.1.3.6.1.2.1.1.2.0'; $oidExplore = '.1.3.6.1.2.1.1.2.0';
@ -1310,7 +1387,7 @@ class AgentWizard extends HTML
* *
* @return array * @return array
*/ */
public function candidateModuleToCreate(array $data):array public function candidateModuleToCreate(array $data): array
{ {
$modulesActivated = []; $modulesActivated = [];
$generalInterface = false; $generalInterface = false;
@ -1560,8 +1637,8 @@ class AgentWizard extends HTML
if ($this->securityLevelV3 === 'authNoPriv' if ($this->securityLevelV3 === 'authNoPriv'
|| $this->securityLevelV3 === 'authPriv' || $this->securityLevelV3 === 'authPriv'
) { ) {
$values['plugin_parameter'] = $this->authMethodV3; $values['plugin_parameter'] = $this->authMethodV3;
$values['plugin_pass'] = $this->authPassV3; $values['plugin_pass'] = $this->authPassV3;
if ($this->securityLevelV3 === 'authPriv') { if ($this->securityLevelV3 === 'authPriv') {
$values['custom_string_1'] = $this->privacyMethodV3; $values['custom_string_1'] = $this->privacyMethodV3;
$values['custom_string_2'] = $this->privacyPassV3; $values['custom_string_2'] = $this->privacyPassV3;
@ -2261,7 +2338,7 @@ class AgentWizard extends HTML
private function replacementMacrosPlugin( private function replacementMacrosPlugin(
string $text, string $text,
array $macros array $macros
):string { ): string {
// Only agents. // Only agents.
if (empty($this->idPolicy) === true) { if (empty($this->idPolicy) === true) {
// Common. // Common.
@ -2308,7 +2385,7 @@ class AgentWizard extends HTML
?string $value, ?string $value,
?string $unit='', ?string $unit='',
?int $moduleType=0 ?int $moduleType=0
):string { ): string {
if ($moduleType !== MODULE_TYPE_REMOTE_SNMP_INC if ($moduleType !== MODULE_TYPE_REMOTE_SNMP_INC
&& $moduleType !== MODULE_TYPE_GENERIC_DATA_INC && $moduleType !== MODULE_TYPE_GENERIC_DATA_INC
&& $moduleType !== MODULE_TYPE_REMOTE_TCP_INC && $moduleType !== MODULE_TYPE_REMOTE_TCP_INC
@ -2562,7 +2639,7 @@ class AgentWizard extends HTML
// Unpack the extra fields // Unpack the extra fields
// and include with key field in a field set. // and include with key field in a field set.
$macros = json_decode($module['macros'], true); $macros = json_decode($module['macros'], true);
$fieldSet = [ '0' => $module['query_key_field'] ]; $fieldSet = ['0' => $module['query_key_field']];
foreach ($macros as $fieldKey => $fieldMacro) { foreach ($macros as $fieldKey => $fieldMacro) {
if (preg_match('/extra_field_/', $fieldKey) !== 0) { if (preg_match('/extra_field_/', $fieldKey) !== 0) {
$tmpKey = explode('_', $fieldKey); $tmpKey = explode('_', $fieldKey);
@ -3002,7 +3079,7 @@ class AgentWizard extends HTML
$newModule = $module; $newModule = $module;
// Split the values got to obtain the name. // Split the values got to obtain the name.
$tmpFirst = explode('.', $value); $tmpFirst = explode('.', $value);
$tmpSecond = explode(' ', $tmpFirst[1]); $tmpSecond = explode(' ', $tmpFirst[(count($tmpFirst) - 1)]);
// Position 0 is the index, Position 3 is the MIB name. // Position 0 is the index, Position 3 is the MIB name.
$snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3]; $snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3];
// Perform the operations for get the values. // Perform the operations for get the values.
@ -3011,6 +3088,11 @@ class AgentWizard extends HTML
$currentOid = $oid.'.'.$tmpSecond[0]; $currentOid = $oid.'.'.$tmpSecond[0];
$macros['macros'][$oidName] = $currentOid; $macros['macros'][$oidName] = $currentOid;
$currentOidValue = $this->snmpgetValue($currentOid); $currentOidValue = $this->snmpgetValue($currentOid);
// If for any reason the value comes empty, add 1.
if ($currentOidValue == '') {
$currentOidValue = 1;
}
$thisOperation = preg_replace( $thisOperation = preg_replace(
'/'.$oidName.'/', '/'.$oidName.'/',
$currentOidValue, $currentOidValue,
@ -3095,7 +3177,6 @@ class AgentWizard extends HTML
// Add Create Modules form. // Add Create Modules form.
$this->createModulesForm(); $this->createModulesForm();
} }
} }
@ -3204,7 +3285,6 @@ class AgentWizard extends HTML
} }
return false; return false;
} }
@ -3301,7 +3381,7 @@ class AgentWizard extends HTML
* *
* @return array Inputs for common data. * @return array Inputs for common data.
*/ */
private function getCommonDataInputs():array private function getCommonDataInputs(): array
{ {
$inputs[] = [ $inputs[] = [
'id' => 'create-modules-action', 'id' => 'create-modules-action',
@ -4111,13 +4191,13 @@ class AgentWizard extends HTML
} }
/** /**
* This function return the definition of modules for SNMP Interfaces * This function return the definition of modules for SNMP Interfaces
* *
* @param array $data Data. * @param array $data Data.
* *
* @return array Return modules for defect. * @return array Return modules for defect.
*/ */
private function getInterfacesModules(array $data=[]) private function getInterfacesModules(array $data=[])
{ {
$moduleDescription = ''; $moduleDescription = '';
@ -4202,6 +4282,34 @@ class AgentWizard extends HTML
], ],
]; ];
// Get x86 or x64 modules.
if ($this->interfacesx64 === true) {
$definition_temp = $this->getInterfacesModulesx64($data);
} else {
$definition_temp = $this->getInterfacesModulesx86($data);
}
// General monitoring names.
$general_module_names = [
'ifInOctets / ifHCInOctets',
'ifOutOctets / ifHCOutOctets',
'ifInUcastPkts / ifHCInUcastPkts',
'ifOutUcastPkts / ifHCOutUcastPkts',
'ifInNUcastPkts / ifHCInNUcastPkts',
'ifOutNUcastPkts / ifHCOutNUcastPkts',
];
if ($name == '') {
foreach ($definition_temp as $module => $module_def) {
$definition_temp[$module]['module_name'] = array_shift($general_module_names);
}
}
if (empty($definition_temp) === false) {
$definition = array_merge($definition, $definition_temp);
}
// Continue with common x86 and x84 modules.
// IfAdminStatus. // IfAdminStatus.
$moduleName = $name.'ifAdminStatus'; $moduleName = $name.'ifAdminStatus';
$definition['ifAdminStatus'] = [ $definition['ifAdminStatus'] = [
@ -4328,19 +4436,6 @@ class AgentWizard extends HTML
], ],
]; ];
// Get x86 or x64 modules.
if ($this->interfacesx64 === true) {
$definitionx64 = $this->getInterfacesModulesx64($data);
if (empty($definitionx64) === false) {
$definition = array_merge($definition, $definitionx64);
}
} else {
$definitionx86 = $this->getInterfacesModulesx86($data);
if (empty($definitionx86) === false) {
$definition = array_merge($definition, $definitionx86);
}
}
return $definition; return $definition;
} }
@ -4566,7 +4661,7 @@ class AgentWizard extends HTML
// Definition object. // Definition object.
$definition = []; $definition = [];
// ifHCInOctets. // IfHCInOctets.
$moduleName = $name.'ifHCInOctets'; $moduleName = $name.'ifHCInOctets';
$definition['ifHCInOctets'] = [ $definition['ifHCInOctets'] = [
'module_name' => $moduleName, 'module_name' => $moduleName,
@ -4592,7 +4687,7 @@ class AgentWizard extends HTML
], ],
]; ];
// ifHCOutOctets. // IfHCOutOctets.
$moduleName = $name.'ifHCOutOctets'; $moduleName = $name.'ifHCOutOctets';
$definition['ifHCOutOctets'] = [ $definition['ifHCOutOctets'] = [
'module_name' => $moduleName, 'module_name' => $moduleName,
@ -4618,7 +4713,7 @@ class AgentWizard extends HTML
], ],
]; ];
// ifHCInUcastPkts. // IfHCInUcastPkts.
$moduleName = $name.'ifHCInUcastPkts'; $moduleName = $name.'ifHCInUcastPkts';
$definition['ifHCInUcastPkts'] = [ $definition['ifHCInUcastPkts'] = [
'module_name' => $moduleName, 'module_name' => $moduleName,
@ -4644,7 +4739,7 @@ class AgentWizard extends HTML
], ],
]; ];
// ifHCOutUcastPkts. // IfHCOutUcastPkts.
$moduleName = $name.'ifHCOutUcastPkts'; $moduleName = $name.'ifHCOutUcastPkts';
$definition['ifHCOutUcastPkts'] = [ $definition['ifHCOutUcastPkts'] = [
'module_name' => $moduleName, 'module_name' => $moduleName,
@ -4669,7 +4764,7 @@ class AgentWizard extends HTML
'inv_critical' => false, 'inv_critical' => false,
], ],
]; ];
// ifHCInNUcastPkts. // IfHCInNUcastPkts.
$moduleName = $name.'ifHCInNUcastPkts'; $moduleName = $name.'ifHCInNUcastPkts';
$definition['ifHCInNUcastPkts'] = [ $definition['ifHCInNUcastPkts'] = [
'module_name' => $moduleName, 'module_name' => $moduleName,
@ -4733,17 +4828,18 @@ class AgentWizard extends HTML
* @param integer|null $type Module type. * @param integer|null $type Module type.
* *
* @return string * @return string
* @throws Exception Handle of unwanted operations.
*/ */
private function evalOperation( private function evalOperation(
string $operation, string $operation,
string $unit='', string $unit='',
?int $type=0 ?int $type=0
) { ) {
// Avoid non-numeric or arithmetic chars for security reasons. try {
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) { // Avoid non-numeric or arithmetic chars for security reasons.
$output = 'ERROR'; if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
} else { throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
try { } else {
// Get the result of the operation and set it. // Get the result of the operation and set it.
$output = ''; $output = '';
eval('$output = '.$operation.';'); eval('$output = '.$operation.';');
@ -4753,9 +4849,11 @@ class AgentWizard extends HTML
$unit, $unit,
$type $type
); );
} catch (Exception $e) {
$output = 'ERROR';
} }
} catch (Exception $e) {
$this->message['type'][] = 'error';
$this->message['message'][] = $e->getMessage();
$this->showMessage();
} }
return $output; return $output;
@ -4807,7 +4905,7 @@ class AgentWizard extends HTML
try { try {
exec($execution, $output); exec($execution, $output);
} catch (Exception $ex) { } catch (Exception $ex) {
$output = [ '0' => 'ERROR: Failed execution: '.(string) $ex]; $output = ['0' => 'ERROR: Failed execution: '.(string) $ex];
} }
return $output; return $output;
@ -4905,7 +5003,7 @@ class AgentWizard extends HTML
// Meta. // Meta.
var meta = "<?php echo is_metaconsole(); ?>"; var meta = "<?php echo is_metaconsole(); ?>";
var hack_meta = ''; var hack_meta = '';
if(meta){ if (meta) {
hack_meta = '../../'; hack_meta = '../../';
} }
@ -4913,15 +5011,15 @@ class AgentWizard extends HTML
showV3Form(); showV3Form();
// Filter search interfaces snmp. // Filter search interfaces snmp.
$('#text-filter-search').keyup(function () { $('#text-filter-search').keyup(function() {
var string = $('#text-filter-search').val(); var string = $('#text-filter-search').val();
var regex = new RegExp(string); var regex = new RegExp(string);
var interfaces = $('.interfaces_search'); var interfaces = $('.interfaces_search');
interfaces.each(function(){ interfaces.each(function() {
if(string == ''){ if (string == '') {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
} else { } else {
if(this.id.match(regex)) { if (this.id.match(regex)) {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
} else { } else {
$(this).addClass('hidden'); $(this).addClass('hidden');
@ -4931,12 +5029,12 @@ class AgentWizard extends HTML
}); });
// Loading. // Loading.
$('#submit-sub-protocol').click(function () { $('#submit-sub-protocol').click(function() {
$('.wizard-result').remove(); $('.wizard-result').remove();
$('#form-create-modules').remove(); $('#form-create-modules').remove();
$('.textodialogo').remove(); $('.textodialogo').remove();
$('.loading-wizard') $('.loading-wizard')
.html('<center><span style="font-size:25px;">Loading...</span><img style="width:25px;heigth:25px;" src="'+hack_meta+'images/spinner.gif"></center>'); .html('<center><span style="font-size:25px;">Loading...</span><img style="width:25px;heigth:25px;" src="' + hack_meta + 'images/spinner.gif"></center>');
}); });
}); });
@ -4954,17 +5052,17 @@ class AgentWizard extends HTML
function showSecurityLevelForm() { function showSecurityLevelForm() {
var selector = $('#securityLevelV3').val(); var selector = $('#securityLevelV3').val();
if(selector === 'authNoPriv' || selector === 'authPriv'){ if (selector === 'authNoPriv' || selector === 'authPriv') {
$('#txt-authMethodV3').removeClass('invisible'); $('#txt-authMethodV3').removeClass('invisible');
$('#txt-authPassV3').removeClass('invisible'); $('#txt-authPassV3').removeClass('invisible');
if(selector === 'authPriv'){ if (selector === 'authPriv') {
$('#txt-privacyMethodV3').removeClass('invisible'); $('#txt-privacyMethodV3').removeClass('invisible');
$('#txt-privacyPassV3').removeClass('invisible'); $('#txt-privacyPassV3').removeClass('invisible');
} else { } else {
$('#txt-privacyMethodV3').addClass('invisible'); $('#txt-privacyMethodV3').addClass('invisible');
$('#txt-privacyPassV3').addClass('invisible'); $('#txt-privacyPassV3').addClass('invisible');
} }
} else { } else {
$('#txt-authMethodV3').addClass('invisible'); $('#txt-authMethodV3').addClass('invisible');
$('#txt-authPassV3').addClass('invisible'); $('#txt-authPassV3').addClass('invisible');
$('#txt-privacyMethodV3').addClass('invisible'); $('#txt-privacyMethodV3').addClass('invisible');
@ -4978,45 +5076,42 @@ class AgentWizard extends HTML
var text = ""; var text = "";
var failed = 0; var failed = 0;
try { try {
data = JSON.parse(data); data = JSON.parse(data);
text = data["result"]; text = data["result"];
} catch (err) { } catch (err) {
title = "<?php echo __('Failed'); ?>"; title = "<?php echo __('Failed'); ?>";
text = err.message; text = err.message;
failed = 1; failed = 1;
} }
if (!failed && data["error"] != undefined) { if (!failed && data["error"] != undefined) {
title = "<?php echo __('Failed'); ?>"; title = "<?php echo __('Failed'); ?>";
text = data["error"]; text = data["error"];
failed = 1; failed = 1;
} }
if (data["report"] != undefined) { if (data["report"] != undefined) {
data["report"].forEach(function(item) { data["report"].forEach(function(item) {
text += "<br>" + item; text += "<br>" + item;
}); });
} }
$("#msg").empty(); $("#msg").empty();
$("#msg").html(text); $("#msg").html(text);
$("#msg").dialog({ $("#msg").dialog({
width: 450, width: 450,
position: { position: {
my: "center", my: "center",
at: "center", at: "center",
of: window, of: window,
collision: "fit" collision: "fit"
}, },
title: title, title: title,
buttons: [ buttons: [{
{ class: "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: "OK", text: "OK",
click: function(e) { click: function(e) {
$("#msg").close(); $("#msg").close();
} }
} }]
]
}); });
} }
@ -5034,41 +5129,39 @@ class AgentWizard extends HTML
var imageInfoModules = $("#image-info-modules-" + blockNumber); var imageInfoModules = $("#image-info-modules-" + blockNumber);
var totalCount = 0; var totalCount = 0;
var markedCount = 0; var markedCount = 0;
var hidden_input = document.getElementById("hidden-module-active-"+switchName[2]+"_"+switchName[3]);
var id_input = hidden_input.id.split("_");
if (type == 'block') { if (type == 'block') {
selectedBlock selectedBlock
.parent() .parent()
.removeClass("alpha50"); .removeClass("alpha50");
if (selectedBlock.prop("checked")) { if (selectedBlock.prop("checked")) {
// Set to active the values of fields. // Set to active the values of fields.
$("[id*='"+id_input[0]+"']") $("[id*=hidden-module-active-"+blockNumber+"]")
.each(function(){ .each(function(){
$(this).val('1'); $(this).val('1');
}); });
// Set checked. // Set checked.
$("[id*=checkbox-sel_module_" + blockNumber + "]") $("[id*=checkbox-sel_module_" + blockNumber + "]")
.each(function(){ .each(function() {
$(this).prop("checked", true); $(this).prop("checked", true);
}); });
imageInfoModules.removeClass('hidden'); imageInfoModules.removeClass('hidden');
} else { } else {
// Set to inactive the values of fields. // Set to inactive the values of fields.
$("[id*='"+id_input[0]+"']") $("[id*=hidden-module-active-"+blockNumber+"]")
.each(function(){ .each(function(){
$(this).val('0'); $(this).val('0');
}); });
// Set unchecked. // Set unchecked.
$("[id*=checkbox-sel_module_" + blockNumber + "]") $("[id*=checkbox-sel_module_" + blockNumber + "]")
.each(function(){ .each(function() {
$(this).prop("checked", false); $(this).prop("checked", false);
}); });
imageInfoModules.addClass('hidden'); imageInfoModules.addClass('hidden');
} }
} else if (type == 'module') { } else if (type == 'module') {
// Getting the element. // Getting the element.
var thisModuleHidden = document.getElementById("hidden-module-active-"+switchName[2]+"_"+moduleNumber); var thisModuleHidden = document.getElementById("hidden-module-active-" + switchName[2] + "_" + moduleNumber);
var thisModule = $("#checkbox-sel_module_"+blockNumber+"_"+moduleNumber); var thisModule = $("#checkbox-sel_module_" + blockNumber + "_" + moduleNumber);
// Setting the individual field // Setting the individual field
if (thisModule.prop('checked')) { if (thisModule.prop('checked')) {
thisModuleHidden.value = '1'; thisModuleHidden.value = '1';
@ -5078,12 +5171,12 @@ class AgentWizard extends HTML
// Get the list of selected modules. // Get the list of selected modules.
$("[id*=checkbox-sel_module_" + blockNumber + "]") $("[id*=checkbox-sel_module_" + blockNumber + "]")
.each(function() { .each(function() {
if ($(this).prop("checked")) { if ($(this).prop("checked")) {
markedCount++; markedCount++;
} }
totalCount++; totalCount++;
}); });
if (totalCount == markedCount) { if (totalCount == markedCount) {
selectedBlock.prop("checked", true); selectedBlock.prop("checked", true);
@ -5112,7 +5205,7 @@ class AgentWizard extends HTML
*/ */
function switchBlockControlInterfaces(e) { function switchBlockControlInterfaces(e) {
var string = $('#text-filter-search').val(); var string = $('#text-filter-search').val();
if(string == ''){ if (string == '') {
if (e.checked) { if (e.checked) {
$(".interfaz_select").prop("checked", true); $(".interfaz_select").prop("checked", true);
} else { } else {
@ -5121,15 +5214,15 @@ class AgentWizard extends HTML
} else { } else {
var regex = new RegExp(string); var regex = new RegExp(string);
var interfaces = $('.interfaces_search'); var interfaces = $('.interfaces_search');
interfaces.each(function(){ interfaces.each(function() {
if(this.id.match(regex)) { if (this.id.match(regex)) {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
if (e.checked) { if (e.checked) {
$("input[name='interfaz_select_"+this.id+"']") $("input[name='interfaz_select_" + this.id + "']")
.prop("checked", true); .prop("checked", true);
} else { } else {
$("input[name='interfaz_select_"+this.id+"']") $("input[name='interfaz_select_" + this.id + "']")
.prop("checked", false); .prop("checked", false);
} }
} }
}); });
@ -5137,13 +5230,13 @@ class AgentWizard extends HTML
} }
/** /**
* Show the modal with modules for create. * Show the modal with modules for create.
*/ */
function processListModules() { function processListModules() {
confirmDialog({ confirmDialog({
title: "<?php echo __('Modules about to be created'); ?>", title: "<?php echo __('Modules about to be created'); ?>",
message: function() { message: function() {
var id = "div-"+uniqId(); var id = "div-" + uniqId();
var loading = "<?php echo __('Loading'); ?>" + "..."; var loading = "<?php echo __('Loading'); ?>" + "...";
$.ajax({ $.ajax({
method: "post", method: "post",
@ -5159,22 +5252,22 @@ class AgentWizard extends HTML
}, },
datatype: "html", datatype: "html",
success: function(data) { success: function(data) {
$('#'+id).empty().append(data); $('#' + id).empty().append(data);
}, },
error: function(e) { error: function(e) {
showMsg(e); showMsg(e);
} }
}); });
return "<div id ='"+id+"'>"+loading+"</div>"; return "<div id ='" + id + "'>" + loading + "</div>";
}, },
ok: "<?php echo __('OK'); ?>", ok: "<?php echo __('OK'); ?>",
cancel: "<?php echo __('Cancel'); ?>", cancel: "<?php echo __('Cancel'); ?>",
onAccept: function() { onAccept: function() {
$('#reviewed-modules').submit(); $('#reviewed-modules').submit();
}, },
size:750, size: 750,
maxHeight:500 maxHeight: 500
}); });
} }

View File

@ -107,13 +107,13 @@ class ConsoleSupervisor
$this->verbose = $verbose; $this->verbose = $verbose;
if ($source === false) { if ($source === false) {
$this->enabled = false; $this->notificationsEnabled = false;
$this->sourceId = null; $this->sourceId = null;
$this->targetGroups = null; $this->targetGroups = null;
$this->targetUsers = null; $this->targetUsers = null;
} else { } else {
$this->enabled = (bool) $source['enabled']; $this->notificationsEnabled = (bool) $source['enabled'];
$this->sourceId = $source['id']; $this->sourceId = $source['id'];
// Assign targets. // Assign targets.
@ -251,8 +251,10 @@ class ConsoleSupervisor
{ {
global $config; global $config;
if ($this->enabled === false) { $this->maintenanceOperations();
// Feature not enabled.
if ($this->notificationsEnabled === false) {
// Notifications not enabled.
return; return;
} }
@ -490,6 +492,21 @@ class ConsoleSupervisor
} }
/**
* Executes console maintenance operations. Executed ALWAYS through CRON.
*
* @return void
*/
public function maintenanceOperations()
{
/*
* Process cache clean if needed.
*/
$this->checkCleanPhantomCache();
}
/** /**
* Update targets for given notification using object targets. * Update targets for given notification using object targets.
* *
@ -2105,6 +2122,14 @@ class ConsoleSupervisor
$fontpath = io_safe_output($config['fontpath']); $fontpath = io_safe_output($config['fontpath']);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// Windows.
$fontpath = $config['homedir'].'\include\fonts\\'.$fontpath;
} else {
$home = str_replace('\\', '/', $config['homedir']);
$fontpath = $home.'/include/fonts/'.$fontpath;
}
if (($fontpath == '') if (($fontpath == '')
|| (file_exists($fontpath) === false) || (file_exists($fontpath) === false)
) { ) {
@ -2589,4 +2614,30 @@ class ConsoleSupervisor
} }
/**
* Clean Phantom cache if needed.
*
* @return void
*/
public function checkCleanPhantomCache()
{
global $config;
if ((int) $config['clean_phantomjs_cache'] !== 1) {
return;
}
$cache_dir = $config['homedir'].'/attachment/cache';
if (is_dir($cache_dir) === true) {
rrmdir($cache_dir);
}
// Clean process has ended.
config_update_value(
'clean_phantomjs_cache',
0
);
}
} }

View File

@ -248,7 +248,7 @@ class CredentialStore extends Wizard
); );
} else { } else {
$groups = [ $filter['filter_id_group'] ]; $groups = [ $filter['filter_id_group'] ];
$childrens = groups_get_childrens($id_group, null, true); $childrens = groups_get_children($id_group, null, true);
if (!empty($childrens)) { if (!empty($childrens)) {
foreach ($childrens as $child) { foreach ($childrens as $child) {
$groups[] = (int) $child['id_grupo']; $groups[] = (int) $child['id_grupo'];

View File

@ -547,6 +547,7 @@ class HTML
} else { } else {
if ($input['arguments']['type'] != 'hidden' if ($input['arguments']['type'] != 'hidden'
&& $input['arguments']['type'] != 'hidden_extended' && $input['arguments']['type'] != 'hidden_extended'
&& $input['arguments']['type'] != 'datalist'
) { ) {
if (!$direct) { if (!$direct) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['id'].'" class="'.$class.'">';

View File

@ -810,7 +810,7 @@ class NetworkMap
$filter['id_grupo'] = $this->idGroup; $filter['id_grupo'] = $this->idGroup;
} else { } else {
// Show current group and children. // Show current group and children.
$childrens = groups_get_childrens($this->idGroup, null, true); $childrens = groups_get_children($this->idGroup, null, true);
if (!empty($childrens)) { if (!empty($childrens)) {
$childrens = array_keys($childrens); $childrens = array_keys($childrens);

View File

@ -264,6 +264,7 @@ class TreeService extends Tree
ts.id_agent_module, ts.id_agent_module,
ts.name, ts.name,
ts.name as `alias`, ts.name as `alias`,
ts.description as `description`,
ts.id as `rootID`, ts.id as `rootID`,
"services" as `rootType`, "services" as `rootType`,
"services" as `type`, "services" as `type`,
@ -311,6 +312,7 @@ class TreeService extends Tree
]; ];
$services[$service['id']]['name'] = $service['name']; $services[$service['id']]['name'] = $service['name'];
$services[$service['id']]['id'] = $service['id']; $services[$service['id']]['id'] = $service['id'];
$services[$service['id']]['description'] = $service['description'];
$services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id']; $services[$service['id']]['serviceDetail'] = 'index.php?sec=network&sec2=enterprise/operation/services/services&tab=service_map&id_service='.(int) $service['id'];
} }
@ -512,6 +514,8 @@ class TreeService extends Tree
$tmp['id'] = (int) $item->service()->id(); $tmp['id'] = (int) $item->service()->id();
$tmp['name'] = $item->service()->name(); $tmp['name'] = $item->service()->name();
$tmp['alias'] = $item->service()->name(); $tmp['alias'] = $item->service()->name();
$tmp['description'] = $item->service()->description();
$tmp['elementDescription'] = $item->description();
if ($this->connectedToNode === false if ($this->connectedToNode === false
&& is_metaconsole() === true && is_metaconsole() === true
@ -643,6 +647,8 @@ class TreeService extends Tree
ts.id_agent_module, ts.id_agent_module,
ts.name, ts.name,
ts.name as `alias`, ts.name as `alias`,
ts.description as `description`,
tse.description as `elementDescription`,
tse.id_service as `rootID`, tse.id_service as `rootID`,
"services" as `rootType`, "services" as `rootType`,
"services" as `type`, "services" as `type`,

View File

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

View File

@ -309,7 +309,7 @@ define('STATUS_ALERT_DISABLED', 'alert_disabled.png');
// For servers. // For servers.
define('STATUS_SERVER_OK', 'server_ok.png'); define('STATUS_SERVER_OK', 'server_ok.png');
define('STATUS_SERVER_DOWN', 'server_down.png'); define('STATUS_SERVER_DOWN', 'server_down.png');
define('STATUS_SERVER_CRASH', 'server_crash.png');
// Status images (ball). // Status images (ball).
@ -335,6 +335,7 @@ define('STATUS_ALERT_DISABLED_BALL', 'alert_disabled_ball.png');
// For servers. // For servers.
define('STATUS_SERVER_OK_BALL', 'server_ok_ball.png'); define('STATUS_SERVER_OK_BALL', 'server_ok_ball.png');
define('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png'); define('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png');
define('STATUS_SERVER_CRASH_BALL', 'server_crash_ball.png');

View File

@ -1342,6 +1342,73 @@ function get_priority_name($priority)
} }
/**
* Translates status into string.
*
* @param integer $status Agent status.
*
* @return string Translation.
*/
function get_agent_status_string($status)
{
switch ($status) {
case AGENT_STATUS_CRITICAL:
return __('CRITICAL');
case AGENT_STATUS_WARNING:
return __('WARNING');
case AGENT_STATUS_ALERT_FIRED:
return __('ALERT FIRED');
case AGENT_STATUS_NOT_INIT:
return __('NO DATA');
case AGENT_STATUS_NORMAL:
return __('NORMAL');
case AGENT_STATUS_UNKNOWN:
default:
return __('UNKNOWN');
}
}
/**
* Translates status into string.
*
* @param integer $status Module status.
*
* @return string Translation.
*/
function get_module_status_string($status)
{
switch ($status) {
case AGENT_MODULE_STATUS_CRITICAL_BAD:
return __('CRITICAL');
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
return __('ALERT FIRED');
case AGENT_MODULE_STATUS_WARNING:
return __('WARNING');
case AGENT_MODULE_STATUS_UNKNOWN:
return __('UNKNOWN');
case AGENT_MODULE_STATUS_NO_DATA:
case AGENT_MODULE_STATUS_NOT_INIT:
return __('NO DATA');
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_NORMAL:
default:
return __('NORMAL');
}
}
/** /**
* Get priority class (CSS class) from priority value. * Get priority class (CSS class) from priority value.
* *
@ -3753,7 +3820,16 @@ function series_type_graph_array($data, $show_elements_graph)
$name_legend .= __('Unit ').' '; $name_legend .= __('Unit ').' ';
$name_legend .= $show_elements_graph['unit'].': '; $name_legend .= $show_elements_graph['unit'].': ';
} else { } else {
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; if (isset($show_elements_graph['from_interface']) === true
&& (bool) $show_elements_graph['from_interface'] === true
) {
$label_interfaces = array_flip($show_elements_graph['modules_series']);
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']][$label_interfaces[$value['agent_module_id']]].': ';
} else if (is_array($show_elements_graph['labels'][$value['agent_module_id']]) === true) {
$name_legend = 'Avg: ';
} else {
$name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': ';
}
} }
} else { } else {
if (strpos($key, 'baseline') !== false) { if (strpos($key, 'baseline') !== false) {
@ -3973,8 +4049,22 @@ function series_type_graph_array($data, $show_elements_graph)
} }
function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false, $module_list=false) /**
{ * Draw chart pdf.
*
* @param string $type_graph_pdf Type graph.
* @param array $params Params.
* @param boolean $params_combined Params only charts combined.
* @param boolean $module_list Array modules.
*
* @return string Img or base64.
*/
function generator_chart_to_pdf(
$type_graph_pdf,
$params,
$params_combined=false,
$module_list=false
) {
global $config; global $config;
if (is_metaconsole()) { if (is_metaconsole()) {
@ -4016,8 +4106,18 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
} }
$session_id = session_id(); $session_id = session_id();
$cache_dir = $config['homedir'].'/attachment/cache';
$cmd = '"'.io_safe_output($config['phantomjs_bin']).DIRECTORY_SEPARATOR.'phantomjs" --ssl-protocol=any --ignore-ssl-errors=true "'.$file_js.'" '.' "'.$url.'"'.' "'.$type_graph_pdf.'"'.' "'.$params_encode_json.'"'.' "'.$params_combined.'"'.' "'.$module_list.'"'.' "'.$img_path.'"'.' "'.$width_img.'"'.' "'.$height_img.'"'.' "'.$session_id.'"'.' "'.$params['return_img_base_64'].'"'; $cmd = '"'.io_safe_output($config['phantomjs_bin']);
$cmd .= DIRECTORY_SEPARATOR.'phantomjs" ';
$cmd .= ' --disk-cache=true --disk-cache-path="'.$cache_dir.'"';
$cmd .= ' --max-disk-cache-size=10000 ';
$cmd .= ' --ssl-protocol=any --ignore-ssl-errors=true ';
$cmd .= '"'.$file_js.'" "'.$url.'" "'.$type_graph_pdf.'"';
$cmd .= ' "'.$params_encode_json.'" "'.$params_combined.'"';
$cmd .= ' "'.$module_list.'" "'.$img_path.'"';
$cmd .= ' "'.$width_img.'" "'.$height_img.'"';
$cmd .= ' "'.$session_id.'" "'.$params['return_img_base_64'].'"';
$result = null; $result = null;
$retcode = null; $retcode = null;
@ -4029,7 +4129,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
// To be used in alerts. // To be used in alerts.
return $img_content; return $img_content;
} else { } else {
// to be used in PDF files. // To be used in PDF files.
$config['temp_images'][] = $img_path; $config['temp_images'][] = $img_path;
return '<img src="'.$img_url.'" />'; return '<img src="'.$img_url.'" />';
} }
@ -5740,3 +5840,60 @@ function get_data_multiplier($unit)
return $multiplier; return $multiplier;
} }
/**
* Send test email to check email setups.
*
* @param string $to Target email account.
*
* @return integer Status of the email send task.
*/
function send_test_email(
string $to
) {
global $config;
$result = false;
try {
$transport = new Swift_SmtpTransport(
$config['email_smtpServer'],
$config['email_smtpPort']
);
$transport->setUsername($config['email_username']);
$transport->setPassword($config['email_password']);
if ($config['email_encryption']) {
$transport->setEncryption($config['email_encryption']);
}
$mailer = new Swift_Mailer($transport);
$message = new Swift_Message(io_safe_output(__('Testing Pandora FMS email')));
$message->setFrom(
[
$config['email_from_dir'] => io_safe_output(
$config['email_from_name']
),
]
);
$to = trim($to);
$message->setTo([$to => $to]);
$message->setBody(
__('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'),
'text/html'
);
ini_restore('sendmail_from');
$result = $mailer->send($message);
} catch (Exception $e) {
error_log($e->getMessage());
db_pandora_audit('Cron jobs mail', $e->getMessage());
}
return $result;
}

View File

@ -19,17 +19,18 @@
require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';/** require_once $config['homedir'].'/include/functions_users.php';
* Return the agent if exists in the DB.
*
* @param integer $id_agent The agent id.
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
* @param boolean $force_meta
*
* @return boolean The result to check if the agent is in the DB.
*/
/**
* Return the agent if exists in the DB.
*
* @param integer $id_agent The agent id.
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
* @param boolean $force_meta
*
* @return boolean The result to check if the agent is in the DB.
*/
function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false) function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false)
{ {
$agent = db_get_row_filter( $agent = db_get_row_filter(
@ -335,6 +336,11 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
// Filter by agents id. // Filter by agents id.
$id_agents_list = implode(',', $id_agent); $id_agents_list = implode(',', $id_agent);
if ($id_agents_list === '') {
$id_agents_list = '0';
}
$subQuery .= ' AND id_agente in ('.$id_agents_list.')'; $subQuery .= ' AND id_agente in ('.$id_agents_list.')';
} else if ($id_agent === false || empty($id_agent)) { } else if ($id_agent === false || empty($id_agent)) {
if ($allModules) { if ($allModules) {
@ -1108,11 +1114,14 @@ function agents_get_group_agents(
foreach ($id_group as $parent) { foreach ($id_group as $parent) {
$id_group = array_merge( $id_group = array_merge(
$id_group, $id_group,
groups_get_id_recursive($parent, false) groups_get_children_ids($parent, $noACL)
); );
} }
} else { } else {
$id_group = groups_get_id_recursive($id_group, false); $id_group = array_merge(
[$id_group],
groups_get_children_ids($id_group, $noACL)
);
} }
// Check available groups for target user only if asking for 'All' group. // Check available groups for target user only if asking for 'All' group.

View File

@ -2830,3 +2830,74 @@ function alerts_ui_update_or_create_actions($update=true)
$update ? __('Could not be updated') : __('Could not be created') $update ? __('Could not be updated') : __('Could not be created')
); );
} }
/**
* Retrieve all agent_modules with configured alerts filtered by group.
*
* @param integer|null $id_grupo Filter by group.
* @param boolean $recursion Filter by group recursive.
*
* @return array With agent module ids.
*/
function alerts_get_agent_modules(
?int $id_grupo,
bool $recursion=false
) : array {
if ($id_grupo === null) {
$agent_modules = db_get_all_rows_sql(
'SELECT distinct(atm.id_agent_module)
FROM talert_template_modules atm
INNER JOIN tagente_modulo am
ON am.id_agente_modulo = atm.id_agent_module
WHERE atm.disabled = 0'
);
} else if ($recursion !== true) {
$sql = sprintf(
'SELECT distinct(atm.id_agent_module)
FROM talert_template_modules atm
INNER JOIN tagente_modulo am
ON am.id_agente_modulo = atm.id_agent_module
INNER JOIN tagente ta
ON am.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON tasg.id_agent = ta.id_agente
WHERE atm.disabled = 0
AND (tasg.id_group = %d
OR ta.id_grupo = %d)
',
$id_grupo,
$id_grupo
);
$agent_modules = db_get_all_rows_sql($sql);
} else {
$groups = groups_get_children_ids($id_grupo, true);
if (empty($groups) === false) {
$sql = sprintf(
'SELECT distinct(atm.id_agent_module)
FROM talert_template_modules atm
INNER JOIN tagente_modulo am
ON am.id_agente_modulo = atm.id_agent_module
INNER JOIN tagente ta
ON am.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON tasg.id_agent = ta.id_agente
WHERE atm.disabled = 0
AND (tasg.id_group IN (%s)
OR ta.id_grupo IN (%s))
',
implode(',', $groups),
implode(',', $groups)
);
}
$agent_modules = db_get_all_rows_sql($sql);
}
if ($agent_modules === false) {
return [];
}
return $agent_modules;
}

View File

@ -1973,7 +1973,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
$ag_groups = $other['data'][1]; $ag_groups = $other['data'][1];
// Recursion. // Recursion.
if ($other['data'][6] === '1') { if ($other['data'][6] === '1') {
$ag_groups = groups_get_id_recursive($ag_groups, true); $ag_groups = groups_get_children_ids($ag_groups, true);
} }
$ag_groups = implode(',', (array) $ag_groups); $ag_groups = implode(',', (array) $ag_groups);
@ -12513,7 +12513,13 @@ function api_set_create_event($id, $trash1, $other, $returnType)
if ($other['data'][18] != '') { if ($other['data'][18] != '') {
$values['id_extra'] = $other['data'][18]; $values['id_extra'] = $other['data'][18];
$sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";'; if (is_metaconsole()) {
$table_event = 'tmetaconsole_event';
} else {
$table_event = 'tevento';
}
$sql_validation = 'SELECT id_evento FROM '.$table_event.' where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
$validation = db_get_all_rows_sql($sql_validation); $validation = db_get_all_rows_sql($sql_validation);
if ($validation) { if ($validation) {
foreach ($validation as $val) { foreach ($validation as $val) {

View File

@ -1217,8 +1217,14 @@ function config_update_config()
$error_update[] = __('Default zoom graphs'); $error_update[] = __('Default zoom graphs');
} }
if (!config_update_value('graph_image_height', (int) get_parameter('graph_image_height', 280))) { if (!config_update_value(
$error_update[] = __('Default height of the chart image'); 'graph_image_height',
(int) get_parameter('graph_image_height', 130)
)
) {
$error_update[] = __(
'Default height of the chart image'
);
} }
// -------------------------------------------------- // --------------------------------------------------
@ -1324,7 +1330,7 @@ function config_update_config()
$error_update[] = __('HTML font size for SLA (em)'); $error_update[] = __('HTML font size for SLA (em)');
} }
if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 14))) { if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 10))) {
$error_update[] = __('PDF font size (px)'); $error_update[] = __('PDF font size (px)');
} }
@ -1987,7 +1993,7 @@ function config_process_config()
} }
if (!isset($config['font_size'])) { if (!isset($config['font_size'])) {
config_update_value('font_size', 6); config_update_value('font_size', 8);
} }
if (!isset($config['limit_parameters_massive'])) { if (!isset($config['limit_parameters_massive'])) {
@ -2057,17 +2063,9 @@ function config_process_config()
} }
if (!isset($config['fontpath'])) { if (!isset($config['fontpath'])) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// Windows.
$fontpath = $config['homedir'].'\include\fonts\smallfont.ttf';
} else {
$home = str_replace('\\', '/', $config['homedir']);
$fontpath = $home.'/include/fonts/smallfont.ttf';
}
config_update_value( config_update_value(
'fontpath', 'fontpath',
$fontpath 'opensans.ttf'
); );
} }
@ -2864,7 +2862,7 @@ function config_process_config()
} }
if (!isset($config['graph_image_height'])) { if (!isset($config['graph_image_height'])) {
config_update_value('graph_image_height', 280); config_update_value('graph_image_height', 130);
} }
if (!isset($config['zoom_graph'])) { if (!isset($config['zoom_graph'])) {
@ -2919,17 +2917,20 @@ function config_process_config()
config_update_value('custom_report_info', 1); config_update_value('custom_report_info', 1);
} }
// Juanma (06/05/2014) New feature: Custom front page for reports.
if (!isset($config['custom_report_front'])) { if (!isset($config['custom_report_front'])) {
config_update_value('custom_report_front', 0); config_update_value('custom_report_front', 0);
} }
if (!isset($config['global_font_size_report'])) {
config_update_value('global_font_size_report', 10);
}
if (!isset($config['font_size_item_report'])) { if (!isset($config['font_size_item_report'])) {
config_update_value('font_size_item_report', 2); config_update_value('font_size_item_report', 2);
} }
if (!isset($config['custom_report_front_font'])) { if (!isset($config['custom_report_front_font'])) {
config_update_value('custom_report_front_font', 'FreeSans.ttf'); config_update_value('custom_report_front_font', 'opensans.ttf');
} }
if (!isset($config['custom_report_front_logo'])) { if (!isset($config['custom_report_front_logo'])) {

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