diff --git a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh index 1e71295af..88c299747 100755 --- a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh @@ -137,7 +137,13 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" update_config_var $ZBX_CONFIG "DBHost" - update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + : ${ZBX_USE_NODE_NAME_AS_DB_NAME:="false"} + if [ "${ZBX_USE_NODE_NAME_AS_DB_NAME,,}" == "false" ]; then + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + else + node_name=$(uname -n) + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/$node_name.sqlite" + fi update_config_var $ZBX_CONFIG "DBUser" update_config_var $ZBX_CONFIG "DBPort" update_config_var $ZBX_CONFIG "DBPassword" diff --git a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh index 1e71295af..88c299747 100755 --- a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh @@ -137,7 +137,13 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" update_config_var $ZBX_CONFIG "DBHost" - update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + : ${ZBX_USE_NODE_NAME_AS_DB_NAME:="false"} + if [ "${ZBX_USE_NODE_NAME_AS_DB_NAME,,}" == "false" ]; then + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + else + node_name=$(uname -n) + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/$node_name.sqlite" + fi update_config_var $ZBX_CONFIG "DBUser" update_config_var $ZBX_CONFIG "DBPort" update_config_var $ZBX_CONFIG "DBPassword" diff --git a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh index 1e71295af..88c299747 100755 --- a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh @@ -137,7 +137,13 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" update_config_var $ZBX_CONFIG "DBHost" - update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + : ${ZBX_USE_NODE_NAME_AS_DB_NAME:="false"} + if [ "${ZBX_USE_NODE_NAME_AS_DB_NAME,,}" == "false" ]; then + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + else + node_name=$(uname -n) + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/$node_name.sqlite" + fi update_config_var $ZBX_CONFIG "DBUser" update_config_var $ZBX_CONFIG "DBPort" update_config_var $ZBX_CONFIG "DBPassword" diff --git a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh index 1e71295af..88c299747 100755 --- a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh @@ -137,7 +137,13 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" update_config_var $ZBX_CONFIG "DBHost" - update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + : ${ZBX_USE_NODE_NAME_AS_DB_NAME:="false"} + if [ "${ZBX_USE_NODE_NAME_AS_DB_NAME,,}" == "false" ]; then + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + else + node_name=$(uname -n) + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/$node_name.sqlite" + fi update_config_var $ZBX_CONFIG "DBUser" update_config_var $ZBX_CONFIG "DBPort" update_config_var $ZBX_CONFIG "DBPassword" diff --git a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh index 08fe183a2..61bee51e7 100755 --- a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh @@ -137,7 +137,13 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}" update_config_var $ZBX_CONFIG "DBHost" - update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + : ${ZBX_USE_NODE_NAME_AS_DB_NAME:="false"} + if [ "${ZBX_USE_NODE_NAME_AS_DB_NAME,,}" == "false" ]; then + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/${ZBX_HOSTNAME:-"zabbix-proxy-sqlite3"}.sqlite" + else + node_name=$(uname -n) + update_config_var $ZBX_CONFIG "DBName" "/var/lib/zabbix/db_data/$node_name.sqlite" + fi update_config_var $ZBX_CONFIG "DBUser" update_config_var $ZBX_CONFIG "DBPort" update_config_var $ZBX_CONFIG "DBPassword" diff --git a/env_vars/.env_prx b/env_vars/.env_prx index a8533a26a..5447cf2d4 100644 --- a/env_vars/.env_prx +++ b/env_vars/.env_prx @@ -2,6 +2,7 @@ # ZBX_SERVER_HOST=zabbix-server # ZBX_SERVER_PORT=10051 # Deprecated since 6.0.0 # ZBX_HOSTNAME=zabbix-proxy-$db_type +# ZBX_USE_NODE_NAME_AS_DB_NAME=false # ZBX_ENABLEREMOTECOMMANDS=0 # Available since 3.4.0 # ZBX_LOGREMOTECOMMANDS=0 # Available since 3.4.0 # ZBX_HOSTNAMEITEM=system.hostname