I was trying to figure out how to create a MIB: here is what I have done so far:
I created a MIB and tried to highlight the values for the 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
- confirmed this MIB regarding smilint,
- put it in ~ / .snmp / mibs /
- has rwcommunity string for the whole host without OID restriction
- restarted snmpd daemon (On Debian)
So far so good.
Then I tried to find out if the daemon knew about this new venture, and I did:
snmpwalk -v2c -m +ALL localhost .1.3.6.1.4.1.39106
which outputs: TEST-MIB :: test = No This object is available for this agent with an OID
So, I think snmpd is telling me that it cannot find anything under this tree because nothing has been installed yet.
So, I'm trying to set this test variable using snmpset in the 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
: snmpset -v2c -m + ALL localhost.1.3.6.1.4.1.39106.2.1.0 111
root,
snmptranslate, , MIB :
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 }
? ?