Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I add my own MIB module to net-snmp.

I put my Mib txt file under - '/usr/local/share/snmp/mibs'

I see that if i change net-snmp files their the change is reflected , so this mibs are loaded correct. It seems that it not load my MIB file from there.

When i run snmptranslate on my Mib like this:

snmptranslate .1.3.6.1.4.1.8077

I get:

SNMPv2-SMI::enterprises.8077

My MIB def:

TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS
    MODULE-IDENTITY, enterprises FROM SNMPv2-SMI;

testMib MODULE-IDENTITY
    DESCRIPTION
    "First draft"
    ::= { enterprises 8077}

testMibObject              OBJECT IDENTIFIER ::= {testMib 1}


END
share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

To find the location of snmp.conf you can use :

snmpd -Dread_config -H 2>&1 | grep "config path" | sort –u

then tell the tools to load this MIB

(examples)::

    snmpwalk -m +MY-MIB .....

        (load it for this command only)

or

    export MIBS=+MY-MIB

        (load it for this session only)

or

    echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf

        (load it every time)
share|improve this answer
add comment

Here you can find references for all situations: Using and loading MIBS

I saved your MIB to a file TEST-MIB, placed it under /usr/share/snmp/mibs and snmptranslate is able to find the testMib object, although your MIB is missing some fields to properly conform to the standard:

$ snmptranslate .1.3.6.1.4.1.8077
No log handling enabled - using stderr logging
Expected LAST-UPDATED (DESCRIPTION): At line 6 in /usr/share/snmp/mibs/TEST-MIB
TEST-MIB::testMib

For making your MIBs conform you can use the tool smidump, which will tell you everything your MIB is missing to properly conform:

$ smidump /usr/share/snmp/mibs/TEST-MIB 
/usr/share/snmp/mibs/TEST-MIB:6: syntax error, unexpected DESCRIPTION, expecting LAST_UPDATED
/usr/share/snmp/mibs/TEST-MIB:13: missing MODULE-IDENTITY clause in SMIv2 MIB
/usr/share/snmp/mibs/TEST-MIB:10: unknown object identifier label `testMib'
smidump: module `/usr/share/snmp/mibs/TEST-MIB' contains errors, expect flawed output
smidump: aborting due to severe parsing errors
smidump: use the -k option to force continuation
share|improve this answer
    
This wasnt enough. i place it there, but in additional i need to create snmp.conf and define the mib file there –  user1495181 Oct 31 '12 at 12:39
    
Did you already create this snmp.conf file with something like this inside? mibs +TEST-MIB (In my system it works without this, but it might help) –  Claudio Oct 31 '12 at 12:41
    
I didnt have this file, so i added this file with 2 lines: mibfile and mibs (i think that mibfile is sufficient) , but without this file it wasnt work unless you do export for the session –  user1495181 Oct 31 '12 at 12:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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