Merge remote-tracking branch 'origin/develop' into ent-5145-omnishell-agentes-windows

This commit is contained in:
fbsanchez 2020-11-30 10:06:04 +01:00
commit 0eab0c3a18
281 changed files with 12411 additions and 3991 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-201002 Version: 7.0NG.750-201130
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-201002" pandora_version="7.0NG.750-201130"
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

@ -45,8 +45,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 => '201002'; use constant AGENT_BUILD => '201130';
# 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 201002 %define release 201130
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 201002 %define release 201130
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="201002" PI_BUILD="201130"
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
{201002} {201130}
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 201002)") #define PANDORA_VERSION ("7.0NG.750(Build 201130)")
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 201002))" VALUE "ProductVersion", "(7.0NG.750(Build 201130))"
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-201002 Version: 7.0NG.750-201130
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-201002" pandora_version="7.0NG.750-201130"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1,649 +1,91 @@
<?php <?php
/**
* Agents/Alerts Monitoring view.
*
* @category Operations
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2020 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com // Begin.
// ================================================== global $config;
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas // Require needed class.
// Please see http://pandorafms.org for full contribution list require_once $config['homedir'].'/include/class/AgentsAlerts.class.php';
// This program is free software; you can redistribute it and/or // Get the parameter.
// modify it under the terms of the GNU General Public License $sec2 = get_parameter_get('sec2');
// as published by the Free Software Foundation; version 2 // Add operation menu option.
// This program is distributed in the hope that it will be useful, extensions_add_operation_menu_option(
// but WITHOUT ANY WARRANTY; without even the implied warranty of __('Agents/Alerts view'),
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 'estado',
// GNU General Public License for more details. null,
require_once $config['homedir'].'/include/functions_agents.php'; 'v1r1',
require_once $config['homedir'].'/include/functions_modules.php'; 'view'
require_once $config['homedir'].'/include/functions_users.php'; );
// If sec2 parameter come with this page info.
if ($sec2 === 'extensions/agents_alerts') {
extensions_add_main_function('mainAgentsAlerts');
}
/**
* Function for load the controller.
*
* @return void
*/
function mainAgentsAlerts() function mainAgentsAlerts()
{ {
global $config; // Ajax variables.
$pageName = '[AgentsAlerts]';
// Load global vars // Control call flow.
include_once 'include/config.php'; try {
include_once 'include/functions_reporting.php'; // User access and validation is being processed on class constructor.
$obj = new AgentsAlerts();
check_login(); } catch (Exception $e) {
// ACL Check if (is_ajax() === true) {
if (! check_acl($config['id_user'], 0, 'AR')) { echo json_encode(['error' => $pageName.$e->getMessage() ]);
db_pandora_audit(
'ACL Violation',
'Trying to access Agent view (Grouped)'
);
include 'general/noaccess.php';
exit;
}
// Update network modules for this group
// Check for Network FLAG change request
// Made it a subquery, much faster on both the database and server side
if (isset($_GET['update_netgroup'])) {
$group = get_parameter_get('update_netgroup', 0);
if (check_acl($config['id_user'], $group, 'AW')) {
$where = ['id_agente' => 'ANY(SELECT id_agente FROM tagente WHERE id_grupo = '.$group];
db_process_sql_update('tagente_modulo', ['flag' => 1], $where);
} else {
db_pandora_audit('ACL Violation', 'Trying to set flag for groups');
include 'general/noaccess.php';
exit; exit;
}
}
if ($config['realtimestats'] == 0) {
$updated_info = __('Last update').' : '.ui_print_timestamp(db_get_sql('SELECT min(utimestamp) FROM tgroup_stat'), true);
} else {
// $updated_info = __("Updated at realtime");
$updated_info = '';
}
$updated_time = $updated_info;
$create_alert = (int) get_parameter('create_alert', 0);
if ($create_alert) {
$template2 = get_parameter('template');
$module_action_threshold = get_parameter('module_action_threshold');
$id_alert = alerts_create_alert_agent_module($create_alert, $template2);
if ($id_alert !== false) {
$action_select = get_parameter('action_select', 0);
if ($action_select != 0) {
$values = [];
$values['fires_min'] = 0;
$values['fires_max'] = 0;
$values['module_action_threshold'] = (int) get_parameter('module_action_threshold');
alerts_add_alert_agent_module_action($id_alert, $action_select, $values);
}
}
}
$refr = (int) get_parameter('refr', 30);
// By default 30 seconds
$show_modules = (bool) get_parameter('show_modules', 0);
$group_id = get_parameter('group_id', 0);
$offset = get_parameter('offset', 0);
$hor_offset = get_parameter('hor_offset', 0);
$block = 20;
$groups = users_get_groups();
$filter_groups .= '<b>'.__('Group').'</b>';
$filter_groups .= html_print_select_groups(false, 'AR', true, 'group_id', $group_id, false, '', '', true, false, true, '', false, 'margin-right: 10px; margin-top: 5px;');
$check = '<b>'.__('Show modules without alerts').'</b>';
$check .= html_print_checkbox('slides_ids[]', $d['id'], $show_modules, true, false, '', true);
$comborefr = '<form method="post" action="'.ui_get_url_refresh(['offset' => 0, 'hor_offset' => 0]).'">';
$comborefr .= '<b>'.__('Refresh').'</b>';
$comborefr .= html_print_select(
[
'30' => '30 '.__('seconds'),
(string) SECONDS_1MINUTE => __('1 minute'),
(string) SECONDS_2MINUTES => __('2 minutes'),
(string) SECONDS_5MINUTES => __('5 minutes'),
(string) SECONDS_10MINUTES => __('10 minutes'),
],
'refr',
(int) get_parameter('refr', 0),
$script = 'this.form.submit()',
'',
0,
true,
false,
false,
'',
false,
'width: 100px; margin-right: 10px; margin-top: 5px;'
);
$comborefr .= '</form>';
if ($config['pure'] == 0) {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 1]).'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).'</a>';
} else {
$fullscreen['text'] = '<a href="'.ui_get_url_refresh(['pure' => 0]).'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]).'</a>';
$config['refr'] = $refr;
}
$onheader = [
'updated_time' => $updated_time,
'fullscreen' => $fullscreen,
'combo_groups' => $filter_groups,
];
if ($config['pure'] == 1) {
$onheader['combo_refr'] = $comborefr;
}
// Header.
ui_print_page_header(
__('Agents/Alerts'),
'images/op_alerts.png',
false,
'',
false,
$updated_time
);
// Old style table, we need a lot of special formatting,don't use table function
// Prepare old-style table
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo '<tr>';
echo '<td>'.$filter_groups.'</td>';
echo '<td>'.$check.'</td>';
if ($config['pure'] == 1) {
echo '<td>'.$comborefr.'</td>';
}
echo '<td> <strong>'.__('Full screen').'</strong>'.$fullscreen['text'].'</td>';
echo '</tr>';
echo '</table>';
if ($show_modules) {
if ($group_id > 0) {
$grupo = " AND tagente.id_grupo = $group_id";
} else { } else {
$grupo = ''; echo $pageName.$e->getMessage();
} }
$offset_modules = get_parameter('offset', 0); // Stop this execution, but continue 'globally'.
$sql_count = "SELECT COUNT(tagente_modulo.nombre) FROM tagente_modulo return;
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo";
$count_agent_module = db_get_all_rows_sql($sql_count);
$sql = "SELECT tagente.alias, tagente_modulo.nombre,
tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente.id_agente = tagente_modulo.id_agente
WHERE id_agente_modulo NOT IN (SELECT id_agent_module FROM talert_template_modules)
$grupo LIMIT 20 OFFSET $offset_modules";
$agent_modules = db_get_all_rows_sql($sql);
ui_pagination(
$count_agent_module[0]['COUNT(tagente_modulo.nombre)'],
ui_get_url_refresh(),
0,
0,
false,
'offset',
true,
'',
'',
false,
'alerts_modules'
);
$table->width = '100%';
$table->class = 'databox data';
$table->id = 'table_agent_module';
$table->data = [];
$table->head[0] = __('Agents');
$table->head[1] = __('Modules');
$table->head[2] = __('Actions');
$table->style[0] = 'width: 25%;';
$table->style[1] = 'width: 33%;';
$table->style[2] = 'width: 33%;';
foreach ($agent_modules as $agent_module) {
$data[0] = io_safe_output($agent_module['alias']);
$data[1] = io_safe_output($agent_module['nombre']);
$uniqid = $agent_module['id_agente_modulo'];
$data[2] = "<a title='".__('Create alert')."' href='javascript:show_add_alerts(\"$uniqid\")'>".html_print_image('images/add_mc.png', true).'</a>';
array_push($table->data, $data);
$table2->width = '100%';
$table2->id = 'table_add_alert';
$table2->class = 'databox filters';
$table2->data = [];
// $data[0] =
$table2->data[0][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";
$actions = db_get_all_rows_sql($sql);
}
$table2->data[0][1] = html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
'',
true,
'',
false,
'width: 250px;'
);
$table2->data[0][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table2->data[0][1] .= __('Number of alerts match from').' ';
$table2->data[0][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table2->data[0][1] .= ' '.__('to').' ';
$table2->data[0][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table2->data[0][1] .= ui_print_help_icon(
'alert-matches',
true,
ui_get_full_url(false, false, false, false)
);
$table2->data[0][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[0][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table2->data[0][1] .= html_print_image('images/add.png', true);
$table2->data[0][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
$table2->data[0][1] .= '</a>';
}
$table2->data[1][0] = __('Template');
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$templates = alerts_get_alert_templates(false, ['id', 'name']);
} else {
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
}
$table2->data[1][1] = html_print_select(
index_array($templates, 'id', 'name'),
'template',
'',
'',
__('Select'),
0,
true,
false,
true,
'',
false,
'width: 250px;'
);
$table2->data[1][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table2->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table2->data[1][1] .= html_print_image('images/add.png', true);
$table2->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
$table2->data[1][1] .= '</a>';
}
$table2->data[2][0] = __('Threshold');
$table2->data[2][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
$table2->data[2][1] .= ' '.__('seconds');
$content2 = '<form class="add_alert_form" method="post">';
$content2 .= html_print_table($table2, true);
$content2 .= '<div class="action-buttons" style="width: '.$table2->width.'">';
$content2 .= html_print_submit_button(__('Add alert'), 'add', false, 'class="sub wand"', true);
$content2 .= html_print_input_hidden('create_alert', $uniqid, true);
$content2 .= '</div></form>';
$module_name = ui_print_truncate_text(io_safe_output($agent_module['nombre']), 40, false, true, false, '&hellip;', false);
echo '<div id="add_alerts_dialog_'.$uniqid.'" title="'.__('Agent').': '.$agent_module['alias'].' / '.__('module').': '.$module_name.'" style="display:none">'.$content2.'</div>';
}
html_print_table($table);
} else {
$filter = [
'offset' => (int) $offset,
'limit' => (int) $config['block_size'],
];
$filter_count = [];
if ($group_id > 0) {
$filter['id_grupo'] = $group_id;
$filter_count['id_grupo'] = $group_id;
}
// Get the id of all agents with alerts
$sql = 'SELECT DISTINCT(id_agente)
FROM tagente_modulo
WHERE id_agente_modulo IN
(SELECT id_agent_module
FROM talert_template_modules)';
$agents_with_alerts_raw = db_get_all_rows_sql($sql);
if ($agents_with_alerts_raw === false) {
$agents_with_alerts_raw = [];
}
$agents_with_alerts = [];
foreach ($agents_with_alerts_raw as $awar) {
$agents_with_alerts[] = $awar['id_agente'];
}
$filter['id_agente'] = $agents_with_alerts;
$filter_count['id_agente'] = $agents_with_alerts;
$agents = agents_get_agents($filter);
$nagents = count(agents_get_agents($filter_count));
if ($agents == false) {
ui_print_info_message(['no_close' => true, 'message' => __('There are no agents with alerts') ]);
return;
}
$all_alerts = agents_get_alerts_simple();
if ($config['pure'] == 1) {
$block = count($all_alerts);
}
$templates = [];
$agent_alerts = [];
foreach ($all_alerts as $alert) {
$templates[$alert['id_alert_template']] = '';
$agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert;
}
// Prepare pagination
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
echo '<table class="info_table" cellpadding="0" cellspacing="0" border="0" width=100%>';
echo '<thead><tr>';
echo "<th width='140px' >".__('Agents').' / '.__('Alert templates').'</th>';
if ($hor_offset > 0) {
$new_hor_offset = ($hor_offset - $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowleft.png', true, ['title' => __('Previous templates')]).'</a> </th>';
}
$templates_raw = [];
if (!empty($templates)) {
$sql = sprintf(
'SELECT id, name
FROM talert_templates
WHERE id IN (%s)',
implode(',', array_keys($templates))
);
$templates_raw = db_get_all_rows_sql($sql);
}
if (empty($templates_raw)) {
$templates_raw = [];
}
$alerts = [];
$ntemplates = 0;
foreach ($templates_raw as $temp) {
if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') {
$ntemplates++;
if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset + $block)) {
continue;
}
$templates[$temp['id']] = $temp['name'];
}
}
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
echo '<th width="20px" >'.io_safe_output($tname).'</th>';
}
echo '</tr></thead>';
if (($hor_offset + $block) < $ntemplates) {
$new_hor_offset = ($hor_offset + $block);
echo "<th width='20px' style='' rowspan='".($nagents + 1)."'>
<a href='index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=".$new_hor_offset.'&offset='.$offset.'&group_id='.$group_id."'>".html_print_image('images/darrowright.png', true, ['title' => __('More templates')]).'</a> </th>';
}
foreach ($agents as $agent) {
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent
echo '<td style="font-weight:bold;">'.$alias['alias'].'</td>';
// Alerts of the agent
$anyfired = false;
foreach ($templates as $tid => $tname) {
if ($tname == '') {
continue;
}
if (isset($agent_alerts[$agent['nombre']][$tid])) {
foreach ($agent_alerts[$agent['nombre']][$tid] as $alert) {
if ($alert['times_fired'] > 0) {
$anyfired = true;
}
}
$cellstyle = '';
if ($anyfired) {
$cellstyle = 'background:'.COL_ALERTFIRED.';';
}
echo '<td style=";'.$cellstyle.'" class="action_buttons"> ';
$uniqid = uniqid();
echo '<div>';
echo count($agent_alerts[$agent['nombre']][$tid]).' '.__('Alerts').' ';
echo "<a href='javascript:show_alerts_details(\"$uniqid\")'>".html_print_image('images/zoom.png', true).'</a>';
echo '</div>';
print_alerts_summary_modal_window($uniqid, $agent_alerts[$agent['nombre']][$tid]);
} else {
echo '<td style="text-align:center"> ';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
ui_pagination(
$nagents,
false,
0,
0,
false,
'offset',
true,
'pagination-bottom',
'',
[
'count' => '',
'offset' => 'offset_param',
],
'alerts_agents'
);
} }
// AJAX controller.
if (is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($obj, $method) === true) {
$obj->{$method}();
} else {
$obj->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;
} else {
// Run.
$obj->run();
}
} }
// Print the modal window for the summary of each alerts group
function print_alerts_summary_modal_window($id, $alerts)
{
$table->width = '98%';
$table->class = 'info_table';
$table->data = [];
$table->head[0] = __('Module');
$table->head[1] = __('Action');
$table->head[2] = __('Last fired');
$table->head[3] = __('Status');
foreach ($alerts as $alert) {
$data[0] = modules_get_agentmodule_name($alert['id_agent_module']);
$actions = alerts_get_alert_agent_module_actions($alert['id']);
$actionDefault = db_get_value_sql(
'
SELECT id_alert_action
FROM talert_templates
WHERE id = '.$alert['id_alert_template']
);
$actionText = '';
if (!empty($actions)) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
foreach ($actions as $action) {
$actionText .= '<div><span class="action_name"><li>'.$action['name'];
if ($action['fires_min'] != $action['fires_max']) {
$actionText .= ' ('.$action['fires_min'].' / '.$action['fires_max'].')';
}
$actionText .= '</li></span><br /></div>';
}
$actionText .= '</ul></div>';
} else {
if (!empty($actionDefault)) {
$actionText = db_get_sql(
"SELECT name
FROM talert_actions
WHERE id = $actionDefault"
).' <i>('.__('Default').')</i>';
}
}
$data[1] = $actionText;
$data[2] = ui_print_timestamp($alert['last_fired'], true);
$status = STATUS_ALERT_NOT_FIRED;
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
} else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[3] = ui_print_status_image($status, $title, true);
array_push($table->data, $data);
}
$content = html_print_table($table, true);
$agent = modules_get_agentmodule_agent_alias($alerts[0]['id_agent_module']);
$template = alerts_get_alert_template_name($alerts[0]['id_alert_template']);
echo '<div id="alerts_details_'.$id.'" title="'.__('Agent').': '.$agent.' / '.__('Template').': '.$template.'" style="display:none">'.$content.'</div>';
}
extensions_add_operation_menu_option(__('Agents/Alerts view'), 'estado', null, 'v1r1', 'view');
extensions_add_main_function('mainAgentsAlerts');
ui_require_jquery_file('pandora');
?>
<script type="text/javascript">
function show_alerts_details(id) {
$("#alerts_details_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 280,
width: 800,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
function show_add_alerts(id) {
$("#add_alerts_dialog_"+id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 235,
width: 600,
overlay: {
opacity: 0.5,
background: "black"
}
});
}
// checkbox-slides_ids
$(document).ready(function () {
$('#checkbox-slides_ids').click(function(){
if ($('#checkbox-slides_ids').prop('checked')){
var url = location.href.replace("&show_modules=true", "");
location.href = url+"&show_modules=true";
} else {
var url = location.href.replace("&show_modules=true", "");
var re = /&offset=\d*/g;
location.href = url.replace(re, "");
}
});
$('#group_id').change(function(){
if(location.href.indexOf("extensions/agents_modules") == -1){
var regx = /&group_id=\d*/g;
var url = location.href.replace(regx, "");
location.href = url+"&group_id="+$("#group_id").val();
}
});
});
</script>

View File

@ -26,17 +26,6 @@ function agents_modules_load_js()
$ignored_params['refresh'] = ''; $ignored_params['refresh'] = '';
?> ?>
<style type='text/css'>
.rotate_text_module {
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: lr-tb;
white-space: nowrap;
}
</style>
<script type='text/javascript'> <script type='text/javascript'>
$(document).ready(function () { $(document).ready(function () {
//Get max width of name of modules //Get max width of name of modules
@ -389,8 +378,8 @@ function mainAgentsModules()
$filter_groups_label = '<b>'.__('Group').'</b>'; $filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
$filter_recursion_label = '<b>'.__('Recursion').'</b>'; $filter_recursion_label = '</td><td><b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true); $filter_recursion = html_print_checkbox('recursion', 1, 0, true).'</td>';
// Groups module. // Groups module.
$filter_module_groups_label = '<b>'.__('Module group').'</b>'; $filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql( $filter_module_groups = html_print_select_from_sql(
@ -668,7 +657,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

@ -53,7 +53,28 @@ foreach ($groups as $id => $name) {
$row = []; $row = [];
$row[0] = __('Groups'); $row[0] = __('Groups');
$row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', ''); $row[1] = '<div class="w290px">'.html_print_select_groups(
// Id_user.
false,
// Privilege.
'AR',
// ReturnAllGroup.
true,
// Name.
'groups[]',
// Selected.
$groups_selected,
// Script.
'',
// Nothing.
'',
// Nothing_value.
0,
// Return.
true,
// Multiple.
true
).'</div>';
$table->data[] = $row; $table->data[] = $row;
$table->colspan[][1] = 3; $table->colspan[][1] = 3;

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

@ -468,6 +468,7 @@ function quickShellSettings()
100, 100,
true true
); );
$hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true);
html_print_table($t); html_print_table($t);

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

@ -22,4 +22,15 @@ ALTER TABLE talert_actions ADD COLUMN `field18_recovery` TEXT NOT NULL DEFAULT "
ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field19_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT ""; ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE `treport_content` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
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 `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

@ -770,7 +770,8 @@ CREATE TABLE IF NOT EXISTS `treport_template` (
`custom_font` varchar(200) default NULL, `custom_font` varchar(200) default NULL,
`metaconsole` tinyint(1) DEFAULT 0, `metaconsole` tinyint(1) DEFAULT 0,
`agent_regex` varchar(600) NOT NULL default '', `agent_regex` varchar(600) NOT NULL default '',
`cover_page_render` tinyint(1) NOT NULL DEFAULT 1,
`index_render` tinyint(1) NOT NULL DEFAULT 1,
PRIMARY KEY(`id_report`) PRIMARY KEY(`id_report`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -849,7 +850,8 @@ ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1)
MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0'; MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content_template` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Table `tnews` -- Table `tnews`
@ -1370,13 +1372,13 @@ ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 41); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 42);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '749'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', 750);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@ -1403,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`
@ -1692,7 +1695,8 @@ ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned
MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1'; MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0; ALTER TABLE `treport_content` ADD COLUMN `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
@ -2225,13 +2229,15 @@ INSERT INTO tlog_graph_models VALUES (6, 'Pages&#x20;with&#x20;warnings',
INSERT INTO tlog_graph_models VALUES (7, 'Users&#x20;login', INSERT INTO tlog_graph_models VALUES (7, 'Users&#x20;login',
'Starting&#x20;Session&#x20;&#92;d+&#92;&#x20;of&#x20;user&#x20;&#40;.*&#41;', 'Starting&#x20;Session&#x20;&#92;d+&#92;&#x20;of&#x20;user&#x20;&#40;.*&#41;',
'user', 0); 'user', 0);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Add column in table `treport` -- Add column in table `treport`
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0; ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical'; ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
ALTER TABLE `treport` MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT '0' AFTER `non_interactive`; ALTER TABLE `treport` MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT '0' AFTER `non_interactive`;
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1'; ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default ''; ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';

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');
@ -322,7 +322,16 @@ $table_primary_group = '<div class="label_select"><p class="input_label">'.__('P
$table_primary_group .= '<div class="label_select_parent">'; $table_primary_group .= '<div class="label_select_parent">';
// Cannot change primary group if user have not permission for that group. // Cannot change primary group if user have not permission for that group.
if (isset($groups[$grupo]) || $new_agent) { if (isset($groups[$grupo]) || $new_agent) {
$table_primary_group .= html_print_select_groups(false, 'AR', false, 'grupo', $grupo, '', '', 0, true); $table_primary_group .= html_print_input(
[
'type' => 'select_groups',
'returnAllGroup' => false,
'name' => 'grupo',
'selected' => $grupo,
'return' => true,
'required' => true,
]
);
} else { } else {
$table_primary_group .= groups_get_name($grupo); $table_primary_group .= groups_get_name($grupo);
$table_primary_group .= html_print_input_hidden('grupo', $grupo, true); $table_primary_group .= html_print_input_hidden('grupo', $grupo, true);
@ -424,44 +433,66 @@ if (enterprise_installed()) {
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
$adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').'</p></div>'; $adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').'</p></div>';
$adv_secondary_groups_left = html_print_select_groups( $adv_secondary_groups_left = html_print_select_groups(
false, // Id_user.
// Use the current user to select the groups. // Use the current user to select the groups.
'AR',
// ACL permission.
false, false,
// Privilege.
// ACL permission.
'AR',
// ReturnAllGroup.
// Not all group. // Not all group.
'secondary_groups', false,
// Name.
// HTML id. // HTML id.
'', 'secondary_groups',
// Selected.
// No select any by default. // No select any by default.
'', '',
// Script.
// Javascript onChange code. // Javascript onChange code.
'', '',
// Nothing.
// Do not user no selected value. // Do not user no selected value.
0, false,
// Nothing_value.
// Do not use no selected value. // Do not use no selected value.
true, 0,
// Return.
// Return HTML (not echo). // Return HTML (not echo).
true, true,
// Multiple.
// Multiple selection. // Multiple selection.
true, true,
// Sort.
// Sorting by default. // Sorting by default.
'', true,
// Class.
// CSS classnames (default). // CSS classnames (default).
false, '',
// Disabled.
// Not disabled (default). // Not disabled (default).
'min-width:170px;',
// Inline styles (default).
false, false,
// Style.
// Inline styles (default).
'min-width:170px;',
// Option_style.
// Option style select (default). // Option style select (default).
false, false,
// Id_group.
// Do not truncate the users tree (default). // Do not truncate the users tree (default).
'id_grupo',
// Key to get as value (default).
false, false,
// Keys_field.
// Key to get as value (default).
'id_grupo',
// Strict_user.
// Not strict user (default). // Not strict user (default).
$secondary_groups_selected['plain'] false,
// Delete_groups.
// Do not show the primary group in this selection. // Do not show the primary group in this selection.
array_merge($secondary_groups_selected['plain'], [$agent['id_grupo']])
// Include_groups.
// Size.
// Simple_multiple_options.
); );
$adv_secondary_groups_arrows = html_print_input_image( $adv_secondary_groups_arrows = html_print_input_image(
@ -489,30 +520,30 @@ if (enterprise_installed()) {
); );
$adv_secondary_groups_right .= html_print_select( $adv_secondary_groups_right .= html_print_select(
$secondary_groups_selected['for_select'],
// Values. // Values.
'secondary_groups_selected', $secondary_groups_selected['for_select'],
// HTML id. // HTML id.
'', 'secondary_groups_selected',
// Selected. // Selected.
'', '',
// Javascript onChange code. // Javascript onChange code.
'', '',
// Nothing selected. // Nothing selected.
0, false,
// Nothing selected. // Nothing selected.
true, 0,
// Return HTML (not echo). // Return HTML (not echo).
true, true,
// Multiple selection. // Multiple selection.
true, true,
// Sort. // Sort.
'', true,
// Class. // Class.
false, '',
// Disabled. // Disabled.
'min-width:170px;' false,
// Style. // Style.
'min-width:170px;'
); );
// Safe operation mode. // Safe operation mode.
@ -1191,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;
@ -1245,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

@ -173,8 +173,9 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$return_all_group = true; $return_all_group = true;
} }
echo '<div class="w250px inline">';
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false); html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
echo '</div>';
echo '<td>'; echo '<td>';
echo __('Show Agents').'&nbsp;'; echo __('Show Agents').'&nbsp;';
$fields = [ $fields = [
@ -407,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);
@ -753,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

@ -535,20 +535,30 @@ $table_advanced->data[0][1] = html_print_input_text(
); );
$table_advanced->data[0][3] = __('Unit'); $table_advanced->data[0][3] = __('Unit');
// $table_advanced->data[1][4] = html_print_input_text ('unit', $unit, '', 20, 65, true, $table_advanced->data[0][4] = html_print_input_text(
// $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
// $table_advanced->colspan[1][4] = 3;
$table_advanced->data[0][4] = html_print_extended_select_for_unit(
'unit', 'unit',
$unit, $unit,
'', '',
'', 20,
'0', 65,
false,
true, true,
$disabledBecauseInPolicy,
false, false,
false '',
$classdisabledBecauseInPolicy
); );
// $table_advanced->colspan[1][4] = 3;
// $table_advanced->data[0][4] = html_print_extended_select_for_unit(
// 'unit',
// $unit,
// '',
// '',
// '0',
// false,
// true,
// false,
// false
// );
$table_advanced->colspan[0][4] = 3; $table_advanced->colspan[0][4] = 3;
$module_id_policy_module = 0; $module_id_policy_module = 0;
@ -1340,115 +1350,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

@ -354,8 +354,8 @@ if ($create_downtime || $update_downtime) {
__('Not created. Error inserting data').'. '.__('The end date must be higher than the current time') __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time')
); );
} else if ($type_execution == 'periodically' } else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to) && $type_periodicity == 'monthly'
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to)) && $periodically_day_from == $periodically_day_to
) { ) {
ui_print_error_message( ui_print_error_message(
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time') __('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
@ -645,7 +645,7 @@ $table->data[0][1] = html_print_input_text(
$disabled_in_execution $disabled_in_execution
); );
$table->data[1][0] = __('Group'); $table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false, false,
$access, $access,
true, true,
@ -659,7 +659,7 @@ $table->data[1][1] = html_print_select_groups(
true, true,
'', '',
$disabled_in_execution $disabled_in_execution
); ).'</div>';
$table->data[2][0] = __('Description'); $table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea( $table->data[2][1] = html_print_textarea(
'description', 'description',
@ -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

@ -296,7 +296,9 @@ if (!users_can_manage_group_all('LM')) {
$can_manage_group_all = true; $can_manage_group_all = true;
} }
echo '<div class="inline w250px">';
html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;'); html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;');
echo '</div>';
echo '</td><td>'; echo '</td><td>';
echo __('Overwrite'); echo __('Overwrite');
ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false); ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false);

