G
Guest
I'm trying to use WMI on Windows 2003 and WinXP to perform an SNMP Get on
SNMP enabled devices. My question is, after loading a MIB how do I retreive
the values when I query the device
For example the code snippet below gives me some basic info from a router
but if I load the CISCO IP SLA mib, how would this code look for it to
retreive RTD and jitter data from the router?
-----------------------------------------------------------------------------------
strTargetSnmpDevice = "192.168.0.1"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("", "root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "Correlate", FALSE, 0 'no correlation set
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", "public"
Set colSystem = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_system", , _
objWmiNamedValueSet)
For Each objSystem In colSystem
WScript.Echo "sysContact: " & objSystem.sysContact & vbCrLf & _
"sysDescr: " & objSystem.sysDescr & vbCrLf & _
"sysLocation: " & objSystem.sysLocation & vbCrLf & _
"sysName: " & objSystem.sysName & vbCrLf & _
"sysObjectID: " & objSystem.sysObjectID & vbCrLf & _
"sysServices: " & objSystem.sysServices & vbCrLf & _
"sysUpTime: " & objSystem.sysUpTime
Next
SNMP enabled devices. My question is, after loading a MIB how do I retreive
the values when I query the device
For example the code snippet below gives me some basic info from a router
but if I load the CISCO IP SLA mib, how would this code look for it to
retreive RTD and jitter data from the router?
-----------------------------------------------------------------------------------
strTargetSnmpDevice = "192.168.0.1"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("", "root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "Correlate", FALSE, 0 'no correlation set
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", "public"
Set colSystem = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_system", , _
objWmiNamedValueSet)
For Each objSystem In colSystem
WScript.Echo "sysContact: " & objSystem.sysContact & vbCrLf & _
"sysDescr: " & objSystem.sysDescr & vbCrLf & _
"sysLocation: " & objSystem.sysLocation & vbCrLf & _
"sysName: " & objSystem.sysName & vbCrLf & _
"sysObjectID: " & objSystem.sysObjectID & vbCrLf & _
"sysServices: " & objSystem.sysServices & vbCrLf & _
"sysUpTime: " & objSystem.sysUpTime
Next