Fixed MySQL socket usage

This commit is contained in:
Alexey Pustovalov 2023-05-02 15:33:33 +09:00
parent 12179538a5
commit 2fa678a75a
29 changed files with 420 additions and 119 deletions

View File

@ -142,8 +142,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -177,6 +180,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix_proxy"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -207,8 +216,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -226,7 +239,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -243,7 +256,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -266,7 +279,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -356,10 +369,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -375,8 +394,6 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "ProxyLocalBuffer" "${ZBX_PROXYLOCALBUFFER}"
update_config_var $ZBX_CONFIG "ProxyOfflineBuffer" "${ZBX_PROXYOFFLINEBUFFER}"
update_config_var $ZBX_CONFIG "HeartbeatFrequency" "${ZBX_PROXYHEARTBEATFREQUENCY}"

View File

@ -142,8 +142,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -177,6 +180,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix_proxy"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -204,8 +213,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -223,7 +236,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -240,7 +253,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -263,7 +276,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -353,10 +366,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -372,8 +391,6 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "ProxyLocalBuffer" "${ZBX_PROXYLOCALBUFFER}"
update_config_var $ZBX_CONFIG "ProxyOfflineBuffer" "${ZBX_PROXYOFFLINEBUFFER}"
update_config_var $ZBX_CONFIG "HeartbeatFrequency" "${ZBX_PROXYHEARTBEATFREQUENCY}"

View File

@ -142,8 +142,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -177,6 +180,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix_proxy"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -204,8 +213,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -223,7 +236,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -240,7 +253,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -263,7 +276,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -353,10 +366,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -372,8 +391,6 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "ProxyLocalBuffer" "${ZBX_PROXYLOCALBUFFER}"
update_config_var $ZBX_CONFIG "ProxyOfflineBuffer" "${ZBX_PROXYOFFLINEBUFFER}"
update_config_var $ZBX_CONFIG "HeartbeatFrequency" "${ZBX_PROXYHEARTBEATFREQUENCY}"

View File

@ -142,8 +142,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -177,6 +180,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix_proxy"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -204,8 +213,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -223,7 +236,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -240,7 +253,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -263,7 +276,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -353,10 +366,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -372,8 +391,6 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "ProxyLocalBuffer" "${ZBX_PROXYLOCALBUFFER}"
update_config_var $ZBX_CONFIG "ProxyOfflineBuffer" "${ZBX_PROXYOFFLINEBUFFER}"
update_config_var $ZBX_CONFIG "HeartbeatFrequency" "${ZBX_PROXYHEARTBEATFREQUENCY}"

View File

