Using the SNMPWALK -o Option

Instead of writing the results of the SNMPWalk to the debug log, Intermapper can write the results to a SQLite file. To use this feature, use the -o option.

When you use the -o option, SNMPWalk stores its output into a SQLite database. To use this feature, specify the name of the database file following the -o option.

Example

To create a SQLite3 database called foo and to store the SNMPWalk results there, use the following server command:

snmpwalk -v1 -c public -o foo switch 1.3

This writes the output to a SQLite database file called foo located in Intermapper Settings/Temporary directory. The database file called foo might contain multiple SNMPWalks. The file is created if it does not already exist.

When the -o option is used, the following 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 ...   

SNMPWALK Schema

The following 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
   );

Table: walks

The walks table stores one row for each SNMPWalk command. Each walk receives a unique identifier that identifies it (id). The other columns are as follows:

  • address

    The address of the SNMPWalk target device.

  • port

    The UDP port number of the SNMPWalk target device.

  • startOid

    The starting OID specified in the SNMPWalk command.

  • snmpVersion

    The SNMP version.

  • pktTimeout

    The packet timeout.

  • pktRetries

    The packet retry count.

  • maxOids

    The maximum number of OIDs.

  • toEnd

    A Boolean flag indicating that the walk should proceed to the end (in other words, it does not limit by startOid).

  • timeStarted

    The UTC timestamp of when the walk started.

  • timeFinished

    The UTC timestamp of when the walk completed.

  • oidCount

    The number of OID rows walked.

  • stopReason

    The reason the walk stopped when it did.

Table: results

The results table stores a row for each entry of one SNMPWalk, as specified by id in the walks table.

  • walk_id

    The identifier of the walk (references walks.id).

  • oid

    The text of the OID naming the SNMP variable.

  • type

    The ASN.1 type integer for the SNMP variable.

  • value

    The actual, uninterpreted binary value returned by the SNMP agent.

Accessing SQLite Data

On macOS 10.4 systems, you can use the following 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,"1.3.6.1.2.1.1.1.0",4,"HP J4813A ProCurve Switch 2524..."
  2,"1.3.6.1.2.1.1.2.0",6,"+\006\001\004\001\013\002\003\007\013\023"
  2,"1.3.6.1.2.1.1.3.0",67,"\035\330J\375"
  2,"1.3.6.1.2.1.1.4.0",4,"Bill Fisher"
  2,"1.3.6.1.2.1.1.5.0",4,"HP ProCurve Switch 2524"

There is a Mozilla Firefox add-on called SQLite Manager that opens and displays SQLite database files. This makes it a cross-platform tool, requiring only Mozilla Firefox 3.5 or higher, plus a small download.

To install SQLite Manager:

  1. Start Mozilla Firefox 3.5 or higher and click Tools > Add-ons - Get Add-ons.
  2. Type SQLite in the Search field and press Return on your keyboard.
  3. Double-click SQLite Manager to install it. Restart Mozilla Firefox when instructed.

To use SQLite Manager:

  1. Click Tools > SQLite Manager to open SQLite Manager.
  2. Click Database > Connect Database (within the window) to open a saved SQLite database.
  3. Click the results table to view it.