Discussion:
Can't add MIB to tools
(too old to reply)
Erik Steggall
2015-05-08 00:40:36 UTC
Permalink
I've created a custom MIB and I'm able to add the MIB to the agent (get and
set values work) but I'm unable to add the MIB so that the tools recognize
the names of my OIDs. Do I need to add anything to the .c/.h files in order
to get the naming to work correctly?

Pages I've read:
http://www.net-snmp.org/wiki/index.php/TUT:Using_and_loading_MIBS
http://www.net-snmp.org/wiki/index.php/FAQ:Applications_06
http://www.net-snmp.org/wiki/index.php/FAQ:Agent_06

More Info:

# This call fails and IDK why
snmptranslate -m +PEAXY-SNMP-MIB -IR -Of pxeSnmpMib
Unknown object identifier: pxeSnmpMib

# OIDs are definitely there...
snmpwalk localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"

# Adding -m doesn't seem to help
snmpwalk -m +PEAXY-SNMP-MIB localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"

# Can't use names
snmpwalk -m +PEAXY-SNMP-MIB localhost PEAXY-SNMP-MIB::pxeSnmpMib
PEAXY-SNMP-MIB::pxeSnmpMib: Unknown Object Identifier

# My mibdirs
net-snmp-config --default-mibdirs
/root/.snmp/mibs:/usr/local/share/snmp/mibs
ls ~/.snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt
ls /usr/local/share/snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt


#### Start MIB ####
PEAXY-SNMP-MIB DEFINITIONS ::= BEGIN

-- Peaxy Inc.
-- Author: Erik Q. Steggall

--
-- IMPORTS: Include definitions from other mibs here
--
IMPORTS
netSnmpExamples FROM NET-SNMP-EXAMPLES-MIB
OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY,
Integer32, Opaque, enterprises, Counter32, Unsigned32
FROM SNMPv2-SMI
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF

--
-- A brief description and update info about this mib
--

pxeSnmpMib MODULE-IDENTITY
LAST-UPDATED "201505050000Z"
ORGANIZATION "Peaxy Inc"
CONTACT-INFO "Postal: Erik Steggall
2380 Bering Dr,
San Jose, CA, 95131
email: ***@peaxy.net
"
DESCRIPTION "An MIB for Peaxy Inc."
::= { enterprises 45190 }

--
-- Define typical mib nodes
--
pxeMIBObjects OBJECT IDENTIFIER ::= { pxeSnmpMib 1 }
pxeMIBConformance OBJECT IDENTIFIER ::= { pxeSnmpMib 2 }

--
-- define objects
--

pxeAgentModules OBJECT IDENTIFIER ::= { pxeMIBObjects 1 }

pxeAgentModuleObject OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is an int to test snmp for PEAXY"
DEFVAL { 1 }
::= { pxeAgentModules 1 }

pxeAgentTestString OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is a demo string, should hold PEAXY"
DEFVAL { 2 }
::= { pxeMIBObjects 2 }

END
#### End MIB ####

best,

- Erik S.
(530)400-6194
Tim Culhane
2015-05-08 07:29:48 UTC
Permalink
Hi,



Try adding the following line to your $HOME/.snmp/snmp.conf file:



MIBS +PEAXY-SNMP-MIB



And see if that works.



Tim





From: Erik Steggall [mailto:***@peaxy.net]
Sent: 08 May 2015 01:41
To: net-snmp-***@lists.sourceforge.net
Subject: Can't add MIB to tools



I've created a custom MIB and I'm able to add the MIB to the agent (get and set values work) but I'm unable to add the MIB so that the tools recognize the names of my OIDs. Do I need to add anything to the .c/.h files in order to get the naming to work correctly?

Pages I've read:
http://www.net-snmp.org/wiki/index.php/TUT:Using_and_loading_MIBS
http://www.net-snmp.org/wiki/index.php/FAQ:Applications_06
http://www.net-snmp.org/wiki/index.php/FAQ:Agent_06

More Info:



# This call fails and IDK why
snmptranslate -m +PEAXY-SNMP-MIB -IR -Of pxeSnmpMib
Unknown object identifier: pxeSnmpMib

# OIDs are definitely there...
snmpwalk localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"

# Adding -m doesn't seem to help
snmpwalk -m +PEAXY-SNMP-MIB localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"

# Can't use names
snmpwalk -m +PEAXY-SNMP-MIB localhost PEAXY-SNMP-MIB::pxeSnmpMib
PEAXY-SNMP-MIB::pxeSnmpMib: Unknown Object Identifier



# My mibdirs
net-snmp-config --default-mibdirs
/root/.snmp/mibs:/usr/local/share/snmp/mibs
ls ~/.snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt
ls /usr/local/share/snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt



#### Start MIB ####

PEAXY-SNMP-MIB DEFINITIONS ::= BEGIN

-- Peaxy Inc.
-- Author: Erik Q. Steggall

