2

I am writing Python code in which a user inputs a SNMP OID in any of the following forms:

1.3.6.1.2.1.90.1.2
internet.2.1.90.1.2

I want my code to resolve internet to 1.3.6.1.

I was thinking of creating a dictionary and giving the corresponding values to the object names but I don't think that's a good idea.

Please help me in guiding how should I proceed.

Semih Yagcioglu
  • 4,011
  • 1
  • 26
  • 43
user3379410
  • 176
  • 1
  • 11

1 Answers1

2
  1. NetSnmp provides a snmptranslate method - that may be useful starting point.

    Its man page says its purpose is to:

    translate MIB OID names between numeric and textual forms.

    There are already Python bindings for net-snmp available, see these SO questions.

  2. Alternatively pysnmp provides similar. See SO question "Translating pysnmp numerical oid output into symbolic names".

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
k1eran
  • 4,492
  • 8
  • 50
  • 73