How to get the name of the Oid (#Snmp)?

匿名 (未验证) 提交于 2019-12-03 02:38:01

问题:

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

回答1:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!