2020-12-18 21:27:28 +01:00
|
|
|
FROM ubuntu:focal
|
2018-02-18 21:42:44 +01:00
|
|
|
|
2019-11-14 06:28:37 +01:00
|
|
|
ARG MAJOR_VERSION=5.0
|
2024-03-25 14:29:06 +01:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}.42
|
2019-05-10 16:11:07 +02:00
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
2018-02-18 21:42:44 +01:00
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
ENV TERM=xterm \
|
|
|
|
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
2021-02-09 01:58:31 +01:00
|
|
|
MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
|
2023-11-11 06:25:11 +01:00
|
|
|
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT=" " \
|
|
|
|
ZBX_SNMP_TRAP_USE_DNS=false
|
2020-04-28 18:39:39 +02:00
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
2020-04-28 18:39:39 +02:00
|
|
|
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
|
|
|
|
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.licenses="GPL v2.0" \
|
|
|
|
org.opencontainers.image.title="zabbix-snmptraps" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
2024-05-21 12:45:53 +02:00
|
|
|
org.opencontainers.image.vendor="Zabbix SIA" \
|
2020-12-18 13:13:28 +01:00
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}"
|
2018-02-18 21:42:44 +01:00
|
|
|
|
|
|
|
STOPSIGNAL SIGTERM
|
2016-08-03 14:23:39 +02:00
|
|
|
|
2024-02-20 09:24:36 +01:00
|
|
|
RUN --mount=type=cache,target=/var/lib/apt/,sharing=locked \
|
|
|
|
set -eux && \
|
2020-12-18 21:21:28 +01:00
|
|
|
echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \
|
2021-10-16 17:49:19 +02:00
|
|
|
INSTALL_PKGS="bash \
|
|
|
|
tzdata \
|
|
|
|
snmp-mibs-downloader \
|
|
|
|
snmptrapd" && \
|
|
|
|
apt-get -y update && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -y \
|
|
|
|
--no-install-recommends install \
|
|
|
|
${INSTALL_PKGS} && \
|
|
|
|
groupadd \
|
|
|
|
--system \
|
|
|
|
--gid 1995 \
|
|
|
|
zabbix && \
|
2020-12-19 17:42:48 +01:00
|
|
|
useradd \
|
2021-10-16 17:49:19 +02:00
|
|
|
--system \
|
|
|
|
--comment "Zabbix monitoring system" \
|
|
|
|
-g zabbix \
|
2020-04-28 18:39:39 +02:00
|
|
|
--uid 1997 \
|
2020-12-19 17:42:48 +01:00
|
|
|
--shell /sbin/nologin \
|
|
|
|
--home-dir /var/lib/zabbix/ \
|
2016-08-03 14:23:39 +02:00
|
|
|
zabbix && \
|
2018-05-31 09:50:32 +02:00
|
|
|
download-mibs && \
|
2016-08-03 14:23:39 +02:00
|
|
|
mkdir -p /var/lib/zabbix && \
|
|
|
|
mkdir -p /var/lib/zabbix/snmptraps && \
|
|
|
|
mkdir -p /var/lib/zabbix/mibs && \
|
2020-04-28 18:39:39 +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/ && \
|
2024-02-20 09:24:36 +01:00
|
|
|
chmod -R g=u /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/
|
2016-08-03 14:23:39 +02:00
|
|
|
|
2020-04-30 02:28:06 +02:00
|
|
|
EXPOSE 1162/UDP
|
2016-08-03 14:23:39 +02:00
|
|
|
|
|
|
|
WORKDIR /var/lib/zabbix/snmptraps/
|
|
|
|
|
2020-07-13 23:43:32 +02:00
|
|
|
VOLUME ["/var/lib/zabbix/snmptraps"]
|
2016-08-03 14:23:39 +02:00
|
|
|
|
2018-02-18 21:42:44 +01:00
|
|
|
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
2020-12-18 13:13:28 +01:00
|
|
|
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
|
2021-02-09 01:58:31 +01:00
|
|
|
COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"]
|
2016-08-03 14:23:39 +02:00
|
|
|
|
2020-04-28 18:39:39 +02:00
|
|
|
USER 1997
|
|
|
|
|
2024-06-21 06:46:09 +02:00
|
|
|
CMD ["/usr/sbin/snmptrapd", "-n", "-t", "-X", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A", "--doNotFork=yes", "--agentuser=zabbix"]
|