mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-01-05 05:09:39 +01:00
Added support for PostgreSQL database socket volume
This commit is contained in:
parent
3c58cf398c
commit
5f7afda5e2
@ -87,16 +87,20 @@ update_config_var() {
|
|||||||
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove configuration parameter definition in case of unset parameter value
|
# Remove configuration parameter definition in case of unset or empty parameter value
|
||||||
if [ -z "$var_value" ]; then
|
if [ -z "$var_value" ]; then
|
||||||
sed -i -e "/^$var_name=/d" "$config_path"
|
sed -i -e "/^$var_name=/d" "$config_path"
|
||||||
echo "removed"
|
echo "removed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove value from configuration parameter in case of double quoted parameter value
|
# Remove value from configuration parameter in case of set to double quoted parameter value
|
||||||
if [ "$var_value" == '""' ]; then
|
if [[ "$var_value" == '""' ]]; then
|
||||||
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
|
||||||
|
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
||||||
|
else
|
||||||
|
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
|
||||||
|
fi
|
||||||
echo "undefined"
|
echo "undefined"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -154,12 +158,12 @@ file_process_from_env() {
|
|||||||
|
|
||||||
# Check prerequisites for PostgreSQL database
|
# Check prerequisites for PostgreSQL database
|
||||||
check_variables_postgresql() {
|
check_variables_postgresql() {
|
||||||
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
|
||||||
|
|
||||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||||
|
|
||||||
@ -171,12 +175,24 @@ check_variables_postgresql() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
DB_SERVER_HOST='""'
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect_postgresql() {
|
check_db_connect_postgresql() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [[ "$DB_SERVER_HOST" != '""' ]]; then
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||||
@ -206,8 +222,8 @@ check_db_connect_postgresql() {
|
|||||||
|
|
||||||
while true :
|
while true :
|
||||||
do
|
do
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
||||||
|
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
@ -244,7 +260,7 @@ psql_query() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(psql --no-align --quiet --tuples-only --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
result=$(psql --no-align --quiet --tuples-only $psql_connect_args \
|
||||||
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -284,7 +300,7 @@ exec_sql_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$command $sql_script | psql --quiet \
|
$command $sql_script | psql --quiet \
|
||||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
$psql_connect_args \
|
||||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -318,7 +334,7 @@ create_db_database_postgresql() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
createdb --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" --username "${DB_SERVER_ROOT_USER}" \
|
createdb $psql_connect_args --username "${DB_SERVER_ROOT_USER}" \
|
||||||
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
@ -87,16 +87,20 @@ update_config_var() {
|
|||||||
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove configuration parameter definition in case of unset parameter value
|
# Remove configuration parameter definition in case of unset or empty parameter value
|
||||||
if [ -z "$var_value" ]; then
|
if [ -z "$var_value" ]; then
|
||||||
sed -i -e "/^$var_name=/d" "$config_path"
|
sed -i -e "/^$var_name=/d" "$config_path"
|
||||||
echo "removed"
|
echo "removed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove value from configuration parameter in case of double quoted parameter value
|
# Remove value from configuration parameter in case of set to double quoted parameter value
|
||||||
if [ "$var_value" == '""' ]; then
|
if [[ "$var_value" == '""' ]]; then
|
||||||
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
|
||||||
|
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
||||||
|
else
|
||||||
|
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
|
||||||
|
fi
|
||||||
echo "undefined"
|
echo "undefined"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -154,12 +158,12 @@ file_process_from_env() {
|
|||||||
|
|
||||||
# Check prerequisites for PostgreSQL database
|
# Check prerequisites for PostgreSQL database
|
||||||
check_variables_postgresql() {
|
check_variables_postgresql() {
|
||||||
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
|
||||||
|
|
||||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||||
|
|
||||||
@ -171,12 +175,24 @@ check_variables_postgresql() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
DB_SERVER_HOST='""'
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect_postgresql() {
|
check_db_connect_postgresql() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [[ "$DB_SERVER_HOST" != '""' ]]; then
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||||
@ -206,8 +222,8 @@ check_db_connect_postgresql() {
|
|||||||
|
|
||||||
while true :
|
while true :
|
||||||
do
|
do
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
||||||
|
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
@ -244,7 +260,7 @@ psql_query() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(psql --no-align --quiet --tuples-only --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
result=$(psql --no-align --quiet --tuples-only $psql_connect_args \
|
||||||
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -284,7 +300,7 @@ exec_sql_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$command $sql_script | psql --quiet \
|
$command $sql_script | psql --quiet \
|
||||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
$psql_connect_args \
|
||||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -318,7 +334,7 @@ create_db_database_postgresql() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
createdb --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" --username "${DB_SERVER_ROOT_USER}" \
|
createdb $psql_connect_args --username "${DB_SERVER_ROOT_USER}" \
|
||||||
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
@ -87,16 +87,20 @@ update_config_var() {
|
|||||||
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove configuration parameter definition in case of unset parameter value
|
# Remove configuration parameter definition in case of unset or empty parameter value
|
||||||
if [ -z "$var_value" ]; then
|
if [ -z "$var_value" ]; then
|
||||||
sed -i -e "/^$var_name=/d" "$config_path"
|
sed -i -e "/^$var_name=/d" "$config_path"
|
||||||
echo "removed"
|
echo "removed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove value from configuration parameter in case of double quoted parameter value
|
# Remove value from configuration parameter in case of set to double quoted parameter value
|
||||||
if [ "$var_value" == '""' ]; then
|
if [[ "$var_value" == '""' ]]; then
|
||||||
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
|
||||||
|
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
||||||
|
else
|
||||||
|
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
|
||||||
|
fi
|
||||||
echo "undefined"
|
echo "undefined"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -154,12 +158,12 @@ file_process_from_env() {
|
|||||||
|
|
||||||
# Check prerequisites for PostgreSQL database
|
# Check prerequisites for PostgreSQL database
|
||||||
check_variables_postgresql() {
|
check_variables_postgresql() {
|
||||||
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
|
||||||
|
|
||||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||||
|
|
||||||
@ -171,12 +175,24 @@ check_variables_postgresql() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
DB_SERVER_HOST='""'
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect_postgresql() {
|
check_db_connect_postgresql() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [[ "$DB_SERVER_HOST" != '""' ]]; then
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||||
@ -206,8 +222,8 @@ check_db_connect_postgresql() {
|
|||||||
|
|
||||||
while true :
|
while true :
|
||||||
do
|
do
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
||||||
|
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
@ -244,7 +260,7 @@ psql_query() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(psql --no-align --quiet --tuples-only --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
result=$(psql --no-align --quiet --tuples-only $psql_connect_args \
|
||||||
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -284,7 +300,7 @@ exec_sql_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$command $sql_script | psql --quiet \
|
$command $sql_script | psql --quiet \
|
||||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
$psql_connect_args \
|
||||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -318,7 +334,7 @@ create_db_database_postgresql() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
createdb --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" --username "${DB_SERVER_ROOT_USER}" \
|
createdb $psql_connect_args --username "${DB_SERVER_ROOT_USER}" \
|
||||||
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
@ -87,16 +87,20 @@ update_config_var() {
|
|||||||
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove configuration parameter definition in case of unset parameter value
|
# Remove configuration parameter definition in case of unset or empty parameter value
|
||||||
if [ -z "$var_value" ]; then
|
if [ -z "$var_value" ]; then
|
||||||
sed -i -e "/^$var_name=/d" "$config_path"
|
sed -i -e "/^$var_name=/d" "$config_path"
|
||||||
echo "removed"
|
echo "removed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove value from configuration parameter in case of double quoted parameter value
|
# Remove value from configuration parameter in case of set to double quoted parameter value
|
||||||
if [ "$var_value" == '""' ]; then
|
if [[ "$var_value" == '""' ]]; then
|
||||||
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
|
||||||
|
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
||||||
|
else
|
||||||
|
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
|
||||||
|
fi
|
||||||
echo "undefined"
|
echo "undefined"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -154,12 +158,12 @@ file_process_from_env() {
|
|||||||
|
|
||||||
# Check prerequisites for PostgreSQL database
|
# Check prerequisites for PostgreSQL database
|
||||||
check_variables_postgresql() {
|
check_variables_postgresql() {
|
||||||
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
|
||||||
|
|
||||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||||
|
|
||||||
@ -171,12 +175,24 @@ check_variables_postgresql() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
DB_SERVER_HOST='""'
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect_postgresql() {
|
check_db_connect_postgresql() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [[ "$DB_SERVER_HOST" != '""' ]]; then
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||||
@ -206,8 +222,8 @@ check_db_connect_postgresql() {
|
|||||||
|
|
||||||
while true :
|
while true :
|
||||||
do
|
do
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
||||||
|
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
@ -244,7 +260,7 @@ psql_query() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(psql --no-align --quiet --tuples-only --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
result=$(psql --no-align --quiet --tuples-only $psql_connect_args \
|
||||||
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -284,7 +300,7 @@ exec_sql_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$command $sql_script | psql --quiet \
|
$command $sql_script | psql --quiet \
|
||||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
$psql_connect_args \
|
||||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -318,7 +334,7 @@ create_db_database_postgresql() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
createdb --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" --username "${DB_SERVER_ROOT_USER}" \
|
createdb $psql_connect_args --username "${DB_SERVER_ROOT_USER}" \
|
||||||
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
@ -87,16 +87,20 @@ update_config_var() {
|
|||||||
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove configuration parameter definition in case of unset parameter value
|
# Remove configuration parameter definition in case of unset or empty parameter value
|
||||||
if [ -z "$var_value" ]; then
|
if [ -z "$var_value" ]; then
|
||||||
sed -i -e "/^$var_name=/d" "$config_path"
|
sed -i -e "/^$var_name=/d" "$config_path"
|
||||||
echo "removed"
|
echo "removed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove value from configuration parameter in case of double quoted parameter value
|
# Remove value from configuration parameter in case of set to double quoted parameter value
|
||||||
if [ "$var_value" == '""' ]; then
|
if [[ "$var_value" == '""' ]]; then
|
||||||
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
if [ "$(grep -E "^$var_name=" $config_path)" ]; then
|
||||||
|
sed -i -e "/^$var_name=/s/=.*/=/" "$config_path"
|
||||||
|
else
|
||||||
|
sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path"
|
||||||
|
fi
|
||||||
echo "undefined"
|
echo "undefined"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -154,12 +158,12 @@ file_process_from_env() {
|
|||||||
|
|
||||||
# Check prerequisites for PostgreSQL database
|
# Check prerequisites for PostgreSQL database
|
||||||
check_variables_postgresql() {
|
check_variables_postgresql() {
|
||||||
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
|
||||||
|
|
||||||
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
DB_SERVER_ROOT_USER=${POSTGRES_USER:-"postgres"}
|
||||||
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
DB_SERVER_ROOT_PASS=${POSTGRES_PASSWORD:-""}
|
||||||
|
|
||||||
@ -171,12 +175,24 @@ check_variables_postgresql() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
DB_SERVER_HOST='""'
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect_postgresql() {
|
check_db_connect_postgresql() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [[ "$DB_SERVER_HOST" != '""' ]]; then
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||||
@ -206,8 +222,8 @@ check_db_connect_postgresql() {
|
|||||||
|
|
||||||
while true :
|
while true :
|
||||||
do
|
do
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --quiet 1>/dev/null 2>&1 && break
|
||||||
psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
psql $psql_connect_args --username ${DB_SERVER_ROOT_USER} --list --dbname ${DB_SERVER_DBNAME} --quiet 1>/dev/null 2>&1 && break
|
||||||
|
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
@ -244,7 +260,7 @@ psql_query() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(psql --no-align --quiet --tuples-only --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
result=$(psql --no-align --quiet --tuples-only $psql_connect_args \
|
||||||
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
--username "${DB_SERVER_ROOT_USER}" --command "$query" --dbname "$db" 2>/dev/null);
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -284,7 +300,7 @@ exec_sql_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
$command $sql_script | psql --quiet \
|
$command $sql_script | psql --quiet \
|
||||||
--host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" \
|
$psql_connect_args \
|
||||||
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
--username "${DB_SERVER_ZBX_USER}" --dbname "${DB_SERVER_DBNAME}" 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
@ -318,7 +334,7 @@ create_db_database_postgresql() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
createdb --host "${DB_SERVER_HOST}" --port "${DB_SERVER_PORT}" --username "${DB_SERVER_ROOT_USER}" \
|
createdb $psql_connect_args --username "${DB_SERVER_ROOT_USER}" \
|
||||||
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
--owner "${DB_SERVER_ZBX_USER}" --lc-ctype "en_US.utf8" --lc-collate "en_US.utf8" "${DB_SERVER_DBNAME}"
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
|
@ -62,7 +62,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -73,11 +73,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -106,7 +118,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -62,7 +62,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -73,11 +73,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -106,7 +118,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -62,7 +62,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -73,11 +73,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -106,7 +118,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -64,7 +64,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -75,11 +75,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -108,7 +120,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -76,11 +76,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -109,7 +121,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -76,11 +76,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -109,7 +121,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -76,11 +76,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -109,7 +121,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -76,11 +76,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -109,7 +121,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -65,7 +65,7 @@ check_variables() {
|
|||||||
file_env POSTGRES_USER
|
file_env POSTGRES_USER
|
||||||
file_env POSTGRES_PASSWORD
|
file_env POSTGRES_PASSWORD
|
||||||
|
|
||||||
: ${DB_SERVER_HOST:="postgres-server"}
|
: ${DB_SERVER_HOST="postgres-server"}
|
||||||
: ${DB_SERVER_PORT:="5432"}
|
: ${DB_SERVER_PORT:="5432"}
|
||||||
|
|
||||||
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
DB_SERVER_ZBX_USER=${POSTGRES_USER:-"zabbix"}
|
||||||
@ -76,11 +76,23 @@ check_variables() {
|
|||||||
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
DB_SERVER_DBNAME=${POSTGRES_DB:-"zabbix"}
|
||||||
|
|
||||||
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
: ${POSTGRES_USE_IMPLICIT_SEARCH_PATH:="false"}
|
||||||
|
|
||||||
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
psql_connect_args="--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
psql_connect_args="--port ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_db_connect() {
|
check_db_connect() {
|
||||||
echo "********************"
|
echo "********************"
|
||||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
if [ -n "${DB_SERVER_HOST}" ]; then
|
||||||
|
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
else
|
||||||
|
echo "* DB_SERVER_HOST: Using DB socket"
|
||||||
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
|
fi
|
||||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||||
@ -109,7 +121,7 @@ check_db_connect() {
|
|||||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(psql $psql_connect_args --username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} --list --quiet 2>/dev/null)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
@ -18,7 +18,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw
|
- ${DATA_DIRECTORY}/var/lib/mysql:/var/lib/mysql:rw
|
||||||
- ${ENV_VARS_DIRECTORY}/mysql_init/init_proxy_db.sql:/docker-entrypoint-initdb.d/mysql_init_proxy.sql:ro
|
- ${ENV_VARS_DIRECTORY}/mysql_init/init_proxy_db.sql:/docker-entrypoint-initdb.d/mysql_init_proxy.sql:ro
|
||||||
# - dbsocket:/var/run/mysqld/
|
# - mysql_socket:/var/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
||||||
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql_override
|
- path: ${ENV_VARS_DIRECTORY}/.env_db_mysql_override
|
||||||
@ -48,6 +48,7 @@ services:
|
|||||||
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
||||||
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro
|
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/server-cert.pem:ro
|
||||||
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro
|
- ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/server-key.pem:ro
|
||||||
|
# - pgsql_socket:/var/run/postgresql/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
||||||
- path: ${ENV_VARS_DIRECTORY}/.env_db_pgsql_override
|
- path: ${ENV_VARS_DIRECTORY}/.env_db_pgsql_override
|
||||||
|
@ -66,7 +66,7 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
service: server
|
service: server
|
||||||
# volumes:
|
# volumes:
|
||||||
# - dbsocket:/var/run/mysqld/
|
# - mysql_socket:/var/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
||||||
secrets:
|
secrets:
|
||||||
@ -90,6 +90,7 @@ services:
|
|||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
||||||
|
# - pgsql_socket:/var/run/postgresql
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
||||||
secrets:
|
secrets:
|
||||||
@ -181,7 +182,7 @@ services:
|
|||||||
protocol: tcp
|
protocol: tcp
|
||||||
app_protocol: zabbix-trapper
|
app_protocol: zabbix-trapper
|
||||||
# volumes:
|
# volumes:
|
||||||
# - dbsocket:/var/run/mysqld/
|
# - mysql_socket:/var/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy
|
- ${ENV_VARS_DIRECTORY}/.env_db_mysql_proxy
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_prx_mysql
|
- ${ENV_VARS_DIRECTORY}/.env_prx_mysql
|
||||||
@ -259,7 +260,7 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
service: web-apache
|
service: web-apache
|
||||||
# volumes:
|
# volumes:
|
||||||
# - dbsocket:/var/run/mysqld/
|
# - mysql_socket:/var/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
||||||
secrets:
|
secrets:
|
||||||
@ -279,6 +280,7 @@ services:
|
|||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
||||||
|
# - pgsql_socket:/var/run/postgresql
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
||||||
secrets:
|
secrets:
|
||||||
@ -345,7 +347,7 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
service: web-nginx
|
service: web-nginx
|
||||||
# volumes:
|
# volumes:
|
||||||
# - dbsocket:/var/run/mysqld/
|
# - mysql_socket:/var/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
- ${ENV_VARS_DIRECTORY}/.env_db_mysql
|
||||||
secrets:
|
secrets:
|
||||||
@ -369,6 +371,7 @@ services:
|
|||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CA_FILE:/run/secrets/root-ca.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_CERT_FILE:/run/secrets/client-cert.pem:ro
|
||||||
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
# - ${ENV_VARS_DIRECTORY}/.ZBX_DB_KEY_FILE:/run/secrets/client-key.pem:ro
|
||||||
|
# - pgsql_socket:/var/run/postgresql
|
||||||
env_file:
|
env_file:
|
||||||
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
- ${ENV_VARS_DIRECTORY}/.env_db_pgsql
|
||||||
secrets:
|
secrets:
|
||||||
|
@ -158,7 +158,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -258,7 +258,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -173,7 +173,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -287,7 +287,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -158,7 +158,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -259,7 +259,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -172,7 +172,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -286,7 +286,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -158,7 +158,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -259,7 +259,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -172,7 +172,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -286,7 +286,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -146,7 +146,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -247,7 +247,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -160,7 +160,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
@ -274,7 +274,8 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
snmptraps:
|
snmptraps:
|
||||||
# dbsocket:
|
# mysql_socket:
|
||||||
|
# pgsql_socket:
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
MYSQL_USER:
|
MYSQL_USER:
|
||||||
|
Loading…
Reference in New Issue
Block a user