From dcd7f63aa9e6088ce594cad0ee82e50086ae6cff Mon Sep 17 00:00:00 2001 From: dotneft Date: Wed, 3 Aug 2016 05:23:39 -0700 Subject: [PATCH] Moved snmptraps to different image --- agent/alpine/Dockerfile | 4 +- agent/alpine/run_zabbix_component.sh | 67 ++----------------- agent/ubuntu/Dockerfile | 4 +- agent/ubuntu/run_zabbix_component.sh | 67 ++----------------- java-gateway/alpine/Dockerfile | 4 +- java-gateway/alpine/run_zabbix_component.sh | 67 ++----------------- java-gateway/ubuntu/Dockerfile | 4 +- java-gateway/ubuntu/run_zabbix_component.sh | 67 ++----------------- proxy-mysql/alpine/Dockerfile | 10 +-- proxy-mysql/alpine/run_zabbix_component.sh | 67 ++----------------- proxy-mysql/ubuntu/Dockerfile | 21 +++--- .../conf.d/supervisord_snmptraps.conf | 19 ------ proxy-mysql/ubuntu/run_zabbix_component.sh | 67 ++----------------- proxy-sqlite3/alpine/Dockerfile | 8 +-- proxy-sqlite3/alpine/run_zabbix_component.sh | 67 ++----------------- proxy-sqlite3/ubuntu/Dockerfile | 21 +++--- .../etc/logrotate.d/logrotate_zabbix.conf | 8 --- .../conf.d/supervisord_snmptraps.conf | 19 ------ proxy-sqlite3/ubuntu/run_zabbix_component.sh | 67 ++----------------- server-mysql/alpine/Dockerfile | 9 ++- server-mysql/alpine/run_zabbix_component.sh | 67 ++----------------- server-mysql/ubuntu/Dockerfile | 21 +++--- .../etc/logrotate.d/logrotate_zabbix.conf | 8 --- server-mysql/ubuntu/run_zabbix_component.sh | 67 ++----------------- server-pgsql/alpine/Dockerfile | 9 ++- server-pgsql/alpine/run_zabbix_component.sh | 67 ++----------------- server-pgsql/ubuntu/Dockerfile | 18 ++--- .../etc/logrotate.d/logrotate_zabbix.conf | 8 --- .../conf.d/supervisord_snmptraps.conf | 19 ------ server-pgsql/ubuntu/run_zabbix_component.sh | 67 ++----------------- snmptraps/ubuntu/Dockerfile | 50 ++++++++++++++ snmptraps/ubuntu/build.sh | 19 ++++++ .../conf/etc/logrotate.d/zabbix_snmptraps | 2 +- .../conf.d/supervisord_snmptraps.conf | 7 +- .../conf/etc/supervisor/supervisord.conf | 34 ++++++++++ web-apache-mysql/alpine/Dockerfile | 4 +- .../alpine/run_zabbix_component.sh | 67 ++----------------- web-apache-mysql/ubuntu/Dockerfile | 4 +- .../ubuntu/run_zabbix_component.sh | 67 ++----------------- web-nginx-mysql/alpine/Dockerfile | 4 +- .../alpine/run_zabbix_component.sh | 67 ++----------------- web-nginx-mysql/ubuntu/Dockerfile | 4 +- .../ubuntu/run_zabbix_component.sh | 67 ++----------------- web-nginx-pgsql/alpine/Dockerfile | 4 +- .../alpine/run_zabbix_component.sh | 67 ++----------------- web-nginx-pgsql/ubuntu/Dockerfile | 4 +- .../ubuntu/run_zabbix_component.sh | 67 ++----------------- 47 files changed, 316 insertions(+), 1240 deletions(-) delete mode 100644 proxy-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf delete mode 100644 proxy-sqlite3/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf delete mode 100644 proxy-sqlite3/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf delete mode 100644 server-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf delete mode 100644 server-pgsql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf delete mode 100644 server-pgsql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf create mode 100644 snmptraps/ubuntu/Dockerfile create mode 100755 snmptraps/ubuntu/build.sh rename proxy-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf => snmptraps/ubuntu/conf/etc/logrotate.d/zabbix_snmptraps (75%) rename {server-mysql => snmptraps}/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf (65%) create mode 100644 snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf diff --git a/agent/alpine/Dockerfile b/agent/alpine/Dockerfile index 8726d7626..d92eb056c 100644 --- a/agent/alpine/Dockerfile +++ b/agent/alpine/Dockerfile @@ -25,8 +25,8 @@ RUN addgroup zabbix && \ libssl1.0 && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} diff --git a/agent/alpine/run_zabbix_component.sh b/agent/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/agent/alpine/run_zabbix_component.sh +++ b/agent/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/agent/ubuntu/Dockerfile b/agent/ubuntu/Dockerfile index 1ed8fb4f8..e929c5fe0 100644 --- a/agent/ubuntu/Dockerfile +++ b/agent/ubuntu/Dockerfile @@ -30,8 +30,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} diff --git a/agent/ubuntu/run_zabbix_component.sh b/agent/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/agent/ubuntu/run_zabbix_component.sh +++ b/agent/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/java-gateway/alpine/Dockerfile b/java-gateway/alpine/Dockerfile index 7c9862e34..b2824d6cd 100644 --- a/java-gateway/alpine/Dockerfile +++ b/java-gateway/alpine/Dockerfile @@ -21,8 +21,8 @@ RUN addgroup zabbix && \ openjdk8-jre-base && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} diff --git a/java-gateway/alpine/run_zabbix_component.sh b/java-gateway/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/java-gateway/alpine/run_zabbix_component.sh +++ b/java-gateway/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/java-gateway/ubuntu/Dockerfile b/java-gateway/ubuntu/Dockerfile index 1b7bc60ee..0e07039a6 100644 --- a/java-gateway/ubuntu/Dockerfile +++ b/java-gateway/ubuntu/Dockerfile @@ -27,8 +27,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} diff --git a/java-gateway/ubuntu/run_zabbix_component.sh b/java-gateway/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/java-gateway/ubuntu/run_zabbix_component.sh +++ b/java-gateway/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/proxy-mysql/alpine/Dockerfile b/proxy-mysql/alpine/Dockerfile index 420652204..f811cfe7b 100644 --- a/proxy-mysql/alpine/Dockerfile +++ b/proxy-mysql/alpine/Dockerfile @@ -6,6 +6,7 @@ ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG DB_TYPE=mysql ENV TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL RUN addgroup zabbix && \ adduser -S \ @@ -22,6 +23,8 @@ RUN addgroup zabbix && \ mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ apk update && \ @@ -40,8 +43,8 @@ RUN addgroup zabbix && \ libssh2 && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -89,7 +92,6 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ chown --quiet -R zabbix:root /etc/zabbix && \ cp database/${DB_TYPE}/schema.sql /usr/share/doc/zabbix-proxy-${DB_TYPE}/ && \ - cp misc/snmptrap/zabbix_trap_receiver.pl /usr/sbin/zabbix_trap_receiver.pl && \ cd /tmp/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ apk del ${APK_FLAGS_COMMON} --purge \ @@ -101,7 +103,7 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ ADD run_zabbix_component.sh /data/ diff --git a/proxy-mysql/alpine/run_zabbix_component.sh b/proxy-mysql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/proxy-mysql/alpine/run_zabbix_component.sh +++ b/proxy-mysql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/proxy-mysql/ubuntu/Dockerfile b/proxy-mysql/ubuntu/Dockerfile index e9c1f0d39..22ac2fd86 100644 --- a/proxy-mysql/ubuntu/Dockerfile +++ b/proxy-mysql/ubuntu/Dockerfile @@ -6,11 +6,10 @@ ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG DB_TYPE=mysql ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL -RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ - locale-gen $LC_ALL && \ +RUN locale-gen $LC_ALL && \ echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ - echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \ addgroup --system --quiet zabbix && \ adduser --quiet \ --system --disabled-login \ @@ -26,6 +25,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mkdir -p /var/lib/zabbix/ssl/certs && \ mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ mkdir -p /usr/lib/zabbix/externalscripts && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/share/doc/zabbix-proxy-${DB_TYPE} && \ @@ -35,21 +36,20 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mysql-client \ libmysqlclient18 \ libiksemel3 \ + libsnmp30 \ libcurl3 \ unixodbc \ libssh2-1 \ libssl1.0.0 \ libxml2 \ fping \ - libopenipmi0 \ - snmptrapfmt \ - snmp-mibs-downloader 1>/dev/null && \ + libopenipmi0 1>/dev/null && \ apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -117,8 +117,6 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \ make \ automake \ subversion 1>/dev/null && \ - apt-get ${APT_FLAGS_PERSISTANT} install \ - snmp-mibs-downloader 1>/dev/null && \ apt-get ${APT_FLAGS_COMMON} autoremove 1>/dev/null && \ rm -rf /var/lib/apt/lists/* @@ -127,10 +125,9 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ -ADD conf/etc/logrotate.d/logrotate_zabbix.conf /etc/logrotate.d/ ADD run_zabbix_component.sh /data/ ENTRYPOINT ["/bin/bash"] diff --git a/proxy-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf b/proxy-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf deleted file mode 100644 index 39ba03943..000000000 --- a/proxy-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf +++ /dev/null @@ -1,19 +0,0 @@ -[program:snmptrapfmt] -command = /usr/sbin/snmptrapfmt -f /etc/snmp/snmptrapfmt.conf -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 - -[program:snmptrapd] -command = /usr/sbin/snmptrapd -f -n -Lsd -p /var/run/snmptrapd.pid -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 diff --git a/proxy-mysql/ubuntu/run_zabbix_component.sh b/proxy-mysql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/proxy-mysql/ubuntu/run_zabbix_component.sh +++ b/proxy-mysql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/proxy-sqlite3/alpine/Dockerfile b/proxy-sqlite3/alpine/Dockerfile index aa5c65786..e57339d55 100644 --- a/proxy-sqlite3/alpine/Dockerfile +++ b/proxy-sqlite3/alpine/Dockerfile @@ -6,6 +6,7 @@ ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG DB_TYPE=sqlite3 ENV TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL RUN addgroup zabbix && \ adduser -S \ @@ -38,8 +39,8 @@ RUN addgroup zabbix && \ libssh2 && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -86,7 +87,6 @@ RUN apk add ${APK_FLAGS_DEV} --virtual build-dependencies \ cp src/zabbix_proxy/zabbix_proxy /usr/sbin/zabbix_proxy && \ cp conf/zabbix_proxy.conf /etc/zabbix/zabbix_proxy.conf && \ chown --quiet -R zabbix:root /etc/zabbix && \ - cp misc/snmptrap/zabbix_trap_receiver.pl /usr/sbin/zabbix_trap_receiver.pl && \ cd /tmp/ && \ rm -rf /tmp/zabbix-${ZBX_VERSION}/ && \ apk del ${APK_FLAGS_COMMON} --purge \ @@ -98,7 +98,7 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ ADD run_zabbix_component.sh /data/ diff --git a/proxy-sqlite3/alpine/run_zabbix_component.sh b/proxy-sqlite3/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/proxy-sqlite3/alpine/run_zabbix_component.sh +++ b/proxy-sqlite3/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/proxy-sqlite3/ubuntu/Dockerfile b/proxy-sqlite3/ubuntu/Dockerfile index d5f02c18d..4cbf19524 100644 --- a/proxy-sqlite3/ubuntu/Dockerfile +++ b/proxy-sqlite3/ubuntu/Dockerfile @@ -6,11 +6,10 @@ ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG DB_TYPE=sqlite3 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL -RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ - locale-gen $LC_ALL && \ +RUN locale-gen $LC_ALL && \ echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ - echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \ addgroup --system --quiet zabbix && \ adduser --quiet \ --system --disabled-login \ @@ -26,6 +25,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mkdir -p /var/lib/zabbix/ssl/certs && \ mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/lib/zabbix/externalscripts && \ apt-get ${APT_FLAGS_COMMON} update && \ @@ -33,21 +34,20 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO supervisor \ libsqlite3-0 \ libiksemel3 \ + libsnmp30 \ libcurl3 \ unixodbc \ libssh2-1 \ libssl1.0.0 \ libxml2 \ fping \ - libopenipmi0 \ - snmptrapfmt \ - snmp-mibs-downloader 1>/dev/null && \ + libopenipmi0 1>/dev/null && \ apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -122,10 +122,9 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] - +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] + ADD conf/etc/supervisor/ /etc/supervisor/ -ADD conf/etc/logrotate.d/logrotate_zabbix.conf /etc/logrotate.d/ ADD run_zabbix_component.sh /data/ ENTRYPOINT ["/bin/bash"] diff --git a/proxy-sqlite3/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf b/proxy-sqlite3/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf deleted file mode 100644 index d5299aa26..000000000 --- a/proxy-sqlite3/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf +++ /dev/null @@ -1,8 +0,0 @@ -# https://support.zabbix.com/browse/ZBX-9858 -/tmp/snmptrapfmt.log { - missingok - daily - rotate 0 - minsize 50M notifempty - su zabbix zabbix -} diff --git a/proxy-sqlite3/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf b/proxy-sqlite3/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf deleted file mode 100644 index 39ba03943..000000000 --- a/proxy-sqlite3/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf +++ /dev/null @@ -1,19 +0,0 @@ -[program:snmptrapfmt] -command = /usr/sbin/snmptrapfmt -f /etc/snmp/snmptrapfmt.conf -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 - -[program:snmptrapd] -command = /usr/sbin/snmptrapd -f -n -Lsd -p /var/run/snmptrapd.pid -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 diff --git a/proxy-sqlite3/ubuntu/run_zabbix_component.sh b/proxy-sqlite3/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/proxy-sqlite3/ubuntu/run_zabbix_component.sh +++ b/proxy-sqlite3/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/server-mysql/alpine/Dockerfile b/server-mysql/alpine/Dockerfile index 3e8d9a16b..9aef9b3bf 100644 --- a/server-mysql/alpine/Dockerfile +++ b/server-mysql/alpine/Dockerfile @@ -6,6 +6,7 @@ ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG DB_TYPE=mysql ENV TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL RUN addgroup zabbix && \ adduser -S \ @@ -23,6 +24,8 @@ RUN addgroup zabbix && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/lib/zabbix/alertscripts && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ apk update && \ @@ -41,8 +44,8 @@ RUN addgroup zabbix && \ libssh2 && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -103,7 +106,7 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ ADD run_zabbix_component.sh /data/ diff --git a/server-mysql/alpine/run_zabbix_component.sh b/server-mysql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/server-mysql/alpine/run_zabbix_component.sh +++ b/server-mysql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/server-mysql/ubuntu/Dockerfile b/server-mysql/ubuntu/Dockerfile index 729956e9e..ceb4ae3d6 100644 --- a/server-mysql/ubuntu/Dockerfile +++ b/server-mysql/ubuntu/Dockerfile @@ -6,11 +6,10 @@ ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG DB_TYPE=mysql ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL -RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ - locale-gen $LC_ALL && \ +RUN locale-gen $LC_ALL && \ echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ - echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \ addgroup --system --quiet zabbix && \ adduser --quiet \ --system --disabled-login \ @@ -26,6 +25,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mkdir -p /var/lib/zabbix/ssl/certs && \ mkdir -p /var/lib/zabbix/ssl/keys && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/lib/zabbix/alertscripts && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ @@ -36,21 +37,20 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mysql-client \ libmysqlclient18 \ libiksemel3 \ + libsnmp30 \ libcurl3 \ unixodbc \ libssh2-1 \ libssl1.0.0 \ libxml2 \ fping \ - libopenipmi0 \ - snmptrapfmt \ - snmp-mibs-downloader 1>/dev/null && \ + libopenipmi0 1>/dev/null && \ apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -123,15 +123,14 @@ RUN apt-get ${APT_FLAGS_COMMON} update && \ apt-get ${APT_FLAGS_COMMON} autoremove 1>/dev/null && \ rm -rf /var/lib/apt/lists/* -EXPOSE 10051/TCP 162/UDP +EXPOSE 10051/TCP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ -ADD conf/etc/logrotate.d/logrotate_zabbix.conf /etc/logrotate.d/ ADD run_zabbix_component.sh /data/ ENTRYPOINT ["/bin/bash"] diff --git a/server-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf b/server-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf deleted file mode 100644 index d5299aa26..000000000 --- a/server-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf +++ /dev/null @@ -1,8 +0,0 @@ -# https://support.zabbix.com/browse/ZBX-9858 -/tmp/snmptrapfmt.log { - missingok - daily - rotate 0 - minsize 50M notifempty - su zabbix zabbix -} diff --git a/server-mysql/ubuntu/run_zabbix_component.sh b/server-mysql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/server-mysql/ubuntu/run_zabbix_component.sh +++ b/server-mysql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/server-pgsql/alpine/Dockerfile b/server-pgsql/alpine/Dockerfile index f36b02417..26331b9ec 100644 --- a/server-pgsql/alpine/Dockerfile +++ b/server-pgsql/alpine/Dockerfile @@ -6,6 +6,7 @@ ARG APK_FLAGS_PERSISTANT="${APK_FLAGS_COMMON} --clean-protected --no-cache" ARG APK_FLAGS_DEV="${APK_FLAGS_COMMON} --no-cache" ARG DB_TYPE=postgresql ENV TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL RUN addgroup zabbix && \ adduser -S \ @@ -23,6 +24,8 @@ RUN addgroup zabbix && \ mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/lib/zabbix/alertscripts && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ apk update && \ @@ -41,8 +44,8 @@ RUN addgroup zabbix && \ libssh2 && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -103,7 +106,7 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ ADD run_zabbix_component.sh /data/ diff --git a/server-pgsql/alpine/run_zabbix_component.sh b/server-pgsql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/server-pgsql/alpine/run_zabbix_component.sh +++ b/server-pgsql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/server-pgsql/ubuntu/Dockerfile b/server-pgsql/ubuntu/Dockerfile index 8791e3f30..2113c818b 100644 --- a/server-pgsql/ubuntu/Dockerfile +++ b/server-pgsql/ubuntu/Dockerfile @@ -6,11 +6,10 @@ ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" ARG DB_TYPE=postgresql ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm +ENV MIBDIRS=/var/lib/zabbix/mibs MIBS=+ALL -RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ - locale-gen $LC_ALL && \ +RUN locale-gen $LC_ALL && \ echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ - echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \ addgroup --system --quiet zabbix && \ adduser --quiet \ --system --disabled-login \ @@ -28,6 +27,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO mkdir -p /var/lib/zabbix/ssl/ssl_ca && \ mkdir -p /usr/lib/zabbix/externalscripts && \ mkdir -p /usr/lib/zabbix/alertscripts && \ + mkdir -p /var/lib/zabbix/mibs && \ + mkdir -p /var/lib/zabbix/snmptraps && \ chown --quiet -R zabbix:root /var/lib/zabbix && \ mkdir -p /usr/share/doc/zabbix-server-${DB_TYPE} && \ apt-get ${APT_FLAGS_COMMON} update && \ @@ -36,21 +37,20 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO postgresql-client \ libpq5 \ libiksemel3 \ + libsnmp30 \ libcurl3 \ unixodbc \ libssh2-1 \ libssl1.0.0 \ libxml2 \ fping \ - libopenipmi0 \ - snmptrapfmt \ - snmp-mibs-downloader 1>/dev/null && \ + libopenipmi0 1>/dev/null apt-get ${APT_FLAGS_COMMON} autoremove && \ apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} @@ -128,7 +128,7 @@ EXPOSE 10051/TCP 162/UDP WORKDIR /var/lib/zabbix VOLUME ["/usr/lib/zabbix/alertscripts", "/usr/lib/zabbix/externalscripts", "/var/lib/zabbix/enc", "/var/lib/zabbix/modules", "/var/lib/zabbix/ssh_keys"] -VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca"] +VOLUME ["/var/lib/zabbix/ssl/certs", "/var/lib/zabbix/ssl/keys", "/var/lib/zabbix/ssl/ssl_ca", "/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] ADD conf/etc/supervisor/ /etc/supervisor/ ADD conf/etc/logrotate.d/logrotate_zabbix.conf /etc/logrotate.d/ diff --git a/server-pgsql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf b/server-pgsql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf deleted file mode 100644 index d5299aa26..000000000 --- a/server-pgsql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf +++ /dev/null @@ -1,8 +0,0 @@ -# https://support.zabbix.com/browse/ZBX-9858 -/tmp/snmptrapfmt.log { - missingok - daily - rotate 0 - minsize 50M notifempty - su zabbix zabbix -} diff --git a/server-pgsql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf b/server-pgsql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf deleted file mode 100644 index 39ba03943..000000000 --- a/server-pgsql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf +++ /dev/null @@ -1,19 +0,0 @@ -[program:snmptrapfmt] -command = /usr/sbin/snmptrapfmt -f /etc/snmp/snmptrapfmt.conf -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 - -[program:snmptrapd] -command = /usr/sbin/snmptrapd -f -n -Lsd -p /var/run/snmptrapd.pid -auto_start = true -autorestart = true - -stdout_logfile = /dev/stdout -stdout_logfile_maxbytes = 0 -stderr_logfile = /dev/stderr -stderr_logfile_maxbytes = 0 diff --git a/server-pgsql/ubuntu/run_zabbix_component.sh b/server-pgsql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/server-pgsql/ubuntu/run_zabbix_component.sh +++ b/server-pgsql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/snmptraps/ubuntu/Dockerfile b/snmptraps/ubuntu/Dockerfile new file mode 100644 index 000000000..575091779 --- /dev/null +++ b/snmptraps/ubuntu/Dockerfile @@ -0,0 +1,50 @@ +FROM ubuntu:trusty +MAINTAINER Alexey Pustovalov + +ARG APT_FLAGS_COMMON="-qq -y" +ARG APT_FLAGS_PERSISTANT="${APT_FLAGS_COMMON} --no-install-recommends" +ARG APT_FLAGS_DEV="${APT_FLAGS_COMMON} --no-install-recommends" +ARG DB_TYPE=mysql +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive TERM=xterm + +RUN locale-gen $LC_ALL && \ + echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ + DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CODENAME') && \ + echo "deb http://us.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse" >> /etc/apt/sources.list && \ + addgroup --system --quiet zabbix && \ + adduser --quiet \ + --system --disabled-login \ + --ingroup zabbix \ + --home /var/lib/zabbix/ \ + zabbix && \ + apt-get ${APT_FLAGS_COMMON} update && \ + apt-get ${APT_FLAGS_PERSISTANT} install \ + supervisor \ + snmpd \ + snmptrapfmt \ + snmp-mibs-downloader && \ + mkdir -p /var/lib/zabbix && \ + mkdir -p /var/lib/zabbix/snmptraps && \ + mkdir -p /var/lib/zabbix/mibs && \ + chown --quiet -R zabbix:root /var/lib/zabbix && \ + echo "disableAuthorization yes" >> "/etc/snmp/snmptrapd.conf" && \ + echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "/etc/snmp/snmptrapd.conf" && \ + sed -i \ + -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ + -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ + -e "/^LOGFILE=/s/=.*/=\"\/var\/lib\/zabbix\/snmptraps\/snmptraps.log\"/" \ + "/etc/snmp/snmptrapfmt.conf" && \ + apt-get ${APT_FLAGS_COMMON} autoremove && \ + apt-get ${APT_FLAGS_COMMON} clean && \ + rm -rf /var/lib/apt/lists/* + +EXPOSE 162/UDP + +WORKDIR /var/lib/zabbix/snmptraps/ + +VOLUME ["/usr/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"] + +ADD conf/etc/supervisor/ /etc/supervisor/ +ADD conf/etc/logrotate.d/zabbix_snmptraps /etc/logrotate.d/ + +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/snmptraps/ubuntu/build.sh b/snmptraps/ubuntu/build.sh new file mode 100755 index 000000000..88fee9dbe --- /dev/null +++ b/snmptraps/ubuntu/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +os=ubuntu + +version=$1 +version=${version:-"latest"} + +app_component=snmptraps + +if [[ ! $version =~ ^[0-9]*\.[0-9]*\.[0-9]*$ ]] && [ "$version" != "latest" ]; then + echo "Incorrect syntax of the version" + exit 1 +fi + +docker build -t zabbix-$app_component:$os-$version -f Dockerfile . + +docker rm -f zabbix-$app_component + +docker run --name zabbix-$app_component -t -d zabbix-$app_component:$os-$version diff --git a/proxy-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf b/snmptraps/ubuntu/conf/etc/logrotate.d/zabbix_snmptraps similarity index 75% rename from proxy-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf rename to snmptraps/ubuntu/conf/etc/logrotate.d/zabbix_snmptraps index d5299aa26..e5b16c3f8 100644 --- a/proxy-mysql/ubuntu/conf/etc/logrotate.d/logrotate_zabbix.conf +++ b/snmptraps/ubuntu/conf/etc/logrotate.d/zabbix_snmptraps @@ -1,5 +1,5 @@ # https://support.zabbix.com/browse/ZBX-9858 -/tmp/snmptrapfmt.log { +/var/lib/zabbix/snmotraps/snmptraps.log { missingok daily rotate 0 diff --git a/server-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf b/snmptraps/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf similarity index 65% rename from server-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf rename to snmptraps/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf index 39ba03943..7e6ea8c10 100644 --- a/server-mysql/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf +++ b/snmptraps/ubuntu/conf/etc/supervisor/conf.d/supervisord_snmptraps.conf @@ -1,7 +1,11 @@ +[supervisord] +nodaemon = true + [program:snmptrapfmt] command = /usr/sbin/snmptrapfmt -f /etc/snmp/snmptrapfmt.conf auto_start = true autorestart = true +priority = 50 stdout_logfile = /dev/stdout stdout_logfile_maxbytes = 0 @@ -9,9 +13,10 @@ stderr_logfile = /dev/stderr stderr_logfile_maxbytes = 0 [program:snmptrapd] -command = /usr/sbin/snmptrapd -f -n -Lsd -p /var/run/snmptrapd.pid +command = /usr/sbin/snmptrapd -m '+ALL' -M /usr/share/snmp/mibs:/var/lib/mibs/iana:/var/lib/mibs/ietf:/var/lib/zabbix/mibs -f -n -Lo -p /var/run/snmptrapd.pid auto_start = true autorestart = true +priority = 100 stdout_logfile = /dev/stdout stdout_logfile_maxbytes = 0 diff --git a/snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf b/snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf new file mode 100644 index 000000000..e8acd1e4e --- /dev/null +++ b/snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf @@ -0,0 +1,34 @@ +; supervisor config file + +[unix_http_server] +file = /var/run/supervisor.sock ; (the path to the socket file) +chmod = 0700 ; sockef file mode (default 0700) +username = zbx +password = password + +[supervisord] +logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log) +pidfile = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP) +critical = critical +user = root +logfile_maxbytes = 0 +logfile_backupcount = 0 + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/web-apache-mysql/alpine/Dockerfile b/web-apache-mysql/alpine/Dockerfile index 7131381a8..a302fdfb2 100644 --- a/web-apache-mysql/alpine/Dockerfile +++ b/web-apache-mysql/alpine/Dockerfile @@ -37,8 +37,8 @@ RUN addgroup zabbix && \ ttf-dejavu && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-apache-mysql/alpine/run_zabbix_component.sh b/web-apache-mysql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-apache-mysql/alpine/run_zabbix_component.sh +++ b/web-apache-mysql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/web-apache-mysql/ubuntu/Dockerfile b/web-apache-mysql/ubuntu/Dockerfile index 5a5fd70e1..57d013243 100644 --- a/web-apache-mysql/ubuntu/Dockerfile +++ b/web-apache-mysql/ubuntu/Dockerfile @@ -36,8 +36,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-apache-mysql/ubuntu/run_zabbix_component.sh b/web-apache-mysql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-apache-mysql/ubuntu/run_zabbix_component.sh +++ b/web-apache-mysql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/web-nginx-mysql/alpine/Dockerfile b/web-nginx-mysql/alpine/Dockerfile index 3b0bcb004..70ae4e250 100644 --- a/web-nginx-mysql/alpine/Dockerfile +++ b/web-nginx-mysql/alpine/Dockerfile @@ -36,8 +36,8 @@ RUN addgroup zabbix && \ ttf-dejavu && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-nginx-mysql/alpine/run_zabbix_component.sh b/web-nginx-mysql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-nginx-mysql/alpine/run_zabbix_component.sh +++ b/web-nginx-mysql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/web-nginx-mysql/ubuntu/Dockerfile b/web-nginx-mysql/ubuntu/Dockerfile index df5595a57..c90c5e173 100644 --- a/web-nginx-mysql/ubuntu/Dockerfile +++ b/web-nginx-mysql/ubuntu/Dockerfile @@ -41,8 +41,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-nginx-mysql/ubuntu/run_zabbix_component.sh b/web-nginx-mysql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-nginx-mysql/ubuntu/run_zabbix_component.sh +++ b/web-nginx-mysql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/web-nginx-pgsql/alpine/Dockerfile b/web-nginx-pgsql/alpine/Dockerfile index 9415d2643..ddff5c48a 100644 --- a/web-nginx-pgsql/alpine/Dockerfile +++ b/web-nginx-pgsql/alpine/Dockerfile @@ -35,8 +35,8 @@ RUN addgroup zabbix && \ ttf-dejavu && \ rm -rf /var/cache/apk/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-nginx-pgsql/alpine/run_zabbix_component.sh b/web-nginx-pgsql/alpine/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-nginx-pgsql/alpine/run_zabbix_component.sh +++ b/web-nginx-pgsql/alpine/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() { diff --git a/web-nginx-pgsql/ubuntu/Dockerfile b/web-nginx-pgsql/ubuntu/Dockerfile index e963af471..0f1db0888 100644 --- a/web-nginx-pgsql/ubuntu/Dockerfile +++ b/web-nginx-pgsql/ubuntu/Dockerfile @@ -41,8 +41,8 @@ RUN DISTRIB_CODENAME=$(/bin/bash -c 'source /etc/lsb-release && echo $DISTRIB_CO apt-get ${APT_FLAGS_COMMON} clean && \ rm -rf /var/lib/apt/lists/* -ARG MAJOR_VERSION=master -ARG ZBX_VERSION=${MAJOR_VERSION} +ARG MAJOR_VERSION=3.0 +ARG ZBX_VERSION=${MAJOR_VERSION}.4 ARG ZBX_SOURCES=svn://svn.zabbix.com/tags/${ZBX_VERSION}/ ENV ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} DB_TYPE=${DB_TYPE} diff --git a/web-nginx-pgsql/ubuntu/run_zabbix_component.sh b/web-nginx-pgsql/ubuntu/run_zabbix_component.sh index 1af60bc90..7207536f2 100755 --- a/web-nginx-pgsql/ubuntu/run_zabbix_component.sh +++ b/web-nginx-pgsql/ubuntu/run_zabbix_component.sh @@ -21,8 +21,6 @@ ZBX_SERVER_HOST=${ZBX_SERVER_HOST:-"zabbix-server"} # Default Zabbix server port number ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"} -ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} - TZ=${TZ:-"Europe/Riga"} # Default directories @@ -135,7 +133,7 @@ check_variables_mysql() { # If root password is not specified use provided credentials DB_SERVER_ROOT_USER=${DB_SERVER_ROOT_USER:-${MYSQL_USER}} - DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} + [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}} DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"} DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"} @@ -309,21 +307,21 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" - [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD="--password=\"${DB_SERVER_ROOT_PASS}\"" + [ -n "${DB_SERVER_ROOT_PASS}" ] && DB_TMP_PASSWORD=--password=\"${DB_SERVER_ROOT_PASS}\" cat /usr/share/doc/zabbix-$type-mysql/schema.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null if [ "$type" == "server" ]; then echo "** Fill the schema with initial data" cat /usr/share/doc/zabbix-$type-mysql/images.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null cat /usr/share/doc/zabbix-$type-mysql/data.sql | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} $DB_TMP_PASSWORD \ + -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ ${DB_SERVER_DBNAME} 1>/dev/null fi fi @@ -482,46 +480,6 @@ prepare_web_server_nginx() { ln -sf /dev/fd/2 /var/log/php5-fpm.log } -prepare_snmptrapd() { - SNMPTRAPD_CONF="/etc/snmp/snmptrapd.conf" - SNMPTRAPFMT_CONF="/etc/snmp/snmptrapfmt.conf" - - if [ ! -d "/etc/snmp/" ] || [ ! -f "/usr/sbin/snmptrapd" ]; then - echo "**** Impossible to enable SNMP traps feature" - ZBX_ENABLE_SNMP_TRAPS=false - return - fi - - echo "** Updating SNMP traps related configuration files" - - echo "** Updating snmptrapd" - echo "disableAuthorization yes" >> "$SNMPTRAPD_CONF" - - if [ -f "/usr/sbin/snmptrapfmt" ]; then - echo "traphandle default /usr/sbin/snmptrapfmthdlr" >> "$SNMPTRAPD_CONF" - - echo "** Updating snmptrapfmt" - - sed -i \ - -e "/^VARFMT=/s/=.*/=\"%n %v \"/" \ - -e '/^LOGFMT=/s/=.*/=\"$x ZBXTRAP $R $G $S $e $*\"/' \ - -e "/^LOGFILE=/s/=.*/=\"\/tmp\/snmptraps.log\"/" \ - "$SNMPTRAPFMT_CONF" - elif [ -f "/usr/sbin/zabbix_trap_receiver.pl" ]; then - echo "perl do \"/usr/sbin/zabbix_trap_receiver.pl\";" >> "$SNMPTRAPD_CONF" - update_config_var "/usr/sbin/zabbix_trap_receiver.pl" "\$SNMPTrapperFile " "/tmp/snmptraps.log" - fi - - if [ -f "/usr/sbin/logrotate" ]; then - if [ ! -f "/etc/logrotate.d/logrotate_zabbix.conf" ]; then - echo "**** Impossible to manage SNMP traps log file. Zabbix logrotate configuration file not found" - fi - else - rm -f "/etc/logrotate.d/logrotate_zabbix.conf" - echo "**** Impossible to manage SNMP traps log file. Logrotate not found" - fi -} - clear_deploy() { local type=$1 echo "** Cleaning the system" @@ -610,8 +568,9 @@ update_zbx_config() { update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}" update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}" + ZBX_ENABLE_SNMP_TRAPS=${ZBX_ENABLE_SNMP_TRAPS:-"false"} if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - update_config_var $ZBX_CONFIG "SNMPTrapperFile" "/tmp/snmptraps.log" + update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log" update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1" else update_config_var $ZBX_CONFIG "SNMPTrapperFile" @@ -834,12 +793,6 @@ prepare_server() { create_db_database_$db_type create_db_schema_$db_type "server" - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "server" "$db_type" } prepare_proxy() { @@ -855,12 +808,6 @@ prepare_proxy() { create_db_schema_$db_type "proxy" fi - if [ "${ZBX_ENABLE_SNMP_TRAPS}" == "true" ]; then - prepare_snmptrapd - else - rm -f $SUPERVISOR_CONFD/supervisord_snmptraps.conf - fi - update_zbx_config "proxy" $db_type } prepare_web() {