Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemstats_linux: unexpected header length in /proc/net/snmp. 237 != 224 errors #5

Open
shooding opened this issue Sep 2, 2024 · 2 comments

Comments

@shooding
Copy link

shooding commented Sep 2, 2024

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

@indigo423
Copy link
Member

We need to upgrade Net-SNMP it was a bug when running Net-SNMP on newer kernels, see here: net-snmp/net-snmp#785

@shooding
Copy link
Author

shooding commented Sep 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants