Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

Commented Feature: How to get use named integers and other textual conventions? [7244]

$
0
0
Thanks for response.

Below is more detailed example what I mean.
In my application I have the SimpleObjectRegistry object which I use for translating numeric oids to textual representations

Lextm.SharpSnmpLib.Mib.SimpleObjectRegistry registry = new Lextm.SharpSnmpLib.Mib.SimpleObjectRegistry();
registry.CompileFolder("mibs", "*");
Lextm.SharpSnmpLib.IObjectTree tree = registry.Tree;



When my application receives trap. for example the below one:
enterprise: .1.3.6.1.6.3.1.1.5.3
...
variable 2: .1.3.6.1.2.1.2.2.1.3.10 = (Integer32) 22

The following code is executed:

Lextm.SharpSnmpLib.SearchResult o = tree.Search(oid);
return o.AlternativeText;

and have all oids translated as follows:
enterprise: .iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTraps.linkDown

variable 2: .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifType.10 = (Integer32)22

I can see that ifType is 22, and int the RFC1213-MIB file I can find that:
ifType OBJECT-TYPE
SYNTAX INTEGER {
other(1), -- none of the following
regular1822(2),
hdh1822(3),
...
propPointToPointSerial(22),

}
So I would like to have possibility to translate also the value and be able to present the value somehow similar to:
variable 2: .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifType.10 =propPointToPointSerial(22)

Another example,
I use SNMP GET request for getting some information from the iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable,
for example when I get physical address of first interface:
GET iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifPhysAddress.1
I receive value of type OctetString that contains some non-printable characters.

In the RFC1213 MIB I found that:

ifPhysAddress OBJECT-TYPE
SYNTAX PhysAddress


and in the SNMPv2TC MIB I found:

PhysAddress ::= TEXTUAL-CONVENTION
DISPLAY-HINT "1x:"
STATUS current
DESCRIPTION
"Represents media- or physical-level addresses."
SYNTAX OCTET STRING



So I would like to be able to present the value in the appropriate format, like follows:0:b0:64:f:1b:c0



Please let me know If there is something that I could explain better.

Regards
Tomek O
Comments: It is now a feature of #SNMP MIB Compiler Pro. Thus, close this item as by design.

Viewing all articles
Browse latest Browse all 576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>