C Roff Java M4 Makefile
Switch branches/tags
Clone or download
troglobit Minor, mention new .conf file support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Latest commit 3f0f4d9 Jun 7, 2018
Permalink
Failed to load latest commit information.
java Initial import of mini-snmpd v1.0 Oct 31, 2015
.clang-format Add .clang-format file from Nemesis project Apr 11, 2018
.gitignore .gitignore: Update with global tags Nov 11, 2015
.travis.yml Travis-CI: Install libconfuse for building with .conf support May 6, 2018
AUTHORS Update to mention contributions by Javier Palacios Nov 8, 2015
CONTRIBUTING.md Minor, whitespace + rearrange Apr 11, 2018
COPYING COPYING: Update address to FSF Nov 7, 2015
ChangeLog.md Update ChangeLog and bump version for v1.4 release Jun 26, 2017
Makefile.am Enable more compiler warnings and C99 std May 6, 2018
README.develop Convert project to use the GNU Configure and Build system Nov 6, 2015
README.md Minor, mention new .conf file support Jun 9, 2018
TODO Update goals for v1.5 release May 6, 2018
autogen.sh Convert project to use the GNU Configure and Build system Nov 6, 2015
conf.c conf: Add support for iface-table in mini-snmpd.conf May 7, 2018
configure.ac Basic support for a mini-snmpd.conf file May 6, 2018
freebsd.c Provide real MAC addresses instead of dummy Nov 9, 2017
globals.c Refactor initialization of default and fallback values May 6, 2018
linux.c Provide real MAC addresses instead of dummy Nov 9, 2017
mib.c Refactor initialization of default and fallback values May 6, 2018
mini-snmpd.conf conf: Add support for iface-table in mini-snmpd.conf May 7, 2018
mini_snmpd.8 Clarify defaults in man page and usage text May 6, 2018
mini_snmpd.c Clarify defaults in man page and usage text May 6, 2018
mini_snmpd.h Add NELEMS() macro from libite May 7, 2018
protocol.c Fix: Response OID order match with request order Jan 20, 2016
utils.c Check input argument before dereferencing Jul 7, 2016

README.md

Mini SNMP Daemon

License Badge Travis Status

The Mini SNMP daemon is a minimal implementation of an SNMP daemon. It is primarily targeted at embedded systems with limited disk and memory resources. All configuration can be done using command line arguments, but it also supports a minimal .conf file. It supports basic CPU, memory, disk, and network interface statistics.

mini-snmpd is not as flexibible as, and does not support the same features as, the de-facto standard net-snmp, but this also means it does not have the same footprint and overhead.

Supported features:

  • SNMP version 1 and 2c (v3 is on the TODO list)
  • Community string authentication when using 2c or explicitely configured
  • Read-only access (writing is not supported)
  • Includes basic system info like CPU load, memory, disk and network interfaces
  • Does not need a configuation file
  • Supports UDP and TCP (thus supports SSH tunneling of SNMP connections)
  • Supports linux kernel versions 2.4 and 2.6
  • Supports FreeBSD (needs procfs mounted using "mount_linprocfs procfs /proc")

mini-snmpd has only been tested on x86 and ARM platforms using net-snmp as client, so big endian may not work.

  • For info about licensing, see the file COPYING
  • For info about using the program, see the file mini_snmpd.8
  • For info about how to (cross)compile the program, see the file Makefile
  • For info about how to extend the MIB, see the file README.develop

Examples

Start the daemon:

./mini_snmpd -n -p 16161 -D "My laptop" -L "Batcave" \
             -C "Ops <ops@example.comf>" -d '/' -i wlp3s0

Check uptime, useful to "ping" a device over SNMP:

snmpget -c public -v2c 127.0.0.1:16161 system.sysUpTime.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (93103) 0:15:31.03

Complete walk:

snmpwalk -v2c -c public 127.0.0.1:16161
SNMPv2-MIB::sysDescr.0 = STRING: My laptop
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (93103) 0:15:31.03
SNMPv2-MIB::sysContact.0 = STRING: Ops <ops@example.com>
SNMPv2-MIB::sysName.0 = STRING: luthien
SNMPv2-MIB::sysLocation.0 = STRING: Batcave
IF-MIB::ifNumber.0 = INTEGER: 1
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifDescr.1 = STRING: wlp3s0
IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifMtu.1 = INTEGER: 1500
IF-MIB::ifSpeed.1 = Gauge32: 1000000000
IF-MIB::ifPhysAddress.1 = STRING: 6c:88:14:48:57:1c
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifLastChange.1 = Timeticks: (0) 0:00:00.00
IF-MIB::ifInOctets.1 = Counter32: 207845364
IF-MIB::ifInUcastPkts.1 = Counter32: 154221
IF-MIB::ifInDiscards.1 = Counter32: 0
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifOutOctets.1 = Counter32: 13323787
IF-MIB::ifOutUcastPkts.1 = Counter32: 88071
IF-MIB::ifOutDiscards.1 = Counter32: 0
IF-MIB::ifOutErrors.1 = Counter32: 0
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (454155) 1:15:41.55

Check load average:

snmpwalk -v2c -c public 127.0.0.1:16161 UCD-SNMP-MIB::laLoad
UCD-SNMP-MIB::laLoad.1 = STRING: 0.56
UCD-SNMP-MIB::laLoad.2 = STRING: 0.46
UCD-SNMP-MIB::laLoad.3 = STRING: 0.36

Check monitored disks:

snmpwalk -v2c -c public 127.0.0.1:16161 UCD-SNMP-MIB::dskTable
UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1
UCD-SNMP-MIB::dskPath.1 = STRING: /
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 245084448
UCD-SNMP-MIB::dskAvail.1 = INTEGER: 38953552
UCD-SNMP-MIB::dskUsed.1 = INTEGER: 206130896
UCD-SNMP-MIB::dskPercent.1 = INTEGER: 85
UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 10

Build & Install

The [GNU Configure & Build][buildsystem] system use /usr/local as the default install prefix. Usually this is sufficient, the below example installs to /usr instead:

tar xf mini-snmpd-1.4.tar.xz
cd mini-snmpd-1.4/
./configure --prefix=/usr
make -j5
sudo make install-strip

Building from GIT

If you want to contribute, or simply want to try out the latest but still unreleased features, then you need to know a few things about the [GNU Configure & Build][buildsystem] system:

  • configure.ac and a per-directory Makefile.am are key files
  • configure and Makefile.in are generated from autogen.sh, they are not stored in GIT but automatically generated for the release tarballs
  • Makefile is generated by configure script

To build from GIT you first need to clone the repository and run the autogen.sh script. This requires automake and autoconf to be installed on your system.

git clone https://github.com/troglobit/mini-snmpd.git
cd mini-snmpd/
./autogen.sh
./configure && make

GIT sources are a moving target and are not recommended for production systems, unless you know what you are doing!

Origin & References

mini-snmpd on is an effort by Joachim Nilsson to create a focal point for patches and development of the original mini_snmpd project by Robert Ernst, since the original site now has gone dark.

The new project is maintained at GitHub. Use its issue tracker and pull request functions to report bugs or contribute new features.