如何获取 Oid 的名称(#Snmp)?
好的,按照 Lex Li 的建议,我尝试使用其他库获取 Oid 名称:#SnmpLib
这里是示例:
public static void Main(string[] args)
{
string oid = ".1.3.6.1.4.1";
IObjectRegistry registry = new ReloadableObjectRegistry(@"C:\Users\Fnizz\Desktop\MIBS_BARCO\");
IObjectTree tree = registry.Tree;
var o = tree.Search(ObjectIdentifier.Convert(oid));
string textual = o.AlternativeText;
Console.WriteLine(textual);
if (o.GetRemaining().Count == 0)
{
Console.WriteLine(o.Definition.Type.ToString());
}
Console.ReadKey();
}
但不是获取值.iso.org.dod.internet.private.enterprises
我得到这个:.iso.3.6.1.4.1
Ok, following the advice of Lex Li and I try to get Oid name using an other lib : #SnmpLib
Here the sample :
public static void Main(string[] args)
{
string oid = ".1.3.6.1.4.1";
IObjectRegistry registry = new ReloadableObjectRegistry(@"C:\Users\Fnizz\Desktop\MIBS_BARCO\");
IObjectTree tree = registry.Tree;
var o = tree.Search(ObjectIdentifier.Convert(oid));
string textual = o.AlternativeText;
Console.WriteLine(textual);
if (o.GetRemaining().Count == 0)
{
Console.WriteLine(o.Definition.Type.ToString());
}
Console.ReadKey();
}
But instead of to get the value .iso.org.dod.internet.private.enterprises
I get this one : .iso.3.6.1.4.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须首先使用#SNMP MIB Compiler (Compiler.exe) 编译您的MIB 文档。如果缺少任何依赖项,它会告诉您。只有当所有依赖项都存在时,编译器才能正确编译您的文档。
编译器在modules文件夹中生成*.module文件。然后您需要将这些文件(*.module)放入 C:\Users\Fnizz\Desktop\MIBS_BARCO\ 文件夹中。
对象注册表能够加载它们并正确执行名称解析。对象注册表不直接位于 MIB 文档下,因此向其提供 MIB 文档将不起作用。
You must use #SNMP MIB Compiler (Compiler.exe) to compile your MIB documents first. If there is any dependency missing, it will tell. Only when all dependencies are there, the Compiler can compile your documents without an error.
The compiler generates *.module files in modules folder. Then you need to put these files (*.module) into C:\Users\Fnizz\Desktop\MIBS_BARCO\ folder.
The object registry is able to load them and perform the name resolution correctly. The object registry does not under MIB documents directly, so feeding it with MIB documents will not work.