Updated build process

This commit is contained in:
Alexey Pustovalov 2021-10-12 02:08:40 +02:00
parent 09dbb306ef
commit 6df01f148a
30 changed files with 75 additions and 536 deletions

View File

@ -20,7 +20,6 @@ LABEL org.opencontainers.image.title="Zabbix build base" \
org.opencontainers.image.source="${ZBX_SOURCES}"
RUN set -eux && \
env && \
apk add --no-cache --clean-protected \
bash \
autoconf \
@ -36,6 +35,7 @@ RUN set -eux && \
net-snmp-dev \
openipmi-dev \
openldap-dev \
openssl-dev \
pcre-dev \
postgresql-dev \
openjdk8 \

View File

@ -45,4 +45,7 @@ RUN set -eux && \
gettext \
git \
golang-1.16 \
unixodbc-dev
unixodbc-dev && \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*

View File

@ -68,4 +68,7 @@ RUN set -eux && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \
strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender && \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*

View File

@ -68,4 +68,7 @@ RUN set -eux && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \
strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender && \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*

View File

@ -56,4 +56,7 @@ RUN set -eux && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_proxy/zabbix_proxy && \
strip /tmp/zabbix-${ZBX_VERSION}/src/go/bin/zabbix_agent2 && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_get/zabbix_get && \
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender
strip /tmp/zabbix-${ZBX_VERSION}/src/zabbix_sender/zabbix_sender && \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*

View File

