-
-
Notifications
You must be signed in to change notification settings - Fork 91
Updating MIBs
- 1. Configure Git
- 2. Extract your MIBs
- 3. Set MIBHOME
- 4. Create a branch for your work
- 5. Enter the netdisco-mibs workspace
- 6. Bootstrap a net-snmp commandline toolset
- 7. Scan and prepare your new MIBs for import
- 8. Import the MIBs
- 9. Test the new MIBs
- 10. Update netdisco-mibs
snmptranslate
reports - 11. Add new vendor to template
snmp.conf
- 12. Return your Shell Environment
- 13. Commit changes and submit for review
You should decide whether to work on the netdisco-mibs project’s git repository directory, or fork it and work on your own. Either is fine! You can read more about the different collaborative development models if you’re unsure. Email the project mail-list or ask on IRC for netdisco-mibs repository access.
git config --global core.autocrlf input ①
git config --global push.default current ②
git config --global core.whitespace cr-at-eol ③
git clone https://github.com/netdisco/netdisco-mibs.git ④
① fix MIB line endings
② push and track new branches
③ make git-diff ignore windows line endings
④ replace Netdisco’s netdisco-mibs if you wish
Obviously, the git clone link should be your own fork, if that is what you have chosen.
Unzip the bundle to /tmp/vendorname
, where “vendorname
” is the same as
the vendor in netdisco-mibs (or a new one). If you are not sure about the
official name for a vendor you can check the MIB where their enterprise oid is
in defined, which looks either like this:
redlionram OBJECT IDENTIFIER ::= {enterprises 1890}
Here the name to use for the vendor would be redlionram
.
If no OBJECT IDENTIFIER
is present it will be defined via
MODULE-IDENTITY
instead, watchguard
in the example below.
watchguard MODULE-IDENTITY
LAST-UPDATED "200811100000Z"
ORGANIZATION "WatchGuard Technologies, Inc."
CONTACT-INFO
" WatchGuard Technologies, Inc.
505 Fifth Avenue South
Suite 500
Seattle, WA 98104
United States
+1.206.613.6600 "
DESCRIPTION
"The Structure of Management Information for
the WatchGuard enterprise."
REVISION "200811100000Z"
DESCRIPTION
"Initial version."
::= { enterprises 3097 }
Usually this is the directory of the git clone created above, such as:
export MIBHOME=/home/oliver/git/netdisco-mibs
MIBHOME
must not include spaces or wide characters (emoji, etc).
This is only necessary if you are work on the project’s netdisco-mibs repository. If working on your own repository, skip this step (and work on the master branch).
cd $MIBHOME
git checkout -b initials-vendorname-description ①
① your initials, the vendor, a description
Run the following command to see if you have net-snmp 5.9 (required):
snmpstatus --version
If there is no snmpstatus or the version is less than 5.9, either set up your MacOS environment using brew, or install net-snmp locally using the following command:
EXTRAS/scripts/setmibdev
This is a script that looks through your new MIB bundle and tries to sort out the different types of files we see, identify and flag issues which you need to address, and let you know when things are ready for import to netdisco-mibs.
Also, several vendors have extra preparation steps for their mibs, do check
the vendorname
/README file if it exists.
EXTRAS/scripts/prepmibs /tmp/vendorname ①
① the directory where you unzipped your new MIB bundle, with of course the same vendor name as used in netdisco-mibs
💡
|
The script will rename and organise files to help you. |
💡
|
If the MIB module name has illegal characters, simply edit the file to fix. |
💡
|
If the MIB file has multiple module definitions, use the splitmib script to fix.
|
💡
|
Items marked ✘ need manually inspecting and will be in the "review" folder. |
💡
|
Items marked ⚠ will be put in the "skip" folder and skipped. |
💡
|
MIBs belonging to other vendors will be moved to the "other" folder. |
💡
|
If you run manual diffs make sure your line endings (lf, cr, crlf) are the same, we use lf. |
|
MIBs in "other" may be dependencies. If so, run prepmibs on them too.
|
💡
|
Use EXTRAS/scripts/compare <mibfile> to diff a MIB file against the netdisco-mibs version.
|
|
Watch out for new entries that could be bundled RFCs! |
Once you are happy with the output of prepmibs
, you can simply copy the files
which are still in the directory where you unzipped your new MIB bundle.
The prepmibs
script will have moved any files you do not want to copy into
subfolders so just copying the files is good enough.
This script will load the vendor’s MIBs in turn using net-snmp. It will report any loading errors, which you must address before continuing.
EXTRAS/scripts/testload vendorname
🔥
|
Re-run until there are no errors reported in the output. |
💡
|
Use EXTRAS/scripts/compare <mibfile> to diff a MIB file against the netdisco-mibs version.
|
❗
|
Also run this for each "other" vendor that you also imported. |
This script parses all MIBs and stores a translation report for all OIDs.
EXTRAS/scripts/genxlate
🔥
|
Re-run until there are no errors reported in the output. |
The genxlate
output is a set of reports that clearly show what the new MIBs
have introduced or changed. Use git diff
to review these changes:
git diff EXTRAS/reports/vendorname
git diff EXTRAS/reports/all ①
① should look the same as the "vendorname" diff
🔥
|
Sanity check that new entries are what you were expecting. |
💡
|
If EXTRAS/reports/all does not look correct, check your system and user snmp.conf files for interfering +mibdirs entries.
|
Only if necessary, edit EXTRAS/contrib/snmp.conf
to add the new vendor.
If you ran setmibdev
(above), it created a new shell environment. Return to
your previous shell environment by running the exit
command.
Commit your code in git and then push to github. Notify the netdisco-mibs developers of your new branch or fork, or submit a pull request.
git add .
git commit -m "a good comment"
git push
If you are a registered developer, you can run the Update OID Maps GitHub Action.
If you are a registered developer, you can merge this branch and publish a new release.