Snimpy can be invoked with either snimpy or python -m
snimpy. Without any other arhument, the interactive console is
spawned. Otherwise, the given script is executed and the remaining
arguments are served as arguments for the script.

When running interactively, you get a classic Python
environment. There are two additional objects available:

The load() method that takes a MIB name or a path to a
filename. The MIB will be loaded into memory and made available in
all SNMP managers:

Also note that iterating over a table require an accessible index. Old
MIB usually have accessible indexes. If this is not the case, you’ll
have to iterate on a column instead. For example, the first example
could be written as:

forindexinm.ifDescr:print(repr(m.ifDescr[index]))

If you want to group several write into a single request, you can do
it with with keyword:

It’s also possible to set a custom timeout and a custom value for the
number of retries. For example, to wait 2.5 seconds before timeout
occurs and retry 10 times, you can use:

m=M("localhost",timeout=2.5,retries=10)

Snimpy will stop on any error with an exception. This allows you to
not check the result at each step. Your script can’t go awry. If this
behaviour does not suit you, it is possible to suppress exceptions
when querying inexistant objects. Instead of an exception, you’ll get
None:

m=M("localhost",none=True)

If for some reason, you need to specify the module you want to use to
lookup a node, you can do that using the following syntax:

If you get an exception like RAPID-CITY contains major SMI errors
(check with smilint -s -l1), this means that there are some grave
errors in this MIB which may lead to segfaults if the MIB is used as
is. Usually, this means that some identifier are unknown. Use smilint
-s -l1 YOUR-MIB to see what the problem is and try to solve all
problems reported by lines beginning by [1].