@ -1,487 +0,0 @@
#!/bin/bash
set -o pipefail
set +e
# Script trace mode
if [ "${DEBUG_MODE,,}" == "true" ]; then
set -o xtrace
fi
# Default directories
# User 'zabbix' home directory
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
var_value="${var_value//\\/\\\\}"
var_value="${var_value//[$'\n']/}"
var_value="${var_value//\//\\/}"
var_value="${var_value//./\\.}"
var_value="${var_value//\*/\\*}"
var_value="${var_value//^/\\^}"
var_value="${var_value//\$/\\\$}"
var_value="${var_value//\&/\\\&}"
var_value="${var_value//\[/\\[}"
var_value="${var_value//\]/\\]}"
echo "$var_value"
}
update_config_var() {
local config_path=$1
local var_name=$2
local var_value=$3
local is_multiple=$4
local masklist=("DBPassword TLSPSKIdentity")
if [ ! -f "$config_path" ]; then
echo "**** Configuration file '$config_path' does not exist"
return
fi
if [[ " ${masklist[@]} " =~ " $var_name " ]] && [ ! -z "$var_value" ]; then
echo -n "** Updating '$config_path' parameter \"$var_name\": '****'. Enable DEBUG_MODE to view value ..."
else
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
fi
# Remove configuration parameter definition in case of unset parameter value
if [ -z "$var_value" ]; then
sed -i -e "/^$var_name=/d" "$config_path"
echo "removed"
return
fi
# Remove value from configuration parameter in case of double quoted parameter value
if [ "$var_value" == '""' ]; then
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
echo "undefined"
return
fi
# Use full path to a file for TLS related configuration parameters
if [[ $var_name =~ ^TLS.*File$ ]]; then
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
fi
# Escaping characters in parameter value and name
var_value=$(escape_spec_char "$var_value")
var_name=$(escape_spec_char "$var_name")
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
echo "updated"
elif [ "$(grep -Ec "^# $var_name=" $config_path)" -gt 1 ]; then
sed -i -e "/^[#;] $var_name=$/i\\$var_name=$var_value" "$config_path"
echo "added first occurrence"
else
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=$var_value/" "$config_path"
echo "added"
fi
}
update_config_multiple_var() {
local config_path=$1
local var_name=$2
local var_value=$3
var_value="${var_value%\"}"
var_value="${var_value#\"}"
local IFS=,
local OPT_LIST=($var_value)
for value in "${OPT_LIST[@]}"; do
update_config_var $config_path $var_name $value true
done
}
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
file_env MYSQL_PASSWORD
file_env MYSQL_ROOT_PASSWORD
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
exit 1
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 it is not empty"
exit 1
fi
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
USE_DB_ROOT_USER=true
DB_SERVER_ROOT_USER="root"
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
fi
[ -n "${MYSQL_USER}" ] && [ "${USE_DB_ROOT_USER}" == "true" ] && CREATE_ZBX_DB_USER=true
# If root password is not specified use provided credentials
: ${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"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
}
db_tls_params() {
local result=""
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
ssl_mode=${ZBX_DBTLSCONNECT//verify_full/verify_identity}
result="--ssl-mode=$ssl_mode"
if [ -n "${ZBX_DBTLSCAFILE}" ]; then
result="${result} --ssl-ca=${ZBX_DBTLSCAFILE}"
fi
if [ -n "${ZBX_DBTLSKEYFILE}" ]; then
result="${result} --ssl-key=${ZBX_DBTLSKEYFILE}"
fi
if [ -n "${ZBX_DBTLSCERTFILE}" ]; then
result="${result} --ssl-cert=${ZBX_DBTLSCERTFILE}"
fi
fi
echo $result
}
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
fi
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
echo "* DB_SERVER_ZBX_PASS: ${DB_SERVER_ZBX_PASS}"
fi
echo "********************"
WAIT_TIMEOUT=5
ssl_opts="$(db_tls_params)"
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT
done
unset MYSQL_PWD
}
mysql_query() {
query=$1
local result=""
ssl_opts="$(db_tls_params)"
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
echo $result
}
create_db_user_mysql() {
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
echo "** Creating '${DB_SERVER_ZBX_USER}' user in MySQL database"
USER_EXISTS=$(mysql_query "SELECT 1 FROM mysql.user WHERE user = '${DB_SERVER_ZBX_USER}' AND host = '%'")
if [ -z "$USER_EXISTS" ]; then
mysql_query "CREATE USER '${DB_SERVER_ZBX_USER}'@'%' IDENTIFIED BY '${DB_SERVER_ZBX_PASS}'" 1>/dev/null
else
mysql_query "ALTER USER ${DB_SERVER_ZBX_USER} IDENTIFIED BY '${DB_SERVER_ZBX_PASS}';" 1>/dev/null
fi
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
}
create_db_database_mysql() {
DB_EXISTS=$(mysql_query "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME='${DB_SERVER_DBNAME}'")
if [ -z ${DB_EXISTS} ]; then
echo "** Database '${DB_SERVER_DBNAME}' does not exist. Creating..."
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET utf8 COLLATE utf8_bin" 1>/dev/null
# better solution?
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
else
echo "** Database '${DB_SERVER_DBNAME}' already exists. Please be careful with database COLLATE!"
fi
}
create_db_schema_mysql() {
DBVERSION_TABLE_EXISTS=$(mysql_query "SELECT 1 FROM information_schema.tables WHERE table_schema='${DB_SERVER_DBNAME}' and table_name = 'dbversion'")
if [ -n "${DBVERSION_TABLE_EXISTS}" ]; then
echo "** Table '${DB_SERVER_DBNAME}.dbversion' already exists."
ZBX_DB_VERSION=$(mysql_query "SELECT mandatory FROM ${DB_SERVER_DBNAME}.dbversion")
fi
if [ -z "${ZBX_DB_VERSION}" ]; then
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
ssl_opts="$(db_tls_params)"
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
unset MYSQL_PWD
fi
}
update_zbx_config() {
echo "** Preparing Zabbix server configuration file"
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"
update_config_var $ZBX_CONFIG "LogType" "console"
update_config_var $ZBX_CONFIG "LogFile"
update_config_var $ZBX_CONFIG "LogFileSize"
update_config_var $ZBX_CONFIG "PidFile"
update_config_var $ZBX_CONFIG "DebugLevel" "${ZBX_DEBUGLEVEL}"
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
update_config_var $ZBX_CONFIG "DBTLSConnect" "${ZBX_DBTLSCONNECT}"
update_config_var $ZBX_CONFIG "DBTLSCAFile" "${ZBX_DBTLSCAFILE}"
update_config_var $ZBX_CONFIG "DBTLSCertFile" "${ZBX_DBTLSCERTFILE}"
update_config_var $ZBX_CONFIG "DBTLSKeyFile" "${ZBX_DBTLSKEYFILE}"
update_config_var $ZBX_CONFIG "DBTLSCipher" "${ZBX_DBTLSCIPHER}"
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
if [ -n "${VAULT_TOKEN}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"
update_config_var $ZBX_CONFIG "DBUser"
update_config_var $ZBX_CONFIG "DBPassword"
else
update_config_var $ZBX_CONFIG "VaultDBPath"
update_config_var $ZBX_CONFIG "VaultURL"
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
fi
update_config_var $ZBX_CONFIG "StartReportWriters" "${ZBX_STARTREPORTWRITERS}"
: ${ZBX_WEBSERVICEURL:="http://zabbix-web-service:10053/report"}
update_config_var $ZBX_CONFIG "WebServiceURL" "${ZBX_WEBSERVICEURL}"
update_config_var $ZBX_CONFIG "HistoryStorageURL" "${ZBX_HISTORYSTORAGEURL}"
update_config_var $ZBX_CONFIG "HistoryStorageTypes" "${ZBX_HISTORYSTORAGETYPES}"
update_config_var $ZBX_CONFIG "HistoryStorageDateIndex" "${ZBX_HISTORYSTORAGEDATEINDEX}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "StatsAllowedIP" "${ZBX_STATSALLOWEDIP}"
update_config_var $ZBX_CONFIG "StartPollers" "${ZBX_STARTPOLLERS}"
update_config_var $ZBX_CONFIG "StartIPMIPollers" "${ZBX_IPMIPOLLERS}"
update_config_var $ZBX_CONFIG "StartPollersUnreachable" "${ZBX_STARTPOLLERSUNREACHABLE}"
update_config_var $ZBX_CONFIG "StartTrappers" "${ZBX_STARTTRAPPERS}"
update_config_var $ZBX_CONFIG "StartPingers" "${ZBX_STARTPINGERS}"
update_config_var $ZBX_CONFIG "StartDiscoverers" "${ZBX_STARTDISCOVERERS}"
update_config_var $ZBX_CONFIG "StartHistoryPollers" "${ZBX_STARTHISTORYPOLLERS}"
update_config_var $ZBX_CONFIG "StartHTTPPollers" "${ZBX_STARTHTTPPOLLERS}"
update_config_var $ZBX_CONFIG "StartPreprocessors" "${ZBX_STARTPREPROCESSORS}"
update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"
update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"
update_config_var $ZBX_CONFIG "StartAlerters" "${ZBX_STARTALERTERS}"
update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"
update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"
update_config_var $ZBX_CONFIG "StartLLDProcessors" "${ZBX_STARTLLDPROCESSORS}"
: ${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}"
update_config_var $ZBX_CONFIG "StartJavaPollers" "${ZBX_STARTJAVAPOLLERS:-"5"}"
else
update_config_var $ZBX_CONFIG "JavaGateway"
update_config_var $ZBX_CONFIG "JavaGatewayPort"
update_config_var $ZBX_CONFIG "StartJavaPollers"
fi
update_config_var $ZBX_CONFIG "StartVMwareCollectors" "${ZBX_STARTVMWARECOLLECTORS}"
update_config_var $ZBX_CONFIG "VMwareFrequency" "${ZBX_VMWAREFREQUENCY}"
update_config_var $ZBX_CONFIG "VMwarePerfFrequency" "${ZBX_VMWAREPERFFREQUENCY}"
update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"
update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"
: ${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"
else
update_config_var $ZBX_CONFIG "SNMPTrapperFile"
update_config_var $ZBX_CONFIG "StartSNMPTrapper"
fi
update_config_var $ZBX_CONFIG "HousekeepingFrequency" "${ZBX_HOUSEKEEPINGFREQUENCY}"
update_config_var $ZBX_CONFIG "MaxHousekeeperDelete" "${ZBX_MAXHOUSEKEEPERDELETE}"
update_config_var $ZBX_CONFIG "SenderFrequency" "${ZBX_SENDERFREQUENCY}"
update_config_var $ZBX_CONFIG "CacheSize" "${ZBX_CACHESIZE}"
update_config_var $ZBX_CONFIG "CacheUpdateFrequency" "${ZBX_CACHEUPDATEFREQUENCY}"
update_config_var $ZBX_CONFIG "StartDBSyncers" "${ZBX_STARTDBSYNCERS}"
update_config_var $ZBX_CONFIG "HistoryCacheSize" "${ZBX_HISTORYCACHESIZE}"
update_config_var $ZBX_CONFIG "HistoryIndexCacheSize" "${ZBX_HISTORYINDEXCACHESIZE}"
update_config_var $ZBX_CONFIG "TrendCacheSize" "${ZBX_TRENDCACHESIZE}"
update_config_var $ZBX_CONFIG "ValueCacheSize" "${ZBX_VALUECACHESIZE}"
update_config_var $ZBX_CONFIG "Timeout" "${ZBX_TIMEOUT}"
update_config_var $ZBX_CONFIG "TrapperTimeout" "${ZBX_TRAPPERTIMEOUT}"
update_config_var $ZBX_CONFIG "UnreachablePeriod" "${ZBX_UNREACHABLEPERIOD}"
update_config_var $ZBX_CONFIG "UnavailableDelay" "${ZBX_UNAVAILABLEDELAY}"
update_config_var $ZBX_CONFIG "UnreachableDelay" "${ZBX_UNREACHABLEDELAY}"
update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts"
update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts"
if [ -n "${ZBX_EXPORTFILESIZE}" ]; then
update_config_var $ZBX_CONFIG "ExportDir" "$ZABBIX_USER_HOME_DIR/export/"
update_config_var $ZBX_CONFIG "ExportFileSize" "${ZBX_EXPORTFILESIZE}"
update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}"
fi
update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping"
update_config_var $ZBX_CONFIG "Fping6Location" "/usr/bin/fping6"
update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys"
update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}"
update_config_var $ZBX_CONFIG "StartProxyPollers" "${ZBX_STARTPROXYPOLLERS}"
update_config_var $ZBX_CONFIG "ProxyConfigFrequency" "${ZBX_PROXYCONFIGFREQUENCY}"
update_config_var $ZBX_CONFIG "ProxyDataFrequency" "${ZBX_PROXYDATAFREQUENCY}"
update_config_var $ZBX_CONFIG "SSLCertLocation" "$ZABBIX_USER_HOME_DIR/ssl/certs/"
update_config_var $ZBX_CONFIG "SSLKeyLocation" "$ZABBIX_USER_HOME_DIR/ssl/keys/"
update_config_var $ZBX_CONFIG "SSLCALocation" "$ZABBIX_USER_HOME_DIR/ssl/ssl_ca/"
update_config_var $ZBX_CONFIG "LoadModulePath" "$ZABBIX_USER_HOME_DIR/modules/"
update_config_multiple_var $ZBX_CONFIG "LoadModule" "${ZBX_LOADMODULE}"
update_config_var $ZBX_CONFIG "TLSCAFile" "${ZBX_TLSCAFILE}"
update_config_var $ZBX_CONFIG "TLSCRLFile" "${ZBX_TLSCRLFILE}"
update_config_var $ZBX_CONFIG "TLSCertFile" "${ZBX_TLSCERTFILE}"
update_config_var $ZBX_CONFIG "TLSCipherAll" "${ZBX_TLSCIPHERALL}"
update_config_var $ZBX_CONFIG "TLSCipherAll13" "${ZBX_TLSCIPHERALL13}"
update_config_var $ZBX_CONFIG "TLSCipherCert" "${ZBX_TLSCIPHERCERT}"
update_config_var $ZBX_CONFIG "TLSCipherCert13" "${ZBX_TLSCIPHERCERT13}"
update_config_var $ZBX_CONFIG "TLSCipherPSK" "${ZBX_TLSCIPHERPSK}"
update_config_var $ZBX_CONFIG "TLSCipherPSK13" "${ZBX_TLSCIPHERPSK13}"
update_config_var $ZBX_CONFIG "TLSKeyFile" "${ZBX_TLSKEYFILE}"
update_config_var $ZBX_CONFIG "TLSPSKIdentity" "${ZBX_TLSPSKIDENTITY}"
update_config_var $ZBX_CONFIG "TLSPSKFile" "${ZBX_TLSPSKFILE}"
if [ "$(id -u)" != '0' ]; then
update_config_var $ZBX_CONFIG "User" "$(whoami)"
else
update_config_var $ZBX_CONFIG "AllowRoot" "1"
fi
}
prepare_server() {
echo "** Preparing Zabbix server"
check_variables_mysql
check_db_connect_mysql
create_db_user_mysql
create_db_database_mysql
create_db_schema_mysql
update_zbx_config
}
#################################################
if [ "${1#-}" != "$1" ]; then
set -- /usr/sbin/zabbix_server "$@"
fi
if [ "$1" == '/usr/sbin/zabbix_server' ]; then
prepare_server
fi
exec "$@"
#################################################

View File

@ -60,7 +60,7 @@ RUN set -eux && \
REPOLIST="baseos,appstream,epel" && \
INSTALL_PKGS="libevent \
tini \
systemd \
gzip \
libssh \
file-libs \
fping \

View File

@ -60,7 +60,7 @@ RUN set -eux && \
microdnf -y module enable mysql && \
INSTALL_PKGS="libevent \
tini \
systemd \
gzip \
libssh \
file-libs \
fping \

View File

@ -61,7 +61,7 @@ RUN set -eux && \
libssh \
fping \
file-libs \
systemd \
gzip \
libxml2 \
net-snmp-libs \
OpenIPMI-libs \

View File

@ -61,7 +61,7 @@ RUN set -eux && \
libssh \
fping \
file-libs \
systemd \
gzip \
libxml2 \
net-snmp-libs \
OpenIPMI-libs \

View File

@ -28,10 +28,17 @@ RUN set -eux && \
--shell /sbin/nologin \
--home-dir /var/lib/zabbix/ \
zabbix && \
dnf --quiet makecache && \
dnf -y install --setopt=tsflags=nodocs \
REPOLIST="baseos,appstream" && \
INSTALL_PKGS="bash \
tzdata \
net-snmp && \
net-snmp" && \
dnf -y install \
--disablerepo "*" \
--enablerepo "${REPOLIST}" \
--setopt=tsflags=nodocs \
--setopt=install_weak_deps=False \
--best \
${INSTALL_PKGS} && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \

View File

@ -6,7 +6,7 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" "
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT="\n"
LABEL org.opencontainers.image.title="zabbix-snmptraps-ol" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
@ -20,7 +20,8 @@ LABEL org.opencontainers.image.title="zabbix-snmptraps-ol" \
STOPSIGNAL SIGTERM
RUN set -eux && \
INSTALL_PKGS="tzdata \
INSTALL_PKGS="bash \
tzdata \
net-snmp" && \
groupadd --system --gid 1995 zabbix && \
useradd \
@ -30,9 +31,13 @@ RUN set -eux && \
--shell /sbin/nologin \
--home-dir /var/lib/zabbix/ \
zabbix && \
microdnf -y --disablerepo="*" --enablerepo="ol8_baseos_latest" \
microdnf -y install \
--disablerepo="*" \
--enablerepo="ol8_baseos_latest" \
--enablerepo="ol8_appstream" \
install --setopt=install_weak_deps=0 --best --nodocs ${INSTALL_PKGS} && \
--setopt=install_weak_deps=0 \
--best \
--nodocs ${INSTALL_PKGS} && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \

View File

@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log"
ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"}
ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-" "}
ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-"\n"}
date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT")

