SNMP Traps

Hi Guys,

Anybody knows if SNMP traps are supported at Librenms?

Yes but only up/down ports. https://docs.librenms.org/Extensions/SNMP-Trap-Handler/

Do you know if i a new version more traps will be supported?

I’ve never quite understood what LibreNMS does with the traps it can receive?
I guess it is just there to be able to trigger alerts, right?

Your guess is good as mine … looking at the code https://github.com/librenms/librenms/blob/master/snmptrap.php
:confused:

Seems like it just logs it in the eventlog (?), according to the two files it includes:

This (kind of) also answers @amaizenshtein’s question: If I understand the code correctly, you should be able to add (PR!) files corresponding to the traps you want in includes/snmptrap/.

I had to add some extra code to get the snmptrap up/down working.

Would you care to share your code? I’d be very interested in it.

That depends. If you know any programming, I would rather offer you hints on how to fix it yourself. If you promise that you do NOT know any programming and will not mock my programming skills, I will send it to you. Note, I only have port up/downs working.

I promise to not know ANY programmering!

Please consider constructing a pull request or send me the code and I will attempt to do so. We all can collectively further the progress of this amazing software.

Don’t be worried about your code but the only way this software exists is because people fix issues and submit the changes, if you have genuinely found a bug and have a fix, submit it back to us.

It’s a cobble - I can’t speak php 'none good and had to write some python to parse the trap lines for keywords. Couldn’t find the php Libre uses to send email, I had to python the email as well. I don’t know if traps are standard, it may fail on other vendors. I’d be embarrassed to show Laf.

How about I work with florianbeer and, if it works for him, we can look at some ways to make it less embarrassing. Meanwhile, the snmptrap page should be changed, because it doesn’t work, not at all.

Just send me your code and I’ll try to translate it to PHP and integrate it into LibreNMS.

And I swear noone’s going to mock you, all code is valid - whatever works, works :slight_smile:

@laf
Do you think that librenms will provide more snmp traps in the future, by the way, good job on Librenms product and community support.
Thanks
Ali

1 Like

@aalshaea Check https://github.com/librenms/librenms/pull/8898

That PR will give support to Port Up/Down, BGP Up/Down and Authorization.

1 Like

@aalshaea By the way, if you test it, please comment on the PR with the results.

I’ve tested in my install and works perfect, but more tests will supply better results.

Actually I did not test it, our SNMP traps need for our power supply for Palo Alto Networks Product, let me see how to add it and let you know.