View File

@ -168,7 +168,7 @@ $table->data[1][0] = __('Group');
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = '<div class="w250px inline">'.html_print_select_groups(
false, false,
'LW', 'LW',
true, true,
@ -182,7 +182,7 @@ $table->data[1][1] = html_print_select_groups(
true, true,
'', '',
$is_central_policies_on_node $is_central_policies_on_node
); ).'</div>';
$table->colspan[1][1] = 2; $table->colspan[1][1] = 2;
$table->data[2][0] = __('Command'); $table->data[2][0] = __('Command');

View File

@ -218,7 +218,7 @@ $table->data['command'][1] = html_print_textarea(
$table->colspan['group'][1] = 3; $table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group'); $table->data['group'][0] = __('Group');
$table->data['group'][1] = html_print_select_groups( $table->data['group'][1] = '<div class="w250px inline">'.html_print_select_groups(
false, false,
'LM', 'LM',
true, true,
@ -232,7 +232,7 @@ $table->data['group'][1] = html_print_select_groups(
true, true,
'', '',
$is_central_policies_on_node $is_central_policies_on_node
); ).'</div>';
$table->colspan['description'][1] = 3; $table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description'); $table->data['description'][0] = __('Description');

View File

@ -1099,7 +1099,7 @@ if ($step == 2) {
} }
$table->data[0][1] .= '&nbsp;'; $table->data[0][1] .= '&nbsp;';
$table->data[0][1] .= html_print_select_groups( $table->data[0][1] .= '<div class="w250px inline">'.html_print_select_groups(
false, false,
'AR', 'AR',
$display_all_group, $display_all_group,
@ -1113,7 +1113,7 @@ if ($step == 2) {
true, true,
'', '',
$is_central_policies_on_node $is_central_policies_on_node
); ).'</div>';
$table->data[1][0] = __('Description'); $table->data[1][0] = __('Description');

View File

@ -130,6 +130,16 @@ 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', '');
@ -241,7 +251,7 @@ if ($returnAllGroup === false && $id_group_filter == 0) {
$returnAllGroup = true; $returnAllGroup = true;
} }
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'], $config['id_user'],
$access, $access,
$returnAllGroup, $returnAllGroup,
@ -260,21 +270,21 @@ $table->data[1][1] = html_print_select_groups(
false, false,
'id_grupo', 'id_grupo',
$strict_user $strict_user
); ).'</div>';
$table->data[2][0] = '<b>'.__('Group').'</b>'; $table->data[2][0] = '<b>'.__('Group').'</b>';
$display_all_group = (users_is_admin() || users_can_manage_group_all('AR')); $display_all_group = (users_is_admin() || users_can_manage_group_all('AR'));
$table->data[2][1] = html_print_select_groups( $table->data[2][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'], $config['id_user'],
'AR', 'AR',
$display_all_group, $display_all_group,
'id_group', 'id_group',
$idGroup, $id_group,
'', '',
'', '',
'', '',
true true
); ).'</div>';
$types = get_event_types(); $types = get_event_types();
// Expand standard array to add not_normal (not exist in the array, used only for searches) // Expand standard array to add not_normal (not exist in the array, used only for searches)

