mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-12-22 06:21:29 +01:00
Moved snmptraps to different image
This commit is contained in:
parent
e710748c64
commit
dcd7f63aa9
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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/
|
||||
|
@ -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() {
|
||||
|
@ -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"]
|
||||
|
@ -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
|
@ -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() {
|
||||
|
@ -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/
|
||||
|
@ -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() {
|
||||
|
@ -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"]
|
||||
|
@ -1,8 +0,0 @@
|
||||
# https://support.zabbix.com/browse/ZBX-9858
|
||||
/tmp/snmptrapfmt.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 0
|
||||
minsize 50M notifempty
|
||||
su zabbix zabbix
|
||||
}
|
@ -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
|
@ -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() {
|
||||
|
@ -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/
|
||||
|
@ -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() {
|
||||
|
@ -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"]
|
||||
|
@ -1,8 +0,0 @@
|
||||
# https://support.zabbix.com/browse/ZBX-9858
|
||||
/tmp/snmptrapfmt.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 0
|
||||
minsize 50M notifempty
|
||||
su zabbix zabbix
|
||||
}
|
@ -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() {
|
||||
|
@ -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/
|
||||
|
@ -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() {
|
||||
|
@ -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/
|
||||
|
@ -1,8 +0,0 @@
|
||||
# https://support.zabbix.com/browse/ZBX-9858
|
||||
/tmp/snmptrapfmt.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 0
|
||||
minsize 50M notifempty
|
||||
su zabbix zabbix
|
||||
}
|
@ -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
|
@ -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() {
|
||||
|
50
snmptraps/ubuntu/Dockerfile
Normal file
50
snmptraps/ubuntu/Dockerfile
Normal file
@ -0,0 +1,50 @@
|
||||
FROM ubuntu:trusty
|
||||
MAINTAINER Alexey Pustovalov <alexey.pustovalov@zabbix.com>
|
||||
|
||||
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"]
|
19
snmptraps/ubuntu/build.sh
Executable file
19
snmptraps/ubuntu/build.sh
Executable file
@ -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
|
@ -1,5 +1,5 @@
|
||||
# https://support.zabbix.com/browse/ZBX-9858
|
||||
/tmp/snmptrapfmt.log {
|
||||
/var/lib/zabbix/snmotraps/snmptraps.log {
|
||||
missingok
|
||||
daily
|
||||
rotate 0
|
@ -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
|
34
snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf
Normal file
34
snmptraps/ubuntu/conf/etc/supervisor/supervisord.conf
Normal file
@ -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
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user