Hi NAV gurus,
I am in the process of learning how to use the snmptrapd handler for NAV. I hit a few road blocks along the way.
I first test a simple home-made snmptrap (V1), what is the procedure to incorporate it into NAV snmptrapd.
Where do I put the text mib files? /usr/share/snmp/mibs?
Do I need to convert the text mib file into *.py in the directory (using smidump ?) /usr/share/pyshared/nav/smidumps ?
I need to modify /etc/nav/snmptrapd.conf to add our own handler and put it in /usr/share/pyshared/nav/snmptrapd/handlers/
In my trap handler, I need to tell it process the trap with trap.genericType match what we define it. But I still could not get it to work properly.
I would appreciate if someone can point me to the right direction, as I still miss a few pieces here and there.
Thank you.
Zhi-Wei Lu IET-CR-Network Operations Center University of California, Davis (530) 752-0155
On Tue, 12 Dec 2017 18:28:04 +0000 Zhi-Wei Lu zwlu@ucdavis.edu wrote:
I am in the process of learning how to use the snmptrapd handler for NAV. I hit a few road blocks along the way.
Well, the documentation seems to be in severe need of some attention. There's already a bug report filed against the snmptrapd documentation, but it deserves one more for not being more detailed about traphandler implementation.
I first test a simple home-made snmptrap (V1), what is the procedure to incorporate it into NAV snmptrapd.
Where do I put the text mib files? /usr/share/snmp/mibs?
Do I need to convert the text mib file into *.py in the directory (using smidump ?) /usr/share/pyshared/nav/smidumps ?
If you need the MIB files for your development, you can do whatever you like. If you want to access the MIB file contents as Python data structured, you are best served by converting them to Python modules using `smidump`, as suggested.
There's really nothing in snmptrapd that will require MIB files for anything. Only some of the existing handler modules use MIB data, others hardcode what little they need of the MIB objects to parse and handle the incoming traps.
I need to modify /etc/nav/snmptrapd.conf to add our own handler and put it in /usr/share/pyshared/nav/snmptrapd/handlers/
I would not put homegrown handler modules in /usr/share/pyshared/nav/snmptrapd/handlers/ - You'll be better off making your own namespace and adding them there, to avoid potential future conflicts when upgrading NAV.
In my trap handler, I need to tell it process the trap with trap.genericType match what we define it. But I still could not get it to work properly.
I would appreciate if someone can point me to the right direction, as I still miss a few pieces here and there.
There's a template handler module (it doesn't work, but demonstrates the the concept of building one) in nav/snmptrapd/handlers/handlertemplate.py. Did you have a look at it?