简体   繁体   English

如何获得Oid(#Snmp)的名称?

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

Ok, following the advice of Lex Li and I try to get Oid name using an other lib : #SnmpLib 好的,按照Lex Li的建议,我尝试使用另一个lib获得Oid名称: #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 但是我没有得到值.iso.org.dod.internet.private.enterprises我得到了一个: .iso.3.6.1.4.1

You must use #SNMP MIB Compiler (Compiler.exe) to compile your MIB documents first. 您必须先使用#SNMP MIB编译器(Compiler.exe)来编译您的MIB文档。 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. 编译器在modules文件夹中生成* .module文件。 Then you need to put these files (*.module) into C:\\Users\\Fnizz\\Desktop\\MIBS_BARCO\\ folder. 然后,您需要将这些文件(* .module)放入C:\\ Users \\ Fnizz \\ Desktop \\ MIBS_BARCO \\文件夹中。

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. 对象注册表不会直接在MIB文档下,因此无法将MIB文档提供给它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM