mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-11-29 11:13:08 +01:00
Merge pull request #325 from zabbix/master
Fixed PostgreSQL schema name. Fixed graph legends on CentOS
This commit is contained in:
commit
d2aaf83fa1
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -77,7 +77,7 @@ RUN groupadd --system zabbix && \
|
||||
php-mbstring \
|
||||
php-mysql \
|
||||
php-xml && \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
ln -s /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
yum ${YUM_FLAGS_PERSISTANT} clean all && \
|
||||
rm -rf /var/cache/yum/
|
||||
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -78,7 +78,7 @@ RUN groupadd --system zabbix && \
|
||||
php-pgsql \
|
||||
php-xml \
|
||||
postgresql && \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
ln -s /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
yum ${YUM_FLAGS_PERSISTENT} clean all && \
|
||||
rm -rf /var/cache/yum/
|
||||
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -80,7 +80,7 @@ RUN groupadd --system zabbix && \
|
||||
php-mysql \
|
||||
php-xml \
|
||||
supervisor && \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
ln -s /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
rm -f /etc/php-fpm.d/www.conf && \
|
||||
mkdir -p /var/lib/php/ && \
|
||||
chown --quiet -R nginx:nginx /var/lib/php/ && \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -79,7 +79,7 @@ RUN groupadd --system zabbix && \
|
||||
php-mbstring \
|
||||
php-pgsql \
|
||||
php-xml && \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
ln -s /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
rm -f /etc/php-fpm.d/www.conf && \
|
||||
mkdir -p /var/lib/php/ && \
|
||||
chown --quiet -R nginx:nginx /var/lib/php/ && \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -10,7 +10,7 @@ $DB['USER'] = '{DB_SERVER_USER}';
|
||||
$DB['PASSWORD'] = '{DB_SERVER_PASS}';
|
||||
|
||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
||||
$DB['SCHEMA'] = '';
|
||||
$DB['SCHEMA'] = '{DB_SERVER_SCHEMA}';
|
||||
|
||||
$ZBX_SERVER = '{ZBX_SERVER_HOST}';
|
||||
$ZBX_SERVER_PORT = '{ZBX_SERVER_PORT}';
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -168,7 +168,7 @@ RUN groupadd --system zabbix && \
|
||||
mkdir -p /var/lib/php/ && \
|
||||
chown --quiet -R nginx:nginx /var/lib/php/ && \
|
||||
ls -lah /usr/share/zabbix/ && \
|
||||
ln -s /usr/share/fonts/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
ln -s /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/graphfont.ttf && \
|
||||
yum ${YUM_FLAGS_PERSISTENT} clean all && \
|
||||
rm -rf /var/cache/yum/
|
||||
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -656,6 +675,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -847,6 +867,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
@ -290,6 +290,7 @@ check_db_connect_postgresql() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
echo "* DB_SERVER_SCHEMA: ${DB_SERVER_SCHEMA}"
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -306,6 +307,11 @@ check_db_connect_postgresql() {
|
||||
fi
|
||||
|
||||
WAIT_TIMEOUT=5
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
while [ ! "$(psql -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} -U ${DB_SERVER_ROOT_USER} -d ${DB_SERVER_DBNAME} -l -q 2>/dev/null)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
@ -313,6 +319,7 @@ check_db_connect_postgresql() {
|
||||
done
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
}
|
||||
|
||||
|
||||
@ -335,11 +342,17 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
result=$(psql -A -q -t -h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ROOT_USER} -c "$query" $db 2>/dev/null);
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
|
||||
echo $result
|
||||
}
|
||||
@ -436,11 +449,17 @@ create_db_schema_postgresql() {
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
fi
|
||||
|
||||
zcat /usr/share/doc/zabbix-$type-postgresql/create.sql.gz | psql -q \
|
||||
-h ${DB_SERVER_HOST} -p ${DB_SERVER_PORT} \
|
||||
-U ${DB_SERVER_ZBX_USER} ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
|
||||
unset PGPASSWORD
|
||||
unset PGOPTIONS
|
||||
fi
|
||||
}
|
||||
|
||||
@ -651,6 +670,7 @@ update_zbx_config() {
|
||||
else
|
||||
update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"
|
||||
update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"
|
||||
update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"
|
||||
update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"
|
||||
update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"
|
||||
update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"
|
||||
@ -835,6 +855,7 @@ prepare_zbx_web_config() {
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_SCHEMA}/${DB_SERVER_SCHEMA}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
|
Loading…
Reference in New Issue
Block a user