The big one update :-)

This commit is contained in:
Alexey Pustovalov
2018-02-18 22:42:44 +02:00
parent 3b7cc92f9b
commit 67d50cacb3
144 changed files with 16435 additions and 15824 deletions

View File

@ -1,24 +1,37 @@
FROM alpine:3.4
LABEL maintainer "Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
LABEL maintainer="Alexey Pustovalov <alexey.pustovalov@zabbix.com>"
ARG BUILD_DATE
ARG VCS_REF
ARG APK_FLAGS_COMMON="-q"
ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache"
ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache"
ENV TERM=xterm
ENV TERM=xterm PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ JAVA_HOME=/usr/lib/jvm/default-jvm
LABEL org.label-schema.name="zabbix-java-gateway-alpine" \
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.url="https://zabbix.com/" \
org.label-schema.description="Zabbix Java Gateway performs native support for monitoring JMX applications" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.schema-version="1.0" \
org.label-schema.license="GPL 2.0"
STOPSIGNAL SIGTERM
RUN addgroup zabbix && \
adduser -S \
-D -G zabbix \
-h /var/lib/zabbix/ \
-H \
zabbix && \
mkdir -p /etc/zabbix/ && \
chown --quiet -R zabbix:root /etc/zabbix && \
apk update && \
apk add ${APK_FLAGS_COMMON} \
supervisor \
bash \
openjdk8-jre-base && \
openjdk8-jre-base \
supervisor && \
rm -rf /var/cache/apk/*
ARG MAJOR_VERSION=master
@ -26,47 +39,54 @@ ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/
ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
LABEL org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.label-schema.version="${ZBX_VERSION}" \
org.label-schema.vcs-url="${ZBX_SOURCES}" \
org.label-schema.docker.cmd="docker run --name zabbix-java-gateway --link zabbix-server:zabbix-server -p 10052:10052 -d zabbix-java-gateway:alpine-${ZBX_VERSION}"
RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \
alpine-sdk \
coreutils \
automake \
autoconf \
automake \
coreutils \
openjdk8 \
subversion && \
subversion \
alpine-sdk && \
cd /tmp/ && \
svn --quiet export ${ZBX_SOURCES} zabbix-${ZBX_VERSION} 1>/dev/null && \
cd /tmp/zabbix-${ZBX_VERSION} && \
zabbix_revision=`svn info ${ZBX_SOURCES} |grep "Last Changed Rev"|awk '{print $4;}'` && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" include/version.h && \
sed -i "s/{ZABBIX_REVISION}/$zabbix_revision/g" src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java && \
export PATH=$PATH:/usr/lib/jvm/default-jvm/bin/ && \
./bootstrap.sh 1>/dev/null && \
./configure \
--prefix=/usr \
--silent \
--sysconfdir=/etc/zabbix \
--libdir=/usr/lib/zabbix \
--datadir=/usr/lib \
--enable-java && \
--libdir=/usr/lib/zabbix \
--sysconfdir=/etc/zabbix \
--prefix=/usr \
--enable-java \
--silent && \
make -j"$(nproc)" -s 1>/dev/null && \
mkdir -p /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/bin /usr/sbin/zabbix_java/ && \
cp -r src/zabbix_java/lib /usr/sbin/zabbix_java/ && \
rm -rf /usr/sbin/zabbix_java/lib/*.xml && \
cd /tmp/ && \
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
apk del ${APK_FLAGS_COMMON} --purge \
build-dependencies && \
rm -rf /var/cache/apk/*
rm -rf /var/cache/apk/* && \
rm -rf /root/.subversion && \
rm -rf /var/svn
EXPOSE 10052/TCP
WORKDIR /usr/sbin/zabbix_java/
WORKDIR /var/lib/zabbix
ADD conf/etc/supervisor/ /etc/supervisor/
ADD conf/etc/zabbix/zabbix_java_gateway_logback.xml /etc/zabbix/
ADD conf/usr/sbin/zabbix_java_gateway /usr/sbin/
ADD run_zabbix_component.sh /
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
COPY ["conf/etc/zabbix/zabbix_java_gateway_logback.xml", "/etc/zabbix/"]
COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
COPY ["docker-entrypoint.sh", "/usr/bin/"]
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/run_zabbix_component.sh", "java-gateway", "none"]
CMD ["java-gateway", "none"]

View File

@ -1,4 +1,4 @@
![logo](http://www.zabbix.com/ru/img/logo/zabbix_logo_500x131.png)
![logo](https://assets.zabbix.com/img/logo/zabbix_logo_500x131.png)
# What is Zabbix?
@ -14,15 +14,15 @@ Zabbix Java Gateway performs native support for monitoring JMX applications. Jav
# Zabbix Java Gateway images
These are the only official Zabbix Java Gateway Docker images. They are based on latest Alpine and trusty Ubuntu images. The available versions of Zabbix Java Gateway are:
These are the only official Zabbix Java Gateway Docker images. They are based on Alpine Linux v3.4, Ubuntu 14.04 (trusty) and CentOS 7 images. The available versions of Zabbix Java Gateway are:
Zabbix server 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest)
Zabbix server 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*)
Zabbix server 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest)
Zabbix server 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*)
Zabbix server 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, alpine-latest, ubuntu-latest, latest)
Zabbix server 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*)
Zabbix server 4.0 (tags: alpine-trunk, ubuntu-trunk)
Zabbix Java Gateway 3.0 (tags: alpine-3.0-latest, ubuntu-3.0-latest, centos-3.0-latest)
Zabbix Java Gateway 3.0.* (tags: alpine-3.0.*, ubuntu-3.0.*, centos-3.0.*)
Zabbix Java Gateway 3.2 (tags: alpine-3.2-latest, ubuntu-3.2-latest, centos-3.2-latest)
Zabbix Java Gateway 3.2.* (tags: alpine-3.2.*, ubuntu-3.2.*, centos-3.2.*)
Zabbix Java Gateway 3.4 (tags: alpine-3.4-latest, ubuntu-3.4-latest, centos-3.4-centos, alpine-latest, ubuntu-latest, centos-latest, latest)
Zabbix Java Gateway 3.4.* (tags: alpine-3.4.*, ubuntu-3.4.*, centos-3.4.*)
Zabbix Java Gateway 4.0 (tags: alpine-trunk, ubuntu-trunk, centos-trunk)
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.

View File

@ -1,18 +1,24 @@
#!/bin/bash
os=alpine
os=${PWD##*/}
version=$1
version=${version:-"latest"}
app_component=java-gateway
cd ../
app_component=${PWD##*/}
cd $os/
if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then
echo "Incorrect syntax of the version"
exit 1
fi
docker build -t zabbix-$app_component:$os-$version -f Dockerfile .
if [ "$version" != "latest" ]; then
VCS_REF=`svn info svn://svn.zabbix.com/tags/$version |grep "Last Changed Rev"|awk '{print $4;}'`
fi
docker build -t zabbix-$app_component:$os-$version --build-arg VCS_REF="$VCS_REF" --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` -f Dockerfile .
#docker rm -f zabbix-$app_component
#docker run --name zabbix-$app_component -t -d --link zabbix-server:zabbix-server zabbix-$app_component:$os-$version

View File

@ -1,15 +1,17 @@
[supervisord]
nodaemon = true
[program:zabbix-java-gateway]
command = /bin/bash /usr/sbin/zabbix_java_gateway
stopsignal = INT
stopwaitsecs = 2
[program:zabbix_java_gateway]
command = /bin/bash /usr/sbin/%(program_name)s
user = zabbix
auto_start = true
autorestart = true
startsecs=3
startretries=3
stopsignal=INT
stopwaitsecs=2
redirect_stderr=true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0

View File

@ -14,6 +14,7 @@ critical = critical
user = root
logfile_maxbytes = 0
logfile_backupcount = 0
loglevel = info
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -eo pipefail
set +e
# Script trace mode
@ -126,7 +128,7 @@ check_variables_mysql() {
fi
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" != "true" ]; then
echo "*** Impossible to use MySQL server because 'root' password is not defined and not empty"
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
exit 1
fi
@ -216,7 +218,7 @@ check_db_connect_postgresql() {
WAIT_TIMEOUT=5
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -l -q 2>/dev/null)" ]; do
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT
done
@ -320,21 +322,10 @@ create_db_schema_mysql() {
if [ -z "${ZBX_DB_VERSION}" ]; then
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \
zcat /usr/share/doc/zabbix-$type-mysql/create.sql.gz | mysql --silent --skip-column-names \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
${DB_SERVER_DBNAME} 1>/dev/null
if [ "$type" == "server" ]; then
echo "** Fill the schema with initial data"
cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
${DB_SERVER_DBNAME} 1>/dev/null
cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \
${DB_SERVER_DBNAME} 1>/dev/null
fi
fi
}
@ -356,18 +347,9 @@ create_db_schema_postgresql() {
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
fi
cat /usr/share/doc/zabbix-$type-postgresql/schema.sql | psql -q \
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
if [ "$type" == "server" ]; then
echo "** Fill the schema with initial data"
cat /usr/share/doc/zabbix-$type-postgresql/images.sql | psql -q \
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
cat /usr/share/doc/zabbix-$type-postgresql/data.sql | psql -q \
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
fi
unset PGPASSWORD
fi
@ -378,6 +360,8 @@ prepare_web_server_apache() {
APACHE_SITES_DIR=/etc/apache2/sites-available
elif [ -d "/etc/apache2/conf.d" ]; then
APACHE_SITES_DIR=/etc/apache2/conf.d
elif [ -d "/etc/httpd/conf.d" ]; then
APACHE_SITES_DIR=/etc/httpd/conf.d
else
echo "**** Apache is not available"
exit 1
@ -390,6 +374,7 @@ prepare_web_server_apache() {
elif [ -f "/etc/apache2/conf.d/default.conf" ]; then
echo "** Disable default site"
rm -f "/etc/apache2/conf.d/default.conf"
rm -f "/etc/httpd/conf.d/welcome.conf"
fi
echo "** Adding Zabbix virtual host (HTTP)"
@ -433,6 +418,13 @@ prepare_web_server_apache() {
"/etc/apache2/apache2.conf"
fi
if [ -f "/etc/httpd/conf/httpd.conf" ]; then
sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
"/etc/httpd/conf/httpd.conf"
fi
if [ -f "/etc/apache2/httpd.conf" ]; then
sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
@ -456,6 +448,10 @@ prepare_web_server_apache() {
if [ -f "/var/run/apache2/apache2.pid" ]; then
rm -f "/var/run/apache2/apache2.pid"
fi
if [ -f "/var/run/httpd/httpd.pid" ]; then
rm -f "/var/run/httpd/httpd.pid"
fi
}
prepare_web_server_nginx() {
@ -692,6 +688,8 @@ prepare_zbx_web_config() {
PHP_CONFIG_FILE="/etc/php/7.0/apache2/conf.d/99-zabbix.ini"
elif [ -f "/etc/php/7.0/fpm/conf.d/99-zabbix.ini" ]; then
PHP_CONFIG_FILE="/etc/php/7.0/fpm/conf.d/99-zabbix.ini"
elif [ -f "/etc/php.d/99-zabbix.ini" ]; then
PHP_CONFIG_FILE="/etc/php.d/99-zabbix.ini"
fi
if [ -n "$PHP_CONFIG_FILE" ]; then