SNMP in containers and base image?

baseimage
resinos2x
network

#1

I’m starting to monitor all of my network-connected devices - including those which do not run Resin.io - using LibreNMS.

I’ve tried to install the SNMPd package into the raspberry-pi-buildpack image, however the packages don’t appear to be available in the repositories that are configured.

Is there a reason for this? If so, how do I get SNMP installed into the container?

If there’s a way of enabling SNMP in the base os as well, then that would be amazing.


#2

If you use a Debian-based image it should be possible to install snmpd with apt-get update && apt-get install snmpd


#3

Yeah, that was what I thought as well, however it doesn’t appear to be the case. net-snmp, snmp, and snmpd all fail with “package does not exist” or similar error.

I’ll run a few tests again tonight and past the full logs here, however it does seem to be that the packages aren’t even in the repositories.


#4

@proffalken the below Dockerfile.template works for me with a Raspberry Pi 3. Could you give it a test and report back?

FROM resin/%%RESIN_MACHINE_NAME%%-debian

RUN apt-get update && apt-get install -yq \
   snmp snmpd && \
   apt-get clean && rm -rf /var/lib/apt/lists/*

CMD ["echo", "hello world"]

#5

Hmmm, that worked.

I’ve tested it and for some reason unless you specify the apt-get update, it can’t find the packages. I’m not sure if that’s a bug or not?


#6

You should always run apt-get update before apt-get install as it downloads the package lists from the repositories and “updates” them to get information on the newest versions of packages and their dependencies.


#7

OK, thanks, I’ll keep that in mind for future.

Is there anyway to get SNMP enabled on the physical host itself now that I’ve got this working in the container?


#8

The resinOS host operating system is intended to be quite minimal so it doesn’t have features like SNMP enabled. Is there a particular need you have for SNMP in the host OS?


#9

I just like monitoring everything on the network and being able to monitor the hypervisor as well as the container is preferable to just monitoring the container.

I’m going to be playing around with the OpenSource version of Resin as soon as it’s properly released (something that I don’t think has happened yet?), so once that’s in place I’ll start playing with the resinos images as well.

Cheers,

Matt


#10

The resinOS code is fully open source, you should be able to find the relevant information on where to find it and how to build it here: https://resinos.io/

The built images tend to lag behind the current latest version a little bit but all the code is on github.


#11

Great, thanks, I’ll take a look.