Add snmptrapd handler for juniper syslog traps#4080
Conversation
Test naming conventionAll new test names follow the convention. 👍 |
Test results 5 files 5 suites 7m 31s ⏱️ Results for commit 4351150. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4080 +/- ##
==========================================
+ Coverage 64.59% 65.46% +0.87%
==========================================
Files 633 630 -3
Lines 47010 47295 +285
Branches 43 0 -43
==========================================
+ Hits 30366 30964 +598
+ Misses 16634 16331 -303
+ Partials 10 0 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dd5c444 to
0f14f92
Compare
Specifically handle traps indicating haSrgStateChange
94ace7e to
c450b37
Compare
hmpf
left a comment
There was a problem hiding this comment.
How can this be tested/triggered?
The relevant event sadly can't be manually triggered, one has to wait for the trap to happen when a firewall is experiencing problems |
Sure you can test it. Add 127.0.0.1 as a netbox to NAV and use snmptrap -v 2c -c public 127.0.0.1:162 '' \
1.3.6.1.4.1.2636.4.12.0.1 \
1.3.6.1.4.1.2636.3.35.1.1.1.2.15 s "JSRPD_HA_SRG_STATE_CHANGE" \
1.3.6.1.4.1.2636.3.35.1.1.1.9.15 s "JSRPD_HA_SRG_STATE_CHANGE: SRG[7]:HA state transitioned [BACKUP -->INELIGIBLE] Reason: [Control plane down]" \
1.3.6.1.4.1.2636.3.35.1.2.1.2.15.1 s "srg-id" \
1.3.6.1.4.1.2636.3.35.1.2.1.3.15.1 s "7" \
1.3.6.1.4.1.2636.3.35.1.2.1.2.15.2 s "old-state" \
1.3.6.1.4.1.2636.3.35.1.2.1.3.15.2 s "BACKUP" \
1.3.6.1.4.1.2636.3.35.1.2.1.2.15.3 s "new-state" \
1.3.6.1.4.1.2636.3.35.1.2.1.3.15.3 s "INELIGIBLE"(or if you have the MIB module loaded): snmptrap -v 2c -c public -m JUNIPER-SYSLOG-MIB 127.0.0.1:162 '' \
JUNIPER-SYSLOG-MIB::jnxSyslogTrap \
JUNIPER-SYSLOG-MIB::jnxSyslogEventName.15 s "JSRPD_HA_SRG_STATE_CHANGE" \
JUNIPER-SYSLOG-MIB::jnxSyslogMessage.15 s "JSRPD_HA_SRG_STATE_CHANGE: SRG[7]:HA state transitioned [BACKUP -->INELIGIBLE] Reason: [Control plane down]" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvAttribute.15.1 s "srg-id" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvValue.15.1 s "7" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvAttribute.15.2 s "old-state" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvValue.15.2 s "BACKUP" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvAttribute.15.3 s "new-state" \
JUNIPER-SYSLOG-MIB::jnxSyslogAvValue.15.3 s "INELIGIBLE"(also, if you want to run snmptrapd without root access, put it on a different port than 162, run it in the foreground, e.g. |
lunkwill42
left a comment
There was a problem hiding this comment.
This feels vaguely familiar; is this based on a PoC I threw together at the end of my last day before my summer vacation last year? 😆
Other than the inline comments:
- Test name complaints from CI are valid.
- The plugin is not listed as a handlermodule in
snmptrapd.conf, so it will never be loaded. doc/reference/alerttypes.rstshould be updated (we have make rule to help with that,make doc/reference/alerttypes.rst)
There might be more to dig into in the tests, but this is enough for a first look...
Co-authored-by: Morten Brekkevold <morten.brekkevold@sikt.no>
Co-authored-by: Morten Brekkevold <morten.brekkevold@sikt.no>
|



Scope and purpose
Reference: https://mibs.observium.org/mib/JUNIPER-SYSLOG-MIB/
This PR adds a handler for
snmptrapdthat handles juniper syslog traps and posts events for relevant state changes for the high-availability services-redundancy-group.Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.