--
-- IMPORTS: Include definitions from other mibs here
--
IMPORTS
netSnmpExamples FROM NET-SNMP-EXAMPLES-MIB
OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY,
Integer32, Opaque, enterprises, Counter32, Unsigned32
FROM SNMPv2-SMI
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF

--
-- A brief description and update info about this mib
--

pxeSnmpMib MODULE-IDENTITY
LAST-UPDATED "201505050000Z"
ORGANIZATION "Peaxy Inc"
CONTACT-INFO "Postal: Erik Steggall
2380 Bering Dr,
San Jose, CA, 95131
email: ***@peaxy.net <mailto:***@peaxy.net>
"
DESCRIPTION "An MIB for Peaxy Inc."
::= { enterprises 45190 }

--
-- Define typical mib nodes
--
pxeMIBObjects OBJECT IDENTIFIER ::= { pxeSnmpMib 1 }
pxeMIBConformance OBJECT IDENTIFIER ::= { pxeSnmpMib 2 }

--
-- define objects
--

pxeAgentModules OBJECT IDENTIFIER ::= { pxeMIBObjects 1 }

pxeAgentModuleObject OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is an int to test snmp for PEAXY"
DEFVAL { 1 }
::= { pxeAgentModules 1 }

pxeAgentTestString OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is a demo string, should hold PEAXY"
DEFVAL { 2 }
::= { pxeMIBObjects 2 }

END

#### End MIB ####

best,

- Erik S.
(530)400-6194
Erik Steggall
2015-05-08 19:30:05 UTC
Permalink
Thanks for the response but unfortunately still no luck :\

I've written my own .c/.h files and compiled into the agent instead of
using mib2c. Is there any configuration in need to do in the c files in
order to get naming working or is it all in the MIB?
Post by Tim Culhane
Hi,
MIBS +PEAXY-SNMP-MIB
And see if that works.
Tim
*Sent:* 08 May 2015 01:41
*Subject:* Can't add MIB to tools
I've created a custom MIB and I'm able to add the MIB to the agent (get
and set values work) but I'm unable to add the MIB so that the tools
recognize the names of my OIDs. Do I need to add anything to the .c/.h
files in order to get the naming to work correctly?
http://www.net-snmp.org/wiki/index.php/TUT:Using_and_loading_MIBS
http://www.net-snmp.org/wiki/index.php/FAQ:Applications_06
http://www.net-snmp.org/wiki/index.php/FAQ:Agent_06
# This call fails and IDK why
snmptranslate -m +PEAXY-SNMP-MIB -IR -Of pxeSnmpMib
Unknown object identifier: pxeSnmpMib
# OIDs are definitely there...
snmpwalk localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"
# Adding -m doesn't seem to help
snmpwalk -m +PEAXY-SNMP-MIB localhost .1.3.6.1.4.1.45190
SNMPv2-SMI::enterprises.45190.1.1.1.0 = INTEGER: 42
SNMPv2-SMI::enterprises.45190.1.1.2.0 = STRING: "Peaxy Inc"
# Can't use names
snmpwalk -m +PEAXY-SNMP-MIB localhost PEAXY-SNMP-MIB::pxeSnmpMib
PEAXY-SNMP-MIB::pxeSnmpMib: Unknown Object Identifier
# My mibdirs
net-snmp-config --default-mibdirs
/root/.snmp/mibs:/usr/local/share/snmp/mibs
ls ~/.snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt
ls /usr/local/share/snmp/mibs/ | grep PEAXY
PEAXY-SNMP-MIB.txt
#### Start MIB ####
PEAXY-SNMP-MIB DEFINITIONS ::= BEGIN
-- Peaxy Inc.
-- Author: Erik Q. Steggall
--
-- IMPORTS: Include definitions from other mibs here
--
IMPORTS
netSnmpExamples FROM NET-SNMP-EXAMPLES-MIB
OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY,
Integer32, Opaque, enterprises, Counter32, Unsigned32
FROM SNMPv2-SMI
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF
--
-- A brief description and update info about this mib
--
pxeSnmpMib MODULE-IDENTITY
LAST-UPDATED "201505050000Z"
ORGANIZATION "Peaxy Inc"
CONTACT-INFO "Postal: Erik Steggall
2380 Bering Dr,
San Jose, CA, 95131
"
DESCRIPTION "An MIB for Peaxy Inc."
::= { enterprises 45190 }
--
-- Define typical mib nodes
--
pxeMIBObjects OBJECT IDENTIFIER ::= { pxeSnmpMib 1 }
pxeMIBConformance OBJECT IDENTIFIER ::= { pxeSnmpMib 2 }
--
-- define objects
--
pxeAgentModules OBJECT IDENTIFIER ::= { pxeMIBObjects 1 }
pxeAgentModuleObject OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is an int to test snmp for PEAXY"
DEFVAL { 1 }
::= { pxeAgentModules 1 }
pxeAgentTestString OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is a demo string, should hold PEAXY"
DEFVAL { 2 }
::= { pxeMIBObjects 2 }
END
#### End MIB ####
best,
- Erik S.
(530)400-6194
Loading...