View File

@ -10,7 +10,7 @@ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES}
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" "
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT="\n"
LABEL name="zabbix/zabbix-snmptraps-trunk" \
maintainer="alexey.pustovalov@zabbix.com" \
@ -43,7 +43,8 @@ STOPSIGNAL SIGTERM
COPY ["licenses", "/licenses"]
RUN set -eux && \
INSTALL_PKGS="shadow-utils \
INSTALL_PKGS="bash \
shadow-utils \
tzdata \
net-snmp" && \
microdnf -y --disablerepo="*" --enablerepo="rhel-8-for-x86_64-baseos-rpms" \

View File

@ -4,7 +4,7 @@ ZABBIX_TRAPS_FILE="/var/lib/zabbix/snmptraps/snmptraps.log"
ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"}
ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-" "}
ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-"\n"}
date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT")

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support
@ -138,6 +138,7 @@ The variable is timezone in PHP format. Full list of supported timezones are ava
The variable is visible Zabbix installation name in right top corner of the web interface.
### `DB_DOUBLE_IEEE754`
Use IEEE754 compatible value range for 64-bit Numeric (float) history values. Available since 5.0.0. Enabled by default.

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support
@ -237,7 +237,7 @@ The volume allows to use custom certificates for SAML authentification. The volu
The `zabbix-web-nginx-mysql` images come in many flavors, each designed for a specific use case.
## `zabbix-agent2:alpine-<version>`
## `zabbix-web-nginx-mysql:alpine-<version>`
This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
@ -245,11 +245,11 @@ This variant is highly recommended when final image size being as small as possi
To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
## `zabbix-agent:ubuntu-<version>`
## `zabbix-web-nginx-mysql:ubuntu-<version>`
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
## `zabbix-agent:ol-<version>`
## `zabbix-web-nginx-mysql:ol-<version>`
Oracle Linux is an open-source operating system available under the GNU General Public License (GPLv2). Suitable for general purpose or Oracle workloads, it benefits from rigorous testing of more than 128,000 hours per day with real-world workloads and includes unique innovations such as Ksplice for zero-downtime kernel patching, DTrace for real-time diagnostics, the powerful Btrfs file system, and more.

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -38,7 +38,7 @@ These are the only official Zabbix web interface Docker images. They are based o
Images are updated when new releases are published. The image with ``latest`` tag is based on Alpine Linux.
Zabbix web interface available in three editions:
Zabbix web interface available in four editions:
- Zabbix web-interface based on Apache2 web server with MySQL database support
- Zabbix web-interface based on Apache2 web server with PostgreSQL database support
- Zabbix web-interface based on Nginx web server with MySQL database support

