Home
You are not currently signed in.

MIB Smithy

  1. Up to Table of Contents

Scotty MIB Command Migration

The following section provides a basic mapping of Scotty MIB database 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 quering MIB module properties.

Querying the MAX-/MIN-/ACCESS Property

Scotty 2.0 Syntax

mib ?-exact? access label

Example
% mib access sysDescr
read-only

Scotty 3.0 Syntax

Tnm::mib ?-exact? access label

Example
% Tnm::mib access sysDescr
read-only

MIB Smithy SDK

dbcmd get ?-exact? -access label

Example
% smilib get -access sysDescr
read-only

Getting a list of children in OID space

Scotty 2.0 Syntax

mib ?-exact? successor label

Example
% mib successor system
sysDescr sysObjectID sysUpTime sysContact sysName sysLocation sysServices sysORLastChange sysORTable

Scotty 3.0 Syntax

Tnm::mib children label

Example
% Tnm::mib children system
SNMPv2-MIB::sysDescr SNMPv2-MIB::sysObjectID SNMPv2-MIB::sysUpTime SNMPv2-MIB::sysContact SNMPv2-MIB::sysName SNMPv2-MIB::sysLocation SNMPv2-MIB::sysServices SNMPv2-MIB::sysORLastChange SNMPv2-MIB::sysORTable

MIB Smithy SDK

dbcmd get ?-exact? -subnodes label

Example
% smilib get -subnodes system
sysDescr sysObjectID sysUpTime sysContact sysName sysLocation sysServices sysORLastChange sysORTable

Comparing OID Values

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib compare oid1 oid2

Example
% Tnm::mib compare 1.3.6.1 1.3.6.2
-1

MIB Smithy SDK

dbcmd oidcmp ?options? oid1 oid2

Example
% smilib oidcmp 1.3.6.1 1.3.6.2
-1

Querying the DEFVAL Property

Scotty 2.0 Syntax

mib ?-exact? defval label

Example
% string length [mib defval ifRcvAddressType]
0

Scotty 3.0 Syntax

Tnm::mib ?-exact? defval label

Example
% Tnm::mib defval ifRcvAddressType
volatile

MIB Smithy SDK

dbcmd get ?-exact? -defval label

Example
% smilib get -defval ifRcvAddressType
volatile

Querying the DESCRIPTION Property

Scotty 2.0 Syntax

mib ?-exact? description label

Example
% mib description sysDescr
A textual description of the entity. This value should
include the full name and version identification of the
system's hardware type, software operating-system, and
networking software.

Scotty 3.0 Syntax

Tnm::mib description label

Example
% Tnm::mib description sysDescr
A textual description of the entity. This value should
include the full name and version identification of the
system's hardware type, software operating-system, and
networking software.

MIB Smithy SDK

dbcmd get ?-exact? -description label

Example
% smilib get -descr sysDescr
A textual description of the entity. This value should include the full name and version identification of the system's hardware type, software operating-system, and networking software.

Querying the DISPLAY-HINT Property

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib ?-exact? displayhint label

Example
% Tnm::mib displayhint DisplayString
255a

MIB Smithy SDK

dbcmd get ?-exact? -format label

Example
% smilib get -format DisplayString
255a

Querying the Enumerations List of the SYNTAX Property

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib enums type ?varName?

Example
% mib enums ifType
unknown type "ifType"

% mib enums IANAifType
other 1 regular1822 2 hdh1822 3 ddnX25 4 rfc877x25 5 ...

MIB Smithy SDK

smilib get ?-exact? -enums label

Example
% smilib get -enums ifType
{other 1 {none of the following}} {regular1822 2} {hdh1822 3} {ddnX25 4} {rfc877x25 5} ...

% smilib get -enums IANAifType
{other 1 {none of the following}} {regular1822 2} {hdh1822 3} {ddnX25 4} {rfc877x25 5} ...

Determining if a Record is Defined

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib exists label

Example
% mib exists system
1

MIB Smithy SDK

dbcmd is defined label

Example
% smilib is defined system
1

Determining the MIB File for a Record

Scotty 2.0 Syntax

mib ?-exact? file label

Example
% mib file system
/usr/local/lib/tnm2.1.9/mibs/rfc1907.mib

Scotty 3.0 Syntax

Tnm::mib file label

Example
% Tnm::mib file system
/usr/local/lib/tnm3.0.0/mibs/SNMPv2-MIB

MIB Smithy SDK

dbcmd get -filename fileHandle

Example
% set fullName [smilib get -fullname system]
@File4!SNMPv2-MIB!system
% set fileHandle [lindex [split $fullname !] 0]
@File4
% $db get -filename $fileHandle
../../mibs/rfc3418.mib

Formatting Data Using DISPLAY-HINT

Scotty 2.0 Syntax