View File

@ -145,7 +145,8 @@ if ($id_group) {
$table->data[2][1] = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true); $table->data[2][1] = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true);
} else { } else {
$table->data[2][1] = html_print_select_groups( $table->data[2][1] = '<div class="w250px inline">';
$table->data[2][1] .= html_print_select_groups(
false, false,
'AR', 'AR',
true, true,
@ -163,9 +164,20 @@ if ($id_group) {
false, false,
$id_group $id_group
); );
$table->data[2][1] .= '</div>';
} }
} else { } else {
$table->data[2][1] = html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true); $table->data[2][1] = '<div class="w250px inline">';
$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>';
} }
if ($acl_parent) { if ($acl_parent) {

View File

@ -419,45 +419,52 @@ if ($update_group) {
$aviable_name = false; $aviable_name = false;
} }
// Check if group name is unique.
$check = db_get_value_filter(
'nombre',
'tgrupo',
[
'nombre' => $name,
'id_grupo' => $id_group,
],
'AND NOT'
);
// Check if name field is empty. // Check if name field is empty.
if ($name != '' && $aviable_name === true) { if ($name != '') {
$sql = sprintf( if (!$check) {
'UPDATE tgrupo if ($aviable_name === true) {
SET nombre = "%s", $values = [
icon = "%s", 'nombre' => $name,
disabled = %d, 'icon' => empty($icon) ? '' : substr($icon, 0, -4),
parent = %d, 'parent' => $id_parent,
custom_id = "%s", 'disabled' => !$alerts_enabled,
propagate = %d, 'custom_id' => $custom_id,
id_skin = %d, 'id_skin' => $skin,
description = "%s", 'description' => $description,
contact = "%s", 'contact' => $contact,
other = "%s", 'propagate' => $propagate,
password = "%s" 'other' => $other,
WHERE id_grupo = %d', 'password' => io_safe_input($group_pass),
$name, ];
empty($icon) ? '' : substr($icon, 0, -4),
!$alerts_enabled,
$id_parent,
$custom_id,
$propagate,
$skin,
$description,
$contact,
$other,
$group_pass,
$id_group
);
$result = db_process_sql($sql); $result = db_process_sql_update(
} else { 'tgrupo',
$result = false; $values,
} ['id_grupo' => $id_group]
);
}
if ($result !== false) { if ($result) {
ui_print_success_message(__('Group successfully updated')); ui_print_success_message(__('Group successfully updated'));
} else {
ui_print_error_message(__('There was a problem modifying group'));
}
} else {
ui_print_error_message(__('Each group must have a different name'));
}
} else { } else {
ui_print_error_message(__('There was a problem modifying group')); ui_print_error_message(__('Group must have a name'));
} }
} }

View File

