0

我一直在尝试从工作中的打印机获取警报代码,以查看到底发生了什么,但是每次发送 SNMP 查询时它都不会返回任何结果。我正在使用 SimpleSNMP 参考。

打印机是佳能 iR-ADV C5045。

这就是我调用函数的方式:

Dim strAlertCode As String = SNMPQueryGet("1.3.6.1.2.1.43.18.1.1.7")

这是功能:

Private Function SNMPQueryGet(ByVal OID As String)
    Dim strResult As String = "True"

    Dim host As String = "192.168.1.202"
    Dim community As String = "public"
    Dim requestOid() As String
    Dim result As Dictionary(Of Oid, AsnType)
    requestOid = New String() {OID}
    Dim snmp As SimpleSnmp = New SimpleSnmp(host, community)
    If Not snmp.Valid Then
        strResult = True
    End If
    result = snmp.Get(SnmpVersion.Ver1, requestOid)
    If result IsNot Nothing Then
        Dim kvp As KeyValuePair(Of Oid, AsnType)
        For Each kvp In result
            If Not kvp.Key.ToString() = "" Then
                strResult = kvp.Value.ToString()
            Else
                strResult = "True"
            End If
        Next
    Else
        strResult = "True"
    End If

    Return strResult
End Function

编辑

打印机 MIB PDF:https ://dl.dropbox.com/u/19613123/MIB_iR-ADV-C5051-C5045-C5035-C5030_v120_non.pdf

4

1 回答 1

0

Rambomst:您提到了包含所有 C5045 OID 的 PDF,您介意分享 PDF 吗?...我正在寻找那些代码!

iReasoning 的 MIB 浏览器对于 SNMP 调试非常方便:http: //ireasoning.com/mibbrowser.shtml

于 2012-06-25T21:31:20.133 回答