mib ?-exact? format name value

Scotty 3.0 Syntax

Tnm::mib format name value

MIB Smithy SDK

dbcmd format ?-nocomplain? name value

Example
% smilib format RowStatus 6
destroy(6)

Querying the INDEX Property

Scotty 2.0 Syntax

mib ?-exact? index label

Example
% mib index sysORTable
sysORIndex

Scotty 3.0 Syntax

Tnm::mib index label

Example
% Tnm::mib index sysORTable
1.3.6.1.2.1.1.9.1.1

MIB Smithy SDK

dbcmd get ?-exact? -index label

Example
% smilib get -index sysORTable
sysORIndex

Querying Constants (e.g. macro names)

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib info subject ?pattern?

MIB Smithy SDK

Not Supported

Determining a Record's Label (Descriptor)

Scotty 2.0 Syntax

mib ?-exact? name oid

Example
% mib name 1.3.6.1.2.1.1.1
sysDescr

Scotty 3.0 Syntax

Tnm::mib label oid

Example
% Tnm::mib label 1.3.6.1.2.1.1.1
sysDescr

MIB Smithy SDK

dbcmd get ?-exact? -name oid

Example
% smilib get -name 1.3.6.1.2.1.1.1
sysDescr

Determining OID Length

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib length label

Example
% Tnm::mib length system
7

MIB Smithy SDK

llength [split [dbcmd get -fulloid label] .]

Example
% llength [split [$db get -fulloid system] .]
7

Loading MIB Files

Scotty 2.0 Syntax

mib load filename

Example
% mib load IANAifType-MIB.mib

Scotty 3.0 Syntax

Tnm::mib load filename

Example
% Tnm::mib load IANAifType-MIB.mib

MIB Smithy SDK

dbcmd import -file filename

Example
% smilib import -file IANAifType-MIB.mib
1

Determining Record Type/Macro

Scotty 2.0 Syntax

mib ?-exact? macro label

Example
% mib macro sysDescr
OBJECT-TYPE

Scotty 3.0 Syntax

Tnm::mib macro label

Example
% Tnm::mib macro sysDescr
OBJECT-TYPE

MIB Smithy SDK

dbcmd whatis label

Example
% smilib whatis sysDescr
leaf

Determining Group Members

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib member label

Example
% Tnm::mib member systemGroup
sysDescr sysObjectID sysUpTime sysContact sysName sysLocation sysServices sysORLastChange sysORID sysORUpTime sysORDescr

MIB Smithy SDK

dbcmd get -members label

Example
% smilib get -members systemGroup
sysDescr sysObjectID sysUpTime sysContact sysName sysLocation sysServices sysORLastChange sysORID sysORUpTime sysORDescr

Determining a Record's Parent Module

Scotty 2.0 Syntax

mib ?-exact? module label

Example
% mib module system
SNMPv2-MIB

Scotty 3.0 Syntax

Tnm::mib module label

Example
% Tnm::mib module system
SNMPv2-MIB

MIB Smithy SDK

lindex [split [dbcmd get -container label] !] 1

Example
% lindex [split [smilib get -container system] !] 1
SNMPv2-MIB

Determining a Record's OID Value

Scotty 2.0 Syntax

mib ?-exact? oid label

Example
% mib oid system
1.3.6.1.2.1.1

Scotty 3.0 Syntax

Tnm::mib oid label

Example
% Tnm::mib oid system
1.3.6.1.2.1.1

MIB Smithy SDK

  • dbcmd get -fulloid label
  • dbcmd get -oid label
Example
% smilib get -fulloid system
1.3.6.1.2.1.1

% smilib get -oid system
mib-2.1

Building OIDs from Parts

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib pack oid value ?value ...?

Example
% mib pack IF-MIB!ifType 4
1.3.6.1.2.1.2.2.1.3.4

MIB Smithy SDK

dbcmd buildoid oid value ?value ...?

Example
% smilib buildoid IF-MIB!ifType 4
1.3.6.1.2.1.2.2.1.3.4

Determining an OID's Parent Record

Scotty 2.0 Syntax

mib ?-exact? parent label

Example
% mib parent sysDescr
system

Scotty 3.0 Syntax

Tnm::mib parent label

Example
% Tnm::mib parent sysDescr
SNMPv2-MIB::system

MIB Smithy SDK

set fulloid [$db get ?-exact? -fulloid label]
set fulloid [join [lrange [split $fulloid .] 0 end-1] .]
$db get -name $fulloid

Example
% set fulloid [smilib get -fulloid sysDescr]
1.3.6.1.2.1.1.1
% set fulloid [join [lrange [split $fulloid .] 0 end-1] .]
1.3.6.1.2.1.1
% smilib get -name sysDescr
system

Querying the Size/Range of the SYNTAX Property

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

  • Tnm::mib range label
  • Tnm::mib size label
