diff --git a/Dockerfiles/proxy-mysql/alpine/Dockerfile b/Dockerfiles/proxy-mysql/alpine/Dockerfile index c8d637407..0ca59cae1 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 c7db68fe0..78a4bccb9 100755 --- a/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh @@ -90,16 +90,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 @@ -486,8 +490,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 21069a9a5..2538dc3c1 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 3a3227f7d..08dfea65d 100755 --- a/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh @@ -90,16 +90,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 @@ -483,8 +487,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 04ee4fc77..13fc0d6c4 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 3a3227f7d..08dfea65d 100755 --- a/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh @@ -90,16 +90,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 @@ -483,8 +487,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 5f5eeceb1..e4333e54a 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 3a3227f7d..08dfea65d 100755 --- a/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh @@ -90,16 +90,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 @@ -483,8 +487,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 9697c294b..fbc7df67c 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/mibs/ietf:/var/lib/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 e20acf994..08dfea65d 100755 --- a/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh @@ -90,16 +90,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 @@ -483,8 +487,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 4f99981d0..a4f2419a4 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 07ea5dd07..68f726c7e 100755 --- a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh @@ -56,16 +56,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 @@ -233,8 +237,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 7419f2f92..37ad51ac5 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 07ea5dd07..68f726c7e 100755 --- a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh @@ -56,16 +56,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 @@ -233,8 +237,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 56794e82f..7e0b41c8e 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 07ea5dd07..68f726c7e 100755 --- a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh @@ -56,16 +56,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 @@ -233,8 +237,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 ac3af2bce..eaf4f4e80 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 07ea5dd07..68f726c7e 100755 --- a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh @@ -56,16 +56,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 @@ -233,8 +237,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 db00dd99d..3e1bb1246 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/mibs/ietf:/var/lib/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 c176f2842..68f726c7e 100755 --- a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh @@ -56,16 +56,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 @@ -233,8 +237,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 69a9b06ed..f79f76579 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 4dd835439..17624a7ea 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 @@ -515,8 +519,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 4d3e302ad..ed6ff00ec 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 2f6560e98..33ee67914 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 @@ -512,8 +516,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 fdab423a5..76030d918 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 2f6560e98..d7d2bb0c5 100755 --- a/Dockerfiles/server-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/ol/docker-entrypoint.sh @@ -512,8 +512,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 78900d377..4db07bf56 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 2f6560e98..33ee67914 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 @@ -512,8 +516,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 c97cc1c12..2094b1f24 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/mibs/ietf:/var/lib/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 a8668e287..33ee67914 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 @@ -512,8 +516,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 07b4e05c9..4f5de19b9 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 ba08deb16..25df212b2 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 @@ -545,8 +541,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 274252c0b..a08d5f2c6 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 ba08deb16..25df212b2 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 @@ -545,8 +541,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 cd9df28c6..c18c43523 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 ba08deb16..b85b6047b 100755 --- a/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh @@ -545,8 +545,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/rhel/Dockerfile b/Dockerfiles/server-pgsql/rhel/Dockerfile index 102015c84..533393608 100644 --- a/Dockerfiles/server-pgsql/rhel/Dockerfile +++ b/Dockerfiles/server-pgsql/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 PostgreSQL database support" \ maintainer="alexey.pustovalov@zabbix.com" \ diff --git a/Dockerfiles/server-pgsql/rhel/docker-entrypoint.sh b/Dockerfiles/server-pgsql/rhel/docker-entrypoint.sh index ba08deb16..25df212b2 100755 --- a/Dockerfiles/server-pgsql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/rhel/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 @@ -545,8 +541,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 fdbdd9008..2005207b0 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/mibs/ietf:/var/lib/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 d1f5aee49..25df212b2 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 @@ -545,8 +541,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}"