2023-01-31 10:12:38 +01:00
|
|
|
FROM oraclelinux:9-slim
|
2021-06-10 22:39:04 +02:00
|
|
|
|
2024-06-04 08:09:07 +02:00
|
|
|
ARG MAJOR_VERSION=7.2
|
2021-06-10 22:39:04 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}
|
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
ENV TERM=xterm \
|
|
|
|
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
2021-06-10 22:39:04 +02:00
|
|
|
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
|
2024-01-26 14:14:49 +01:00
|
|
|
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y-%m-%dT%T%z ZBX_SNMP_TRAP_FORMAT="\n" \
|
2023-11-11 06:25:11 +01:00
|
|
|
ZBX_SNMP_TRAP_USE_DNS=false
|
2021-06-10 22:39:04 +02:00
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
2021-06-10 22:39:04 +02:00
|
|
|
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
|
|
|
|
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
2024-05-13 19:31:38 +02:00
|
|
|
org.opencontainers.image.licenses="AGPL v3.0" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.title="zabbix-snmptraps" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
2024-05-13 19:31:38 +02:00
|
|
|
org.opencontainers.image.vendor="Zabbix SIA" \
|
2021-06-10 22:39:04 +02:00
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}"
|
|
|
|
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
|
2024-02-18 15:27:03 +01:00
|
|
|
RUN --mount=type=tmpfs,target=/var/lib/dnf/ \
|
|
|
|
set -eux && \
|
2021-10-16 17:49:19 +02:00
|
|
|
INSTALL_PKGS="bash \
|
|
|
|
net-snmp" && \
|
|
|
|
microdnf -y install \
|
|
|
|
--disablerepo="*" \
|
2023-01-31 10:12:38 +01:00
|
|
|
--enablerepo="ol9_baseos_latest" \
|
|
|
|
--enablerepo="ol9_appstream" \
|
2021-10-16 17:49:19 +02:00
|
|
|
--setopt=install_weak_deps=0 \
|
2024-02-18 15:27:03 +01:00
|
|
|
--setopt=keepcache=0 \
|
2021-10-16 17:49:19 +02:00
|
|
|
--best \
|
|
|
|
--nodocs \
|
|
|
|
${INSTALL_PKGS} && \
|
|
|
|
groupadd \
|
|
|
|
--system \
|
|
|
|
--gid 1995 \
|
|
|
|
zabbix && \
|
2021-06-10 22:39:04 +02:00
|
|
|
useradd \
|
2021-10-16 17:49:19 +02:00
|
|
|
--system \
|
|
|
|
--comment "Zabbix monitoring system" \
|
|
|
|
-g zabbix \
|
2021-06-10 22:39:04 +02:00
|
|
|
--uid 1997 \
|
|
|
|
--shell /sbin/nologin \
|
|
|
|
--home-dir /var/lib/zabbix/ \
|
|
|
|
zabbix && \
|
|
|
|
mkdir -p /var/lib/zabbix && \
|
|
|
|
mkdir -p /var/lib/zabbix/snmptraps && \
|
|
|
|
mkdir -p /var/lib/zabbix/mibs && \
|
|
|
|
touch /var/lib/net-snmp/snmptrapd.conf && \
|
|
|
|
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/ && \
|
2024-02-18 15:27:03 +01:00
|
|
|
microdnf -y clean all
|
2021-06-10 22:39:04 +02:00
|
|
|
|
|
|
|
EXPOSE 1162/UDP
|
|
|
|
|
|
|
|
WORKDIR /var/lib/zabbix/snmptraps/
|
|
|
|
|
|
|
|
VOLUME ["/var/lib/zabbix/snmptraps"]
|
|
|
|
|
|
|
|
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
|
|
|
|
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
|
|
|
|
COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"]
|
|
|
|
|
|
|
|
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"]
|