Example
% mib size sysDescr
unknown type "sysDescr"
% mib size DisplayString
0 255

MIB Smithy SDK

  • dbcmd get ?-exact? -range
  • dbcmd get ?-exact? -size
Example
% smilib get -size sysDescr
{0 255}
% smilib get -size DisplayString
{0 255}

Scanning DISPLAY-HINT Formatted Values

Scotty 2.0 Syntax

mib ?-exact? scan name value

Example
% mib scan RowStatus destroy
6

Scotty 3.0 Syntax

Tnm::mib scan nodeOrType value

Example
% Tnm::mib scan RowStatus destroy
6

MIB Smithy SDK

dbcmd scan ?options? record ?syntax? value

Example
% smilib scan RowStatus destroy
6

Querying the STATUS Property

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib status label

Example
% Tnm::mib status sysDescr
current

MIB Smithy SDK

dbcmd get -status label

Example
% smilib get -status sysDescr
current

OID Prefix Comparison

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib subtree oid1 oid2

Example
% Tnm::mib subtree system sysDescr
1
% Tnm::mib subtree system ifType
0

MIB Smithy SDK

dbcmd oidcmp -subtree parent child

Example
% smilib oidcmp -subtree system sysDescr
0
% smilib oidcmp -subtree system ifType
1

Querying the SYNTAX Property

Scotty 2.0 Syntax

mib ?-exact? syntax label

Example
% mib syntax sysDescr
DisplayString

Scotty 3.0 Syntax

  • Tnm::mib syntax label
  • Tnm::mib type label
Example
% Tnm::mib syntax sysDescr
OCTET STRING
% Tnm::mib type sysDescr
SNMPv2-TC!DisplayString

MIB Smithy SDK

  • dbcmd get -syntax label
  • dbcmd get -asn1type label
Example
% smilib get -syntax sysDescr
DisplayString
% smilib get -asn1type sysDescr
OCTET STRING

Querying TEXTUAL-CONVENTION Details for OBJECT-TYPEs

Scotty 2.0 Syntax

mib ?-exact? tc label

Example
% mib tc sysDescr
DisplayString {OCTET STRING} 255a {} SNMPv2-TC /usr/local/lib/tnm2.1.9/mibs/rfc1903.tc

Scotty 3.0 Syntax

Not Supported

MIB Smithy SDK

Not Supported

Decoding INDEX Values from OIDs

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

  • Tnm::mib unpack oid
  • Tnm::mib split oid
Example
% Tnm::mib unpack sysORDescr.6
6
% Tnm::mib split sysORDescr.6
1.3.6.1.2.1.1.9.1.3 6

MIB Smithy SDK

  • dbcmd get -indexparts oid
  • dbcmd parseoid oid
Example
% smilib get -indexparts sysORDescr.6
sysORIndex 6 6
% smilib parseoid sysORDescr.6
sysORIndex 6 6

Determining Notification Members

Scotty 2.0 Syntax

Not Supported

Scotty 3.0 Syntax

Tnm::mib variables label

Example
% Tnm::mib variables linkUp
ifIndex ifAdminStatus ifOperStatus

MIB Smithy SDK

dbcmd get -members label

Example
% smilib get -members linkUp
ifIndex ifAdminStatus ifOperStatus

Walking a Subtree

Scotty 2.0 Syntax

mib ?-exact? walk varName label command

Example
% mib walk x sysORTable { puts $x }
sysORTable
sysOREntry
sysORIndex
sysORID
sysORDescr
sysORUpTime

Scotty 3.0 Syntax

Tnm::mib ?-exact? walk varName label command

Example
% Tnm::mib walk x sysORTable { puts $x }
1.3.6.1.2.1.1.9
1.3.6.1.2.1.1.9.1
1.3.6.1.2.1.1.9.1.1
1.3.6.1.2.1.1.9.1.2
1.3.6.1.2.1.1.9.1.3
1.3.6.1.2.1.1.9.1.4

MIB Smithy SDK

snmpcmd walk ?option value ...? ?varBindList?

Example
% foreach vb [snmplib walk system] { puts $vb }
1.3.6.1.2.1.1.1.0 {OCTET STRING} {Example sysDescr}
1.3.6.1.2.1.1.2.0 {OBJECT IDENTIFIER} 1.3.6.1.4.1.8072.3.2.8
1.3.6.1.2.1.1.3.0 TimeTicks 772878758
1.3.6.1.2.1.1.4.0 {OCTET STRING} {Example sysContact}
1.3.6.1.2.1.1.5.0 {OCTET STRING} {Example sysName}
1.3.6.1.2.1.1.6.0 {OCTET STRING} Unknown
1.3.6.1.2.1.1.8.0 TimeTicks 4
  1. Up to Table of Contents