' ' prnode - Prints a lot of detail about a given node ' Input = node oid or node name ' -------------------------------------------------- ' Check usage & arguments ' -------------------------------------------------- Set Sout = WScript.StdOut if WScript.Arguments.Count <> 1 then Sout.WriteLine "Usage: prnode " Sout.WriteLine "Example: prnode sysUpTime " WScript.Quit end if ' -------------------------------------------------- ' Simple way to figure out whether input is OID ' -------------------------------------------------- InpStr = WScript.Arguments.Item(0) InpOID = True If InStr(InpStr,".") Then InpOID = True Else InpOID = False End If ' -------------------------------------------------- ' Create and load repository ' -------------------------------------------------- Set RepMgr = CreateObject("UnbrowseSNMP.RepositoryManager") Set RepDB = RepMgr.LoadRepository ' -------------------------------------------------- ' Convert to OID and then locate the module ' -------------------------------------------------- Dim NodeOID Dim NodeName Dim ModuleInfo Set OIDTable = RepDB.OIDIndexTable If Not InpOID Then Set OIDEntry = OIDTable.FindNameMatch (InpStr,0) Set ModuleInfo = OIDEntry.ModuleInfo NodeOID = OIDEntry.OID NodeName = InpStr Else Set OIDEntry = OIDTable.FindMatch (InpSt) Set ModuleInfo = OIDEntry.ModuleInfo NodeOID = InpStr NodeName = OIDEntry.Name End If Sout.WriteLine "Located node " & NodeName & " in " & ModuleInfo.ModuleName & " OID= " & NodeOID ' -------------------------------------------------- ' Load this module into a MIB browser object ' -------------------------------------------------- Set MIBBrowser = CreateObject("UnbrowseSNMP.MIBBrowser") Set MIBModule = MIBBrowser.Open(ModuleInfo.PathURI) Set MIBNode = MIBModule.FindBestOIDMatch(NodeOID) PrintNode(MIBNode) MIBBrowser = Nil RepMgr=Nil '---------------------------------------------------- ' Print Node - many details about the node '---------------------------------------------------- Sub PrintNode ( Node ) Sout.WriteLine "OID = " & Node.OID Sout.WriteLine "Name = " & Node.Name Sout.WriteLine "OIDName = " & Node.OIDName Sout.WriteLine "Type = " & Node.NodeType Sout.WriteLine "Access = " & Node.Access Sout.WriteLine "Status = " & Node.Status Sout.WriteLine "----Type------" Set nt = Node.Type Sout.WriteLine "Type = " & nt.Name Sout.WriteLine "----Description------" Sout.WriteLine Node.Description End Sub '---------------------------------------------------- ' Print Module Nodes '---------------------------------------------------- Sub PrintModuleNodes ( Module ) For Each Child in Module.ChildNodes Sout.WriteLine Child.Name Next End Sub