View File

@ -45,7 +45,7 @@ Please also follow usage instructions of each Zabbix component image:
* [zabbix-proxy-sqlite3](https://hub.docker.com/r/zabbix/zabbix-proxy-sqlite3/) - Zabbix proxy with SQLite3 database support
* [zabbix-proxy-mysql](https://hub.docker.com/r/zabbix/zabbix-proxy-mysql/) - Zabbix proxy with MySQL database support
* [zabbix-java-gateway](https://hub.docker.com/r/zabbix/zabbix-java-gateway/) - Zabbix Java Gateway
* [zabbix-zabbix-web-service](https://hub.docker.com/r/zabbix/zabbix-web-service/) - Zabbix web service for performing various tasks using headless web browser (for example, reporting)
* [zabbix-web-service](https://hub.docker.com/r/zabbix/zabbix-web-service/) - Zabbix web service for performing various tasks using headless web browser (for example, reporting)
* [zabbix-snmptraps](https://hub.docker.com/r/zabbix/zabbix-snmptraps/) - Additional container image for Zabbix server and Zabbix proxy to support SNMP traps
## Issues and Wiki

View File

@ -61,9 +61,9 @@ services:
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
# - ./.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
ulimits:
nproc: 65535
nofile:
@ -245,9 +245,9 @@ services:
- /etc/timezone:/etc/timezone:ro
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
# - ./.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
deploy:
resources:
limits:
@ -306,9 +306,9 @@ services:
- /etc/timezone:/etc/timezone:ro
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
# - ./.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
# - ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
# - ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
# - ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
deploy:
resources:
limits:
@ -540,9 +540,9 @@ services:
# command: -c ssl=on -c ssl_cert_file=/run/secrets/server-cert.pem -c ssl_key_file=/run/secrets/server-key.pem -c ssl_ca_file=/run/secrets/root-ca.pem
volumes:
- ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw
- ./.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
- ./.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro
- ./.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro
- ./env_vars/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
- ./env_vars/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro
- ./env_vars/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro
env_file:
- ./env_vars/.env_db_pgsql
secrets: