R
ReinhardH
Hello,
I'm playing around with the snmp provider. I got the sample (rfc1213 mib)
working
but when I try to load another mib it always fails with the error "invalid
class".
What I did was
called smi2smir /a c:\tmp\sun_snmp.mib >> c:\tmp\sun_snmp.mof
and called mofcomp c:\tmp\sun_snmp.mof
my code looks like this
Private Function GetSNMPData(ByVal strAgent As String, ByVal strCommunity As
String, ByVal strSNMPClass As String)
Dim mnvc As New ManagementNamedValueCollection
mnvc.Add("AgentAddress", strAgent)
mnvc.Add("AgentReadCommunity", strCommunity)
Dim options As New ObjectGetOptions(mnvc)
Dim mo As New ManagementObject(New ManagementPath("\\.\root\snmp\localhost:"
& strSNMPClass), options)
Dim pdc As System.Management.PropertyDataCollection
Dim pd As System.Management.PropertyData
Dim strValue As String
Try
Response.Write("<b>Get Properties:</b><br>")
pdc = mo.Properties
For Each pd In pdc
strValue = System.Convert.ToString(pd.Value)
If strValue = "" Then strValue = "no value"
Response.Write(pd.Name & vbTab & strValue & "<br>")
Next
Catch e As Exception
Response.Write("error message:" & e.Message & vbTab & "error source:" +
e.Source)
End Try
End Function
And is called GetSNMPData("localhost","public","SNMP_SUN_SNMP_sunSystem=@")
If SNMP_SUN_SNMP_sunSystem will be replaced with this
SNMP_RFC1213_MIB_system then it works!!
Three questions:
a) the snmp provider is located under root\snmp\localhost while the classes
are located under root\snmp\smir - is this the normal behaviour??
b) what means =@ at the end of the snmp class?
c) if I compile the mib to mof and load it in the repository as described
must the classes be located under root\snmp\localhost or root\snmp\smir - if
I open the cimstudio I can only seeing the classes under smir
Thank you
Reinhard
btw - excuse my bad english
I'm playing around with the snmp provider. I got the sample (rfc1213 mib)
working
but when I try to load another mib it always fails with the error "invalid
class".
What I did was
called smi2smir /a c:\tmp\sun_snmp.mib >> c:\tmp\sun_snmp.mof
and called mofcomp c:\tmp\sun_snmp.mof
my code looks like this
Private Function GetSNMPData(ByVal strAgent As String, ByVal strCommunity As
String, ByVal strSNMPClass As String)
Dim mnvc As New ManagementNamedValueCollection
mnvc.Add("AgentAddress", strAgent)
mnvc.Add("AgentReadCommunity", strCommunity)
Dim options As New ObjectGetOptions(mnvc)
Dim mo As New ManagementObject(New ManagementPath("\\.\root\snmp\localhost:"
& strSNMPClass), options)
Dim pdc As System.Management.PropertyDataCollection
Dim pd As System.Management.PropertyData
Dim strValue As String
Try
Response.Write("<b>Get Properties:</b><br>")
pdc = mo.Properties
For Each pd In pdc
strValue = System.Convert.ToString(pd.Value)
If strValue = "" Then strValue = "no value"
Response.Write(pd.Name & vbTab & strValue & "<br>")
Next
Catch e As Exception
Response.Write("error message:" & e.Message & vbTab & "error source:" +
e.Source)
End Try
End Function
And is called GetSNMPData("localhost","public","SNMP_SUN_SNMP_sunSystem=@")
If SNMP_SUN_SNMP_sunSystem will be replaced with this
SNMP_RFC1213_MIB_system then it works!!
Three questions:
a) the snmp provider is located under root\snmp\localhost while the classes
are located under root\snmp\smir - is this the normal behaviour??
b) what means =@ at the end of the snmp class?
c) if I compile the mib to mof and load it in the repository as described
must the classes be located under root\snmp\localhost or root\snmp\smir - if
I open the cimstudio I can only seeing the classes under smir
Thank you
Reinhard
btw - excuse my bad english