mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-12-26 08:19:01 +01:00
Reviewed docker entrypoint files for Alpine images and introduced CMD
This commit is contained in:
parent
c593d36151
commit
d4246a2708
@ -76,6 +76,7 @@ RUN set -eux && \
|
||||
cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get /usr/bin/zabbix_get && \
|
||||
cp /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender /usr/bin/zabbix_sender && \
|
||||
cp /tmp/zabbix-${ZBX_VERSION}/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf && \
|
||||
chown -R zabbix:zabbix /etc/zabbix/ && \
|
||||
cd /tmp/ && \
|
||||
rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \
|
||||
apk del --purge --no-network \
|
||||
@ -91,3 +92,7 @@ VOLUME ["/var/lib/zabbix/enc"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_agentd", "--foreground", "-c", "/etc/zabbix/zabbix_agentd.conf"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -11,9 +11,9 @@ fi
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Default Zabbix server host
|
||||
ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"}
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default directories
|
||||
# User 'zabbix' home directory
|
||||
@ -21,37 +21,6 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
|
||||
# (will allow for "$MYSQL_PASSWORD_FILE" to fill in the value of "$MYSQL_PASSWORD" from a file)
|
||||
# unsets the VAR_FILE afterwards and just leaving VAR
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local defaultValue="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo "**** Both variables $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$defaultValue"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
echo "** Using ${var} variable from ENV"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
if [ ! -f "${!fileVar}" ]; then
|
||||
echo "**** Secret file \"${!fileVar}\" is not found"
|
||||
exit 1
|
||||
fi
|
||||
val="$(< "${!fileVar}")"
|
||||
echo "** Using ${var} variable from secret file"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
@ -138,8 +107,8 @@ prepare_zbx_agent_config() {
|
||||
|
||||
ZBX_AGENT_CONFIG=$ZABBIX_ETC_DIR/zabbix_agentd.conf
|
||||
|
||||
ZBX_PASSIVESERVERS=${ZBX_PASSIVESERVERS:-""}
|
||||
ZBX_ACTIVESERVERS=${ZBX_ACTIVESERVERS:-""}
|
||||
: ${ZBX_PASSIVESERVERS:=""}
|
||||
: ${ZBX_ACTIVESERVERS:=""}
|
||||
|
||||
[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS
|
||||
|
||||
@ -158,7 +127,7 @@ prepare_zbx_agent_config() {
|
||||
update_config_var $ZBX_AGENT_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
|
||||
update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
|
||||
|
||||
ZBX_PASSIVE_ALLOW=${ZBX_PASSIVE_ALLOW:-"true"}
|
||||
: ${ZBX_PASSIVE_ALLOW:="true"}
|
||||
if [ "$ZBX_PASSIVE_ALLOW" == "true" ]; then
|
||||
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
|
||||
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
|
||||
@ -170,7 +139,7 @@ prepare_zbx_agent_config() {
|
||||
update_config_var $ZBX_AGENT_CONFIG "ListenIP" "${ZBX_LISTENIP}"
|
||||
update_config_var $ZBX_AGENT_CONFIG "StartAgents" "${ZBX_STARTAGENTS}"
|
||||
|
||||
ZBX_ACTIVE_ALLOW=${ZBX_ACTIVE_ALLOW:-"true"}
|
||||
: ${ZBX_ACTIVE_ALLOW:="true"}
|
||||
if [ "$ZBX_ACTIVE_ALLOW" == "true" ]; then
|
||||
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
|
||||
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
|
||||
@ -216,12 +185,7 @@ prepare_agent
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix agent"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_agentd --foreground -c /etc/zabbix/zabbix_agentd.conf"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -38,6 +38,7 @@ RUN set -eux && \
|
||||
autoconf \
|
||||
automake \
|
||||
coreutils \
|
||||
pkgconf \
|
||||
git \
|
||||
g++ \
|
||||
make \
|
||||
@ -76,3 +77,7 @@ COPY ["conf/usr/sbin/zabbix_java_gateway", "/usr/sbin/"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_java_gateway"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -13,37 +13,6 @@ fi
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
|
||||
# (will allow for "$MYSQL_PASSWORD_FILE" to fill in the value of "$MYSQL_PASSWORD" from a file)
|
||||
# unsets the VAR_FILE afterwards and just leaving VAR
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local defaultValue="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo "**** Both variables $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$defaultValue"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
echo "** Using ${var} variable from ENV"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
if [ ! -f "${!fileVar}" ]; then
|
||||
echo "**** Secret file \"${!fileVar}\" is not found"
|
||||
exit 1
|
||||
fi
|
||||
val="$(< "${!fileVar}")"
|
||||
echo "** Using ${var} variable from secret file"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
@ -152,12 +121,7 @@ prepare_java_gateway
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix Java Gateway"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_java_gateway"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -45,8 +45,8 @@ RUN set -eux && \
|
||||
fping && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ARG MAJOR_VERSION=3.0
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}.28
|
||||
ARG MAJOR_VERSION=master
|
||||
ARG ZBX_VERSION=${MAJOR_VERSION}
|
||||
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
||||
|
||||
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
||||
@ -123,3 +123,7 @@ VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbi
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_proxy", "--foreground", "-c", "/etc/zabbix/zabbix_proxy.conf"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -10,9 +10,9 @@ if [ "${DEBUG_MODE}" == "true" ]; then
|
||||
fi
|
||||
|
||||
# Default Zabbix server host
|
||||
ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"}
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default directories
|
||||
# User 'zabbix' home directory
|
||||
@ -134,8 +134,8 @@ update_config_multiple_var() {
|
||||
|
||||
# Check prerequisites for MySQL database
|
||||
check_variables_mysql() {
|
||||
DB_SERVER_HOST=${DB_SERVER_HOST:-"mysql-server"}
|
||||
DB_SERVER_PORT=${DB_SERVER_PORT:-"3306"}
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
file_env MYSQL_USER
|
||||
@ -298,7 +298,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "StartDiscoverers" "${ZBX_STARTDISCOVERERS}"
|
||||
update_config_var $ZBX_CONFIG "StartHTTPPollers" "${ZBX_STARTHTTPPOLLERS}"
|
||||
|
||||
ZBX_JAVAGATEWAY_ENABLE=${ZBX_JAVAGATEWAY_ENABLE:-"false"}
|
||||
: ${ZBX_JAVAGATEWAY_ENABLE:="false"}
|
||||
if [ "${ZBX_JAVAGATEWAY_ENABLE}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}"
|
||||
update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}"
|
||||
@ -315,7 +315,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"
|
||||
update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"
|
||||
|
||||
ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"}
|
||||
: ${ZBX_ENABLE_SNMP_TRAPS:="false"}
|
||||
if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log"
|
||||
update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1"
|
||||
@ -395,12 +395,7 @@ prepare_proxy
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix proxy"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -119,3 +119,7 @@ VOLUME ["/var/lib/zabbix/ssh_keys", "/var/lib/zabbix/ssl/certs", "/var/lib/zabbi
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_proxy", "--foreground", "-c", "/etc/zabbix/zabbix_proxy.conf"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -10,9 +10,9 @@ if [ "${DEBUG_MODE}" == "true" ]; then
|
||||
fi
|
||||
|
||||
# Default Zabbix server host
|
||||
ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"}
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default directories
|
||||
# User 'zabbix' home directory
|
||||
@ -20,37 +20,6 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
# usage: file_env VAR [DEFAULT]
|
||||
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
|
||||
# (will allow for "$MYSQL_PASSWORD_FILE" to fill in the value of "$MYSQL_PASSWORD" from a file)
|
||||
# unsets the VAR_FILE afterwards and just leaving VAR
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local defaultValue="${2:-}"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo "**** Both variables $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local val="$defaultValue"
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
echo "** Using ${var} variable from ENV"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
if [ ! -f "${!fileVar}" ]; then
|
||||
echo "**** Secret file \"${!fileVar}\" is not found"
|
||||
exit 1
|
||||
fi
|
||||
val="$(< "${!fileVar}")"
|
||||
echo "** Using ${var} variable from secret file"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
@ -180,7 +149,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "StartDiscoverers" "${ZBX_STARTDISCOVERERS}"
|
||||
update_config_var $ZBX_CONFIG "StartHTTPPollers" "${ZBX_STARTHTTPPOLLERS}"
|
||||
|
||||
ZBX_JAVAGATEWAY_ENABLE=${ZBX_JAVAGATEWAY_ENABLE:-"false"}
|
||||
: ${ZBX_JAVAGATEWAY_ENABLE:="false"}
|
||||
if [ "${ZBX_JAVAGATEWAY_ENABLE}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}"
|
||||
update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}"
|
||||
@ -197,7 +166,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"
|
||||
update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"
|
||||
|
||||
ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"}
|
||||
: ${ZBX_ENABLE_SNMP_TRAPS:="false"}
|
||||
if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log"
|
||||
update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1"
|
||||
@ -286,12 +255,7 @@ prepare_proxy
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix proxy"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_proxy --foreground -c /etc/zabbix/zabbix_proxy.conf"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -129,3 +129,7 @@ VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbi
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_server", "--foreground", "-c", "/etc/zabbix/zabbix_server.conf"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -187,8 +187,8 @@ update_config_multiple_var() {
|
||||
|
||||
# Check prerequisites for MySQL database
|
||||
check_variables_mysql() {
|
||||
DB_SERVER_HOST=${DB_SERVER_HOST:-"mysql-server"}
|
||||
DB_SERVER_PORT=${DB_SERVER_PORT:-"3306"}
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
file_env MYSQL_USER
|
||||
@ -215,7 +215,7 @@ check_variables_mysql() {
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}}
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
@ -337,7 +337,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"
|
||||
update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"
|
||||
|
||||
ZBX_JAVAGATEWAY_ENABLE=${ZBX_JAVAGATEWAY_ENABLE:-"false"}
|
||||
: ${ZBX_JAVAGATEWAY_ENABLE:="false"}
|
||||
if [ "${ZBX_JAVAGATEWAY_ENABLE}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}"
|
||||
update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}"
|
||||
@ -354,7 +354,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"
|
||||
update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"
|
||||
|
||||
ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"}
|
||||
: ${ZBX_ENABLE_SNMP_TRAPS:="false"}
|
||||
if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log"
|
||||
update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1"
|
||||
@ -437,12 +437,7 @@ prepare_server
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix server"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -130,3 +130,7 @@ VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/ssh_keys", "/var/lib/zabbi
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
USER zabbix
|
||||
|
||||
CMD ["/usr/sbin/zabbix_server", "--foreground", "-c", "/etc/zabbix/zabbix_server.conf"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -132,9 +132,9 @@ check_variables_postgresql() {
|
||||
file_env POSTGRES_USER
|
||||
file_env POSTGRES_PASSWORD
|
||||
|
||||
DB_SERVER_HOST=${DB_SERVER_HOST:-"postgres-server"}
|
||||
DB_SERVER_PORT=${DB_SERVER_PORT:-"5432"}
|
||||
CREATE_ZBX_DB_USER=${CREATE_ZBX_DB_USER:-"false"}
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
@ -142,7 +142,7 @@ check_variables_postgresql() {
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
|
||||
DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA:-"public"}
|
||||
: ${DB_SERVER_SCHEMA:="public"}
|
||||
|
||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||
}
|
||||
@ -303,7 +303,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"
|
||||
update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"
|
||||
|
||||
ZBX_JAVAGATEWAY_ENABLE=${ZBX_JAVAGATEWAY_ENABLE:-"false"}
|
||||
: ${ZBX_JAVAGATEWAY_ENABLE:="false"}
|
||||
if [ "${ZBX_JAVAGATEWAY_ENABLE}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}"
|
||||
update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}"
|
||||
@ -320,7 +320,7 @@ update_zbx_config() {
|
||||
update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"
|
||||
update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"
|
||||
|
||||
ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"}
|
||||
: ${ZBX_ENABLE_SNMP_TRAPS:="false"}
|
||||
if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then
|
||||
update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log"
|
||||
update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1"
|
||||
@ -404,12 +404,7 @@ prepare_server
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix server"
|
||||
exec su zabbix -s "/bin/bash" -c "/usr/sbin/zabbix_server --foreground -c /etc/zabbix/zabbix_server.conf"
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -94,3 +94,5 @@ COPY ["conf/etc/php7/conf.d/99-zabbix.ini", "/etc/php7/conf.d/"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -11,14 +11,14 @@ fi
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
ZBX_SERVER_NAME=${ZBX_SERVER_NAME:-"Zabbix docker"}
|
||||
: ${ZBX_SERVER_NAME:="Zabbix docker"}
|
||||
# Default Zabbix server host
|
||||
ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"}
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default timezone for web interface
|
||||
PHP_TZ=${PHP_TZ:-"Europe/Riga"}
|
||||
: ${PHP_TZ:="Europe/Riga"}
|
||||
|
||||
# Default directories
|
||||
# Configuration files directory
|
||||
@ -135,8 +135,8 @@ update_config_multiple_var() {
|
||||
|
||||
# Check prerequisites for MySQL database
|
||||
check_variables_mysql() {
|
||||
DB_SERVER_HOST=${DB_SERVER_HOST:-"mysql-server"}
|
||||
DB_SERVER_PORT=${DB_SERVER_PORT:-"3306"}
|
||||
: ${DB_SERVER_HOST:="mysql-server"}
|
||||
: ${DB_SERVER_PORT:="3306"}
|
||||
USE_DB_ROOT_USER=false
|
||||
CREATE_ZBX_DB_USER=false
|
||||
file_env MYSQL_USER
|
||||
@ -161,7 +161,7 @@ check_variables_mysql() {
|
||||
[ -n "${MYSQL_USER}" ] && CREATE_ZBX_DB_USER=true
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}}
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
@ -271,12 +271,7 @@ prepare_web
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix frontend"
|
||||
exec /usr/sbin/httpd -D FOREGROUND
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
@ -93,3 +93,5 @@ COPY ["conf/etc/php7/conf.d/99-zabbix.ini", "/etc/php7/conf.d/"]
|
||||
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
set -o pipefail
|
||||
|
||||
set +e
|
||||
|
||||
@ -11,14 +11,14 @@ fi
|
||||
|
||||
# Default Zabbix installation name
|
||||
# Used only by Zabbix web-interface
|
||||
ZBX_SERVER_NAME=${ZBX_SERVER_NAME:-"Zabbix docker"}
|
||||
: ${ZBX_SERVER_NAME:="Zabbix docker"}
|
||||
# Default Zabbix server host
|
||||
ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"}
|
||||
: ${ZBX_SERVER_HOST:="zabbix-server"}
|
||||
# Default Zabbix server port number
|
||||
ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default timezone for web interface
|
||||
PHP_TZ=${PHP_TZ:-"Europe/Riga"}
|
||||
: ${PHP_TZ:="Europe/Riga"}
|
||||
|
||||
# Default directories
|
||||
# Configuration files directory
|
||||
@ -143,9 +143,9 @@ check_variables_postgresql() {
|
||||
file_env POSTGRES_USER
|
||||
file_env POSTGRES_PASSWORD
|
||||
|
||||
DB_SERVER_HOST=${DB_SERVER_HOST:-"postgres-server"}
|
||||
DB_SERVER_PORT=${DB_SERVER_PORT:-"5432"}
|
||||
CREATE_ZBX_DB_USER=${CREATE_ZBX_DB_USER:-"false"}
|
||||
: ${DB_SERVER_HOST:="postgres-server"}
|
||||
: ${DB_SERVER_PORT:="5432"}
|
||||
: ${CREATE_ZBX_DB_USER:="false"}
|
||||
|
||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||
@ -153,7 +153,7 @@ check_variables_postgresql() {
|
||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${POSTGRES_PASSWORD:-"zabbix"}
|
||||
|
||||
DB_SERVER_SCHEMA=${DB_SERVER_SCHEMA:-"public"}
|
||||
: ${DB_SERVER_SCHEMA:="public"}
|
||||
|
||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||
}
|
||||
@ -289,12 +289,7 @@ prepare_web
|
||||
|
||||
echo "########################################################"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
else
|
||||
echo "** Starting Zabbix frontend"
|
||||
exec /usr/sbin/httpd -D FOREGROUND
|
||||
fi
|
||||
echo "** Executing '$@'"
|
||||
exec "$@"
|
||||
|
||||
#################################################
|
||||
|
Loading…
Reference in New Issue
Block a user