show-event-config displays unexpected content after adding new event definitions
Description
Acceptance / Success Criteria
None
Lucidchart Diagrams
Activity
Show:
Benjamin Reed July 22, 2022 at 6:02 PM
FYI, this got backported to older Meridians as far as 2020 as well.
Gerald Humphries February 4, 2022 at 6:56 PM
It is actually expected that priority events exist in the configuration twice, so the real bug was that getting events by UEI wasn't filtering out the duplicate priority events. This has been fixed.
Gerald Humphries February 3, 2022 at 3:46 PM
The first two bugs have been fixed, but a third bug was found that's duplicating individual events.
Gerald Humphries February 2, 2022 at 8:27 PM
There are two separate bugs here:
A bug in the show-event-config command is causing it to output a single event over and over, any time two (or more) events have the same UEI.
A bug in the event config reloading logic is causing events with priorities to be duplicated. Every time the config is reloaded, events with priorities multiply.
Fixed
Created August 20, 2020 at 1:29 PM
Updated July 22, 2022 at 6:02 PM
Resolved February 14, 2022 at 3:14 PM
A customer asked me if there is a way to alter the content of event definitions coming from OIA. In particular, an event defined by ALEC.
That is entirely possible by creating a new event definition with a priority element.
The problem is that after doing that, and instruction OpenNMS to reload the event configuration, the number of events displayed by the show-event-config command is incorrect.
Let me explain with an example:
The above is the expected result for that event definition. The first entry is coming from ALEC, as defined in the following link:
https://github.com/OpenNMS/alec/blob/v1.0.2/integrations/opennms/config/src/main/resources/events/Cisco.ext.events.xml#L475
The second one is part of the OpenNMS default configuration (defined inside /opt/opennms/etc/events/Cisco.events.xml).
As expected, event definitions coming via OIA takes more precedence than definitions that OpenNMS provides by default.
This can be altered with the priority field.
I added a new event definitions file with an altered version of the event offered by ALEC:
If I run the show-event-config again, I would expect to see three (3) definitions, having the one I added at the top of the list due to its priority. Instead, I'm seeing six (6) copies of the definition I just added, and the ones that were already present are gone.
That is definitely not expected.
Interestingly, if I restart OpenNMS, to see if the behavior was due to the reload process, I found that the problem is now worst. It shows ten (10) entries:
And, the original definitions are still not displayed.
I don't know if there are repercussions or now because of this. Probably not in terms of behavior, but I'm wondering about the algorithm to find event definitions. That because if this process is repeated for multiple definitions, that will exponentially increase the number of definitions kept in memory and could have side effects on the time invested in processing events before sending them to the Event Bus.