Home
You are not currently signed in.

MIB Smithy

  1. Up to Table of Contents

Scotty SNMP Command Migration

The following table provides a basic mapping of Scotty SNMP Session related commands to MIB Smithy SDK. The information may be helpful as a starting point for migrating legacy scripts to use MIB Smithy SDK's native APIs for session management and request processing.

Creating Sessions

Scotty 2.0 Syntax

snmp session ?option value ...?

Example

% snmp session -address 10.0.0.1
snmp0

Scotty 3.0 Syntax

  • Tnm::snmp generator ?option value ...?
  • Tnm::snmp listener ?option value ...?
  • Tnm::snmp notifier ?option value ...?
  • Tnm::snmp responder ?option value ...?

Example

% Tnm::snmp generator -address 10.0.0.1
snmp0

MIB Smithy SDK

snmplib new ?option value ...?

Example

% snmplib new -remoteaddress 10.0.0.1
snmplib1

Destroying Sessions

Scotty 2.0 Syntax

session destroy

Example

% snmp0 destroy

Scotty 3.0 Syntax

session destroy

Example

% snmp0 destroy

MIB Smithy SDK

session destroy

Example

% snmplib1 destroy

Creating Session Aliases

Scotty 2.0 Syntax

snmp alias ?name ?options??

Example

% snmp alias myhost [list -address 10.0.0.1]

Scotty 3.0 Syntax

Tnm::snmp alias ?name ?options??

Example

% Tnm::snmp alias myhost [list -address 10.0.0.1]

MIB Smithy SDK

session alias ?name ?option value ...??

Example

% snmplib alias myhost [list -address 10.0.0.1]
% snmplib alias myhost -address 10.0.0.1

Listing SNMP Sessions

Scotty 2.0 Syntax

snmp info

Example

% snmp info
snmp0 snmp1 snmp2

Scotty 3.0 Syntax

Tnm::snmp find ?option value ...?

Example

% Tnm::snmp find
snmp0 snmp1 snmp2

MIB Smithy SDK

session mpds

Example

% snmplib mpds
snmplib1 snmplib2 snmplib3

Waiting for Pending Requests

Scotty 2.0 Syntax

  • snmp wait
  • session wait ?request?

Example

% snmp0 wait 1234

Scotty 3.0 Syntax

  • Tnm::snmp wait
  • session wait ?request?

Example

% snmp0 wait 1234

MIB Smithy SDK

session wait ?request ...?

Example

% snmplib1 wait 1234 1235 1236

Tracing Transmitted/Received Packets

Scotty 2.0 Syntax

snmp watch ?boolean?

Example

% snmp watch 1
% snmp0 getnext 0.0
get-next-request 1138644669 noError
1.   0.0
send  36 bytes [127.0.0.1:161]:
3022 0201 0004 0670 7562 6c69 63a1 1502
0443 de56 bd02 0100 0201 0030 0730 0506
0100 0500
recv 119 bytes [127.0.0.1:161]:
3075 0201 0004 0670 7562 6c69 63a2 6802
0443 de56 bd02 0100 0201 0030 5a30 5806
082b 0601 0201 0101 0004 4c46 7265 6542
5344 2073 6c65 7074 6f6e 2e6d 756f 6e69
6300 0000 0000 0000 0000 0052 454c 4541
5345 2046 7265 6542 5344 2034 2e33 2d52
454c 4541 5345 2023 333a 2054 7565 204a
756e 2069 3338 36
response 1138644669 noError

Scotty 3.0 Syntax

snmp watch ?boolean?

Example

% snmp watch 1
% snmp0 getnext 0.0
getnext 1770197484 noError
1.   0.0
[0.0.0.0:2198] -> [127.0.0.1:161] (36 bytes):
30:22:02:01:00:04:06:70:75:62:6C:69:63:A1:15:02
04:69:83:11:EC:02:01:00:02:01:00:30:07:30:05:06
01:00:05:00
[127.0.0.1:161] -> [0.0.0.0:2198] (119 bytes):
30:75:02:01:00:04:06:70:75:62:6C:69:63:A2:68:02
04:69:83:11:EC:02:01:00:02:01:00:30:5A:30:58:06
08:2B:06:01:02:01:01:01:00:04:4C:46:72:65:65:42
53:44:20:00:00:00:00:00:00:00:00:00:00:00:00:00
63:73:2E:63:6F:6D:20:34:2E:33:2D:52:45:4C:45:41
53:45:20:46:72:65:65:42:53:44:20:34:2E:33:2D:52
45:4C:45:41:53:45:20:23:33:3A:20:54:75:65:20:4A
75:6E:20:69:33:38:36
response 1770197484 noError

MIB Smithy SDK

session config -logchannel channel ?channel?

Example

