Question

I have been trying to understand how to create a MIB : here what I did so far :

I created a MIB, and tried to allocate values to new OID => fail

Here is the MIB :

TEST-MIB DEFINITIONS ::= BEGIN

IMPORTS
MODULE-COMPLIANCE, OBJECT-GROUP    FROM SNMPv2-CONF
OBJECT-TYPE, Integer32,MODULE-IDENTITY FROM SNMPv2-SMI;




test    MODULE-IDENTITY
    LAST-UPDATED "201112190200Z"
    ORGANIZATION "blah"
    CONTACT-INFO
        "please"        
    DESCRIPTION
        "I am stuck"
    REVISION    "201112190200Z"
    DESCRIPTION
        "initial Draft"
    ::= { iso org(3) dod(6) internet(1) private(4) enterprises(1) 39106 }

testResearch               OBJECT IDENTIFIER ::= { test 2 }

testVar OBJECT-TYPE
    SYNTAX Integer32
    MAX-ACCESS  read-write
    STATUS  current
    DESCRIPTION
        "just for testing"
    ::= { testResearch 1}

-- conformance information

testMIBConformance OBJECT IDENTIFIER ::= { test 999 }
testMIBCompliances OBJECT IDENTIFIER ::= { testMIBConformance 1 }
testMIBGroups      OBJECT IDENTIFIER ::= { testMIBConformance 2 }

-- compliance statements

testMIBCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
        "blah."
    MODULE  -- this module
    MANDATORY-GROUPS { testGroup }
    ::= { testMIBCompliances 1 }

-- units of conformance

testGroup OBJECT-GROUP
    OBJECTS   { testVar }
    STATUS    current
    DESCRIPTION
        "The draft"
    ::= { testMIBGroups 1 }

END

I then

  • validated this MIB against smilint ,
  • put it in ~/.snmp/mibs/
  • have the rwcommunity string for all host, with no OID restriction
  • restarted the snmpd daemon (On Debian)

So far, all good.

I then tried to see if the daemon knows about this new enterprise, and I did :

snmpwalk -v2c -m +ALL  localhost  .1.3.6.1.4.1.39106

which outputs : TEST-MIB::test= No Such Object available on this agent at this OID

So I guess That snmpd is telling me he can't find anything under this tree, because nothing has been set yet.

So I try to set this test variable with snmpset on a shell :

snmpset  -v2c -m +ALL localhost .1.3.6.1.4.1.39106.2.1 i 111

outputs :

Error in packet.
Reason: notWritable (That object does not support modification)
Failed object: TEST-MIB::testVar

I tried as well with : snmpset -v2c -m +ALL localhost .1.3.6.1.4.1.39106.2.1.0 i 111

and as root, but with no success

But when I do a snmptranslate, I can see that the MIB is parsed correctly :

    snmptranslate -Td  1.3.6.1.4.1.39106.2.1 
    TEST-MIB::testVar
   testVar OBJECT-TYPE
      -- FROM   TEST-MIB
      SYNTAX    Integer32
      MAX-ACCESS    read-write
      STATUS    current
      DESCRIPTION   "just for testing"
    ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) test(39106) testResearch(2) 1 }

is it a bug? A known issue?

Was it helpful?

Solution

It sounds like you're trying to build your own SNMP Agent.

By the looks of things you've created your own MIB OID's correctly but nothing is responding to the new OID when you query the SNMP host.

Have a read of this: http://docs.oracle.com/cd/E13192_01/manager/mgr20/pguide/buildag.htm and see if it addresses your problem q:)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top