@ -67,10 +67,30 @@ if ($add) {
$modules = get_parameter('module'); $modules = get_parameter('module');
$modules_id = []; $modules_id = [];
if (!empty($modules)) { if (!empty($modules)) {
$modules_id = [];
foreach ($modules as $module) { foreach ($modules as $module) {
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent); if ($module == '0') {
$modules_id[] = $module_id['id_agente_modulo']; // Get all modules of agent.
$agent_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
$agent_modules_id = array_map(
function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
} }
} }

View File

@ -106,15 +106,31 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
return false; return false;
} }
$modules_id = [];
foreach ($module_names as $module) { foreach ($module_names as $module) {
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent); if ($module == '0') {
$modules_id[] = $module_id['id_agente_modulo']; // Get all modules of agent.
} $agent_modules = db_get_all_rows_filter(
} 'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
if (count($module_names) == 1 && $module_names[0] == '0') { $agent_modules_id = array_map(
$modules_id = agents_common_modules($id_agents, false, true); function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
} }
$conttotal = 0; $conttotal = 0;

View File

@ -66,10 +66,29 @@ if ($delete) {
$modules = (array) get_parameter('module'); $modules = (array) get_parameter('module');
$modules_id = []; $modules_id = [];
if (!empty($modules)) { if (!empty($modules)) {
$modules_id = [];
foreach ($modules as $module) { foreach ($modules as $module) {
foreach ($id_agents as $id_agent) { foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent); if ($module == '0') {
$modules_id[] = $module_id['id_agente_modulo']; // Get all modules of agent.
$agent_modules = db_get_all_rows_filter(
'tagente_modulo',
['id_agente' => $id_agent],
'id_agente_modulo'
);
$agent_modules_id = array_map(
function ($field) {
return $field['id_agente_modulo'];
},
$agent_modules
);
$modules_id = array_merge($modules_id, $agent_modules_id);
} else {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
} }
} }

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

@ -450,7 +450,7 @@ $table->data['form_modules_2'][1] = html_print_select(
'', '',
false, false,
'width:100%' 'width:100%'
); ).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules'); $table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>'; $table->data['form_modules_2'][2] .= '<br>';
@ -522,7 +522,8 @@ $table->data['form_agents_3'][1] = html_print_select(
'', '',
false, false,
'width:100%' 'width:100%'
); ).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents'); $table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>'; $table->data['form_agents_3'][2] .= '<br>';
$table->data['form_agents_3'][2] .= html_print_select( $table->data['form_agents_3'][2] .= html_print_select(
@ -588,6 +589,44 @@ if ($selection_mode == 'modules') {
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>; var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
$(document).ready (function () { $(document).ready (function () {
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
$("#module_name option").prop('selected', 'selected');
$("#module_name").trigger('change');
} else {
$("#module_name option").prop('selected', false);
$("#module_name").trigger('change');
}
});
$("#module_name").change(function() {
var options_length = $("#module_name option").length;
var options_selected_length = $("#module_name option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_modules').prop("checked", false);
}
});
$("#checkbox-select_all_agents").change(function() {
if( $('#checkbox-select_all_agents').prop('checked')) {
$("#id_agents option").prop('selected', 'selected');
$("#id_agents").trigger('change');
} else {
$("#id_agents option").prop('selected', false);
$("#id_agents").trigger('change');
}
});
$("#id_agents").change(function() {
var options_length = $("#id_agents option").length;
var options_selected_length = $("#id_agents option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_agents').prop("checked", false);
}
});
$("#id_agents").change(agent_changed_by_multiple_agents); $("#id_agents").change(agent_changed_by_multiple_agents);
$("#module_name").change(module_changed_by_multiple_modules); $("#module_name").change(module_changed_by_multiple_modules);
@ -680,7 +719,7 @@ $(document).ready (function () {
$('#groups_select').val(-1); $('#groups_select').val(-1);
} }
$('input[type=checkbox]').change ( $('input[type=checkbox]').not(".static").change (
function () { function () {
if (this.id == "checkbox-force_type") { if (this.id == "checkbox-force_type") {
if (this.checked) { if (this.checked) {

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

@ -406,7 +406,8 @@ $table->data['form_modules_2'][1] = html_print_select(
true, true,
true, true,
true true
); ).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules'); $table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>'; $table->data['form_modules_2'][2] .= '<br>';
$table->data['form_modules_2'][2] .= html_print_select( $table->data['form_modules_2'][2] .= html_print_select(
@ -491,7 +492,7 @@ $table->data['form_agents_3'][1] = html_print_select(
true, true,
true, true,
false false
); ).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents'); $table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>'; $table->data['form_agents_3'][2] .= '<br>';
@ -1212,7 +1213,45 @@ $(document).ready (function () {
return false; return false;
} }
}); });
$("#checkbox-select_all_modules").change(function() {
if( $('#checkbox-select_all_modules').prop('checked')) {
$("#module_name option").prop('selected', 'selected');
$("#module_name").trigger('change');
} else {
$("#module_name option").prop('selected', false);
$("#module_name").trigger('change');
}
});
$("#module_name").change(function() {
var options_length = $("#module_name option").length;
var options_selected_length = $("#module_name option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_modules').prop("checked", false);
}
});
$("#checkbox-select_all_agents").change(function() {
if( $('#checkbox-select_all_agents').prop('checked')) {
$("#id_agents option").prop('selected', 'selected');
$("#id_agents").trigger('change');
} else {
$("#id_agents option").prop('selected', false);
$("#id_agents").trigger('change');
}
});
$("#id_agents").change(function() {
var options_length = $("#id_agents option").length;
var options_selected_length = $("#id_agents option:selected").length;
if (options_selected_length < options_length) {
$('#checkbox-select_all_agents').prop("checked", false);
}
});
$("#text-custom_ip_target").hide(); $("#text-custom_ip_target").hide();
$("#id_agents").change(agent_changed_by_multiple_agents); $("#id_agents").change(agent_changed_by_multiple_agents);
@ -1463,7 +1502,7 @@ $(document).ready (function () {
$('#groups_select').val(-1); $('#groups_select').val(-1);
} }
$('input[type=checkbox]').change ( $('input[type=checkbox]').not(".static").change (
function () { function () {
if (this.id == "checkbox-force_type") { if (this.id == "checkbox-force_type") {
if (this.checked) { if (this.checked) {

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

@ -222,12 +222,14 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
} }
echo "<td style='width: 12%;'><b>".__('Group').'</b></td><td>'; echo "<td style='width: 12%;'><b>".__('Group').'</b></td><td>';
echo '<div class="w250px">';
if ($id_container === '1') { if ($id_container === '1') {
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', true); echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', true);
} else { } else {
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', false); echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', false);
} }
echo '</div>';
echo '</td></tr>'; echo '</td></tr>';
echo '<tr>'; echo '<tr>';
@ -500,7 +502,7 @@ if ($edit_container) {
$data = []; $data = [];
$data[0] = __('Group'); $data[0] = __('Group');
$data[1] = html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true); $data[1] = '<div class="w250px">'.html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true).'</div>';
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';

View File

@ -1,29 +1,44 @@
<?php <?php
/**
* Combined graph
*
* @category Combined graph
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
require_once 'include/functions_custom_graphs.php'; require_once 'include/functions_custom_graphs.php';
if (is_ajax()) { if (is_ajax() === true) {
$search_agents = (bool) get_parameter('search_agents'); $search_agents = (bool) get_parameter('search_agents', false);
if ($search_agents) { if ($search_agents === true) {
include_once 'include/functions_agents.php'; include_once 'include/functions_agents.php';
$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'); $id_group = (int) get_parameter('id_group');
$filter = []; $filter = [];
@ -47,7 +62,9 @@ if (is_ajax()) {
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'RW') && ! check_acl($config['id_user'], 0, 'RM')) { if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM')
) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access graph builder' 'Trying to access graph builder'
@ -57,7 +74,9 @@ if (! check_acl($config['id_user'], 0, 'RW') && ! check_acl($config['id_user'],
} }
if ($edit_graph) { if ($edit_graph) {
$graphInTgraph = db_get_row_sql('SELECT * FROM tgraph WHERE id_graph = '.$id_graph); $graphInTgraph = db_get_row_sql(
'SELECT * FROM tgraph WHERE id_graph = '.$id_graph
);
$stacked = $graphInTgraph['stacked']; $stacked = $graphInTgraph['stacked'];
$period = $graphInTgraph['period']; $period = $graphInTgraph['period'];
$id_group = $graphInTgraph['id_group']; $id_group = $graphInTgraph['id_group'];
@ -94,56 +113,84 @@ if ($edit_graph) {
// ----------------------- // -----------------------
// CREATE/EDIT GRAPH FORM // CREATE/EDIT GRAPH FORM
// ----------------------- // -----------------------
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>"; $url = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder';
if ($edit_graph) { if ($edit_graph) {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&update_graph=1&id=".$id_graph."'>"; $output = "<form method='post' action='".$url.'&edit_graph=1&update_graph=1&id='.$id_graph."'>";
} else { } else {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&add_graph=1'>"; $output = "<form method='post' action='".$url."&edit_graph=1&add_graph=1'>";
} }
echo '<tr>'; $output .= "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo "<td class='datos'><b>".__('Name').'</b></td>'; $output .= '<tr>';
echo "<td class='datos'><input type='text' name='name' size='25' "; $output .= "<td class='datos'><b>".__('Name').'</b></td>';
$output .= "<td class='datos'><input type='text' name='name' size='25' ";
if ($edit_graph) { if ($edit_graph) {
echo "value='".$graphInTgraph['name']."' "; $output .= "value='".$graphInTgraph['name']."' ";
} }
echo '>'; $output .= '>';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
echo '<td><b>'.__('Group').'</b></td><td>'; $output .= '<td><b>'.__('Group').'</b></td><td>';
if (check_acl($config['id_user'], 0, 'RW')) { if (check_acl($config['id_user'], 0, 'RW')) {
echo html_print_select_groups($config['id_user'], 'RW', true, 'graph_id_group', $id_group, '', '', '', true); $output .= html_print_select_groups(
$config['id_user'],
'RW',
true,
'graph_id_group',
$id_group,
'',
'',
'',
true
);
} else if (check_acl($config['id_user'], 0, 'RM')) { } else if (check_acl($config['id_user'], 0, 'RM')) {
echo html_print_select_groups($config['id_user'], 'RM', true, 'graph_id_group', $id_group, '', '', '', true); $output .= html_print_select_groups(
$config['id_user'],
'RM',
true,
'graph_id_group',
$id_group,
'',
'',
'',
true
);
} }
echo '</td></tr>'; $output .= '</td></tr>';
echo '<tr>'; $output .= '<tr>';
echo "<td class='datos2'><b>".__('Description').'</b></td>'; $output .= "<td class='datos2'><b>".__('Description').'</b></td>';
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=55 rows=2>"; $output .= "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=55 rows=2>";
if ($edit_graph) { if ($edit_graph) {
echo $graphInTgraph['description']; $output .= $graphInTgraph['description'];
} }
echo '</textarea>'; $output .= '</textarea>';
echo '</td></tr>'; $output .= '</td></tr>';
if ($stacked == CUSTOM_GRAPH_GAUGE) { if ($stacked == CUSTOM_GRAPH_GAUGE) {
$hidden = ' style="display:none;" '; $hidden = ' style="display:none;" ';
} else { } else {
$hidden = ''; $hidden = '';
} }
echo '<tr>'; $output .= '<tr>';
echo "<td class='datos'>"; $output .= "<td class='datos'>";
echo '<b>'.__('Period').'</b></td>'; $output .= '<b>'.__('Period').'</b></td>';
echo "<td class='datos'>"; $output .= "<td class='datos'>";
html_print_extended_select_for_time('period', $period, '', '', '0', 10); $output .= html_print_extended_select_for_time(
echo "</td><td class='datos2'>"; 'period',
echo '<b>'.__('Type of graph').'</b></td>'; $period,
echo "<td class='datos2'> <div style='float:left;display:inline-block'>"; '',
'',
'0',
10,
true
);
$output .= "</td><td class='datos2'>";
$output .= '<b>'.__('Type of graph').'</b></td>';
$output .= "<td class='datos2'> <div style='float:left;display:inline-block'>";
require_once $config['homedir'].'/include/functions_graph.php'; require_once $config['homedir'].'/include/functions_graph.php';
@ -158,85 +205,149 @@ $stackeds = [
CUSTOM_GRAPH_VBARS => __('Vertical bars'), CUSTOM_GRAPH_VBARS => __('Vertical bars'),
CUSTOM_GRAPH_PIE => __('Pie'), CUSTOM_GRAPH_PIE => __('Pie'),
]; ];
html_print_select($stackeds, 'stacked', $stacked); $output .= html_print_select($stackeds, 'stacked', $stacked, '', '', 0, true);
echo '</div></td></tr>'; $output .= '</div></td></tr>';
echo "<tr><td class='datos2'><b>".__('Percentil').'</b></td>'; $output .= '<tr>';
echo "<td class='datos2'>".html_print_checkbox('percentil', 1, $percentil, true).'</td>'; $output .= "<td class='datos2 thresholdDiv'><b>";
echo "<td class='datos2 thresholdDiv'><b>".__('Equalize maximum thresholds').'</b></td>'; $output .= __('Equalize maximum thresholds');
echo "<td class='datos2 thresholdDiv'>".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false); $output .= '</b></td>';
echo '</td></tr>'; $output .= "<td class='datos2 thresholdDiv'>";
echo "<tr><td class='datos2'><b>".__('Add summatory series').'</b></td>'; $output .= html_print_checkbox(
echo "<td class='datos2'>".html_print_checkbox('summatory_series', 1, $summatory_series, true)."</td> 'threshold',
<td class='datos2'><b>".__('Add average series').'</b></td>'; CUSTOM_GRAPH_BULLET_CHART_THRESHOLD,
echo "<td class='datos2'>".html_print_checkbox('average_series', 1, $average_series, true).'</td></tr>'; $check,
echo "<tr><td class='datos2'><b>".__('Modules and series').'</b></td>'; true,
false,
'',
false
);
$output .= '</td></tr>';
echo "<td class='datos2'>".html_print_checkbox('modules_series', 1, $modules_series, true).'</td>'; $output .= "<tr><td class='datos2 sparse_graph '><b>";
echo "<td class='datos2'><b>".__('Show full scale graph (TIP)').'</td>'; $output .= __('Percentil');
echo "<td class='datos2'>".html_print_checkbox('fullscale', 1, $fullscale, true).'</td>'; $output .= '</b></td>';
echo '</tr>'; $output .= "<td class='datos2 sparse_graph'>";
echo '</table>'; $output .= html_print_checkbox(
'percentil',
1,
$percentil,
true
);
$output .= '</td>';
$output .= '</tr>';
$output .= "<tr><td class='datos2 sparse_graph'><b>";
$output .= __('Add summatory series');
$output .= '</b></td>';
$output .= "<td class='datos2 sparse_graph'>";
$output .= html_print_checkbox(
'summatory_series',
1,
$summatory_series,
true
);
$output .= "</td><td class='datos2 sparse_graph'><b>";
$output .= __('Add average series');
$output .= '</b></td>';
$output .= "<td class='datos2 sparse_graph'>";
$output .= html_print_checkbox(
'average_series',
1,
$average_series,
true
);
$output .= '</td></tr>';
$output .= "<tr><td class='datos2 sparse_graph'><b>";
$output .= __('Modules and series');
$output .= '</b></td>';
$output .= "<td class='datos2 sparse_graph'>";
$output .= html_print_checkbox('modules_series', 1, $modules_series, true);
$output .= '</td>';
$output .= "<td class='datos2 sparse_graph'><b>";
$output .= __('Show full scale graph (TIP)');
$output .= '</td>';
$output .= "<td class='datos2 sparse_graph'>";
$output .= html_print_checkbox('fullscale', 1, $fullscale, true);
$output .= '</td>';
$output .= '</tr>';
$output .= '</table>';
if ($edit_graph) { if ($edit_graph) {
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' class='sub upd' value='".__('Update')."'></div>"; $output .= "<div style='width:100%'>";
$output .= "<input style='float:right;' type=submit name='store' class='sub upd' value='".__('Update')."'>";
$output .= '</div>';
} else { } else {
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' class='sub next' value='".__('Create')."'></div>"; $output .= "<div style='width:100%'>";
$output .= "<input style='float:right;' type=submit name='store' class='sub next' value='".__('Create')."'>";
$output .= '</div>';
} }
echo '</form>'; $output .= '</form>';
echo $output;
?>
<script type="text/javascript">
$(document).ready(function() {
if ($("#stacked").val() == '<?php echo CUSTOM_GRAPH_BULLET_CHART; ?>') {
$(".thresholdDiv").show();
$(".sparse_graph").hide();
} else if (
$("#stacked").val() == '<?php echo CUSTOM_GRAPH_AREA; ?>' ||
$("#stacked").val() == '<?php echo CUSTOM_GRAPH_LINE; ?>'
) {
$(".thresholdDiv").hide();
$(".sparse_graph").show();
} else {
$(".thresholdDiv").hide();
$(".sparse_graph").hide();
}
echo '<script type="text/javascript"> if( !$("#checkbox-summatory_series").is(":checked") &&
$(document).ready(function() { !$("#checkbox-average_series").is(":checked")
if ($("#stacked").val() == '.CUSTOM_GRAPH_BULLET_CHART.') { ){
$(".thresholdDiv").show(); $("#checkbox-modules_series").attr("disabled", true);
}else{ $("#checkbox-modules_series").attr("checked", false);
$(".thresholdDiv").hide(); }
}
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#stacked").change(function(){ $("#stacked").change(function(){
if ( $(this).val() == '.CUSTOM_GRAPH_GAUGE.') { if ( $(this).val() == '<?php echo CUSTOM_GRAPH_BULLET_CHART; ?>') {
$("[name=threshold]").prop("checked", false); $(".thresholdDiv").show();
$(".stacked").hide(); $(".sparse_graph").hide();
$("input[name=\'width\']").hide(); } else if (
$(".thresholdDiv").hide(); $(this).val() == '<?php echo CUSTOM_GRAPH_AREA; ?>' ||
} else if ($(this).val() == '.CUSTOM_GRAPH_BULLET_CHART.') { $(this).val() == '<?php echo CUSTOM_GRAPH_LINE; ?>'
$(".thresholdDiv").show(); ) {
$(".stacked").show(); $(".thresholdDiv").hide();
$("input[name=\'width\']").show(); $(".sparse_graph").show();
} else { } else {
$("[name=threshold]").prop("checked", false); $(".thresholdDiv").hide();
$(".stacked").show(); $(".sparse_graph").hide();
$("input[name=\'width\']").show(); }
$(".thresholdDiv").hide(); });
}
});
$("#checkbox-summatory_series").change(function() {
if($("#checkbox-summatory_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-average_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#checkbox-average_series").change(function() {
if($("#checkbox-average_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-summatory_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
</script>'; $("#checkbox-summatory_series").change(function() {
if( $("#checkbox-summatory_series").is(":checked") &&
$("#checkbox-modules_series").is(":disabled")
) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-average_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#checkbox-average_series").change(function() {
if( $("#checkbox-average_series").is(":checked") &&
$("#checkbox-modules_series").is(":disabled")
) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-summatory_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
});
</script>

View File

@ -1,16 +1,31 @@
<?php <?php
/**
* Combined graph
*
* @category Combined graph
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config; global $config;
if (is_ajax()) { if (is_ajax()) {
@ -21,7 +36,7 @@ if (is_ajax()) {
$id_agent = (int) get_parameter('id_agent'); $id_agent = (int) get_parameter('id_agent');
$string = (string) get_parameter('q'); $string = (string) get_parameter('q');
// q is what autocomplete plugin gives // Q is what autocomplete plugin gives.
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$filter = []; $filter = [];
@ -45,7 +60,9 @@ if (is_ajax()) {
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'RW') && ! check_acl($config['id_user'], 0, 'RM')) { if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM')
) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access graph builder' 'Trying to access graph builder'
@ -95,7 +112,7 @@ if ($add_graph) {
$stacked = $threshold; $stacked = $threshold;
} }
// Create graph // Create graph.
$values = [ $values = [
'id_user' => $config['id_user'], 'id_user' => $config['id_user'],
'name' => $name, 'name' => $name,
@ -114,7 +131,7 @@ if ($add_graph) {
if (trim($name) != '') { if (trim($name) != '') {
$id_graph = db_process_sql_insert('tgraph', $values); $id_graph = db_process_sql_insert('tgraph', $values);
if ($id_graph !== false) { if ($id_graph !== false) {
db_pandora_audit('Report management', "Create graph #$id_graph"); db_pandora_audit('Report management', 'Create graph #'.$id_graph);
} else { } else {
db_pandora_audit('Report management', 'Fail try to create graph'); db_pandora_audit('Report management', 'Fail try to create graph');
} }
@ -166,9 +183,15 @@ if ($update_graph) {
['id_graph' => $id_graph] ['id_graph' => $id_graph]
); );
if ($success !== false) { if ($success !== false) {
db_pandora_audit('Report management', "Update graph #$id_graph"); db_pandora_audit(
'Report management',
'Update graph #'.$id_graph
);
} else { } else {
db_pandora_audit('Report management', "Fail try to update graph #$id_graph"); db_pandora_audit(
'Report management',
'Fail try to update graph #'.$id_graph
);
} }
} else { } else {
$success = false; $success = false;
@ -188,12 +211,12 @@ if ($add_module) {
$id_agents = get_parameter('id_agents'); $id_agents = get_parameter('id_agents');
$weight = get_parameter('weight'); $weight = get_parameter('weight');
// Id modules has double entities conversion // Id modules has double entities conversion.
// Safe output remove all entities // Safe output remove all entities.
io_safe_output_array($id_modules, ''); io_safe_output_array($id_modules, '');
// We need to put the entities again // We need to put the entities again
// to browse in db // to browse in db.
io_safe_input_array($id_modules); io_safe_input_array($id_modules);
$id_agent_modules = db_get_all_rows_sql( $id_agent_modules = db_get_all_rows_sql(
@ -304,23 +327,39 @@ switch ($tab) {
} }
if ($add_graph) { if ($add_graph) {
ui_print_result_message($id_graph, __('Graph stored successfully'), __('There was a problem storing Graph')); ui_print_result_message(
$id_graph,
__('Graph stored successfully'),
__('There was a problem storing Graph')
);
} }
if ($add_module) { if ($add_module) {
ui_print_result_message($result, __('Module added successfully'), __('There was a problem adding Module')); ui_print_result_message(
$result,
__('Module added successfully'),
__('There was a problem adding Module')
);
} }
if ($update_graph) { if ($update_graph) {
ui_print_result_message($success, __('Update the graph'), __('Bad update the graph')); ui_print_result_message(
$success,
__('Update the graph'),
__('Bad update the graph')
);
} }
if ($delete_module) { if ($delete_module) {
ui_print_result_message($result, __('Graph deleted successfully'), __('There was a problem deleting Graph')); ui_print_result_message(
$result,
__('Graph deleted successfully'),
__('There was a problem deleting Graph')
);
} }
// Parse CHUNK information into showable information // Parse CHUNK information into showable information.
// Split id to get all parameters // Split id to get all parameters.
if (!$delete_module) { if (!$delete_module) {
if (isset($_POST['period'])) { if (isset($_POST['period'])) {
$period = $_POST['period']; $period = $_POST['period'];

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);
} }
} }
@ -307,8 +307,9 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'VR')) {
$return_all_group = true; $return_all_group = true;
} }
echo '<div class="w250px inline">';
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false); html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
echo '</div>';
echo "<td style='width:25%;'>"; echo "<td style='width:25%;'>";
echo __('Group Recursion').'&nbsp;'; echo __('Group Recursion').'&nbsp;';
html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()');

View File

@ -156,6 +156,8 @@ $agent_max_value = true;
$agent_min_value = true; $agent_min_value = true;
$uncompressed_module = true; $uncompressed_module = true;
$graph_render = (empty($config['type_mode_graph']) === true) ? 0 : $config['type_mode_graph'];
switch ($action) { switch ($action) {
case 'new': case 'new':
$actionParameter = 'save'; $actionParameter = 'save';
@ -221,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;
} }
@ -259,7 +262,8 @@ switch ($action) {
case 'simple_graph': case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0; $percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
$graph_render = $item['graph_render'];
// The break hasn't be forgotten. // The break hasn't be forgotten.
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'projection_graph': case 'projection_graph':
@ -653,6 +657,7 @@ switch ($action) {
$period = $item['period']; $period = $item['period'];
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$recursion = $item['recursion']; $recursion = $item['recursion'];
$graph_render = $item['graph_render'];
break; break;
case 'top_n': case 'top_n':
@ -1260,6 +1265,7 @@ $class = 'databox filters';
<td style="font-weight:bold;"><?php echo __('Group'); ?></td> <td style="font-weight:bold;"><?php echo __('Group'); ?></td>
<td style=""> <td style="">
<?php <?php
echo '<div class="w250px inline padding-right-2-imp">';
if (check_acl($config['id_user'], 0, 'RW')) { if (check_acl($config['id_user'], 0, 'RW')) {
html_print_select_groups( html_print_select_groups(
$config['id_user'], $config['id_user'],
@ -1280,6 +1286,8 @@ $class = 'databox filters';
); );
} }
echo '</div>';
echo '&nbsp;&nbsp;&nbsp;'.__('Recursion').'&nbsp;&nbsp;&nbsp;'.html_print_checkbox_switch( echo '&nbsp;&nbsp;&nbsp;'.__('Recursion').'&nbsp;&nbsp;&nbsp;'.html_print_checkbox_switch(
'recursion', 'recursion',
1, 1,
@ -1376,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;
@ -2091,6 +2098,49 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_graph_render" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Graph render');
?>
</td>
<td>
<?php
$list_graph_render = [
1 => __('Avg, max & min'),
2 => __('Max only'),
3 => __('Min only'),
0 => __('Avg only'),
];
html_print_select(
$list_graph_render,
'graph_render',
$graph_render
);
?>
</td>
</tr>
<tr id="row_fullscale" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Full resolution graph (TIP)').ui_print_help_tip(
__('TIP mode charts do not support average - maximum - minimum series, you can only enable TIP or average, maximum or minimum series'),
true
);
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'fullscale',
1,
$fullscale
);
?>
</td>
</tr>
<tr id="row_time_compare_overlapped" style="" class="datos"> <tr id="row_time_compare_overlapped" style="" class="datos">
<td style="font-weight:bold;"> <td style="font-weight:bold;">
<?php <?php
@ -2108,29 +2158,9 @@ $class = 'databox filters';
</td> </td>
</tr> </tr>
<tr id="row_fullscale" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Full resolution graph (TIP)').ui_print_help_tip(
__('This option may cause performance issues.'),
true
);
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'fullscale',
1,
$fullscale
);
?>
</td>
</tr>
<tr id="row_percentil" style="" class="datos"> <tr id="row_percentil" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Percentil'); ?></td> <td style="font-weight:bold;"><?php echo __('Percentil'); ?></td>
<td><?php html_print_checkbox('percentil', 1, $percentil); ?></td> <td><?php html_print_checkbox_switch('percentil', 1, $percentil); ?></td>
</tr> </tr>
<tr id="row_exception_condition_value" style="" class="datos"> <tr id="row_exception_condition_value" style="" class="datos">
@ -3714,7 +3744,16 @@ $(document).ready (function () {
$("#combo_group").change ( $("#combo_group").change (
function () { function () {
$("#id_agents").html('');
// 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_agents2").html(''); $("#id_agents2").html('');
$("#module").html(''); $("#module").html('');
$("#inventory_modules").html(''); $("#inventory_modules").html('');
@ -3742,6 +3781,7 @@ $(document).ready (function () {
); );
} }
); );
$("#combo_group").change();
$("#checkbox-recursion").change ( $("#checkbox-recursion").change (
function () { function () {
@ -3891,6 +3931,16 @@ $(document).ready (function () {
}); });
}); });
$("#checkbox-fullscale").change(function(e){
if(e.target.checked === true) {
$("#graph_render").prop('disabled', 'disabled');
} else {
$("#graph_render").prop('disabled', false);
}
});
$('#checkbox-fullscale').trigger('change');
$("#submit-create_item").click(function () { $("#submit-create_item").click(function () {
var type = $('#type').val(); var type = $('#type').val();
var name = $('#text-name').val(); var name = $('#text-name').val();
@ -4906,6 +4956,7 @@ function chooseType() {
$("#row_show_graph").hide(); $("#row_show_graph").hide();
$("#row_max_min_avg").hide(); $("#row_max_min_avg").hide();
$("#row_fullscale").hide(); $("#row_fullscale").hide();
$("#row_graph_render").hide();
$("#row_time_compare_overlapped").hide(); $("#row_time_compare_overlapped").hide();
$("#row_quantity").hide(); $("#row_quantity").hide();
$("#row_exception_condition_value").hide(); $("#row_exception_condition_value").hide();
@ -5010,8 +5061,14 @@ function chooseType() {
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show(); $("#row_time_compare_overlapped").show();
$("#row_fullscale").show(); $("#row_fullscale").show();
if ($("#checkbox-percentil").prop("checked")) $("#row_graph_render").show();
$("#row_percentil").show(); $("#row_percentil").show();
// Force type.
if('<?php echo $action; ?>' === 'new'){
$("#graph_render").val(<?php echo $graph_render; ?>);
}
// The break hasn't be forgotten, this element // The break hasn't be forgotten, this element
// only should be shown on the simple graphs. // only should be shown on the simple graphs.
case 'simple_baseline_graph': case 'simple_baseline_graph':
@ -5377,7 +5434,12 @@ function chooseType() {
$("#row_description").show(); $("#row_description").show();
$("#row_period").show(); $("#row_period").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_graph_render").show();
$("#row_fullscale").show(); $("#row_fullscale").show();
// Force MAX type.
if('<?php echo $action; ?>' === 'new'){
$("#graph_render").val(2);
}
break; break;
case 'top_n': case 'top_n':

View File

@ -1,18 +1,28 @@
<?php <?php
// Pandora FMS - http://pandorafms.com /**
// ================================================== * Reporting builder main.
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas *
// Please see http://pandorafms.org for full contribution list * @category Options reports.
// This program is free software; you can redistribute it and/or * @package Pandora FMS
// modify it under the terms of the GNU General Public License * @subpackage Enterprise
// as published by the Free Software Foundation for version 2. * @version 1.0.0
// This program is distributed in the hope that it will be useful, * @license See below
// but WITHOUT ANY WARRANTY; without even the implied warranty of *
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * ______ ___ _______ _______ ________
// GNU General Public License for more details. * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2007-2019 Artica Soluciones Tecnologicas, http://www.artica.es
* This code is NOT free software. This code is NOT licenced under GPL2 licence
* You cannnot redistribute it without written permission of copyright holder.
* ============================================================================
*/
global $config; global $config;
// Login check // Login check.
check_login(); check_login();
if (! check_acl($config['id_user'], 0, 'RW')) { if (! check_acl($config['id_user'], 0, 'RW')) {
@ -29,6 +39,7 @@ require_once $config['homedir'].'/include/functions_users.php';
$groups = users_get_groups(); $groups = users_get_groups();
switch ($action) { switch ($action) {
default:
case 'new': case 'new':
$actionButtonHtml = html_print_submit_button( $actionButtonHtml = html_print_submit_button(
__('Save'), __('Save'),
@ -39,7 +50,6 @@ switch ($action) {
); );
$hiddenFieldAction = 'save'; $hiddenFieldAction = 'save';
break; break;
case 'update': case 'update':
case 'edit': case 'edit':
$actionButtonHtml = html_print_submit_button( $actionButtonHtml = html_print_submit_button(
@ -59,7 +69,7 @@ $table->id = 'add_alert_table';
$table->class = 'databox filters'; $table->class = 'databox filters';
$table->head = []; $table->head = [];
if (is_metaconsole()) { if (is_metaconsole() === true) {
$table->head[0] = __('Main data'); $table->head[0] = __('Main data');
$table->head_colspan[0] = 4; $table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
@ -70,7 +80,7 @@ $table->size = [];
$table->size = []; $table->size = [];
$table->size[0] = '15%'; $table->size[0] = '15%';
$table->size[1] = '90%'; $table->size[1] = '90%';
if (!is_metaconsole()) { if (is_metaconsole() === false) {
$table->style[0] = 'font-weight: bold; vertical-align: top;'; $table->style[0] = 'font-weight: bold; vertical-align: top;';
} else { } else {
$table->style[0] = 'font-weight: bold;'; $table->style[0] = 'font-weight: bold;';
@ -89,125 +99,154 @@ $table->data['name'][1] = html_print_input_text(
); );
$table->data['group'][0] = __('Group'); $table->data['group'][0] = __('Group');
$write_groups = users_get_groups_for_select(false, 'AR', true, true, false, 'id_grupo'); $write_groups = users_get_groups_for_select(
false,
'AR',
true,
true,
false,
'id_grupo'
);
// If the report group is not among the
// RW groups (special permission) we add it.
if (isset($write_groups[$idGroupReport]) === false && $idGroupReport) {
$write_groups[$idGroupReport] = groups_get_name($idGroupReport);
}
html_print_select_groups( $table->data['group'][1] = '<div class="w290px inline">';
$config['id_user'], $table->data['group'][1] .= html_print_select_groups(
'AR', $config['id_user'],
true, 'AR',
'id_group', true,
$idGroup, 'id_group',
$idGroupReport,
'',
'',
'',
true
);
$table->data['group'][1] .= '</div>';
if ($report_id_user == $config['id_user']
|| is_user_admin($config['id_user'])
) {
// S/he is the creator of report (or admin) and s/he can change the access.
$type_access = [
'group_view' => __('Only the group can view the report'),
'group_edit' => __('The next group can edit the report'),
'user_edit' => __('Only the user and admin user can edit the report'),
];
$table->data['access'][0] = __('Write Access');
$table->data['access'][0] .= ui_print_help_tip(
__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'),
true
);
$table->data['access'][1] = html_print_select(
$type_access,
'type_access',
$type_access_selected,
'change_type_access(this)',
'', '',
0,
true
);
$style = 'display: none;';
if ($type_access_selected == 'group_edit') {
$style = '';
}
$table->data['access'][1] .= '<span style="'.$style.'" class="access_subform" id="group_edit">';
$table->data['access'][1] .= '<div class="w290px inline">';
$table->data['access'][1] .= html_print_select_groups(
false,
'RW',
false,
'id_group_edit',
$id_group_edit,
false,
'', '',
'', '',
true true
); );
$table->data['access'][1] .= '</div>';
$table->data['access'][1] .= '</span>';
}
if ($enterpriseEnable) {
// If the report group is not among the RW groups (special permission) we add it $non_interactive_check = false;
if (!isset($write_groups[$idGroupReport]) && $idGroupReport) { if (isset($non_interactive)) {
$write_groups[$idGroupReport] = groups_get_name($idGroupReport); $non_interactive_check = $non_interactive;
} }
$table->data['group'][1] = html_print_select( $table->data['interactive_report'][0] = __('Non interactive report');
$write_groups, $table->data['interactive_report'][1] = __('Yes');
'id_group', $table->data['interactive_report'][1] .= '&nbsp;&nbsp;&nbsp;';
$idGroupReport, $table->data['interactive_report'][1] .= html_print_radio_button(
false, 'non_interactive',
1,
'', '',
$non_interactive_check,
true
);
$table->data['interactive_report'][1] .= '&nbsp;&nbsp;';
$table->data['interactive_report'][1] .= __('No');
$table->data['interactive_report'][1] .= '&nbsp;&nbsp;&nbsp;';
$table->data['interactive_report'][1] .= html_print_radio_button(
'non_interactive',
0,
'', '',
true, $non_interactive_check,
false, true
false );
}
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea(
'description',
5,
15,
$description,
'',
true
);
if (enterprise_installed() === true) {
$table->data['cover'][0] = __('Generate cover page in PDF render');
$table->data['cover'][1] = html_print_checkbox_switch(
'cover_page_render',
1,
$cover_page_render,
true
); );
if ($report_id_user == $config['id_user'] $table->data['index'][0] = __('Generate index in PDF render');
|| is_user_admin($config['id_user']) $table->data['index'][1] = html_print_checkbox_switch(
) { 'index_render',
// S/he is the creator of report (or admin) and s/he can change the access. 1,
$type_access = [ $index_render,
'group_view' => __('Only the group can view the report'), true
'group_edit' => __('The next group can edit the report'), );
'user_edit' => __('Only the user and admin user can edit the report'), }
];
$table->data['access'][0] = __('Write Access').ui_print_help_tip(__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'), true);
$table->data['access'][1] = html_print_select(
$type_access,
'type_access',
$type_access_selected,
'change_type_access(this)',
'',
0,
true
);
$style = 'display: none;'; echo '<form class="" method="post">';
if ($type_access_selected == 'group_edit') { html_print_table($table);
$style = '';
}
$table->data['access'][1] .= '<span style="'.$style.'" class="access_subform" id="group_edit"> echo '<div class="action-buttons" style="width: '.$table->width.'">';
'.html_print_select_groups( echo $actionButtonHtml;
false, html_print_input_hidden('action', $hiddenFieldAction);
'RW', html_print_input_hidden('id_report', $idReport);
false, echo '</div></form>';
'id_group_edit', ?>
$id_group_edit,
false,
'',
'',
true
).'
</span>';
}
if ($enterpriseEnable) {
$non_interactive_check = false;
if (isset($non_interactive)) {
$non_interactive_check = $non_interactive;
}
$table->data['interactive_report'][0] = __('Non interactive report');
$table->data['interactive_report'][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button(
'non_interactive',
1,
'',
$non_interactive_check,
true
).'&nbsp;&nbsp;';
$table->data['interactive_report'][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button(
'non_interactive',
0,
'',
$non_interactive_check,
true
);
}
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea('description', 5, 15, $description, '', true);
echo '<form class="" method="post">';
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo $actionButtonHtml;
html_print_input_hidden('action', $hiddenFieldAction);
html_print_input_hidden('id_report', $idReport);
echo '</div></form>';
?>
<script type="text/javascript"> <script type="text/javascript">
function change_type_access(select_item) { function change_type_access(select_item) {
$(".access_subform").hide(); $(".access_subform").hide();
switch ($(select_item).val()) { if ($(select_item).val() == "group_edit") {
case 'group_view': $("#group_edit").show()
break; } else {
case 'group_edit': $("#group_edit").hide()
$("#group_edit").show();
break;
case 'user_edit':
break;
} }
} }
</script> </script>

View File

@ -1180,6 +1180,8 @@ switch ($action) {
$report_id_user = 0; $report_id_user = 0;
$type_access_selected = reports_get_type_access(false); $type_access_selected = reports_get_type_access(false);
$id_group_edit = 0; $id_group_edit = 0;
$cover_page_render = true;
$index_render = true;
break; break;
case 'item_editor': case 'item_editor':
@ -1215,6 +1217,12 @@ switch ($action) {
$report_id_user = get_parameter('report_id_user'); $report_id_user = get_parameter('report_id_user');
$non_interactive = get_parameter('non_interactive', 0); $non_interactive = get_parameter('non_interactive', 0);
$cover_page_render = get_parameter_switch(
'cover_page_render',
0
);
$index_render = get_parameter_switch('index_render', 0);
$custom_font = $config['custom_report_front_font']; $custom_font = $config['custom_report_front_font'];
switch ($type_access_selected) { switch ($type_access_selected) {
@ -1241,12 +1249,14 @@ switch ($action) {
if ($action == 'update') { if ($action == 'update') {
if ($reportName != '' && $idGroupReport != '') { if ($reportName != '' && $idGroupReport != '') {
$new_values = [ $new_values = [
'name' => $reportName, 'name' => $reportName,
'id_group' => $idGroupReport, 'id_group' => $idGroupReport,
'description' => $description, 'description' => $description,
'private' => $private, 'private' => $private,
'id_group_edit' => $id_group_edit, 'id_group_edit' => $id_group_edit,
'non_interactive' => $non_interactive, 'non_interactive' => $non_interactive,
'cover_page_render' => $cover_page_render,
'index_render' => $index_render,
]; ];
@ -1311,19 +1321,21 @@ switch ($action) {
$idOrResult = db_process_sql_insert( $idOrResult = db_process_sql_insert(
'treport', 'treport',
[ [
'name' => $reportName, 'name' => $reportName,
'id_group' => $idGroupReport, 'id_group' => $idGroupReport,
'description' => $description, 'description' => $description,
'first_page' => $first_page, 'first_page' => $first_page,
'private' => $private, 'private' => $private,
'id_group_edit' => $id_group_edit, 'id_group_edit' => $id_group_edit,
'id_user' => $config['id_user'], 'id_user' => $config['id_user'],
'metaconsole' => $metaconsole_report, 'metaconsole' => $metaconsole_report,
'non_interactive' => $non_interactive, 'non_interactive' => $non_interactive,
'custom_font' => $custom_font, 'custom_font' => $custom_font,
'custom_logo' => $logo, 'custom_logo' => $logo,
'header' => $header, 'header' => $header,
'footer' => $footer, 'footer' => $footer,
'cover_page_render' => $cover_page_render,
'index_render' => $index_render,
] ]
); );
@ -1368,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'];
@ -1632,6 +1645,9 @@ switch ($action) {
break; break;
case 'simple_graph': case 'simple_graph':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
case 'simple_baseline_graph': case 'simple_baseline_graph':
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
$values['show_graph'] = (int) get_parameter( $values['show_graph'] = (int) get_parameter(
@ -1641,6 +1657,14 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'network_interfaces_report':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'min_value': case 'min_value':
case 'max_value': case 'max_value':
case 'avg_value': case 'avg_value':
@ -1788,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'))
@ -1844,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')
) { ) {
@ -2274,6 +2293,9 @@ switch ($action) {
break; break;
case 'simple_graph': case 'simple_graph':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
case 'simple_baseline_graph': case 'simple_baseline_graph':
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
$values['show_graph'] = (int) get_parameter( $values['show_graph'] = (int) get_parameter(
@ -2283,6 +2305,14 @@ switch ($action) {
$good_format = true; $good_format = true;
break; break;
case 'network_interfaces_report':
$values['graph_render'] = (int) get_parameter(
'graph_render'
);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'min_value': case 'min_value':
case 'max_value': case 'max_value':
case 'avg_value': case 'avg_value':
@ -2714,6 +2744,8 @@ switch ($action) {
$id_group_edit = $report['id_group_edit']; $id_group_edit = $report['id_group_edit'];
$report_id_user = $report['id_user']; $report_id_user = $report['id_user'];
$non_interactive = $report['non_interactive']; $non_interactive = $report['non_interactive'];
$cover_page_render = $report['cover_page_render'];
$index_render = $report['index_render'];
break; break;
case 'delete': case 'delete':
@ -3084,22 +3116,23 @@ if ($enterpriseEnable) {
} }
} }
$urlB = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder';
$buttons = [ $buttons = [
'list_reports' => [ 'list_reports' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">'.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'</a>', 'text' => '<a href="'.$urlB.'&pure='.$pure.'">'.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'</a>',
], ],
'main' => [ 'main' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'</a>', 'text' => '<a href="'.$urlB.'&tab=main&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'</a>',
], ],
'list_items' => [ 'list_items' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List items')]).'</a>', 'text' => '<a href="'.$urlB.'&tab=list_items&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List items')]).'</a>',
], ],
'item_editor' => [ 'item_editor' => [
'active' => false, 'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Item editor')]).'</a>', 'text' => '<a href="'.$urlB.'&tab=item_editor&action=new&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Item editor')]).'</a>',
], ],
]; ];

View File

@ -136,7 +136,7 @@ if ($action == 'new') {
$table->data[1][0] = __('Group:'); $table->data[1][0] = __('Group:');
$table->data[1][1] = html_print_select_groups( $table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'], $config['id_user'],
'RW', 'RW',
true, true,
@ -146,7 +146,7 @@ $table->data[1][1] = html_print_select_groups(
'', '',
'', '',
true true
); ).'</div>';
$backgrounds_list = list_files( $backgrounds_list = list_files(
$config['homedir'].'/images/console/background/', $config['homedir'].'/images/console/background/',
'jpg', 'jpg',

View File

@ -381,7 +381,7 @@ if (is_metaconsole()) {
$table->rowstyle['all_3'] = 'display: none;'; $table->rowstyle['all_3'] = 'display: none;';
$table->data['all_3'][0] = __('Groups'); $table->data['all_3'][0] = __('Groups');
$table->colspan['all_3'][1] = '3'; $table->colspan['all_3'][1] = '3';
$table->data['all_3'][1] = html_print_select_groups( $table->data['all_3'][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'], $config['id_user'],
'AR', 'AR',
true, true,
@ -391,7 +391,7 @@ $table->data['all_3'][1] = html_print_select_groups(
'', '',
0, 0,
true true
); ).'</div>';
$table->rowstyle['all_one_item_per_agent'] = 'display: none'; $table->rowstyle['all_one_item_per_agent'] = 'display: none';

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

@ -55,7 +55,11 @@ if (isset($_POST['create'])) {
'expire_timestamp' => $expire_timestamp, 'expire_timestamp' => $expire_timestamp,
]; ];
$id_link = db_process_sql_insert('tnews', $values); if ($subject === '') {
$id_link = false;
} else {
$id_link = db_process_sql_insert('tnews', $values);
}
ui_print_result_message( ui_print_result_message(
$id_link, $id_link,
@ -92,7 +96,11 @@ if (isset($_POST['update'])) {
'expire_timestamp' => $expire_timestamp, 'expire_timestamp' => $expire_timestamp,
]; ];
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]); if ($subject === '') {
$result = false;
} else {
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
}
ui_print_result_message( ui_print_result_message(
$result, $result,
@ -173,10 +181,12 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
$data = []; $data = [];
$data[0] = __('Subject').'<br>'; $data[0] = __('Subject').'<br>';
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'">'; $data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
$data[1] = __('Group').'<br>'; $data[1] = __('Group').'<br>';
$data[1] .= '<div class="w250px">';
$data[1] .= html_print_select_groups($config['id_user'], 'ER', users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, ''); $data[1] .= html_print_select_groups($config['id_user'], 'ER', users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, '');
$data[1] .= '</div>';
$data[2] = __('Modal screen').'<br>'; $data[2] = __('Modal screen').'<br>';
$data[2] .= html_print_checkbox_extended('modal', 1, $modal, false, '', 'style="margin-top: 5px;margin-bottom: 7px;"', true); $data[2] .= html_print_checkbox_extended('modal', 1, $modal, false, '', 'style="margin-top: 5px;margin-bottom: 7px;"', true);

View File

@ -189,6 +189,10 @@ if (is_ajax()) {
100, 100,
true true
); );
$row['control'] .= ui_print_reveal_password(
'ldap_admin_pass',
true
);
$table->data['ldap_admin_pass'] = $row; $table->data['ldap_admin_pass'] = $row;
break; break;

View File

@ -82,6 +82,7 @@ $table_remote->data['ehorus_user'] = $row;
$row = []; $row = [];
$row['name'] = __('Password'); $row['name'] = __('Password');
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); $row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('ehorus_pass', true);
$table_remote->data['ehorus_pass'] = $row; $table_remote->data['ehorus_pass'] = $row;
// Directory hostname. // Directory hostname.

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;
@ -124,7 +116,8 @@ $table->data[$i][0] = __('Phantomjs bin directory');
$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true); $table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
$table->data[$i][0] = __('Auto login (hash) password'); $table->data[$i][0] = __('Auto login (hash) password');
$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true); $table->data[$i][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
$table->data[$i++][1] .= ui_print_reveal_password('loginhash_pwd', true);
$table->data[$i][0] = __('Time source'); $table->data[$i][0] = __('Time source');
$sources['system'] = __('System'); $sources['system'] = __('System');
@ -162,7 +155,8 @@ if (isset($_POST['list_ACL_IPs_for_API'])) {
$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true); $table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
$table->data[$i][0] = __('API password'); $table->data[$i][0] = __('API password');
$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); $table->data[$i][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
$table->data[$i++][1] .= ui_print_reveal_password('api_password', true);
$table->data[$i][0] = __('Enable GIS features'); $table->data[$i][0] = __('Enable GIS features');
$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true); $table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
@ -387,6 +381,7 @@ $table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['
$table_mail_conf->data[6][0] = __('Email password'); $table_mail_conf->data[6][0] = __('Email password');
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true); $table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
$table_mail_conf->data[6][1] .= ui_print_reveal_password('email_password', true);
$uniqid = uniqid(); $uniqid = uniqid();
@ -479,7 +474,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 +491,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

@ -221,6 +221,7 @@ $table_remote->data['integria_user'] = $row;
$row = []; $row = [];
$row['name'] = __('Password'); $row['name'] = __('Password');
$row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true); $row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_pass', true);
$table_remote->data['integria_pass'] = $row; $table_remote->data['integria_pass'] = $row;
// Integria hostname. // Integria hostname.
@ -233,6 +234,7 @@ $table_remote->data['integria_hostname'] = $row;
$row = []; $row = [];
$row['name'] = __('API Password'); $row['name'] = __('API Password');
$row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true); $row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true);
$row['control'] .= ui_print_reveal_password('integria_api_pass', true);
$table_remote->data['integria_api_pass'] = $row; $table_remote->data['integria_api_pass'] = $row;
// Request timeout. // Request timeout.

View File

@ -738,67 +738,166 @@ $row++;
$table_chars->data = []; $table_chars->data = [];
$table_chars->data[$row][0] = __('Graph color #1'); $table_chars->data[$row][0] = __('Graph color #1');
$table_chars->data[$row][1] = html_print_input_text('graph_color1', $config['graph_color1'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color1',
$config['graph_color1'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #2'); $table_chars->data[$row][0] = __('Graph color #2');
$table_chars->data[$row][1] = html_print_input_text('graph_color2', $config['graph_color2'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color2',
$config['graph_color2'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #3'); $table_chars->data[$row][0] = __('Graph color #3');
$table_chars->data[$row][1] = html_print_input_text('graph_color3', $config['graph_color3'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color3',
$config['graph_color3'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #4'); $table_chars->data[$row][0] = __('Graph color #4');
$table_chars->data[$row][1] = html_print_input_text('graph_color4', $config['graph_color4'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color4',
$config['graph_color4'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #5'); $table_chars->data[$row][0] = __('Graph color #5');
$table_chars->data[$row][1] = html_print_input_text('graph_color5', $config['graph_color5'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color5',
$config['graph_color5'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #6'); $table_chars->data[$row][0] = __('Graph color #6');
$table_chars->data[$row][1] = html_print_input_text('graph_color6', $config['graph_color6'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color6',
$config['graph_color6'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #7'); $table_chars->data[$row][0] = __('Graph color #7');
$table_chars->data[$row][1] = html_print_input_text('graph_color7', $config['graph_color7'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color7',
$config['graph_color7'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #8'); $table_chars->data[$row][0] = __('Graph color #8');
$table_chars->data[$row][1] = html_print_input_text('graph_color8', $config['graph_color8'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color8',
$config['graph_color8'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #9'); $table_chars->data[$row][0] = __('Graph color #9');
$table_chars->data[$row][1] = html_print_input_text('graph_color9', $config['graph_color9'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color9',
$config['graph_color9'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph color #10'); $table_chars->data[$row][0] = __('Graph color #10');
$table_chars->data[$row][1] = html_print_input_text('graph_color10', $config['graph_color10'], '', 8, 8, true); $table_chars->data[$row][1] = html_print_input_text(
'graph_color10',
$config['graph_color10'],
'',
8,
8,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Value to interface graphics'); $table_chars->data[$row][0] = __('Value to interface graphics');
$table_chars->data[$row][1] = html_print_input_text('interface_unit', $config['interface_unit'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text(
'interface_unit',
$config['interface_unit'],
'',
20,
20,
true
);
$row++; $row++;
$disabled_graph_precision = false; $disabled_graph_precision = false;
if (!enterprise_installed()) { if (enterprise_installed() === false) {
$disabled_graph_precision = true; $disabled_graph_precision = true;
} }
$table_chars->data[$row][0] = __('Data precision'); $table_chars->data[$row][0] = __('Data precision');
$table_chars->data[$row][1] = html_print_input_text('graph_precision', $config['graph_precision'], '', 5, 5, true, $disabled_graph_precision, false, 'onChange="change_precision()"'); $table_chars->data[$row][1] = html_print_input_text(
'graph_precision',
$config['graph_precision'],
'',
5,
5,
true,
$disabled_graph_precision,
false,
'onChange="change_precision()"'
);
$row++; $row++;
if (!isset($config['short_module_graph_data'])) { if (isset($config['short_module_graph_data']) === false) {
$config['short_module_graph_data'] = true; $config['short_module_graph_data'] = true;
} }
$table_chars->data[$row][0] = __('Data precision in graphs'); $table_chars->data[$row][0] = __('Data precision in graphs');
$table_chars->data[$row][1] = html_print_input_text('short_module_graph_data', $config['short_module_graph_data'], '', 5, 5, true, $disabled_graph_precision, false, 'onChange="change_precision()"'); $table_chars->data[$row][1] = html_print_input_text(
'short_module_graph_data',
$config['short_module_graph_data'],
'',
5,
5,
true,
$disabled_graph_precision,
false,
'onChange="change_precision()"'
);
$row++; $row++;
$table_chars->data[$row][0] = __('Default line thickness for the Custom Graph.'); $table_chars->data[$row][0] = __(
'Default line thickness for the Custom Graph.'
);
$table_chars->data[$row][1] = html_print_input_text( $table_chars->data[$row][1] = html_print_input_text(
'custom_graph_width', 'custom_graph_width',
$config['custom_graph_width'], $config['custom_graph_width'],
@ -818,6 +917,15 @@ $row++;
); );
$row++; $row++;
$table_chars->data[$row][0] = __('Chart fit to content');
$table_chars->data[$row][1] = html_print_checkbox_switch(
'maximum_y_axis',
1,
$config['maximum_y_axis'],
true
);
$row++;
$table_chars->data[$row][0] = __('Type of module charts'); $table_chars->data[$row][0] = __('Type of module charts');
$table_chars->data[$row][1] = __('Area').'&nbsp;'.html_print_radio_button( $table_chars->data[$row][1] = __('Area').'&nbsp;'.html_print_radio_button(
'type_module_charts', 'type_module_charts',
@ -853,7 +961,14 @@ $row++;
$row++; $row++;
$table_chars->data[$row][0] = __('Percentile'); $table_chars->data[$row][0] = __('Percentile');
$table_chars->data[$row][1] = html_print_input_text('percentil', $config['percentil'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text(
'percentil',
$config['percentil'],
'',
20,
20,
true
);
$row++; $row++;
$table_chars->data[$row][0] = __('Graph TIP view:'); $table_chars->data[$row][0] = __('Graph TIP view:');
@ -863,17 +978,37 @@ $row++;
$options_full_escale[1] = __('All'); $options_full_escale[1] = __('All');
$options_full_escale[2] = __('On Boolean graphs'); $options_full_escale[2] = __('On Boolean graphs');
$table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scale_option', $config['full_scale_option'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_full_escale,
'full_scale_option',
$config['full_scale_option'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
$table_chars->data[$row][0] = __('Show only average'); $table_chars->data[$row][0] = __('Graph mode');
$options_soft_graphs = []; $options_soft_graphs = [];
$options_soft_graphs[0] = __('Show only average by default'); $options_soft_graphs[0] = __('Show only average by default');
$options_soft_graphs[1] = __('Show MAX/AVG/MIN by default'); $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config['type_mode_graph'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_soft_graphs,
'type_mode_graph',
$config['type_mode_graph'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
$table_chars->data[$row][0] = __('Zoom graphs:'); $table_chars->data[$row][0] = __('Zoom graphs:');
@ -885,18 +1020,19 @@ $row++;
$options_zoom_graphs[4] = 'x4'; $options_zoom_graphs[4] = 'x4';
$options_zoom_graphs[5] = 'x5'; $options_zoom_graphs[5] = 'x5';
$table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_graph', $config['zoom_graph'], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select(
$options_zoom_graphs,
'zoom_graph',
$config['zoom_graph'],
'',
'',
0,
true,
false,
false
);
$row++; $row++;
/*
$table_font->data[$row][0] = __('Font path');
$fonts = load_fonts();
$table_font->data[$row][1] = html_print_select($fonts, 'fontpath',
io_safe_output($config["fontpath"]), '', '', 0, true);
$row++;
*/
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).'</legend>'; echo '<legend>'.__('Charts configuration').' '.ui_print_help_icon('charts_conf_tab', true).'</legend>';
html_print_table($table_chars); html_print_table($table_chars);

View File

@ -776,6 +776,7 @@ if ($create_alert || $update_alert) {
// Group // Group
echo '<tr id="tr-group"><td class="datos2">'.__('Group').'</td><td class="datos2">'; echo '<tr id="tr-group"><td class="datos2">'.__('Group').'</td><td class="datos2">';
echo '<div class="w250px">';
html_print_select_groups( html_print_select_groups(
$config['id_user'], $config['id_user'],
'AR', 'AR',
@ -796,6 +797,7 @@ if ($create_alert || $update_alert) {
'id_grupo', 'id_grupo',
false false
); );
echo '</div>';
echo '</td></tr>'; echo '</td></tr>';
// Trap type // Trap type

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