SNMP Tools - monitoring software
SNMP Tools can be controlled from command-line. Executable contains modules. Each
module has its own switches.
SNMP Query module for requesting data from SNMP devices
Run snmptools.exe using "Command Prompt".
Following command-line options can be used to control query module:
|
/query
|
Run SNMP Query (cannot use with /monitor) REQUIRED
|
|
|
/h:<Host>[:<Port>]
|
Host name or IP address (default=localhost)
Port number is optional (default=161)
|
|
|
/c:<Community>
|
Community name (default=public)
|
|
|
/o:<ObjectId>
|
Object ID (default=subkeys from 1.3.6.1.2.1.1)
|
|
|
/v
|
Display values only (hide value type and ObjectID information)
|
|
|
/n
|
Display numeric form only (do not load MIBs)
|
|
|
/s
|
Surf sub-keys (requires ObjectID having sub-keys)
|
|
|
/x:<File>
|
Export results to CSV file (requires /s)
|
Use following example to Extract everything from SNMP device and store it into csv-file:
snmptools.exe /query /h:server /c:public /o:1.3 /s /x:server.csv
CSV-files can be easily opened with Excel.
Use /v switch if you need to use query results in cmd-files. For example, if you
for some reason should need to enumerate storage devices in cmd-file:
@echo off
for /f "delims=" %%x in ('snmptools.exe /query /h:localhost /o:1.3.6.1.2.1.25.2.3.1.3
/s /v') do (
echo %%x
)
pause
If you have enterprise-specific device (most systems are) then you'll need to
add more MIBs. For example if you see MIB paths containing like ...enterprises.318...
then you'll need to add MIBs for enterprise number 318 (318 is APC). Download
MIBs to new folder and add them to your MIB cache using /m switch:
snmptools.exe /query /h:server /c:public /o:1.3 /s /x:server.csv /m:c:\mymibs\318
You'll need use /m switch only once. Once cached loaded MIBs are always available.
One good MIB collection is available from ByteSphere at this location:
http://www.oidview.com/mibs/detail.html
RFC2MIB module for downloading RFCs and extract MIBs
Following command-line options can be used to control rfc2mib module:
|
/rfc2mib
|
Download missing RFCs and extract MIBs from them REQUIRED
|
|
|
/url:<rfcurl>
|
Download URL (default=http://www.ietf.org/rfc/rfc{nnnn}.txt)
|
|
|
/min:<rfcmin>
|
Start Number (default=1)
|
|
|
/max:<rfcmax>
|
Stop Number (default=5000)
|
|
|
/extract
|
Extract MIBs from existing RFCs only, do not download
|
Tool downloads RFCs to ...\rfc\ sub-directory and extracts MIBs to ...\mib\ sub-directory.
By default all RFCs between 1 and 5000 get downloaded and analyzed. If RFC already
exists then download skips it. To download only specific RFCs use /min and /max
switches. To (re)extract MIBs from RFCs use /extract switch.
MIB Cache
SNMP Tools uses MIB Cache to speed up loading large number of MIBs. Once cached
it takes only second or two for few thousand MIBs to load. MIB data is cached in
mibcache.txt. If cache gets corrupted replace mibcache.txt file with original mibcache.txt
from installation package.
You can rebuild it by yourself by running the following command to re-cache all
MIBs:
snmptools.exe /query /r /w
SNMP Monitor module for monitoring SNMP devices
All monitoring tasks should run automatically. Command-line switches are provided
for trouble-shooting and for advanced users.
All configured devices and monitored data is stored in Microsoft SQL Server 2005
database.
Following command-line options can be used to control monitor module:
|
/monitor
|
Run SNMP Monitor (cannot use with /query) REQUIRED, This queries devices,
stores the data and updates the graphs.
|
|
|
/st[oreonly]
|
Store values only, do not generate output graphs (scheduled to run at 1 minute interval)
|
|
|
/gr[aphsonly]
|
Generate output graphs only, do not store values (scheduled to run at 5 minute interval)
|
|
/clean[mon]
|
Remove expired graphs and consolidate data in SQL database so that older data has
lower detail level. This keeps the database small and fast. (Scheduled to run daily
at midnight, do not change the schedule)
|
Run to see if there are any errors generated (disable monitoring related scheduled
tasks to avoid conflicts during the test):
snmptools.exe /monitor