2020-02-20 17:22:58 +01:00
|
|
|
FROM alpine:3.11
|
2018-05-10 22:30:42 +02:00
|
|
|
|
2019-11-14 06:28:37 +01:00
|
|
|
ARG MAJOR_VERSION=5.0
|
2020-07-13 12:25:02 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.2
|
2019-05-10 16:11:07 +02:00
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
2018-05-10 22:30:42 +02:00
|
|
|
|
2019-09-05 19:04:42 +02:00
|
|
|
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
|
|
|
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
|
|
|
|
|
|
|
|
LABEL org.opencontainers.image.title="zabbix-snmptraps-alpine" \
|
|
|
|
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
|
|
|
org.opencontainers.image.vendor="Zabbix LLC" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
|
|
|
org.opencontainers.image.description="Zabbix server with MySQL database support" \
|
|
|
|
org.opencontainers.image.licenses="GPL v2.0" \
|
|
|
|
org.opencontainers.image.documentation="Zabbix SNMP traps receiver" \
|
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}" \
|
|
|
|
org.opencontainers.image.source="https://anonscm.debian.org/gitweb/?p=collab-maint/snmptrapfmt.git"
|
2018-05-10 22:30:42 +02:00
|
|
|
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
|
|
|
|
COPY ["snmptrapfmt_1.14+nmu1ubuntu2.tar.gz", "/tmp/"]
|
|
|
|
|
2019-05-30 20:21:16 +02:00
|
|
|
RUN set -eux && \
|
2020-04-25 19:31:44 +02:00
|
|
|
addgroup -S -g 1995 zabbix && \
|
2018-05-10 22:30:42 +02:00
|
|
|
adduser -S \
|
2020-04-25 19:31:44 +02:00
|
|
|
-D -G zabbix -G root \
|
|
|
|
-u 1997 \
|
2018-05-10 22:30:42 +02:00
|
|
|
-h /var/lib/zabbix/ \
|
|
|
|
zabbix && \
|
|
|
|
apk update && \
|
2020-04-25 19:31:44 +02:00
|
|
|
apk add --clean-protected --no-cache \
|
2018-05-10 22:30:42 +02:00
|
|
|
net-snmp \
|
|
|
|
supervisor && \
|
2020-04-25 19:31:44 +02:00
|
|
|
apk add --no-cache --virtual build-dependencies \
|
2018-05-10 22:30:42 +02:00
|
|
|
alpine-sdk \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
libnsl-dev \
|
|
|
|
net-snmp-dev && \
|
|
|
|
mkdir -p /var/lib/zabbix && \
|
|
|
|
mkdir -p /var/lib/zabbix/snmptraps && \
|
|
|
|
mkdir -p /var/lib/zabbix/mibs && \
|
|
|
|
cd /tmp/ && \
|
|
|
|
tar -zxvf snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
|
|
|
cd /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
|
|
|
patch -p1 < ./patches/makefile.patch && \
|
2020-04-25 22:24:26 +02:00
|
|
|
patch -p1 < ./patches/pid_location.patch && \
|
2018-05-31 09:50:32 +02:00
|
|
|
make -j"$(nproc)" -s && \
|
2018-05-10 22:30:42 +02:00
|
|
|
cp snmptrapfmthdlr /usr/sbin/snmptrapfmthdlr && \
|
|
|
|
cp snmptrapfmt /usr/sbin/snmptrapfmt && \
|
|
|
|
cp snmptrapfmt.conf /etc/snmp/snmptrapfmt.conf && \
|
|
|
|
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" && \
|
2018-05-31 09:50:32 +02:00
|
|
|
rm -rf /tmp/snmptrapfmt_1.14+nmu1ubuntu2.tar.gz && \
|
|
|
|
rm -rf /tmp/snmptrapfmt-1.14+nmu1ubuntu1/ && \
|
2020-04-25 22:24:26 +02:00
|
|
|
chown --quiet -R zabbix:root /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
|
|
|
|
chgrp -R 0 /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
|
|
|
|
chmod -R g=u /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
|
2019-09-05 19:04:42 +02:00
|
|
|
apk del --purge --no-network \
|
2018-05-10 22:30:42 +02:00
|
|
|
build-dependencies && \
|
|
|
|
rm -rf /var/cache/apk/*
|
|
|
|
|
2020-04-25 22:24:26 +02:00
|
|
|
EXPOSE 1162/UDP
|
2018-05-10 22:30:42 +02:00
|
|
|
|
|
|
|
WORKDIR /var/lib/zabbix/snmptraps/
|
|
|
|
|
|
|
|
VOLUME ["/var/lib/zabbix/snmptraps", "/var/lib/zabbix/mibs"]
|
|
|
|
|
|
|
|
COPY ["conf/etc/supervisor/", "/etc/supervisor/"]
|
|
|
|
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
|
|
|
|
2020-04-25 19:31:44 +02:00
|
|
|
USER 1997
|
|
|
|
|
2018-05-10 22:30:42 +02:00
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|