% snmplib1 config -logchannel stdout
% snmplib1 next
Sending 33 bytes to 127.0.0.1:161
0000: 30 1F 02 01  00 04 06 70  75 62 6C 69  63 A1 12 02    0......public...
0016: 01 01 02 01  00 02 01 00  30 07 30 05  06 01 28 05    ........0.0...(.
0032: 00                                                    .
Received 116 bytes from 127.0.0.1:161
0000: 30 72 02 01  00 04 06 70  75 62 6C 69  63 A2 65 02    0r.....public.e.
0016: 01 01 02 01  00 02 01 00  30 5A 30 58  06 08 2B 06    ........0Z0X..+.
0032: 01 02 01 01  01 00 04 4C  46 72 65 65  42 53 44 20    .......LFreeBSD
0048: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00    ................
0064: 63 6F 6D 20  34 2E 33 2D  52 45 4C 45  41 53 45 20    com 4.3-RELEASE
0080: 46 72 65 65  42 53 44 20  34 2E 33 2D  52 45 4C 45    FreeBSD 4.3-RELE
0096: 41 53 45 20  23 33 3A 20  54 75 65 20  4A 75 6E 20    ASE #3: Tue Jun
0112: 69 33 38 36                                           i386

Sending Get Requests

Scotty 2.0 Syntax

session get varBindList ?script?

Example

% snmp0 get sysDescr.0 { puts "%V" }

Scotty 3.0 Syntax

session get varBindList ?script?

Example

% snmp0 get sysDescr.0 { puts "%V" }

MIB Smithy SDK

session get ?options? ?varBindList?

Example

% proc cb { args } {
    array set info $args
    puts $info(-varbinds)
}
% snmplib1 get -callback cb sysDescr.0

Sending Get-Next Requests

Scotty 2.0 Syntax

session getnext varBindList ?script?

Example

% snmp0 getnext 0.0 { puts "%V" }

Scotty 3.0 Syntax

session getnext varBindList ?script?

Example

% snmp0 getnext 0.0 { puts "%V" }

MIB Smithy SDK

session next ?options? ?varBindList?

Example

% proc cb { args } {
    array set info $args
    puts $info(-varbinds)
}
% snmplib1 next -callback cb

Sending Get-Bulk Requests

Scotty 2.0 Syntax

session getbulk non-reps max-reps varBindList ?script?

Example

% snmp0 getbulk 0 10 0.0 { puts "%V" }

Scotty 3.0 Syntax

session getbulk non-reps max-reps varBindList ?script?

Example

% snmp0 getbulk 0 10 0.0 { puts "%V" }

MIB Smithy SDK

session bulk ?options? ?varBindList?

Example

% proc cb { args } {
    array set info $args
    puts $info(-varbinds)
}
% snmplib1 bulk -maxreps 10 -callback cb

Sending Set Requests

Scotty 2.0 Syntax

session set varBindList ?script?

Example

% snmp0 set [list sysContact.0 "new contact"]

Scotty 3.0 Syntax

session set varBindList ?script?

Example

% snmp0 set [list sysContact.0 "new contact"]

MIB Smithy SDK

session set ?options? ?varBindList?

Example

% snmplib1 set [list sysContact.0 "new contact"]

Sending Notifications

Scotty 2.0 Syntax

  • session trap snmpTrapOID varBindList
  • session inform snmpTrapOID varBindList

Example

% set session [snmp session -address 10.0.0.1]
snmp2
% $session trap linkUp ""

Scotty 3.0 Syntax

  • $notifier trap snmpTrapOID varBindList
  • $notifier inform snmpTrapOID varBindList ?script?

Example

% set session [snmp notifier -address 10.0.0.1]
snmp2
% $session trap linkUp ""

MIB Smithy SDK

  • session trap ?options? ?varBindList?
  • session inform ?options? ?varBindList?

Example

% snmplib1 trap -remoteaddress 10.0.0.1 [list snmpTrapOID.0 linkUp]

Receiving Notifications

Scotty 2.0 Syntax

  • session bind {} trap script
  • session bind {} inform script

Example

% snmp0 bind {} trap { puts "%V" }

Scotty 3.0 Syntax

  • $listener bind {} trap script
  • $listener bind {} inform script

Example

% set session [snmp listener]
snmp3
% $session bind {} trap { puts "%V" }

MIB Smithy SDK

session bind -trap|inform|notify ?callback?

Example

% proc cb { args } {
    array set info $args
    puts $info(-varbinds)
}
% snmplib1 bind -notify cb

Walking Subtrees

Scotty 2.0 Syntax

session walk varName varBindList script

Example

% snmp0 walk v sysORTable { puts $v }
{1.3.6.1.2.1.1.9.1.2.1 {OBJECT IDENTIFIER} IF-MIB!ifMIB}
{1.3.6.1.2.1.1.9.1.2.2 {OBJECT IDENTIFIER} SNMPv2-MIB!snmpMIB}
{1.3.6.1.2.1.1.9.1.2.4 {OBJECT IDENTIFIER} RFC1213-MIB!ip}

Scotty 3.0 Syntax

session walk ?varName? varBindList script

Example

% snmp0 walk v sysORTable { puts $v }
{1.3.6.1.2.1.1.9.1.2.1 {OBJECT IDENTIFIER} IF-MIB!ifMIB}
{1.3.6.1.2.1.1.9.1.2.2 {OBJECT IDENTIFIER} SNMPv2-MIB!snmpMIB}
{1.3.6.1.2.1.1.9.1.2.4 {OBJECT IDENTIFIER} RFC1213-MIB!ip}

MIB Smithy SDK

session walk ?options? ?varBindList?

Example

% foreach v [snmplib1 walk sysORTable] { puts $v }
1.3.6.1.2.1.1.9.1.2.1 {OBJECT IDENTIFIER} 1.3.6.1.2.1.31
1.3.6.1.2.1.1.9.1.2.2 {OBJECT IDENTIFIER} 1.3.6.1.6.3.1
1.3.6.1.2.1.1.9.1.2.4 {OBJECT IDENTIFIER} 1.3.6.1.2.1.4
  1. Up to Table of Contents