Open shooding opened 1 month ago
We need to upgrade Net-SNMP it was a bug when running Net-SNMP on newer kernels, see here: https://github.com/net-snmp/net-snmp/pull/785
For people having the same issue, before quay.io/labmonkeys/net-snmp release the latest update to 5.9.4, You can use my image shooding/net-snmp
(arm64 & amd64) as a temp replacement to quay.io/labmonkeys/net-snmp:5.9.3-r0.b1425
in docker-compose.yml.
The Dockerfile I used to build the image is referenced from labmonkeys official repo https://github.com/labmonkeys-space/app-container
# Stage 1: Builder Stage - Build net-snmp from source
FROM "alpine" AS builder
# Install the necessary build tools and dependencies for net-snmp
RUN apk add --no-cache \
build-base \
git \
autoconf \
automake \
bash \
libtool \
make \
bash \
alpine-sdk \
fakeroot \
linux-headers \
libnl3-dev \
perl \
perl-dev \
ruby-dev \
ruby-bundler \
rpm
# Install fpm for packaging RPM/DEB
RUN gem install --no-document fpm
# Set the working directory
WORKDIR /usr/src
# Clone the net-snmp source code
RUN git clone https://github.com/net-snmp/net-snmp.git
# Create the /package directory
RUN mkdir -p /package
# Build the net-snmp package
RUN cd net-snmp && \
./configure --prefix=/package --with-defaults --without-openssl && \
make && \
make install
# Use fpm to create an RPM package from the /package directory and produce to current WORKDIR
RUN fpm -s dir -t rpm -n net-snmp -v "5.9.4" -C /package .
# hadolint ignore=DL3006
FROM "alpine"
# Install rpm so that we can use rpm -i
RUN apk add --no-cache rpm
# Copy the built RPM package from the builder stage
COPY --from=builder /usr/src/*.rpm /tmp/net-snmp.rpm
# Install the RPM package using rpm command
RUN rpm -i /tmp/net-snmp.rpm
# RUN mkdir -p /etc/snmp/conf.d && \
# adduser -S snmp && \
# chown -R snmp:root /etc/snmp /var/lib/net-snmp
RUN mkdir -p /etc/snmp/conf.d && \
adduser -S snmp && \
chown -R snmp:root /etc/snmp
COPY --chown=snmp:root config/snmpd.conf /etc/snmp/snmpd.conf
COPY --chown=snmp:root config/conf.d/* /etc/snmp/conf.d/
# ENTRYPOINT ["/bin/bash"]
USER snmp
ENTRYPOINT [ "/sbin/snmpd" ]
CMD [ "-f", "-Le", "-LS0-6d", "-c", "/etc/snmp/snmpd.conf" ]
# Runtime information and not relevant at build time
EXPOSE 161/udp
Steps to repeat: just docker-compose up -d
quay.io/labmonkeys/net-snmp:5.9.3-r0.b1425 seems to be the issue. I've tried upgraded to latest 5.9.4-r0.b2384 still get
unexpected header length in /proc/net/snmp. 237 != 224 errors