container-images/telegraf-snmp-unifi/Dockerfile
dresi 9ffdc76e6a
All checks were successful
Build and push telegraf-snmp-unifi image / build-and-push-image (push) Successful in 4m3s
fix: import GPG key into keyring instead of apt trusted.gpg.d
2026-06-11 16:12:16 +02:00

46 lines
2.4 KiB
Docker

FROM buildpack-deps:bookworm-curl
LABEL org.opencontainers.image.authors="dockerimage@dresi.wtf"
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
iputils-ping snmp procps lm-sensors libcap2-bin && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget -q -O - https://repos.influxdata.com/influxdata-archive.key | gpg --import
ENV TELEGRAF_VERSION=1.39.0
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) ARCH='amd64';; \
arm64) ARCH='arm64';; \
*) echo "Unsupported architecture: ${dpkgArch}"; exit 1;; \
esac && \
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb.asc && \
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb && \
gpg --batch --verify telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb.asc telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb && \
dpkg -i telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb && \
rm -f telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb*
RUN cd /usr/share/snmp/mibs && \
wget -q https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/SNMPv2-SMI.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/SNMPv2-TC.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/SNMPv2-CONF.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/SNMPv2-MIB.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/RFC1213-MIB.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/HCNUM-TC.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/HOST-RESOURCES-MIB.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/IF-MIB.txt \
https://raw.githubusercontent.com/net-snmp/net-snmp/master/mibs/SNMP-FRAMEWORK-MIB.txt && \
wget -q -O UBNT-MIB \
https://raw.githubusercontent.com/librenms/librenms/master/mibs/ubnt/UBNT-MIB && \
wget -q -O UBNT-UniFi-MIB \
https://raw.githubusercontent.com/librenms/librenms/master/mibs/ubnt/UBNT-UniFi-MIB && \
echo "mibs +ALL" >> /etc/snmp/snmp.conf
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["telegraf"]