如何获取 Oid 的名称? (SnmpSharpNet 库)

发布于 2025-01-08 14:39:59 字数 800 浏览 1 评论 0原文

如何获取 Oid 的名称?

我遵循了网站中的示例,但我没有找到如何执行此操作。要检索 MIB 字符串,没有问题(来自站点的示例):

// Walk through returned variable bindings
foreach (Vb v in result.Pdu.VbList)
{
    // Check that retrieved Oid is "child" of the root OID
    if (rootOid.IsRootOf(v.Oid))
    {
        Console.WriteLine("{0} ({1}): {2}",
            v.Oid.ToString(),
            SnmpConstants.GetTypeName(v.Value.Type),

            v.Value.ToString());
        if (v.Value.Type == SnmpConstants.SMI_ENDOFMIBVIEW)
            lastOid = null;
        else
            lastOid = v.Oid;
    }
    else
    {
        // we have reached the end of the requested
        // MIB tree. Set lastOid to null and exit loop
        lastOid = null;
    }
}

How to get the name of an Oid ?

I followed examples in the site but I did not found how to do this. To retrieve MIB strings, there is no problem (example from the site) :

// Walk through returned variable bindings
foreach (Vb v in result.Pdu.VbList)
{
    // Check that retrieved Oid is "child" of the root OID
    if (rootOid.IsRootOf(v.Oid))
    {
        Console.WriteLine("{0} ({1}): {2}",
            v.Oid.ToString(),
            SnmpConstants.GetTypeName(v.Value.Type),

            v.Value.ToString());
        if (v.Value.Type == SnmpConstants.SMI_ENDOFMIBVIEW)
            lastOid = null;
        else
            lastOid = v.Oid;
    }
    else
    {
        // we have reached the end of the requested
        // MIB tree. Set lastOid to null and exit loop
        lastOid = null;
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沐歌 2025-01-15 14:39:59

警告您,我是#SNMP的主要开发者

要获取OID的名称,您需要相应的MIB文档。但是,我认为 SNMP#NET 目前不具有加载 MIB 文档并允许您进行翻译的功能。

#SNMP 拥有此功能已有相对较长的时间,其 snmptranslate 示例展示了如何实现此功能,

http://pro.sharpsnmp。 com

You are warned that I am the main developer of #SNMP

To get names of OIDs, you need the corresponding MIB documents. However, I don't think SNMP#NET currently has this feature to load the MIB documents and allows you to do translation.

#SNMP has this feature for a relatively long time, and its snmptranslate sample shows how to achieve this,

http://pro.sharpsnmp.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文