mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-01-20 20:38:36 +01:00
Added posibility for custom SQL scripts during DB init
This commit is contained in:
parent
0dbe8461f3
commit
dd9afde5f2
@ -20,6 +20,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -250,6 +253,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -290,16 +314,7 @@ create_db_schema_mysql() {
|
||||
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-proxy-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
|
||||
exec_sql_file "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -247,6 +250,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -287,16 +311,7 @@ create_db_schema_mysql() {
|
||||
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-proxy-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
|
||||
exec_sql_file "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -247,6 +250,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -287,16 +311,7 @@ create_db_schema_mysql() {
|
||||
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-proxy-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
|
||||
exec_sql_file "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -247,6 +250,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -261,7 +285,6 @@ create_db_user_mysql() {
|
||||
fi
|
||||
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
mysql_query "GRANT SESSION_VARIABLES_ADMIN ON *. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
}
|
||||
|
||||
create_db_database_mysql() {
|
||||
@ -288,16 +311,7 @@ create_db_schema_mysql() {
|
||||
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-proxy-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
|
||||
exec_sql_file "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -247,6 +250,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -287,16 +311,7 @@ create_db_schema_mysql() {
|
||||
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-proxy-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
|
||||
exec_sql_file "/usr/share/doc/zabbix-proxy-mysql/create.sql.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -15,6 +15,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -245,6 +248,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -266,7 +290,7 @@ create_db_database_mysql() {
|
||||
|
||||
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
|
||||
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET ${DB_CHARACTER_SET} COLLATE ${DB_CHARACTER_COLLATE}" 1>/dev/null
|
||||
# better solution?
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
else
|
||||
@ -274,6 +298,17 @@ create_db_database_mysql() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
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'")
|
||||
|
||||
@ -285,16 +320,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-mysql/create.sql.gz"
|
||||
|
||||
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
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -15,6 +15,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -242,6 +245,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -263,7 +287,7 @@ create_db_database_mysql() {
|
||||
|
||||
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
|
||||
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET ${DB_CHARACTER_SET} COLLATE ${DB_CHARACTER_COLLATE}" 1>/dev/null
|
||||
# better solution?
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
else
|
||||
@ -271,6 +295,17 @@ create_db_database_mysql() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
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'")
|
||||
|
||||
@ -282,16 +317,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-mysql/create.sql.gz"
|
||||
|
||||
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
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -15,6 +15,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8"}
|
||||
|
||||
# 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)
|
||||
@ -242,6 +245,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -263,7 +287,7 @@ create_db_database_mysql() {
|
||||
|
||||
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
|
||||
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET ${DB_CHARACTER_SET} COLLATE ${DB_CHARACTER_COLLATE}" 1>/dev/null
|
||||
# better solution?
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
else
|
||||
@ -271,6 +295,17 @@ create_db_database_mysql() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
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'")
|
||||
|
||||
@ -282,16 +317,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-mysql/create.sql.gz"
|
||||
|
||||
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
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -15,6 +15,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8"}
|
||||
|
||||
# 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)
|
||||
@ -242,6 +245,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -263,7 +287,7 @@ create_db_database_mysql() {
|
||||
|
||||
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
|
||||
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET ${DB_CHARACTER_SET} COLLATE ${DB_CHARACTER_COLLATE}" 1>/dev/null
|
||||
# better solution?
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
else
|
||||
@ -271,6 +295,17 @@ create_db_database_mysql() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
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'")
|
||||
|
||||
@ -282,16 +317,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-mysql/create.sql.gz"
|
||||
|
||||
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
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -15,6 +15,9 @@ ZABBIX_USER_HOME_DIR="/var/lib/zabbix"
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
|
||||
: ${DB_CHARACTER_SET:="utf8"}
|
||||
: ${DB_CHARACTER_COLLATE:="utf8_bin"}
|
||||
|
||||
# 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)
|
||||
@ -242,6 +245,27 @@ mysql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
|
||||
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command "$sql_script" | 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
|
||||
}
|
||||
|
||||
create_db_user_mysql() {
|
||||
[ "${CREATE_ZBX_DB_USER}" == "true" ] || return
|
||||
|
||||
@ -263,7 +287,7 @@ create_db_database_mysql() {
|
||||
|
||||
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
|
||||
mysql_query "CREATE DATABASE ${DB_SERVER_DBNAME} CHARACTER SET ${DB_CHARACTER_SET} COLLATE ${DB_CHARACTER_COLLATE}" 1>/dev/null
|
||||
# better solution?
|
||||
mysql_query "GRANT ALL PRIVILEGES ON $DB_SERVER_DBNAME. * TO '${DB_SERVER_ZBX_USER}'@'%'" 1>/dev/null
|
||||
else
|
||||
@ -271,6 +295,17 @@ create_db_database_mysql() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
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'")
|
||||
|
||||
@ -282,16 +317,10 @@ create_db_schema_mysql() {
|
||||
if [ -z "${ZBX_DB_VERSION}" ]; then
|
||||
echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL"
|
||||
|
||||
ssl_opts="$(db_tls_params)"
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-mysql/create.sql.gz"
|
||||
|
||||
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
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -242,6 +242,44 @@ psql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command $sql_script | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
}
|
||||
|
||||
create_db_database_postgresql() {
|
||||
DB_EXISTS=$(psql_query "SELECT 1 AS result FROM pg_database WHERE datname='${DB_SERVER_DBNAME}'" "${DB_SERVER_DBNAME}")
|
||||
|
||||
@ -281,6 +319,17 @@ create_db_database_postgresql() {
|
||||
psql_query "CREATE SCHEMA IF NOT EXISTS ${DB_SERVER_SCHEMA}" "${DB_SERVER_DBNAME}" 1>/dev/null
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
create_db_schema_postgresql() {
|
||||
DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid =
|
||||
c.relnamespace WHERE n.nspname = '$DB_SERVER_SCHEMA' AND c.relname = 'dbversion'" "${DB_SERVER_DBNAME}")
|
||||
@ -297,39 +346,14 @@ create_db_schema_postgresql() {
|
||||
psql_query "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" "${DB_SERVER_DBNAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"
|
||||
|
||||
if [ "${ENABLE_TIMESCALEDB,,}" == "true" ]; then
|
||||
cat /usr/share/doc/zabbix-server-postgresql/timescaledb.sql | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -242,6 +242,44 @@ psql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command $sql_script | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
}
|
||||
|
||||
create_db_database_postgresql() {
|
||||
DB_EXISTS=$(psql_query "SELECT 1 AS result FROM pg_database WHERE datname='${DB_SERVER_DBNAME}'" "${DB_SERVER_DBNAME}")
|
||||
|
||||
@ -281,6 +319,17 @@ create_db_database_postgresql() {
|
||||
psql_query "CREATE SCHEMA IF NOT EXISTS ${DB_SERVER_SCHEMA}" "${DB_SERVER_DBNAME}" 1>/dev/null
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
create_db_schema_postgresql() {
|
||||
DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid =
|
||||
c.relnamespace WHERE n.nspname = '$DB_SERVER_SCHEMA' AND c.relname = 'dbversion'" "${DB_SERVER_DBNAME}")
|
||||
@ -297,39 +346,14 @@ create_db_schema_postgresql() {
|
||||
psql_query "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" "${DB_SERVER_DBNAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"
|
||||
|
||||
if [ "${ENABLE_TIMESCALEDB,,}" == "true" ]; then
|
||||
cat /usr/share/doc/zabbix-server-postgresql/timescaledb.sql | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -242,6 +242,44 @@ psql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command $sql_script | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
}
|
||||
|
||||
create_db_database_postgresql() {
|
||||
DB_EXISTS=$(psql_query "SELECT 1 AS result FROM pg_database WHERE datname='${DB_SERVER_DBNAME}'" "${DB_SERVER_DBNAME}")
|
||||
|
||||
@ -281,6 +319,17 @@ create_db_database_postgresql() {
|
||||
psql_query "CREATE SCHEMA IF NOT EXISTS ${DB_SERVER_SCHEMA}" "${DB_SERVER_DBNAME}" 1>/dev/null
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
create_db_schema_postgresql() {
|
||||
DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid =
|
||||
c.relnamespace WHERE n.nspname = '$DB_SERVER_SCHEMA' AND c.relname = 'dbversion'" "${DB_SERVER_DBNAME}")
|
||||
@ -297,39 +346,14 @@ create_db_schema_postgresql() {
|
||||
psql_query "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" "${DB_SERVER_DBNAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"
|
||||
|
||||
if [ "${ENABLE_TIMESCALEDB,,}" == "true" ]; then
|
||||
cat /usr/share/doc/zabbix-server-postgresql/timescaledb.sql | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,8 @@ RUN set -eux && \
|
||||
mkdir -p /etc/zabbix && \
|
||||
mkdir -p /var/lib/zabbix && \
|
||||
mkdir -p /usr/lib/zabbix/alertscripts && \
|
||||
mkdir -p /usr/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/dbscripts && \
|
||||
mkdir -p /var/lib/zabbix/enc && \
|
||||
mkdir -p /var/lib/zabbix/export && \
|
||||
mkdir -p /usr/lib/zabbix/externalscripts && \
|
||||
|
@ -242,6 +242,44 @@ psql_query() {
|
||||
echo $result
|
||||
}
|
||||
|
||||
exec_sql_file() {
|
||||
sql_script=$1
|
||||
|
||||
local command="cat"
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
if [ "${sql_script: -3}" == ".gz" ]; then
|
||||
command="zcat"
|
||||
fi
|
||||
|
||||
$command $sql_script | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
}
|
||||
|
||||
create_db_database_postgresql() {
|
||||
DB_EXISTS=$(psql_query "SELECT 1 AS result FROM pg_database WHERE datname='${DB_SERVER_DBNAME}'" "${DB_SERVER_DBNAME}")
|
||||
|
||||
@ -281,6 +319,17 @@ create_db_database_postgresql() {
|
||||
psql_query "CREATE SCHEMA IF NOT EXISTS ${DB_SERVER_SCHEMA}" "${DB_SERVER_DBNAME}" 1>/dev/null
|
||||
}
|
||||
|
||||
apply_db_scripts() {
|
||||
db_scripts=$1
|
||||
|
||||
for sql_script in $db_scripts; do
|
||||
[ -e "$sql_script" ] || continue
|
||||
echo "** Processing additional '$sql_script' SQL script"
|
||||
|
||||
exec_sql_file "$sql_script"
|
||||
done
|
||||
}
|
||||
|
||||
create_db_schema_postgresql() {
|
||||
DBVERSION_TABLE_EXISTS=$(psql_query "SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid =
|
||||
c.relnamespace WHERE n.nspname = '$DB_SERVER_SCHEMA' AND c.relname = 'dbversion'" "${DB_SERVER_DBNAME}")
|
||||
@ -297,39 +346,14 @@ create_db_schema_postgresql() {
|
||||
psql_query "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" "${DB_SERVER_DBNAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ "${POSTGRES_USE_IMPLICIT_SEARCH_PATH,,}" == "false" ] && [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
if [ -n "${ZBX_DBTLSCONNECT}" ]; then
|
||||
PGSSLMODE=${ZBX_DBTLSCONNECT//_/-}
|
||||
export PGSSLMODE=${PGSSLMODE//required/require}
|
||||
export PGSSLROOTCERT=${ZBX_DBTLSCAFILE}
|
||||
export PGSSLCERT=${ZBX_DBTLSCERTFILE}
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/create.sql.gz"
|
||||
|
||||
if [ "${ENABLE_TIMESCALEDB,,}" == "true" ]; then
|
||||
cat /usr/share/doc/zabbix-server-postgresql/timescaledb.sql | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
exec_sql_file "/usr/share/doc/zabbix-server-postgresql/timescaledb.sql"
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
unset PGSSLMODE
|
||||
unset PGSSLROOTCERT
|
||||
unset PGSSLCERT
|
||||
unset PGSSLKEY
|
||||
apply_db_scripts "/usr/lib/zabbix/dbscripts/*.sql"
|
||||
apply_db_scripts "/var/lib/zabbix/dbscripts/*.sql"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -46,6 +46,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -59,6 +59,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -46,6 +46,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -59,6 +59,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -46,6 +46,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -9,6 +9,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -59,6 +59,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -8,6 +8,7 @@ services:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -45,6 +45,7 @@ services:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -8,6 +8,7 @@ services:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
@ -58,6 +58,7 @@ services:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
|
||||
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/dbscripts:/var/lib/zabbix/dbscripts:ro
|
||||
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
|
||||
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
|
||||
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
|
||||
|
Loading…
Reference in New Issue
Block a user