Unbrowse SNMP Scripting - Sample CodeReady to run samples. You can use this as a starting point for your own powerful scripts
Instructions- Click on the sample code link. The code will open in a new window.
- Save the script to a file on your computer.
- For VBScript code, type in "CSCRIPT <filename.vbs> <parameters>"
SamplesSample 1 : PRTRAP.VBS Prints out details of all traps in a trap database file (VOTRP) | VBScript (prtrap.vbs) | Sample 2 : CTRLTRAP.VBS Start the trap receiver, process a number of traps in real time (as they arrive), then close the trap receiver. | VBScript (ctrltrap.vbs) | Sample 3 : PRWALKER.VBS Print out contents of a MIB walk database. | VBScript (prwalker.vbs) | Sample 4 : OIDTRANS.VBS Lookup the OID of any given SNMP node. Illustrates the use of the MIB Repository object. | VBScript (oidtrans.vbs) | Sample 5 : PRNODE.VBS Print the complete description of any SNMP node. Illustrates the use of the MIB Repository and MIB Browser scripting objects. | VBScript (prnode.vbs) | Sample 6 : DCRIMPORT.VBS Import SNMP agents from Cisco Works DCRv3 format. See blog entry for more details. | VBScript (dcrimport.vbs) | Sample 7 : PRTPROF.VBS Prints all the trap profiles defined by the user. | VBScript (prtprof.vbs) | Sample 8 : POLLER.VBS/RUBY Polls value of sysUpTime every 1 second | VBScript (snpoll.vbs) Ruby (snpoll.rb) | Sample 9 : T2MAIL RUBY Sends email to your account when a SNMP trap arrives. You can customize this to suit your needs. | Ruby (t2mail.rb) | Sample 10 : T2SQL (VBS and RUBY) Save incoming traps into a SQL Database. VBS version works with ODBC, RB version directly inserts into MySQL. | VBScript (t2sql.vbs) Ruby (t2sql.rb) | Sample 11 : T2SQLUDP.VBS Saves incoming traps to SQL, demonstrates how to receive traps from UDP socket instead of Winpcap | VBScript (t2sqludp.vbs)
| Sample 12 : T2SQLBUFFERED.VBS Demonstrates use of "buffered mode". In this mode, the trap receiver buffers traps and you scripts reads from the buffer. Once you have done processing a trap, you can call DeleteTrapByIdx to free it up. Use this if you want the trap receiver to be up and running forever under load. | VBScript (t2sql_buffered.vbs) |
|