0

I am an snmp beginner and have created a custom MIB and included it in snmpd.conf via pass persist.
pass_persist .1.3.6.1.4.1.56947.1.1 /usr/bin/env python3 -u my_script.py

While I can successfully query the data, the returned data is a mix between the OIDs and the textual representation of OIDs.

Something like SNMPv2-SMI::enterprises.56947.1.1.1

If I query, for example the UCD MIB (.1.3.6.1.4.1.2021) I get the full textual representation, like UCD-SNMP-MIB::memIndex.0 which corresponds to .1.3.6.1.4.1.2021.4.1

As far as I know the UCD Mibs have been merged into net-snmp itself and may work differently than my own MIB.

My MIB (ommited some parts for brevity)

MY-MIB DEFINITIONS ::= BEGIN
IMPORTS
  MODULE-IDENTITY, enterprises, Integer32
  FROM SNMPv2-SMI

myMIB MODULE-IDENTITY
 -- identify stuff
 ::= { enterprises 56947 }

product1 OBJECT IDENTIFIER ::= { myMIB 1 }
product1Data OBJECT IDENTIFIER ::= { product1 1 }
objectCount OBJECT-TYPE
  SYNTAX      Integer32
  MAX-ACCESS  read-only
  STATUS      current
  DESCRIPTION "test"
  ::= { product1Data 1 }

END

But is this behavior by design or am I missing something?

My excpectation/wish would be to receive something like MY-MIB::objectCount

5
  • Where did you put your MIB document? If not loaded by NET-SNMP commands, you see things like SNMPv2-SMI::enterprises.56947.1.1.1 – Lex Li Feb 23 at 14:39
  • I put it into /usr/share/snmp/mibs where I found all the other MIBS. Does the file name have to correspond to the name at DEFINITIONS in the file? – Arikael Feb 23 at 16:00
  • I mixed up agent and manager and thought the tools like snmpwalk and snmptranslate use the config /etc/snmp/snmp**d**.conf but they use /etc/snmp/snmp.conf. In this config (on the manager machine) I added the line mibs +MY-MIB and it worked. Also add your mib file to your manager/client – Arikael Feb 24 at 8:55
  • You should post that as an answer and accept it. – Lex Li Feb 24 at 14:13
0

I mixed up agent and manager and thought the tools like snmpwalk and snmptranslate use the config /etc/snmp/snmpd.conf (note the d at the end) but they use /etc/snmp/snmp.conf.
I added line
mibs +MY-MIB
in /etc/snmp/snmp.conf (on the manager machine) and it worked.

Also add your mib file to your manager/client (I added mine to /usr/share/snmp/mibs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.