Merge branch 'develop' into feature/new_networkmap
|
@ -0,0 +1,61 @@
|
|||
FROM debian:jessie
|
||||
|
||||
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
|
||||
RUN groupadd -r mysql && useradd -r -g mysql mysql
|
||||
|
||||
RUN mkdir /docker-entrypoint-initdb.d
|
||||
|
||||
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
|
||||
# File::Basename
|
||||
# File::Copy
|
||||
# Sys::Hostname
|
||||
# Data::Dumper
|
||||
RUN apt-get update && apt-get install -y perl pwgen git --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
|
||||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
|
||||
|
||||
ENV MYSQL_MAJOR 5.6
|
||||
ENV MYSQL_VERSION 5.6.29-1debian8
|
||||
|
||||
RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
|
||||
|
||||
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
|
||||
# also, we set debconf keys to make APT a little quieter
|
||||
RUN { \
|
||||
echo mysql-community-server mysql-community-server/data-dir select ''; \
|
||||
echo mysql-community-server mysql-community-server/root-pass password ''; \
|
||||
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
|
||||
echo mysql-community-server mysql-community-server/remove-test-db select false; \
|
||||
} | debconf-set-selections \
|
||||
&& apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql
|
||||
|
||||
# comment out a few problematic configuration values
|
||||
# don't reverse lookup hostnames, they are usually another container
|
||||
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
|
||||
&& echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
|
||||
&& mv /tmp/my.cnf /etc/mysql/my.cnf
|
||||
|
||||
VOLUME /var/lib/mysql
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
COPY pandora.cnf /etc/mysql/conf.d
|
||||
COPY pandora_initdb.sh /docker-entrypoint-initdb.d
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Make ssh dir
|
||||
RUN mkdir /root/.ssh/
|
||||
# Copy over private key, and set permissions
|
||||
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
|
||||
RUN chown -R root:root /root/.ssh
|
||||
|
||||
|
||||
#Clone the repo
|
||||
RUN git config --global http.sslVerify false
|
||||
RUN git clone -b develop --single-branch https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb.sql /docker-entrypoint-initdb.d
|
||||
#RUN mv -f /tmp/pandorafms/pandora_console/pandoradb_data.sql /docker-entrypoint-initdb.d
|
||||
|
||||
EXPOSE 3306
|
||||
CMD ["mysqld"]
|
|
@ -0,0 +1,113 @@
|
|||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# if command starts with an option, prepend mysqld
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld "$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'mysqld' ]; then
|
||||
# Get config
|
||||
DATADIR="$("$@" --verbose --help --log-bin-index=`mktemp -u` 2>/dev/null | awk '$1 == "datadir" { print $2; exit }')"
|
||||
|
||||
if [ ! -d "$DATADIR/mysql" ]; then
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
echo >&2 'error: database is uninitialized and password option is not specified '
|
||||
echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DATADIR"
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
|
||||
echo 'Initializing database'
|
||||
mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf
|
||||
echo 'Database initialized'
|
||||
|
||||
"$@" --skip-networking &
|
||||
pid="$!"
|
||||
|
||||
mysql=( mysql --protocol=socket -uroot )
|
||||
|
||||
for i in {30..0}; do
|
||||
if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then
|
||||
break
|
||||
fi
|
||||
echo 'MySQL init process in progress...'
|
||||
sleep 1
|
||||
done
|
||||
if [ "$i" = 0 ]; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
|
||||
# sed is for https://bugs.mysql.com/bug.php?id=20545
|
||||
mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql
|
||||
fi
|
||||
|
||||
if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
|
||||
MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
|
||||
echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
|
||||
fi
|
||||
"${mysql[@]}" <<-EOSQL
|
||||
-- What's done in this file shouldn't be replicated
|
||||
-- or products like mysql-fabric won't work
|
||||
SET @@SESSION.SQL_LOG_BIN=0;
|
||||
|
||||
DELETE FROM mysql.user ;
|
||||
CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
|
||||
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
|
||||
DROP DATABASE IF EXISTS test ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOSQL
|
||||
|
||||
if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
mysql+=( -p"${MYSQL_ROOT_PASSWORD}" )
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}"
|
||||
mysql+=( "$MYSQL_DATABASE" )
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then
|
||||
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}"
|
||||
|
||||
if [ "$MYSQL_DATABASE" ]; then
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}"
|
||||
fi
|
||||
|
||||
echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}"
|
||||
fi
|
||||
|
||||
echo
|
||||
for f in /docker-entrypoint-initdb.d/*; do
|
||||
case "$f" in
|
||||
*.sh) echo "$0: running $f"; . "$f" ;;
|
||||
*.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;;
|
||||
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
|
||||
*) echo "$0: ignoring $f" ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
|
||||
if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then
|
||||
"${mysql[@]}" <<-EOSQL
|
||||
ALTER USER 'root'@'%' PASSWORD EXPIRE;
|
||||
EOSQL
|
||||
fi
|
||||
if ! kill -s TERM "$pid" || ! wait "$pid"; then
|
||||
echo >&2 'MySQL init process failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo 'MySQL init process done. Ready for start up.'
|
||||
echo
|
||||
fi
|
||||
|
||||
chown -R mysql:mysql "$DATADIR"
|
||||
fi
|
||||
|
||||
exec "$@"
|
|
@ -0,0 +1,11 @@
|
|||
[mysqld]
|
||||
sql_mode = ""
|
||||
character-set-server=utf8
|
||||
skip-character-set-client-handshake
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
# Mysql optimizations for Pandora FMS
|
||||
# Please check the documentation in http://pandorafms.com for better results
|
||||
innodb_file_per_table
|
||||
innodb_flush_log_at_trx_commit = 0
|
||||
innodb_flush_method = O_DIRECT
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < /tmp/pandorafms/pandora_console/pandoradb.sql
|
||||
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < /tmp/pandorafms/pandora_console/pandoradb_data.sql
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 6.1dev-160309
|
||||
Version: 6.1dev-160329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160309"
|
||||
pandora_version="6.1dev-160329"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '6.1dev';
|
||||
use constant AGENT_BUILD => '160309';
|
||||
use constant AGENT_BUILD => '160329';
|
||||
|
||||
# Commands to retrieve total memory information in kB
|
||||
use constant TOTALMEMORY_CMDS => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="6.1dev"
|
||||
PI_BUILD="160309"
|
||||
PI_BUILD="160329"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (c) 2016 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2016 Artica Soluciones Tecnologicas S.L.
|
||||
#
|
||||
# sockstat.sh Pandora FMS agent plug-in to retrieve file handle statistics.
|
||||
#
|
||||
# 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; version 2 of the License.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
###############################################################################
|
||||
OUT=`cat /proc/sys/fs/file-nr`
|
||||
ALLOC=`echo $OUT | cut -d' ' -f 1`
|
||||
UNUSED=`echo $OUT | cut -d' ' -f 2`
|
||||
MAX=`echo $OUT | cut -d' ' -f 3`
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>File handles allocated</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$ALLOC</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>File handles unused</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$UNUSED</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>File handles maximum</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$MAX</data>"
|
||||
echo '</module>'
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright (c) 2016 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2016 Artica Soluciones Tecnologicas S.L.
|
||||
#
|
||||
# sockstat.sh Pandora FMS agent plug-in to retrieve socket statistics.
|
||||
#
|
||||
# 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; version 2 of the License.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
###############################################################################
|
||||
OUT=`cat /proc/net/sockstat | grep TCP`
|
||||
MAX=`cat /proc/sys/net/ipv4/tcp_mem | cut -d' ' -f 3`
|
||||
INUSE=`echo $OUT | cut -d' ' -f 3`
|
||||
ORPHAN=`echo $OUT | cut -d' ' -f 5`
|
||||
TW=`echo $OUT | cut -d' ' -f 7`
|
||||
ALLOC=`echo $OUT | cut -d' ' -f 9`
|
||||
MEM=`echo $OUT | cut -d' ' -f 11`
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP sockets in use</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$INUSE</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP orphan sockets</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$ORPHAN</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP sockets in TIME_WAIT</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$TW</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP sockets allocated</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo "<data>$ALLOC</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP pages allocated</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo '<unit>pages</unit>'
|
||||
echo "<data>$MEM</data>"
|
||||
echo '</module>'
|
||||
|
||||
echo '<module>'
|
||||
echo '<name>TCP pages maximum</name>'
|
||||
echo '<type>generic_data</type>'
|
||||
echo '<unit>pages</unit>'
|
||||
echo "<data>$MAX</data>"
|
||||
echo '</module>'
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{160309}
|
||||
{160329}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("6.1dev(Build 160309)")
|
||||
#define PANDORA_VERSION ("6.1dev(Build 160329)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(6.1dev(Build 160309))"
|
||||
VALUE "ProductVersion", "(6.1dev(Build 160329))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-console
|
||||
Version: 6.1dev-160309
|
||||
Version: 6.1dev-160329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client
|
||||
Depends: php5, php5-snmp, php5-gd, php5-mysql, php-db, php5-xmlrpc, php-gettext, php5-curl, graphviz, dbconfig-common, php5-ldap, mysql-client | virtual-mysql-client
|
||||
Description: Pandora FMS is a monitoring Open Source software. It watches your systems and applications, and allows you to know the status of any element of those systems. Web console is the graphical user interface (GUI) to manage and watch reports and graphs from Pandora FMS monitoring.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160309"
|
||||
pandora_version="6.1dev-160329"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -5,7 +5,9 @@ chmod -R u+rwX,g+rX,g-w,o-rwx /var/www/pandora_console
|
|||
chgrp www-data /var/www/pandora_console -R
|
||||
chown www-data /var/www/pandora_console -R
|
||||
|
||||
if [ -f /etc/init.d/apache2 ]; then
|
||||
echo Restart the apache.
|
||||
/etc/init.d/apache2 restart
|
||||
fi
|
||||
|
||||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
FROM centos:centos6
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
RUN { \
|
||||
echo '[EPEL]'; \
|
||||
echo 'name = CentOS Epel'; \
|
||||
echo 'baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64'; \
|
||||
echo 'enabled=1'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
} > /etc/yum.repos.d/extra_repos.repo
|
||||
|
||||
RUN { \
|
||||
echo '[artica_pandorafms]'; \
|
||||
echo 'name=CentOS6 - PandoraFMS official repo'; \
|
||||
echo 'baseurl=http://artica.es/centos6'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
echo 'enabled=1'; \
|
||||
} > /etc/yum.repos.d/pandorafms.repo
|
||||
|
||||
RUN yum -y update; yum clean all;
|
||||
RUN yum install -y \
|
||||
git \
|
||||
httpd \
|
||||
cronie \
|
||||
ntp \
|
||||
openldap \
|
||||
anytermd \
|
||||
nfdump \
|
||||
wget \
|
||||
curl \
|
||||
openldap \
|
||||
plymouth \
|
||||
xterm \
|
||||
php \
|
||||
php-gd \
|
||||
graphviz \
|
||||
php-mysql \
|
||||
php-pear-DB \
|
||||
php-pear \
|
||||
php-pdo \
|
||||
php-mbstring \
|
||||
php-ldap \
|
||||
php-snmp \
|
||||
php-ldap \
|
||||
php-common \
|
||||
php-zip \
|
||||
nmap \
|
||||
xprobe2
|
||||
|
||||
#Clone the repo
|
||||
RUN git clone -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
#Exposing ports for: HTTP, SNMP Traps, Anytermd (SSH), Anytermd (Telnet), Tentacle protocol
|
||||
EXPOSE 80 162/udp 8022 8023 41121
|
||||
|
||||
# Simple startup script to avoid some issues observed with container restart
|
||||
ADD docker_entrypoint.sh /entrypoint.sh
|
||||
RUN chmod -v +x /entrypoint.sh
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
PANDORA_DB_HOST='mysql'
|
||||
else
|
||||
echo >&2 'warning: both PANDORA_DB_HOST and MYSQL_PORT_3306_TCP found'
|
||||
echo >&2 " Connecting to PANDORA_DB_HOST ($PANDORA_DB_HOST)"
|
||||
echo >&2 ' instead of the linked mysql container'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
echo >&2 'error: missing PANDORA_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
|
||||
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
|
||||
echo >&2 ' with -e PANDORA_DB_HOST=hostname:port?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if we're linked to MySQL and thus have credentials already, let's use them
|
||||
: ${PANDORA_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
|
||||
if [ "$PANDORA_DB_USER" = 'root' ]; then
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
||||
fi
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD}
|
||||
if [ -z "$PANDORA_DB_NAME" ]; then
|
||||
: ${PANDORA_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-pandora}}
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_PASSWORD" ]; then
|
||||
echo >&2 'error: missing required PANDORA_DB_PASSWORD environment variable'
|
||||
echo >&2 ' Did you forget to -e PANDORA_DB_PASSWORD=... ?'
|
||||
echo >&2
|
||||
echo >&2 ' (Also of interest might be PANDORA_DB_USER and PANDORA_DB_NAME.)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv -f /tmp/pandorafms/pandora_console /var/www/html
|
||||
cd /var/www/html/pandora_console/include
|
||||
cat > config.php <<- 'EOF'
|
||||
<?php
|
||||
$config["dbtype"] = "mysql";
|
||||
$config["homedir"]="/var/www/html/pandora_console"; // Config homedir
|
||||
$config["homeurl"]="/pandora_console"; // Base URL
|
||||
$config["homeurl_static"]="/pandora_console"; // Don't delete
|
||||
error_reporting(E_ALL);
|
||||
$ownDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
||||
EOF
|
||||
|
||||
echo "\$config[\"dbname\"]=\"$PANDORA_DB_NAME\";" >> config.php
|
||||
echo "\$config[\"dbuser\"]=\"$PANDORA_DB_USER\";" >> config.php
|
||||
echo "\$config[\"dbpass\"]=\"$PANDORA_DB_PASSWORD\";" >> config.php
|
||||
echo "\$config[\"dbhost\"]=\"$PANDORA_DB_HOST\";" >> config.php
|
||||
echo "include (\$ownDir . \"config_process.php\");" >> config.php
|
||||
echo "?>" >> config.php
|
||||
|
||||
echo "Granting apache permissions to the console directory"
|
||||
chown -R apache:apache /var/www/html/pandora_console
|
||||
chmod 600 /var/www/html/pandora_console/include/config.php
|
||||
|
||||
# Customize php.iniA
|
||||
echo "Configuring Pandora FMS elements and depending services"
|
||||
sed "s/.*error_reporting =.*/error_reporting = E_ALL \& \~E_DEPRECATED \& \~E_NOTICE \& \~E_USER_WARNING/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*max_execution_time =.*/max_execution_time = 0/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*max_input_time =.*/max_input_time = -1/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*upload_max_filesize =.*/upload_max_filesize = 800M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*memory_limit =.*/memory_limit = 500M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
sed "s/.*post_max_size =.*/post_max_size = 100M/" /etc/php.ini > /tmp/php.ini && mv /tmp/php.ini /etc/php.ini
|
||||
|
||||
cd /var/www/html/pandora_console && mv -f install.php install.php.done
|
||||
|
||||
#Create the pandora user to run the anyterd, mainly
|
||||
/usr/sbin/useradd -d /home/pandora -s /bin/false -M -g 0 pandora
|
||||
|
||||
#Rock n' roll!
|
||||
/etc/init.d/crond start &
|
||||
/etc/init.d/ntpd start &
|
||||
/etc/init.d/anytermd start &
|
||||
|
||||
rm -rf /run/httpd/*
|
||||
exec /usr/sbin/apachectl -D FOREGROUND
|
|
@ -3,3 +3,9 @@
|
|||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DEFAULT 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tserver`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
|
||||
|
|
|
@ -3,3 +3,9 @@
|
|||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE talert_templates ADD COLUMN min_alerts_reset_counter NUMBER(5, 0) DEFAULT 0;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tserver`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE tserver ADD COLUMN server_keepalive NUMBER(10, 0) DEFAULT 0;
|
||||
|
|
|
@ -88,7 +88,7 @@ $friday = true;
|
|||
$saturday = true;
|
||||
$sunday = true;
|
||||
$time_from = '00:00:00';
|
||||
$time_to = '23:59:00';
|
||||
$time_to = '00:00:00';
|
||||
$show_graph = 0;
|
||||
$sla_sorted_by = 0;
|
||||
$id_agents = '';
|
||||
|
|
|
@ -107,7 +107,8 @@ foreach ($layoutDatas as $layoutData) {
|
|||
visual_map_print_user_lines($layoutData);
|
||||
break;
|
||||
default:
|
||||
visual_map_print_item("write", $layoutData);
|
||||
visual_map_print_item("write", $layoutData,
|
||||
null, true, false, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,6 +179,8 @@ if ($filemanager) {
|
|||
$chunck_url = '&create=1';
|
||||
}
|
||||
|
||||
$homedir_filemanager = isset ($config['homedir_filemanager']) ? $config['homedir_filemanager'] : false;
|
||||
|
||||
filemanager_file_explorer($real_directory,
|
||||
$directory,
|
||||
'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin=' . $id_plugin,
|
||||
|
@ -187,7 +189,8 @@ if ($filemanager) {
|
|||
false,
|
||||
'index.php?sec=gservers&sec2=godmode/servers/plugin' . $chunck_url . '&plugin_command=[FILE_FULLPATH]&id_plugin=' . $id_plugin,
|
||||
true,
|
||||
0775);
|
||||
0775,
|
||||
$homedir_filemanager);
|
||||
|
||||
|
||||
return;
|
||||
|
|
|
@ -30,6 +30,7 @@ if (! check_acl ($config["id_user"], 0, "AW")) {
|
|||
|
||||
global $tiny;
|
||||
global $hidden_toggle;
|
||||
$date = time();
|
||||
|
||||
$servers = servers_get_info();
|
||||
if ($servers === false) {
|
||||
|
@ -84,12 +85,11 @@ foreach ($servers as $server) {
|
|||
$data[0] = '<span title="' . $server['version'] . '">' .
|
||||
$server['name'] . '</span>';
|
||||
|
||||
if ($server['status'] == 0) {
|
||||
//Status
|
||||
$data[1] = ui_print_status_image (STATUS_SERVER_OK, '', true);
|
||||
if (($server['status'] == 0) || (($date - strtotime($server['keepalive'])) > ($server['server_keepalive'])*2)) {
|
||||
$data[1] = ui_print_status_image (STATUS_SERVER_DOWN, '', true);
|
||||
}
|
||||
else {
|
||||
$data[1] = ui_print_status_image (STATUS_SERVER_OK, '', true);
|
||||
}
|
||||
|
||||
// Type
|
||||
$data[2] = '<span style="white-space:nowrap;">' . $server["img"];
|
||||
|
|
|
@ -62,7 +62,16 @@ $real_directory = realpath ($config['homedir'] . '/' . $directory);
|
|||
|
||||
echo '<h4>' . __('Index of %s', $directory) . '</h4>';
|
||||
|
||||
$homedir_filemanager = isset ($config['homedir_filemanager']) ? $config['homedir_filemanager'] : false;
|
||||
|
||||
filemanager_file_explorer($real_directory,
|
||||
$directory,
|
||||
'index.php?sec=gsetup&sec2=godmode/setup/file_manager');
|
||||
'index.php?sec=gsetup&sec2=godmode/setup/file_manager',
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
$homedir_filemanager);
|
||||
?>
|
||||
|
|
|
@ -36,13 +36,14 @@ enterprise_include_once('include/functions_visual_map.php');
|
|||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
$render_map = (bool)get_parameter('render_map', false);
|
||||
$graph_javascript = (bool)get_parameter('graph_javascript', false);
|
||||
|
||||
if ($render_map) {
|
||||
$width = (int)get_parameter('width', '400');
|
||||
$height = (int)get_parameter('height', '400');
|
||||
|
||||
visual_map_print_visual_map($id_visual_console, true, true, $width,
|
||||
$height);
|
||||
$height, '', false, $graph_javascript);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC160309';
|
||||
$build_version = 'PC160329';
|
||||
$pandora_version = 'v6.1dev';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$background_color = 'white', $modules_param = array(), $homeurl = '',
|
||||
$name_list = array(), $unit_list = array(), $show_last = true,
|
||||
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
|
||||
$dashboard = false) {
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -243,7 +243,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$show_min,
|
||||
$show_avg,
|
||||
$labels,
|
||||
$dashboard);
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -765,7 +765,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$unit = '', $baseline = 0, $return_data = 0, $show_title = true,
|
||||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
||||
$adapt_key = '', $compare = false, $show_unknown = false,
|
||||
$menu = true, $backgroundColor = 'white', $percentil = null) {
|
||||
$menu = true, $backgroundColor = 'white', $percentil = null,
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
@ -892,7 +893,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$config['font_size'], $unit, $ttl, $series_type,
|
||||
$chart_extra_data, $warning_min, $critical_min,
|
||||
$adapt_key, false, $series_suffix_str, $menu,
|
||||
$backgroundColor);
|
||||
$backgroundColor, $dashboard, $vconsole);
|
||||
}
|
||||
}
|
||||
elseif ($config['type_module_charts'] === 'line') {
|
||||
|
@ -969,7 +970,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
||||
$prediction_period = false, $background_color = 'white',
|
||||
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
|
||||
$show_min = true, $show_avg = true, $labels = false, $dashboard = false) {
|
||||
$show_min = true, $show_avg = true, $labels = false, $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
@ -1428,7 +1429,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date);
|
||||
' AND utimestamp < ' . (int) $date) .
|
||||
" ORDER BY utimestamp DESC";
|
||||
|
||||
if ($temp_data) {
|
||||
if (is_numeric($temp_data))
|
||||
|
@ -1483,7 +1485,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date);
|
||||
' AND utimestamp < ' . (int) $date) .
|
||||
" ORDER BY utimestamp DESC";
|
||||
|
||||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_name ($module));
|
||||
|
@ -1524,7 +1527,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date);
|
||||
' AND utimestamp < ' . (int) $date) .
|
||||
" ORDER BY utimestamp DESC";
|
||||
if ( $temp_data ){
|
||||
if (is_numeric($temp_data))
|
||||
$value = $temp_data;
|
||||
|
@ -1576,7 +1580,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date);
|
||||
' AND utimestamp < ' . (int) $date) .
|
||||
" ORDER BY utimestamp DESC";
|
||||
if ( $temp_data ) {
|
||||
if (is_numeric($temp_data))
|
||||
$value = $temp_data;
|
||||
|
@ -1708,7 +1713,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $homeurl, $water_mark, $config['fontpath'],
|
||||
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
|
||||
false, '', true, $background_color,$dashboard);
|
||||
false, '', true, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
default:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
|
@ -1716,21 +1721,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard);
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return line_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$unit, $ttl, $homeurl, $background_color,$dashboard);
|
||||
$unit, $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard);
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
return stacked_bullet_chart($flash_charts, $graph_values,
|
||||
|
@ -2104,7 +2109,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
|
|||
// If the data is not provided, we got it
|
||||
if ($data === false) {
|
||||
$data = reporting_get_agentmodule_sla_array ($id, $period,
|
||||
$sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to);
|
||||
$sla_min, $sla_max, $date, $daysWeek, null, null);
|
||||
}
|
||||
|
||||
$col_planned_downtime = '#20973F';
|
||||
|
|
|
@ -702,7 +702,16 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
global $config;
|
||||
|
||||
$fields = get_periods();
|
||||
|
||||
|
||||
if ( ! $selected ) {
|
||||
foreach( $fields as $t_key => $t_value){
|
||||
if ( $t_key != -1 ) { // -1 means 'custom'
|
||||
$selected = $t_key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($selected !== false) && (!isset($fields[$selected]) && $selected != 0)) {
|
||||
$fields[$selected] = human_time_description_raw($selected,true);
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ function menu_print_menu (&$menu) {
|
|||
$count_sub2 = 0;
|
||||
foreach ($sub['sub2'] as $key => $sub2) {
|
||||
|
||||
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $subsec2, false,$key)) == false) {
|
||||
if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec, $subsec2, false, $key)) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -387,17 +387,15 @@ function menu_print_menu (&$menu) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($menu_selected)
|
||||
$seleccionado = 'selected';
|
||||
else
|
||||
$seleccionado = '';
|
||||
|
||||
|
||||
//Print out the first level
|
||||
$output .= '<li class="'.implode (" ", $classes).' ' . $seleccionado . '" id="icon_'.$id.'">';
|
||||
//onclick="location.href=\'index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'\'">';
|
||||
|
||||
|
||||
$length = strlen(__($main["text"]));
|
||||
$padding_top = ( $length >= 18) ? 6 : 12;
|
||||
|
||||
|
@ -663,7 +661,7 @@ function menu_get_sec2_pages($sec, $sec2, $menu_hash = false) {
|
|||
|
||||
$sec3_array = array();
|
||||
|
||||
if (isset($sec2)) {
|
||||
if (isset($menu[$sec]['sub']) AND isset($menu[$sec]['sub'][$sec2]['sub2'])) {
|
||||
// Get the sec2 of the subsections
|
||||
foreach ($menu[$sec]['sub'][$sec2]['sub2'] as $k => $v) {
|
||||
$sec3_array[$k] = $v['text'];
|
||||
|
|
|
@ -7741,7 +7741,15 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
// Limit date to start searching data
|
||||
$datelimit = $date - $period;
|
||||
|
||||
|
||||
// Substract the not working time
|
||||
// Initialize the working time status machine ($wt_status)
|
||||
// Search the first data at worktime start
|
||||
list ($period_reduced, $wt_status, $datelimit_increased) = reporting_get_agentmodule_sla_day_period ($period, $date, $timeFrom, $timeTo);
|
||||
if ($period_reduced <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$wt_points = reporting_get_agentmodule_sla_working_timestamp ($period, $date, $timeFrom, $timeTo);
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
|
@ -7784,7 +7792,7 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* The not working time consideration is now doing in foreach loop above
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
|
@ -7801,6 +7809,7 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
case "oracle":
|
||||
break;
|
||||
}
|
||||
* */
|
||||
|
||||
|
||||
$sql .= ' ORDER BY utimestamp ASC';
|
||||
|
@ -7815,11 +7824,33 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
reporting_get_planned_downtimes_intervals($id_agent_module, $datelimit, $date);
|
||||
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data($id_agent_module, $datelimit);
|
||||
$previous_data = modules_get_previous_data($id_agent_module, $datelimit + $datelimit_increased);
|
||||
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
$previous_data['utimestamp'] = $datelimit + $datelimit_increased;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
} else if (count ($interval_data) > 0) {
|
||||
// Propagate undefined status to first time point
|
||||
$first_interval_time = array_shift ($interval_data);
|
||||
$previous_point = $datelimit + $datelimit_increased;
|
||||
$point = $datelimit + $datelimit_increased;
|
||||
// Remove rebased points and substract time only on working time
|
||||
while ($wt_points[0] <= $first_interval_time['utimestamp']) {
|
||||
$point = array_shift ($wt_points);
|
||||
if ($wt_status){
|
||||
$period_reduced -= $point - $previous_point;
|
||||
}
|
||||
$wt_status = !$wt_status;
|
||||
$previous_point = $point;
|
||||
}
|
||||
if ($wt_status){
|
||||
$period_reduced -= $first_interval_time['utimestamp'] - $point;
|
||||
}
|
||||
array_unshift ($interval_data, $first_interval_time);
|
||||
}
|
||||
|
||||
if (count ($wt_points) < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get next data
|
||||
|
@ -7868,8 +7899,18 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
// Previous status was critical
|
||||
if ($previous_status == 1) {
|
||||
// Test if working time is changed
|
||||
while ($wt_points[0] <= $data['utimestamp']) {
|
||||
$intermediate_point = array_shift($wt_points);
|
||||
if ($wt_status && ($previous_status == 1)) {
|
||||
$bad_period += $intermediate_point - $previous_utimestamp;
|
||||
}
|
||||
$previous_utimestamp = $intermediate_point;
|
||||
$wt_status = !$wt_status;
|
||||
}
|
||||
|
||||
// Increses bad_period only if it is working time
|
||||
if ($wt_status && ($previous_status == 1)) {
|
||||
$bad_period += $data['utimestamp'] - $previous_utimestamp;
|
||||
}
|
||||
|
||||
|
@ -7895,7 +7936,7 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
|
||||
|
||||
// Return the percentage of SLA compliance
|
||||
return (float) (100 - ($bad_period / $period) * 100);
|
||||
return (float) (100 - ($bad_period / $period_reduced) * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8505,4 +8546,184 @@ function reporting_format_planned_downtime_dates ($planned_downtime) {
|
|||
return $dates;
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* Get real period in SLA subtracting worktime period.
|
||||
* Get if is working in the first point
|
||||
* Get time between first point and
|
||||
*
|
||||
* @param int Period to check the SLA compliance.
|
||||
* @param int Date_end date end the sla compliace interval
|
||||
* @param int Working Time start
|
||||
* @param int Working Time end
|
||||
*
|
||||
* @return array (int fixed SLA period, bool inside working time)
|
||||
* found
|
||||
*/
|
||||
function reporting_get_agentmodule_sla_day_period ($period, $date_end, $wt_start = "00:00:00", $wt_end = "23:59:59") {
|
||||
|
||||
$date_start = $date_end - $period;
|
||||
// Converts to timestamp
|
||||
$human_date_end = date ('H:i:s', $date_end);
|
||||
$human_date_start = date ('H:i:s', $date_start);
|
||||
// Store into an array the points
|
||||
// "s" start SLA interval point
|
||||
// "e" end SLA interval point
|
||||
// "f" start worktime interval point (from)
|
||||
// "t" end worktime interval point (to)
|
||||
$tp = array (
|
||||
"s" => strtotime($human_date_start),
|
||||
"e" => strtotime($human_date_end),
|
||||
"f" => strtotime($wt_start),
|
||||
"t" => strtotime($wt_end)
|
||||
);
|
||||
|
||||
asort ($tp);
|
||||
$order = "";
|
||||
foreach ($tp as $type => $time) {
|
||||
$order .= $type;
|
||||
}
|
||||
|
||||
$period_reduced = $period;
|
||||
$start_working = true;
|
||||
$datelimit_increased = 0;
|
||||
|
||||
//Special case. If $order = "seft" and start time == end time it should be treated like "esft"
|
||||
if (($period > 0) and ($human_date_end == $human_date_start) and ($order == "seft")) {
|
||||
$order = "esft";
|
||||
}
|
||||
|
||||
// Discriminates the cases depends what time point is higher than other
|
||||
switch ($order) {
|
||||
|
||||
case "setf":
|
||||
case "etfs":
|
||||
case "tfse":
|
||||
case "fset":
|
||||
// Default $period_reduced
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "stef":
|
||||
case "tefs":
|
||||
case "fste":
|
||||
$period_reduced = $period - ($tp["e"] - $tp["t"]);
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "stfe":
|
||||
case "estf":
|
||||
case "tfes":
|
||||
$period_reduced = $period - ($tp["f"] -$tp["t"]);
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "tsef":
|
||||
case "seft":
|
||||
case "ftse":
|
||||
case "efts":
|
||||
$period_reduced = -1;
|
||||
$start_working = false;
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "tsfe":
|
||||
case "etsf":
|
||||
case "sfet":
|
||||
$period_reduced = $period - ($tp["f"] - $tp["s"]);
|
||||
$start_working = false;
|
||||
$datelimit_increased = $tp["f"] - $tp["s"];
|
||||
break;
|
||||
case "efst":
|
||||
$period_reduced = $tp["t"] - $tp["s"];
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "fest":
|
||||
$period_reduced = ($tp["t"] - $tp["s"]) + ($tp["e"] - $tp["f"]);
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
case "tesf":
|
||||
$period_reduced = SECONDS_1DAY - ($tp["f"] - $tp["t"]);
|
||||
$start_working = false;
|
||||
$datelimit_increased = $tp["f"] - $tp["s"];
|
||||
break;
|
||||
case "sfte":
|
||||
case "esft":
|
||||
$period_reduced = $tp["t"] - $tp["f"];
|
||||
$start_working = false;
|
||||
$datelimit_increased = $tp["f"] - $tp["s"];
|
||||
break;
|
||||
case "ftes":
|
||||
$period_reduced = $tp["t"] - $tp["f"];
|
||||
$start_working = false;
|
||||
$datelimit_increased = $tp["f"] + SECONDS_1DAY - $tp["s"];
|
||||
break;
|
||||
case "fets":
|
||||
$period_reduced = $tp["e"] - $tp["f"];
|
||||
$start_working = false;
|
||||
$datelimit_increased = $tp["f"] + SECONDS_1DAY - $tp["s"];
|
||||
break;
|
||||
default:
|
||||
// Default $period_reduced
|
||||
// Default $start_working
|
||||
// Default $datelimit_increased
|
||||
break;
|
||||
}
|
||||
|
||||
return array ($period_reduced, $start_working, $datelimit_increased);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get working time SLA in timestamp form. Get all items and discard previous not necessaries
|
||||
*
|
||||
* @param int Period to check the SLA compliance.
|
||||
* @param int Date_end date end the sla compliace interval
|
||||
* @param int Working Time start
|
||||
* @param int Working Time end
|
||||
*
|
||||
* @return array work time points
|
||||
* found
|
||||
*/
|
||||
function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $wt_start = "00:00:00", $wt_end = "23:59:59") {
|
||||
|
||||
$date_previous_day = $date_end - SECONDS_1DAY;
|
||||
$wt = array ();
|
||||
|
||||
// Calculate posibles data points
|
||||
$relative_date_end = strtotime (date ('H:i:s', $date_end));
|
||||
$relative_00_00_00 = strtotime ("00:00:00");
|
||||
$relative_wt_start = strtotime($wt_start) - $relative_00_00_00;
|
||||
$relative_wt_end = strtotime($wt_end) - $relative_00_00_00;
|
||||
|
||||
$absolute_previous_00_00_00 = $date_previous_day - ($relative_date_end - $relative_00_00_00);
|
||||
$absolute_00_00_00 = $date_end - ($relative_date_end - $relative_00_00_00);
|
||||
array_push ($wt, $absolute_previous_00_00_00);
|
||||
if ($relative_wt_start < $relative_wt_end) {
|
||||
array_push ($wt, $absolute_previous_00_00_00 + $relative_wt_start);
|
||||
array_push ($wt, $absolute_previous_00_00_00 + $relative_wt_end);
|
||||
array_push ($wt, $absolute_00_00_00 + $relative_wt_start);
|
||||
array_push ($wt, $absolute_00_00_00 + $relative_wt_end);
|
||||
} else {
|
||||
array_push ($wt, $absolute_previous_00_00_00 + $relative_wt_end);
|
||||
array_push ($wt, $absolute_previous_00_00_00 + $relative_wt_start);
|
||||
array_push ($wt, $absolute_00_00_00 + $relative_wt_end);
|
||||
array_push ($wt, $absolute_00_00_00 + $relative_wt_start);
|
||||
}
|
||||
array_push ($wt, $absolute_00_00_00 + SECONDS_1DAY);
|
||||
|
||||
//Discard outside period time points
|
||||
$date_start = $date_end - $period;
|
||||
|
||||
$first_time = array_shift ($wt);
|
||||
while ($first_time < $date_start) {
|
||||
if (empty ($wt)) {
|
||||
return $wt;
|
||||
}
|
||||
$first_time = array_shift ($wt);
|
||||
}
|
||||
array_unshift ($wt, $first_time);
|
||||
|
||||
return $wt;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1658,7 +1658,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
$table1->head[2] = __('# Checks');
|
||||
$table1->head[3] = __('# Failed');
|
||||
$table1->head[4] = __('% Fail');
|
||||
$table1->head[5] = __('Poling time');
|
||||
$table1->head[5] = __('Time available');
|
||||
$table1->head[6] = __('Time unavailable');
|
||||
$table1->head[7] = __('% Ok');
|
||||
|
||||
|
|
|
@ -765,19 +765,19 @@ function servers_check_status () {
|
|||
$sql = "SELECT COUNT(id_server)
|
||||
FROM tserver
|
||||
WHERE status = 1
|
||||
AND keepalive > NOW() - INTERVAL 15 MINUTE";
|
||||
AND keepalive > NOW() - INTERVAL server_keepalive*2 SECOND";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT COUNT(id_server)
|
||||
FROM tserver
|
||||
WHERE status = 1
|
||||
AND keepalive > NOW() - INTERVAL '15 MINUTE'";
|
||||
AND keepalive > NOW() - INTERVAL 'server_keepalive*2 SECOND'";
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = "SELECT COUNT(id_server)
|
||||
FROM tserver
|
||||
WHERE status = 1
|
||||
AND keepalive > systimestamp - INTERVAL '15' MINUTE";
|
||||
AND keepalive > systimestamp - INTERVAL 'server_keepalive*2' SECOND";
|
||||
break;
|
||||
}
|
||||
$status = (int) db_get_sql ($sql); //Cast as int will assure a number value
|
||||
|
|
|
@ -230,6 +230,8 @@ function update_manager_check_online_free_packages_available() {
|
|||
curl_setopt($curlObj, CURLOPT_POST, true);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $params);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curlObj, CURLOPT_CONNECTTIMEOUT, 4);
|
||||
|
||||
if (isset($config['update_manager_proxy_server'])) {
|
||||
curl_setopt($curlObj, CURLOPT_PROXY, $config['update_manager_proxy_server']);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ function visual_map_print_user_line_handles($layoutData) {
|
|||
}
|
||||
|
||||
function visual_map_print_item($mode = "read", $layoutData,
|
||||
$proportion = null, $show_links = true, $isExternalLink = false) {
|
||||
$proportion = null, $show_links = true, $isExternalLink = false, $graph_javascript = true) {
|
||||
global $config;
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
@ -771,12 +771,15 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['id_custom_graph'] != 0) {
|
||||
$img = custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], $height, $width,
|
||||
$period, null, true, 0, true, $layoutData['image']);
|
||||
$period, null, true, 0, true, $layoutData['image'],
|
||||
array(), '', array(), array(), true,
|
||||
true, true, true, 1, false, $graph_javascript);
|
||||
}
|
||||
else {
|
||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||
$height, '', null, false, 1, false, 0, '', 0, 0, true, true,
|
||||
'', 1, false, '', false, false, true, $layoutData['image']);
|
||||
$height, '', null, false, 1, false, 0, '', 0, 0,
|
||||
true, true, '', 1, false, '', false, false, true,
|
||||
$layoutData['image'], null, false, $graph_javascript);
|
||||
}
|
||||
|
||||
//Restore db connection
|
||||
|
@ -1918,7 +1921,7 @@ function visual_map_print_user_lines($layout_data, $proportion = null) {
|
|||
* @param bool $draw_lines
|
||||
*/
|
||||
function visual_map_print_visual_map ($id_layout, $show_links = true,
|
||||
$draw_lines = true, $width = null, $height = null, $home_url = '', $isExternalLink = false) {
|
||||
$draw_lines = true, $width = null, $height = null, $home_url = '', $isExternalLink = false, $graph_javascript = true) {
|
||||
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
|
@ -2067,7 +2070,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||
break;
|
||||
default:
|
||||
visual_map_print_item("read", $layout_data,
|
||||
$proportion, $show_links, $isExternalLink);
|
||||
$proportion, $show_links, $isExternalLink, $graph_javascript);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$chart_extra_data = array(), $yellow_threshold = 0,
|
||||
$red_threshold = 0, $adapt_key = '', $force_integer = false,
|
||||
$series_suffix_str = '', $menu = true, $backgroundColor = 'white',
|
||||
$dashboard = false) {
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
@ -260,35 +260,55 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$dashboard);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
$graph['unit'] = $unit;
|
||||
$graph['series_type'] = $series_type;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
||||
|
||||
|
||||
|
||||
|
||||
return "<img src='" .
|
||||
ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?" .
|
||||
"static_graph=1&" .
|
||||
"graph_type=area&" .
|
||||
"ttl=" . $ttl . "&" .
|
||||
"id_graph=" . $id_graph . "'>";
|
||||
if ($vconsole) {
|
||||
return flot_area_simple_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$series_type,
|
||||
$chart_extra_data,
|
||||
$yellow_threshold,
|
||||
$red_threshold,
|
||||
$adapt_key,
|
||||
$force_integer,
|
||||
$series_suffix_str,
|
||||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
$graph['unit'] = $unit;
|
||||
$graph['series_type'] = $series_type;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
|
||||
return "<img src='" .
|
||||
ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?" .
|
||||
"static_graph=1&" .
|
||||
"graph_type=area&" .
|
||||
"ttl=" . $ttl . "&" .
|
||||
"id_graph=" . $id_graph . "'>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +316,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false) {
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
|
@ -327,25 +347,51 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height,
|
|||
$dashboard);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . ui_get_full_url (false, false, false, false) . "include/graphs/functions_pchart.php?static_graph=1&graph_type=stacked_area&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
if ($vconsole) {
|
||||
return flot_area_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . ui_get_full_url (false, false, false, false) .
|
||||
"include/graphs/functions_pchart.php?static_graph=1&graph_type=stacked_area&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +399,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false) {
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
|
@ -385,25 +431,50 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
|
|||
$dashboard);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
if ($vconsole) {
|
||||
return flot_line_stacked_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$background_color,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
//Stack the data
|
||||
stack_data($chart_data, $legend, $color);
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,7 +535,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false) {
|
||||
$dashboard = false, $vconsole = false) {
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
|
@ -495,22 +566,47 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$dashboard);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
if ($vconsole) {
|
||||
return flot_line_simple_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['backgroundColor'] = $backgroundColor;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -706,7 +706,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
}
|
||||
}
|
||||
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2) {
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript) {
|
||||
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
|
@ -804,7 +804,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
colors, type, serie_types, water_mark, width, max_x, homeurl, unit,
|
||||
font_size, menu, events, event_ids, legend_events, alerts,
|
||||
alert_ids, legend_alerts, yellow_threshold, red_threshold,
|
||||
force_integer, separator, separator2, series_suffix_str) {
|
||||
force_integer, separator, separator2, series_suffix_str, vconsole) {
|
||||
|
||||
var threshold = true;
|
||||
var thresholded = false;
|
||||
|
@ -1024,11 +1024,25 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
labelFormatter: lFormatter
|
||||
}
|
||||
};
|
||||
|
||||
if (vconsole) {
|
||||
options.grid['hoverable'] = false;
|
||||
options.grid['clickable'] = false;
|
||||
options.crosshair = false;
|
||||
options.selection = false;
|
||||
}
|
||||
|
||||
var stack = 0, bars = true, lines = false, steps = false;
|
||||
|
||||
var plot = $.plot($('#' + graph_id), datas, options);
|
||||
|
||||
|
||||
if (vconsole) {
|
||||
var myCanvas = plot.getCanvas();
|
||||
plot.setupGrid(); // redraw plot to new size
|
||||
plot.draw();
|
||||
var image = myCanvas.toDataURL("image/png");
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust the overview plot to the width and position of the main plot
|
||||
adjust_left_width_canvas(graph_id, 'overview_'+graph_id);
|
||||
|
||||
|
@ -1267,7 +1281,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
|
||||
$('#'+graph_id).bind('mouseout',resetInteractivity);
|
||||
$('#overview_'+graph_id).bind('mouseout',resetInteractivity);
|
||||
|
||||
|
||||
// Reset interactivity styles
|
||||
function resetInteractivity() {
|
||||
$('#timestamp_'+graph_id).hide();
|
||||
|
|
|
@ -152,7 +152,7 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend,
|
|||
$id_bullet = uniqid();
|
||||
|
||||
$output .=
|
||||
'<div id="bullet_graph_' . $id_bullet . '" class="bulle" style="overflow: hidden;"></div>
|
||||
'<div id="bullet_graph_' . $id_bullet . '" class="bullet" style="overflow: hidden; width: '.$width.'px"></div>
|
||||
<style>
|
||||
|
||||
.bullet_graph {
|
||||
|
@ -226,7 +226,7 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend,
|
|||
|
||||
var title = svg.append("g")
|
||||
.style("text-anchor", "end")
|
||||
.attr("transform", "translate(-20," + height + ")");
|
||||
.attr("transform", "translate(-10, 15)");
|
||||
|
||||
title.append("text")
|
||||
.attr("class", "title")
|
||||
|
|
|
@ -94,7 +94,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -102,7 +102,7 @@ function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'area_stacked',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard);
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
}
|
||||
|
||||
function flot_area_simple_graph($chart_data, $width, $height, $color,
|
||||
|
@ -110,7 +110,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -118,7 +118,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'area_simple',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard);
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
}
|
||||
|
||||
function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
||||
|
@ -126,7 +126,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -134,7 +134,7 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'line_stacked',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard);
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
}
|
||||
|
||||
function flot_line_simple_graph($chart_data, $width, $height, $color,
|
||||
|
@ -142,7 +142,7 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -150,14 +150,14 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard);
|
||||
$menu, $background_color, $dashboard, $vconsole);
|
||||
}
|
||||
|
||||
function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
||||
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
||||
$force_integer, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -202,7 +202,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
}
|
||||
$return .= html_print_input_hidden ('lineWidhtGraph', $config['custom_graph_width'],true);
|
||||
$menu_width = 25 * $nbuttons + 15;
|
||||
if ( $dashboard == false) {
|
||||
if ( $dashboard == false AND $vconsole == false) {
|
||||
$return .= "<div id='menu_$graph_id' class='menu_graph' " .
|
||||
"style='display: none; " .
|
||||
"text-align: center; " .
|
||||
|
@ -233,7 +233,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
else {
|
||||
$height = 1;
|
||||
}
|
||||
$return .= "<div id='overview_$graph_id' class='overview_graph' style='visibility: hidden; margin-left:0px; margin-top:20px; width: ".$width."px; height: ".$height ."px;'></div>";
|
||||
if ( $dashboard == false AND $vconsole == false )
|
||||
$return .= "<div id='overview_$graph_id' class='overview_graph' style='visibility: hidden; margin-left:0px; margin-top:20px; width: ".$width."px; height: ".$height ."px;'></div>";
|
||||
|
||||
if ($water_mark != '') {
|
||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
||||
|
@ -425,7 +426,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
"$force_integer, \n" .
|
||||
"'$separator', \n" .
|
||||
"'$separator2', \n" .
|
||||
"'$series_suffix_str');";
|
||||
"'$series_suffix_str',
|
||||
'$vconsole');";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '6.1dev';
|
||||
$build = '160309';
|
||||
$build = '160329';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -67,8 +67,16 @@ ui_print_info_message(__("MIB files will be installed on the system. Please note
|
|||
|
||||
//echo '<h4>' . __('Index of %s', $directory) . '</h4>';
|
||||
|
||||
$homedir_filemanager = isset ($config['homedir_filemanager']) ? $config['homedir_filemanager'] : false;
|
||||
|
||||
filemanager_file_explorer($real_directory,
|
||||
$directory,
|
||||
'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_mib_uploader',
|
||||
SNMP_DIR_MIBS);
|
||||
SNMP_DIR_MIBS,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
$homedir_filemanager);
|
||||
?>
|
||||
|
|
|
@ -42,6 +42,7 @@ else {
|
|||
}
|
||||
|
||||
$refr = (int) get_parameter ('refr', $config['vc_refr']);
|
||||
$graph_javascript = (bool) get_parameter ('graph_javascript', false);
|
||||
$vc_refr = false;
|
||||
|
||||
if (isset($config['vc_refr']) and $config['vc_refr'] != 0)
|
||||
|
@ -153,7 +154,7 @@ else {
|
|||
html_print_input_hidden('metaconsole', 1);
|
||||
}
|
||||
|
||||
visual_map_print_visual_map ($id_layout);
|
||||
visual_map_print_visual_map ($id_layout, true, true, null, null, '', false, $graph_javascript);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -65,7 +65,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
|
|||
INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
|
||||
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.1dev');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160309');
|
||||
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD160329');
|
||||
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
|
||||
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
|
||||
INSERT INTO tconfig (token, value) VALUES ('style','pandora');
|
||||
|
|
|
@ -1001,6 +1001,7 @@ CREATE TABLE tserver (
|
|||
lag_modules NUMBER(10, 0) DEFAULT 0,
|
||||
total_modules_running NUMBER(10, 0) DEFAULT 0,
|
||||
my_modules NUMBER(10, 0) DEFAULT 0,
|
||||
server_keepalive NUMBER(10, 0) DEFAULT 0,
|
||||
stat_utimestamp NUMBER(19, 0) DEFAULT 0
|
||||
);
|
||||
CREATE INDEX tserver_name_idx ON tserver(name);
|
||||
|
|
|
@ -820,6 +820,7 @@ CREATE TABLE "tserver" (
|
|||
"lag_modules" INTEGER NOT NULL default 0,
|
||||
"total_modules_running" INTEGER NOT NULL default 0,
|
||||
"my_modules" INTEGER NOT NULL default 0,
|
||||
"server_keepalive" INTEGER NOT NULL default 0,
|
||||
"stat_utimestamp" BIGINT NOT NULL default 0
|
||||
);
|
||||
CREATE INDEX "tserver_name_idx" ON "tserver"("name");
|
||||
|
|
|
@ -895,6 +895,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
|
|||
`lag_modules` int(11) NOT NULL default 0,
|
||||
`total_modules_running` int(11) NOT NULL default 0,
|
||||
`my_modules` int(11) NOT NULL default 0,
|
||||
`server_keepalive` int(11) NOT NULL default 0,
|
||||
`stat_utimestamp` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_server`),
|
||||
KEY `name` (`name`)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 6.1dev-160309
|
||||
Version: 6.1dev-160329
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.1dev-160309"
|
||||
pandora_version="6.1dev-160329"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
FROM centos:centos6
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
RUN { \
|
||||
echo '[EPEL]'; \
|
||||
echo 'name = CentOS Epel'; \
|
||||
echo 'baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64'; \
|
||||
echo 'enabled=1'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
} > /etc/yum.repos.d/extra_repos.repo
|
||||
|
||||
RUN { \
|
||||
echo '[artica_pandorafms]'; \
|
||||
echo 'name=CentOS6 - PandoraFMS official repo'; \
|
||||
echo 'baseurl=http://artica.es/centos6'; \
|
||||
echo 'gpgcheck=0'; \
|
||||
echo 'enabled=1'; \
|
||||
} > /etc/yum.repos.d/pandorafms.repo
|
||||
|
||||
RUN yum -y update; yum clean all;
|
||||
RUN yum install -y \
|
||||
git \
|
||||
cronie \
|
||||
ntp \
|
||||
wget \
|
||||
curl \
|
||||
xterm \
|
||||
postfix \
|
||||
wmic \
|
||||
perl-HTML-Tree \
|
||||
perl-DBI \
|
||||
perl-DBD-mysql \
|
||||
perl-libwww-perl \
|
||||
perl-XML-Simple \
|
||||
perl-XML-SAX \
|
||||
perl-NetAddr-IP \
|
||||
net-snmp \
|
||||
net-tools \
|
||||
perl-IO-Socket-INET6 \
|
||||
perl-Socket6 \
|
||||
nmap \
|
||||
sudo \
|
||||
xprobe2 \
|
||||
make \
|
||||
perl-CPAN \
|
||||
perl-JSON \
|
||||
net-snmp-perl \
|
||||
perl-Time-HiRes \
|
||||
perl-XML-Twig \
|
||||
perl-Encode-Locale \
|
||||
net-snmp \
|
||||
net-snmp-utils
|
||||
|
||||
|
||||
#Clone the repo
|
||||
RUN git clone -b develop https://github.com/pandorafms/pandorafms.git /tmp/pandorafms
|
||||
|
||||
#Exposing ports for: Tentacle protocol
|
||||
EXPOSE 41121
|
||||
|
||||
# Simple startup script to avoid some issues observed with container restart
|
||||
ADD docker_entrypoint.sh /entrypoint.sh
|
||||
RUN chmod -v +x /entrypoint.sh
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
|
@ -606,8 +606,13 @@ sub main() {
|
|||
$server->update();
|
||||
}
|
||||
|
||||
# Update fallen servers
|
||||
db_do ($DBH, "UPDATE tserver SET status = 0 WHERE keepalive < ?", strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - $Config{'keepalive'})));
|
||||
# Update fallen servers
|
||||
my @servers_db = get_db_rows ($DBH, "SELECT id_server, server_keepalive FROM tserver");
|
||||
for (@servers_db) {
|
||||
my %server_db = %$_;
|
||||
my $expected_update = strftime ("%Y-%m-%d %H:%M:%S", localtime(time() - $server_db{'server_keepalive'} * 2));
|
||||
db_do ($DBH, "UPDATE tserver SET status = 0 WHERE keepalive < ? AND id_server = ?", $expected_update, $server_db{'id_server'});
|
||||
}
|
||||
|
||||
# Set the master server
|
||||
pandora_set_master(\%Config, $DBH);
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
PANDORA_DB_HOST='mysql'
|
||||
else
|
||||
echo >&2 'warning: both PANDORA_DB_HOST and MYSQL_PORT_3306_TCP found'
|
||||
echo >&2 " Connecting to PANDORA_DB_HOST ($PANDORA_DB_HOST)"
|
||||
echo >&2 ' instead of the linked mysql container'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_HOST" ]; then
|
||||
echo >&2 'error: missing PANDORA_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
|
||||
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
|
||||
echo >&2 ' with -e PANDORA_DB_HOST=hostname:port?'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if we're linked to MySQL and thus have credentials already, let's use them
|
||||
: ${PANDORA_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
|
||||
if [ "$PANDORA_DB_USER" = 'root' ]; then
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
||||
fi
|
||||
: ${PANDORA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD}
|
||||
if [ -z "$PANDORA_DB_NAME" ]; then
|
||||
: ${PANDORA_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-pandora}}
|
||||
fi
|
||||
|
||||
if [ -z "$PANDORA_DB_PASSWORD" ]; then
|
||||
echo >&2 'error: missing required PANDORA_DB_PASSWORD environment variable'
|
||||
echo >&2 ' Did you forget to -e PANDORA_DB_PASSWORD=... ?'
|
||||
echo >&2
|
||||
echo >&2 ' (Also of interest might be PANDORA_DB_USER and PANDORA_DB_NAME.)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Create the pandora user to run the anyterd, mainly
|
||||
/usr/sbin/useradd -d /home/pandora -s /bin/false -M -g 0 pandora
|
||||
|
||||
cd /tmp/pandorafms/pandora_server && chmod +x pandora_server_installer && ./pandora_server_installer --install
|
||||
|
||||
#Configure the Pandora FMS Server to connect to the database
|
||||
sed -i "s/dbname pandora/dbname $PANDORA_DB_NAME/g" /etc/pandora/pandora_server.conf
|
||||
sed -i "s/dbpass pandora/dbpass $PANDORA_DB_PASSWORD/g" /etc/pandora/pandora_server.conf
|
||||
sed -i "s/dbuser pandora/dbuser $PANDORA_DB_USER/g" /etc/pandora/pandora_server.conf
|
||||
sed -i "s/dbhost 127.0.0.1/dbhost $PANDORA_DB_HOST/g" /etc/pandora/pandora_server.conf
|
||||
|
||||
#Rock n' roll!
|
||||
/etc/init.d/crond start &
|
||||
/etc/init.d/ntpd start &
|
||||
/etc/init.d/anytermd start &
|
||||
/etc/init.d/postfix start &
|
||||
/etc/init.d/tentacle_serverd start &
|
||||
/usr/bin/pandora_server /etc/pandora/pandora_server.conf
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "6.1dev";
|
||||
my $pandora_build = "160309";
|
||||
my $pandora_build = "160329";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -2197,12 +2197,13 @@ Update server status:
|
|||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_update_server ($$$$$$;$$$) {
|
||||
sub pandora_update_server ($$$$$$;$$$$) {
|
||||
my ($pa_config, $dbh, $server_name, $server_id, $status,
|
||||
$server_type, $num_threads, $queue_size, $version) = @_;
|
||||
$server_type, $num_threads, $queue_size, $version, $keepalive) = @_;
|
||||
|
||||
$num_threads = 0 unless defined ($num_threads);
|
||||
$queue_size = 0 unless defined ($queue_size);
|
||||
$keepalive = $pa_config->{'keepalive'} unless defined ($keepalive);
|
||||
|
||||
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
|
||||
$version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'} unless defined($version);
|
||||
|
@ -2215,9 +2216,9 @@ sub pandora_update_server ($$$$$$;$$$) {
|
|||
# Create an entry in tserver if needed
|
||||
my $server = get_db_single_row ($dbh, 'SELECT id_server FROM tserver WHERE name = ? AND server_type = ?', $server_name, $server_type);
|
||||
if (! defined ($server)) {
|
||||
$server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', $server_name, $server_type,
|
||||
'Autocreated at startup', $version, $num_threads, $queue_size);
|
||||
$server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules, server_keepalive)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)', $server_name, $server_type,
|
||||
'Autocreated at startup', $version, $num_threads, $queue_size, $keepalive);
|
||||
|
||||
$server = get_db_single_row ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $server_id);
|
||||
if (! defined ($server)) {
|
||||
|
@ -2228,14 +2229,14 @@ sub pandora_update_server ($$$$$$;$$$) {
|
|||
$server_id = $server->{'id_server'};
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ?
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?
|
||||
WHERE id_server = ?',
|
||||
1, $timestamp, $master, $timestamp, $version, $num_threads, $queue_size, $server_id);
|
||||
1, $timestamp, $master, $timestamp, $version, $num_threads, $queue_size, $keepalive, $server_id);
|
||||
return;
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ?
|
||||
WHERE id_server = ?', $status, $timestamp, $master, $version, $num_threads, $queue_size, $server_id);
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ?, server_keepalive = ?
|
||||
WHERE id_server = ?', $status, $timestamp, $master, $version, $num_threads, $queue_size, $keepalive, $server_id);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
|
|
@ -817,7 +817,7 @@ sub process_xml_server ($$$$) {
|
|||
$version = '' unless defined($version);
|
||||
|
||||
# Update server information
|
||||
pandora_update_server ($pa_config, $dbh, $data->{'server_name'}, 0, 1, $server_type, $threads, $modules, $version);
|
||||
pandora_update_server ($pa_config, $dbh, $data->{'server_name'}, 0, 1, $server_type, $threads, $modules, $version, $data->{'keepalive'});
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.1dev
|
||||
%define release 160309
|
||||
%define release 160329
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="6.1dev"
|
||||
PI_BUILD="160309"
|
||||
PI_BUILD="160329"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Pandora FMS ChatOps plugins
|
||||
A set of plugins for [Pandora FMS](https://github.com/pandorafms/pandorafms) to enable notifications to ChatOps solutions.
|
||||
|
||||
#Solutions covered
|
||||
1. Slack
|
||||
2. Mattermost
|
||||
|
||||
# Usage
|
||||
Assuming you are using Pandora FMS 6.0, the steps are:
|
||||
|
||||
1. Create the [Alert command](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#The_Alert_Command_.28Pandora_Versions_5_and_above_only.29) in Pandora FMS console following the instructions of your solution inside this folder
|
||||
|
||||
2. Define the [Alert Action](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#Alert_Actions_.28all_Pandora_FMS_versions_including_5.0.29) in Pandora FMS console following the instructions of your solution inside this folder
|
||||
|
||||
3. Assign the action to an existing module under Alerts -> [List of alerts](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#Assigning_Alerts_from_an_Alert.27s_Sub_Menu):
|
||||

|
||||
|
||||
4. Optinionally, go to your agent and verify the alert has been created:
|
||||

|
||||
|
||||
When the alert triggers, the result would be something like this:
|
||||

|
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 30 KiB |
|
@ -0,0 +1,20 @@
|
|||
# Pandora FMS Mattermost Plugin
|
||||
A plugin for [Pandora FMS](https://github.com/pandorafms/pandorafms) to enable notifications to Mattermost Open Source Chat.
|
||||
|
||||
# Usage
|
||||
Assuming you are using Pandora FMS 6.0, the steps are:
|
||||
|
||||
1. Create the [Alert command](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#The_Alert_Command_.28Pandora_Versions_5_and_above_only.29) going to Alerts -> Commands and clicking on "Create". Then:
|
||||

|
||||
|
||||
2. Define the [Alert Action](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#Alert_Actions_.28all_Pandora_FMS_versions_including_5.0.29) going to Alerts -> Actions and clicking on "Create". Then:
|
||||

|
||||
|
||||
3. Assign the action to an existing module under Alerts -> List of alerts:
|
||||

|
||||
|
||||
4. Optinionally, go to your agent and verify the alert has been created:
|
||||

|
||||
|
||||
When the alert triggers, the result would be something like this:
|
||||

|
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Integration script with Mattermost and Slack for sending messages from Pandora FMS
|
||||
# (c) 2016 Axel Amigo <axl@artica.es>
|
||||
|
||||
|
||||
# SET HERE YOUR DATA
|
||||
USERNAME=pandorafmsbot
|
||||
ICON="http://cdn9.staztic.com/app/a/3528/3528476/pandora-fms-1-l-78x78.png"
|
||||
URL="$2"
|
||||
|
||||
# Do not touch from there:
|
||||
|
||||
MSG="'payload={\"username\": \"$USERNAME\", \"text\": \"$1\", \"icon_url\": \"$ICON\"}'"
|
||||
COMMAND="curl -k -X POST --data-urlencode $MSG $URL"
|
||||
|
||||
eval $COMMAND
|
|
@ -0,0 +1,20 @@
|
|||
# Pandora FMS Slack Plugin
|
||||
A plugin for [Pandora FMS](https://github.com/pandorafms/pandorafms) to enable notifications to Slack Open Source Chat.
|
||||
|
||||
# Usage
|
||||
Assuming you are using Pandora FMS 6.0, the steps are:
|
||||
|
||||
1. Create the [Alert command](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#The_Alert_Command_.28Pandora_Versions_5_and_above_only.29) going to Alerts -> Commands and clicking on "Create". Then:
|
||||

|
||||
|
||||
2. Define the [Alert Action](http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Alerts#Alert_Actions_.28all_Pandora_FMS_versions_including_5.0.29) going to Alerts -> Actions and clicking on "Create". Then:
|
||||

|
||||
|
||||
3. Assign the action to an existing module under Alerts -> List of alerts:
|
||||

|
||||
|
||||
4. Optinionally, go to your agent and verify the alert has been created:
|
||||

|
||||
|
||||
When the alert triggers, the result would be something like this:
|
||||

|
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Integration script with Mattermost and Slack for sending messages from Pandora FMS
|
||||
# (c) 2016 Axel Amigo <axl@artica.es>
|
||||
|
||||
|
||||
# SET HERE YOUR DATA
|
||||
USERNAME=pandorafmsbot
|
||||
ICON="http://cdn9.staztic.com/app/a/3528/3528476/pandora-fms-1-l-78x78.png"
|
||||
URL="$2"
|
||||
|
||||
# Do not touch from there:
|
||||
|
||||
MSG="'payload={\"username\": \"$USERNAME\", \"text\": \"$1\", \"icon_url\": \"$ICON\"}'"
|
||||
COMMAND="curl -k -X POST --data-urlencode $MSG $URL"
|
||||
|
||||
eval $COMMAND
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.1dev PS160309";
|
||||
my $version = "6.1dev PS160329";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -710,7 +710,9 @@ sub pandora_checkdb_integrity {
|
|||
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente NOT IN (SELECT id_agente FROM tagente)');
|
||||
|
||||
# Delete orphan modules in tagente_estado
|
||||
db_do ($dbh, 'DELETE FROM tagente_estado WHERE id_agente NOT IN (SELECT id_agente FROM tagente)');
|
||||
while (defined (get_db_value ($dbh, 'SELECT id_agente FROM tagente_estado WHERE id_agente NOT IN (SELECT id_agente FROM tagente)'))) {
|
||||
db_delete_limit ($dbh, 'tagente_estado', 'id_agente NOT IN (SELECT id_agente FROM tagente)', $BIG_OPERATION_STEP);
|
||||
}
|
||||
|
||||
# Delete orphan data_inc reference records
|
||||
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
|
||||
|
|
|
@ -35,7 +35,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.1dev PS160309";
|
||||
my $version = "6.1dev PS160329";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|