如何获取 Oid 的名称? (SnmpSharpNet 库)
如何获取 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
警告您,我是#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