Instead of writing the voluminous results of the SNMPWalk to the Debug log, InterMapper can write the results to an SQLite file. To use this feature, you use the -o option.
When you use the -o option, snmpwalk stores its output into an SQLite database. To use this feature, you specify the name of the database file following the -o option.
To create an SQLite3 database named "foo" and store the snmpwalk results there, use the following "server command":
snmpwalk -v1 -c public -o foo switch 1.3
This writes the output to an SQLite database file named "foo", located in InterMapper Settings/Temporary directory. The database file named "foo" may contain multiple snmpwalk's. The file is created if it doesn't exist.
When the -o option is used, only these four lines are written to the Debug log:
SNMPWalk command received: 'snmpwalk -v1 -c public -o foo -n 10 switch 1.3' SNMPWalk 192.168.1.36 3: prefix 1.3 (version SNMPv1 ... SNMPWalk on switch started SNMPWalk 192.168.1.36 3: Finished (10 OIDs ...
The SNMPWALK Schema
Here is the schema used for the snmpwalk database:
CREATE TABLE walks ( id INTEGER PRIMARY KEY, address TEXT, port INTEGER, startOid TEXT, snmpVersion INTEGER, pktTimeout INTEGER, pktRetries INTEGER, maxOids INTEGER, toEnd INTEGER, timeStarted INTEGER, timeFinished INTEGER, oidCount INTEGER, stopReason TEXT ); CREATE TABLE results ( walk_id INTEGER, name TEXT, oid TEXT, type INTEGER, value BLOB );
The walks table stores one row for each snmpwalk command. Each walk will receive a unique id that is used to identify it (id). The other columns are:
the address of the snmpwalk target device
the udp port number of the snmpwalk target device
the starting OID specified in the snmpwalk command
the SNMP version specified
the packet timeout specified
the packet retry count specified
the maximum number of OID's specified
a boolean flag indicating that the walk should proceed to the end (i.e. don't limit by startOid).
the UTC timestamp when the walk was started
the UTC timestamp when the walk was completed
the number of OID rows walked
text indicating the reason the walk stopped where it did
The results table stores a row for each entry of one snmpwalk, as specified by id in the walks table.
the id of the walk (references walks.id)
the text of the OID naming the SNMP variable
the ASN.1 type integer for the SNMP variable
the actual, uninterpreted binary value returned by the SNMP agent
On Mac OS X 10.4, you can use the built-in sqlite3 command to access the data in the SQLite database file:
$ sqlite3 foo sqlite> .mode csv sqlite> select * from walks; 1,"192.168.1.1",161,1.0,0,10000,3,2000,0,1178801645,1178801685,0,"No answer received" 2,"192.168.1.2",161,1.3,0,10000,3,2000,0,1178801708,1178801895,2000,"Finished (2000 OIDs found)" sqlite> select count(*) from results where walk_id = 1; 0 sqlite> select count(*) from results where walk_id = 2; 2000 sqlite> select * from results where walk_id = 2 order by oid limit 5; 2,"188.8.131.52.184.108.40.206.0",4,"HP J4813A ProCurve Switch 2524..." 2,"220.127.116.11.18.104.22.168.0",6,"+\006\001\004\001\013\002\003\007\013\023" 2,"22.214.171.124.126.96.36.199.0",67,"\035\330J\375" 2,"188.8.131.52.184.108.40.206.0",4,"Bill Fisher" 2,"220.127.116.11.18.104.22.168.0",4,"HP ProCurve Switch 2524"
There is a Firefox add-on called "SQLite Manager" that opens and displays SQLite database files. This makes it a cross-platform tool, requiring only Firefox 3.5 or greater, plus a small download.
To install SQLite Manager:
To use SQLite Manager: