# Do you run an snmp daemon ?



## Alain De Vos (Jun 25, 2021)

Do you run an snmp daemon ? If so which one ?
Which programs do you use to send traps or to browse mibs ?


----------



## Jose (Jun 25, 2021)

I use snmpd on Openbsd, but not on Freebsd. Unfortunately it appears the daemons are quite different. I use MRTG to create traffic graphs with the SNMP data from my Openbsd gateway.


----------



## Alain De Vos (Jun 25, 2021)

It seems freebsd has gsnmp, net-snmp, mrtg & mrtg-ping-probe.


----------



## sko (Jun 25, 2021)

net-snmp is considered to be the "most RFC-compliant" and most widely available implementation - that being said, SNMP in the real world is a minefield planted throughout its 30+ year history with a multitude of "interpretations" of the (many) RFCs and lots of new and inventive implementations of vendors that think they could just bend those RFCs to their will (or flat out ignoring them).

BTT:
I recommend sticking with net-snmp for agents and managers that you have control over and have to configure and/or probe by hand. This way you at least have a somewhat consistent interface and configuration logic you can get used to. It's also the most widely used implementation on a lot of other networking gear or at least those vendors based their agent on some version or variant of net-snmp.
On OpenBSD I'm using snmpd which also works reasonably well (but I also only pull some network/PF-related stats from OpenBSD hosts..). If you only have such hosts, consider yourself lucky.

Everywhere else you are in the hands of the vendor of the specific kit - as said, many use some version or abomination of net-snmp, many others have their own, home-brewn agents that may need some special treatment and/or have weird "edge cases". E.g. some might fall over from bulkwalks or even when sending traps (one of our APC UPS had such a buggy firmware once, was fun to see it going all red in the middle of the day..) and a lot have broken auth and/or encryption mechanisms (if any) or only a few special combinations are working as intended.


If you really have to dive more deeply into that topic, I can highly recommend the "SNMP Mastery" book (aka "The Networknomicon") from Michael W. Lucas. This book gives you everything you need to stay somewhat sane when dealing with SNMP on a regular basis.


----------



## Alain De Vos (Jun 25, 2021)

I'll install net-snmp.


----------



## Alain De Vos (Jun 25, 2021)

net-snmp open for me a high udp port and it binds on all interfaces.
sockstat -46 | grep snmp

```
root     snmpd      44650 9  tcp4   127.0.0.1:3000        *:*
root     snmpd      44650 10 udp4   *:38598               *:*
root     snmpd      44650 11 tcp4   127.0.0.1:705         *:*
root     snmpd      44650 12 tcp4   127.0.0.1:4000        *:*
```
This open udp port is annoying as I am on a public interface and not behind a nat.
But i fixed it by disabling the trapsink.


----------



## sko (Jun 25, 2021)

You can specify the listening address, port and protocol of snmpd. Have a look at the "LISTENING ADDRESSES" section in snmpd(8). Set the appropriate config via "snmpd_flags" in /etc/rc.conf

You can also specify this via the "agentAddress" option in the snmpd.conf (see example config at /usr/local/share/snmp/snmpd.conf.example)


----------



## Alain De Vos (Jun 25, 2021)

It's fixed. I had to give the IP-address instead of the hostname and i dropped the udp/tcp specifier in the config file.
sockstat -46 | grep snmp

```
root     snmpd      90360 9  udp4   127.0.0.1:3000        *:*
root     snmpd      90360 10 udp4   127.0.0.1:13628       *:*
root     snmpd      90360 11 udp4   127.0.0.1:60015       *:*
root     snmpd      90360 13 tcp4   127.0.0.1:4000        *:*
```


----------



## Alain De Vos (Jun 25, 2021)

I wonder, are there general mibs I could try ? Not specific from hardware vendors.
Does net-snmp allows to query a "kernel mib" ?


----------



## sko (Jun 25, 2021)

The standard MIBs coming with the FreeBSD net-snmp package should be enough for basic monitoring purposes. What MIBs you 'need' depends on what information your agent(s) provide.

To get a first agent up and running for querying, use `snmpconf -g basic_setup` to create a new config (-> don't read any of the existing config files at the first step of the config wizard!). It will ask you a bunch of questions to set up basic information about the host and what other information about the system you want to expose (i.e. processes, disks, load...).

Use snmpbulkwalk to get a list of all OIDs an agent supports (beware: there are still some proprietary agents in the wild that blow up on snmp walks!).
If you don't see any numeric OIDs your manager has all MIBs it needs. Don't just add any MIB you can find - a lot of them interfere with each other and generate tons of error messages and a lot of MIBs are just broken...


----------

