Automatic db file name for SQLite3 base proxy

This commit is contained in:
Alexey Pustovalov
2023-01-16 17:01:06 +09:00
parent eac4a90f46
commit a706601495
6 changed files with 36 additions and 5 deletions

View File

@ -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"