diff --git a/Dockerfiles/proxy-mysql/alpine/Dockerfile b/Dockerfiles/proxy-mysql/alpine/Dockerfile index fa11460b7..8c00dce21 100644 --- a/Dockerfiles/proxy-mysql/alpine/Dockerfile +++ b/Dockerfiles/proxy-mysql/alpine/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ diff --git a/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh index fa4ac0195..3fcd8ca3a 100755 --- a/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh @@ -92,16 +92,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -460,8 +464,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-mysql/centos/Dockerfile b/Dockerfiles/proxy-mysql/centos/Dockerfile index 0c7f76478..b88508292 100644 --- a/Dockerfiles/proxy-mysql/centos/Dockerfile +++ b/Dockerfiles/proxy-mysql/centos/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ diff --git a/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh index 112dc34b0..7b6ac984a 100755 --- a/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh @@ -92,16 +92,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -457,8 +461,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-mysql/ol/Dockerfile b/Dockerfiles/proxy-mysql/ol/Dockerfile index 420ae10b5..428039c63 100644 --- a/Dockerfiles/proxy-mysql/ol/Dockerfile +++ b/Dockerfiles/proxy-mysql/ol/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED=""\ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ diff --git a/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh index 112dc34b0..7b6ac984a 100755 --- a/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh @@ -92,16 +92,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -457,8 +461,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-mysql/rhel/Dockerfile b/Dockerfiles/proxy-mysql/rhel/Dockerfile index d4a6ced31..303ab87a4 100644 --- a/Dockerfiles/proxy-mysql/rhel/Dockerfile +++ b/Dockerfiles/proxy-mysql/rhel/Dockerfile @@ -16,7 +16,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL description="Zabbix proxy with MySQL database support" \ maintainer="alexey.pustovalov@zabbix.com" \ diff --git a/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh index 112dc34b0..7b6ac984a 100755 --- a/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh @@ -92,16 +92,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -457,8 +461,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-mysql/ubuntu/Dockerfile b/Dockerfiles/proxy-mysql/ubuntu/Dockerfile index 9f8d92a8d..f0de323fa 100644 --- a/Dockerfiles/proxy-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/proxy-mysql/ubuntu/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/bin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with MySQL database support" \ diff --git a/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh index 79518a878..7b6ac984a 100755 --- a/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh @@ -92,16 +92,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -457,8 +461,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-sqlite3/alpine/Dockerfile b/Dockerfiles/proxy-sqlite3/alpine/Dockerfile index dd7a6cd55..289ab2a64 100644 --- a/Dockerfiles/proxy-sqlite3/alpine/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/alpine/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ diff --git a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh index 1c06a57be..e4f8671c5 100755 --- a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh @@ -58,16 +58,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -226,8 +230,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-sqlite3/centos/Dockerfile b/Dockerfiles/proxy-sqlite3/centos/Dockerfile index 1a660a484..e5a9709f8 100644 --- a/Dockerfiles/proxy-sqlite3/centos/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/centos/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ diff --git a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh index 1c06a57be..e4f8671c5 100755 --- a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh @@ -58,16 +58,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -226,8 +230,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-sqlite3/ol/Dockerfile b/Dockerfiles/proxy-sqlite3/ol/Dockerfile index 10c519dc6..8e4791d5b 100644 --- a/Dockerfiles/proxy-sqlite3/ol/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/ol/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ diff --git a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh index 1c06a57be..e4f8671c5 100755 --- a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh @@ -58,16 +58,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -226,8 +230,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-sqlite3/rhel/Dockerfile b/Dockerfiles/proxy-sqlite3/rhel/Dockerfile index 1973c10a9..89eee0c56 100644 --- a/Dockerfiles/proxy-sqlite3/rhel/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/rhel/Dockerfile @@ -16,7 +16,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL description="Zabbix proxy with SQLite3 database support" \ maintainer="alexey.pustovalov@zabbix.com" \ diff --git a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh index 1c06a57be..e4f8671c5 100755 --- a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh @@ -58,16 +58,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -226,8 +230,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile b/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile index bcf17c18c..dbf6a732a 100644 --- a/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile +++ b/Dockerfiles/proxy-sqlite3/ubuntu/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/bin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix proxy with SQLite3 database support" \ diff --git a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh index c192a088f..e4f8671c5 100755 --- a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh @@ -58,16 +58,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -226,8 +230,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts" update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts" - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-mysql/alpine/Dockerfile b/Dockerfiles/server-mysql/alpine/Dockerfile index f63672c3b..b2b824c92 100644 --- a/Dockerfiles/server-mysql/alpine/Dockerfile +++ b/Dockerfiles/server-mysql/alpine/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ diff --git a/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh b/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh index 37e5c6e2d..b3a4bd9bf 100755 --- a/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh @@ -87,16 +87,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -472,8 +476,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-mysql/centos/Dockerfile b/Dockerfiles/server-mysql/centos/Dockerfile index 9c0475c27..69fb03af0 100644 --- a/Dockerfiles/server-mysql/centos/Dockerfile +++ b/Dockerfiles/server-mysql/centos/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ diff --git a/Dockerfiles/server-mysql/centos/docker-entrypoint.sh b/Dockerfiles/server-mysql/centos/docker-entrypoint.sh index f4b21d11c..3d52db11f 100755 --- a/Dockerfiles/server-mysql/centos/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/centos/docker-entrypoint.sh @@ -87,16 +87,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -469,8 +473,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-mysql/ol/Dockerfile b/Dockerfiles/server-mysql/ol/Dockerfile index 79699db9b..6bd2d4928 100644 --- a/Dockerfiles/server-mysql/ol/Dockerfile +++ b/Dockerfiles/server-mysql/ol/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED=""\ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ diff --git a/Dockerfiles/server-mysql/ol/docker-entrypoint.sh b/Dockerfiles/server-mysql/ol/docker-entrypoint.sh index f4b21d11c..390d9dc55 100755 --- a/Dockerfiles/server-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/ol/docker-entrypoint.sh @@ -469,8 +469,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-mysql/rhel/Dockerfile b/Dockerfiles/server-mysql/rhel/Dockerfile index 278ce85c6..4a9a69428 100644 --- a/Dockerfiles/server-mysql/rhel/Dockerfile +++ b/Dockerfiles/server-mysql/rhel/Dockerfile @@ -16,7 +16,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL description="Zabbix server with MySQL database support" \ maintainer="alexey.pustovalov@zabbix.com" \ diff --git a/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh b/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh index f4b21d11c..3d52db11f 100755 --- a/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh @@ -87,16 +87,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -469,8 +473,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-mysql/ubuntu/Dockerfile b/Dockerfiles/server-mysql/ubuntu/Dockerfile index 5375f6684..e6ece4f2d 100644 --- a/Dockerfiles/server-mysql/ubuntu/Dockerfile +++ b/Dockerfiles/server-mysql/ubuntu/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/bin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with MySQL database support" \ diff --git a/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh b/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh index 97023441c..3d52db11f 100755 --- a/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh @@ -87,16 +87,20 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset parameter value + # Remove configuration parameter definition in case of unset or empty parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of double quoted parameter value - if [ "$var_value" == '""' ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + # Remove value from configuration parameter in case of set to double quoted parameter value + if [[ "$var_value" == '""' ]]; then + if [ "$(grep -E "^$var_name=" $config_path)" ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" + else + sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" + fi echo "undefined" return fi @@ -469,8 +473,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-pgsql/alpine/Dockerfile b/Dockerfiles/server-pgsql/alpine/Dockerfile index da42bf71c..ffd6b5522 100644 --- a/Dockerfiles/server-pgsql/alpine/Dockerfile +++ b/Dockerfiles/server-pgsql/alpine/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ diff --git a/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh b/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh index 18ba6e3a1..7033592ac 100755 --- a/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh @@ -87,20 +87,16 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset or empty parameter value + # Remove configuration parameter definition in case of unset parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of set to double quoted parameter value - if [[ "$var_value" == '""' ]]; then - if [ "$(grep -E "^$var_name=" $config_path)" ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" - else - sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" - fi + # Remove value from configuration parameter in case of double quoted parameter value + if [ "$var_value" == '""' ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" echo "undefined" return fi @@ -502,8 +498,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-pgsql/centos/Dockerfile b/Dockerfiles/server-pgsql/centos/Dockerfile index dc5ecf2d6..5e9f42ff7 100644 --- a/Dockerfiles/server-pgsql/centos/Dockerfile +++ b/Dockerfiles/server-pgsql/centos/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ diff --git a/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh b/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh index 18ba6e3a1..7033592ac 100755 --- a/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh @@ -87,20 +87,16 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset or empty parameter value + # Remove configuration parameter definition in case of unset parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of set to double quoted parameter value - if [[ "$var_value" == '""' ]]; then - if [ "$(grep -E "^$var_name=" $config_path)" ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" - else - sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" - fi + # Remove value from configuration parameter in case of double quoted parameter value + if [ "$var_value" == '""' ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" echo "undefined" return fi @@ -502,8 +498,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-pgsql/ol/Dockerfile b/Dockerfiles/server-pgsql/ol/Dockerfile index ec73db7c5..22ee1cb95 100644 --- a/Dockerfiles/server-pgsql/ol/Dockerfile +++ b/Dockerfiles/server-pgsql/ol/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED=""\ + ZBX_FPINGLOCATION="/usr/sbin/fping" LABEL org.opencontainers.image.title="Zabbix server (PostgreSQL)" \ org.opencontainers.image.authors="Alexey Pustovalov " \ diff --git a/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh b/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh index 18ba6e3a1..f0cc74973 100755 --- a/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh @@ -502,8 +502,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}" diff --git a/Dockerfiles/server-pgsql/ubuntu/Dockerfile b/Dockerfiles/server-pgsql/ubuntu/Dockerfile index 6692f673e..3223eb7cf 100644 --- a/Dockerfiles/server-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/server-pgsql/ubuntu/Dockerfile @@ -14,7 +14,8 @@ ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ENV TERM=xterm \ ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \ MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \ - NMAP_PRIVILEGED="" + NMAP_PRIVILEGED="" \ + ZBX_FPINGLOCATION="/usr/bin/fping" LABEL org.opencontainers.image.authors="Alexey Pustovalov " \ org.opencontainers.image.description="Zabbix server with PostgreSQL database support" \ diff --git a/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh b/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh index 2e3b0b7e7..7033592ac 100755 --- a/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh @@ -87,20 +87,16 @@ update_config_var() { echo -n "** Updating '$config_path' parameter \"$var_name\": '$var_value'..." fi - # Remove configuration parameter definition in case of unset or empty parameter value + # Remove configuration parameter definition in case of unset parameter value if [ -z "$var_value" ]; then sed -i -e "/^$var_name=/d" "$config_path" echo "removed" return fi - # Remove value from configuration parameter in case of set to double quoted parameter value - if [[ "$var_value" == '""' ]]; then - if [ "$(grep -E "^$var_name=" $config_path)" ]; then - sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" - else - sed -i -e "/^[#;] $var_name=/s/.*/&\n$var_name=/" "$config_path" - fi + # Remove value from configuration parameter in case of double quoted parameter value + if [ "$var_value" == '""' ]; then + sed -i -e "/^$var_name=/s/=.*/=/" "$config_path" echo "undefined" return fi @@ -502,8 +498,8 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}" fi - update_config_var $ZBX_CONFIG "FpingLocation" "/usr/bin/fping" - update_config_var $ZBX_CONFIG "Fping6Location" + update_config_var $ZBX_CONFIG "FpingLocation" "${ZBX_FPINGLOCATION}" + update_config_var $ZBX_CONFIG "Fping6Location" '""' update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys" update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}"