@ -142,8 +142,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -177,6 +180,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix_proxy"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -204,8 +213,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -223,7 +236,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -240,7 +253,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -263,7 +276,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -353,10 +366,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "EnableRemoteCommands" "${ZBX_ENABLEREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -372,8 +391,6 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
update_config_var $ZBX_CONFIG "ProxyLocalBuffer" "${ZBX_PROXYLOCALBUFFER}"
update_config_var $ZBX_CONFIG "ProxyOfflineBuffer" "${ZBX_PROXYOFFLINEBUFFER}"
update_config_var $ZBX_CONFIG "HeartbeatFrequency" "${ZBX_PROXYHEARTBEATFREQUENCY}"

View File

@ -139,8 +139,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -174,6 +177,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -204,8 +213,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -223,7 +236,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -240,7 +253,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -263,7 +276,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -354,10 +367,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -381,8 +400,6 @@ update_zbx_config() {
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}"

View File

@ -139,8 +139,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -174,6 +177,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -201,8 +210,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -220,7 +233,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -237,7 +250,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -260,7 +273,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -351,10 +364,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -378,8 +397,6 @@ update_zbx_config() {
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}"

View File

@ -139,8 +139,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -174,6 +177,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -201,8 +210,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -220,7 +233,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -237,7 +250,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -260,7 +273,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -351,10 +364,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -378,8 +397,6 @@ update_zbx_config() {
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}"

View File

@ -139,8 +139,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -174,6 +177,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -201,8 +210,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -220,7 +233,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -237,7 +250,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -260,7 +273,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -351,10 +364,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -378,8 +397,6 @@ update_zbx_config() {
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}"

View File

@ -139,8 +139,11 @@ update_config_multiple_var() {
# Check prerequisites for MySQL database
check_variables_mysql() {
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
: ${DB_SERVER_HOST:="mysql-server"}
: ${DB_SERVER_PORT:="3306"}
fi
USE_DB_ROOT_USER=false
CREATE_ZBX_DB_USER=false
file_env MYSQL_USER
@ -174,6 +177,12 @@ check_variables_mysql() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -201,8 +210,12 @@ db_tls_params() {
check_db_connect_mysql() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
else
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
@ -220,7 +233,7 @@ check_db_connect_mysql() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -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
@ -237,7 +250,7 @@ mysql_query() {
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
result=$(mysql --silent --skip-column-names $mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
unset MYSQL_PWD
@ -260,7 +273,7 @@ exec_sql_file() {
$command "$sql_script" | mysql --silent --skip-column-names \
--default-character-set=${DB_CHARACTER_SET} \
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
$mysql_connect_args \
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
${DB_SERVER_DBNAME} 1>/dev/null
@ -351,10 +364,16 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"
fi
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
else
update_config_var $ZBX_CONFIG "DBHost"
update_config_var $ZBX_CONFIG "DBPort"
fi
update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"
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}" ] && [ -n "${ZBX_VAULTURL}" ]; then
update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"
@ -378,8 +397,6 @@ update_zbx_config() {
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}"

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -67,6 +67,12 @@ check_variables() {
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
DB_SERVER_DBNAME=${MYSQL_DATABASE:-"zabbix"}
if [ ! -n "${DB_SERVER_SOCKET}" ]; then
mysql_connect_args="-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT}"
else
mysql_connect_args="-S ${DB_SERVER_SOCKET}"
fi
}
db_tls_params() {
@ -95,6 +101,9 @@ check_db_connect() {
echo "********************"
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
if [ -n "${DB_SERVER_SOCKET}" ]; then
echo "* DB_SERVER_SOCKET: ${DB_SERVER_SOCKET}"
fi
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
if [ "${DEBUG_MODE,,}" == "true" ]; then
echo "* DB_SERVER_ZBX_USER: ${DB_SERVER_ZBX_USER}"
@ -108,7 +117,7 @@ check_db_connect() {
export MYSQL_PWD="${DB_SERVER_ZBX_PASS}"
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ZBX_USER} \
while [ ! "$(mysqladmin ping $mysql_connect_args -u ${DB_SERVER_ZBX_USER} \
--silent --connect_timeout=10 $ssl_opts)" ]; do
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
sleep $WAIT_TIMEOUT

View File

@ -7,6 +7,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -123,6 +124,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -183,6 +185,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -237,6 +240,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -428,6 +432,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -484,6 +489,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -44,6 +44,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -174,6 +175,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -241,6 +243,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -302,6 +305,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -524,6 +528,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -580,6 +585,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -7,6 +7,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -123,6 +124,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -183,6 +185,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -237,6 +240,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -427,6 +431,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -483,6 +488,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -44,6 +44,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -174,6 +175,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -241,6 +243,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -302,6 +305,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -521,6 +525,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -577,6 +582,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -7,6 +7,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -123,6 +124,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -183,6 +185,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -237,6 +240,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -427,6 +431,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -483,6 +488,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -44,6 +44,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -174,6 +175,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -241,6 +243,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -302,6 +305,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -521,6 +525,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -577,6 +582,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -6,6 +6,7 @@ services:
- "10051:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -120,6 +121,7 @@ services:
- "10071:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -177,6 +179,7 @@ services:
- "8443:8443"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -230,6 +233,7 @@ services:
- "443:8443"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -419,6 +423,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -475,6 +480,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -43,6 +43,7 @@ services:
- "10051:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./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
@ -171,6 +172,7 @@ services:
- "10071:10051"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
@ -237,6 +239,7 @@ services:
- "8443:8443"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/apache2:/etc/ssl/apache2:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -297,6 +300,7 @@ services:
- "443:8443"
volumes:
- /etc/localtime:/etc/localtime:ro
# - dbsocket:/var/run/mysqld/
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
@ -515,6 +519,7 @@ services:
# - --ssl-key=/run/secrets/server-key.pem
volumes:
- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
# - dbsocket:/var/run/mysqld/
env_file:
- ./env_vars/.env_db_mysql
secrets:
@ -571,6 +576,7 @@ networks:
volumes:
snmptraps:
# dbsocket:
secrets:
MYSQL_USER:

View File

@ -1,5 +1,6 @@
# DB_SERVER_HOST=mysql-server
# DB_SERVER_PORT=3306
# DB_SERVER_SOCKET=/var/run/mysqld/mysqld.sock
# MYSQL_USER=zabbix
MYSQL_USER_FILE=/run/secrets/MYSQL_USER
# MYSQL_PASSWORD=zabbix

View File

@ -1,5 +1,6 @@
# DB_SERVER_HOST=mysql-server
# DB_SERVER_PORT=3306
# DB_SERVER_SOCKET=/var/run/mysqld/mysqld.sock
# MYSQL_USER=zabbix
MYSQL_USER=zabbix
# MYSQL_USER_FILE=/run/secrets/MYSQL_USER