BSNMP - mini SNMP daemon
For a couple of projects that involved controlling software on
a couple of machines from a single controlling machine I decided
to use SNMP. After looking at several available SNMP implementations
I started to implement my own SNMP stuff, because what was available
was not really what I needed (for several reasons). The result is
bsnmp.
Bsnmp consists of the following pieces:
- a library libbsnmp that includes ASN.1 handling, the SNMP protocol
version V1 and V2C and a number of helper stuff to simplify writing
of SNMP agents and clients.
- the gensnmptree tool that generates the C- and H-files from an
object hierarchy description (.def file).
- the gensnmpdef tool that generates an initial .def file from a MIB.
This requires the libsmi library.
- bsnmpd - the SNMP daemon.
- snmp_mibII - an implementation of the standard MIB-II sub-tree.
- snmp_ntp - a partial implementation of the experimental NTP MIB.
The bsnmpd daemon implements just the bare minimum that is needed for such
a daemon: the system group, parts of the SNMP group and a private tree
that does the following:
- handling of loadable modules. This allows loading/unloading parts of
the tree at runtime or configuration time.
- handling of communities. A table that allows loaded modules to
create new communities at run-time (ILMI is a consumer of this). This
table can be disabled for obvious reasons.
- handling trap destinations for V1.
- several configuration parameters like the protocol versions to handle,
buffer sizes and so on.
- tables that manage the UDP and local unix ports the daemon is listening on.
- statistics and debugging
All real functionality is implemented via loadable modules and hence the
daemon can be used for remote-control functions that have nothing to do
with network management.
Examples
Snmp_mibII implements much of the standard MIB-II tree. The source of this
module is part of the bsnmp distribution.
Snmp_netgraph allows read-only access to the netgraph sub-system in the
FreeBSD kernel. The source of this module is part of FreeBSD.
Several modules exists that implement different functions of the ATM protocol
stack. Snmp_ilmi implements the ILMI protocol as well as management of local
UNI instances (creation, destroy, change). Snmp_atmroute implements the
management of ATM routes for an ATM switch. Snmp_switch on top of these
two modules implements the call control functionality of an ATM switch.
Snmp_watm is used to control a wireless ATM simulator for satellite links.
The controlling application for the simulator runs on a remote machine
and communicates with the simulator via SNMP.
Portability
As of version 1.11 the full version of bsnmp runs only on FreeBSD.
Most parts may be built on Linux (last I tried was a year ago).
The snmp_mibII port for Linux is complicated by the fact that Linux
misses usable interfaces between the kernel networking stuff and userland.
Source
A stable version of bsnmp is available in the FreeBSD base system under
src/contrib/bsnmp. The most actual source can be found here.
Note that in order to build you need also either a libisc (you may get
this from earlier bind sources), or better
libbegemot.