The Alarm History feature is not working

Description

The alarm history feature, used to forward alarm changes to Elasticsearch is not working on Horizon 26.1.0, but it works on 25.x (verified with 25.2.1).

I'm including a simple test environment with Docker that someone can use to verify that it works with H25 but not with H26.

With H26, there is an exception on karaf.log on every attempt to send an alarm to Elastic:

2020-05-15T13:20:56,900 | ERROR | ElasticAlarmIndexer | DefaultTemplateInitializer | 293 - org.opennms.features.jest.client - 26.1.0 | An error occurred while initializing template alarms: java.lang.ClassCastException: class com.google.gson.JsonPrimitive cannot be cast to class com.google.gson.JsonArray (com.google.gson.JsonPrimitive and com.google.gson.JsonArray are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @306682d6). com.google.common.util.concurrent.UncheckedExecutionException: java.lang.ClassCastException: class com.google.gson.JsonPrimitive cannot be cast to class com.google.gson.JsonArray (com.google.gson.JsonPrimitive and com.google.gson.JsonArray are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @306682d6) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203) ~[?:?] at com.google.common.cache.LocalCache.get(LocalCache.java:3937) ~[?:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) ~[?:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) ~[?:?] at org.opennms.features.jest.client.template.CachingTemplateLoader.load(CachingTemplateLoader.java:59) ~[293:org.opennms.features.jest.client:26.1.0] at org.opennms.features.jest.client.template.DefaultTemplateInitializer.doInitialize(DefaultTemplateInitializer.java:118) ~[293:org.opennms.features.jest.client:26.1.0] at org.opennms.features.jest.client.template.DefaultTemplateInitializer.initialize(DefaultTemplateInitializer.java:85) [293:org.opennms.features.jest.client:26.1.0] at org.opennms.features.alarms.history.elastic.ElasticAlarmIndexer.run(ElasticAlarmIndexer.java:205) [408:org.opennms.features.alarms.history.elastic:26.1.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?] Caused by: java.lang.ClassCastException: class com.google.gson.JsonPrimitive cannot be cast to class com.google.gson.JsonArray (com.google.gson.JsonPrimitive and com.google.gson.JsonArray are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @306682d6) at com.google.gson.JsonObject.getAsJsonArray(JsonObject.java:195) ~[?:?] at org.opennms.features.jest.client.template.TemplateMerger.merge(TemplateMerger.java:62) ~[?:?] at org.opennms.features.jest.client.template.TemplateMerger.merge(TemplateMerger.java:52) ~[?:?] at org.opennms.features.jest.client.template.MergingTemplateLoader.merge(MergingTemplateLoader.java:54) ~[?:?] at org.opennms.features.jest.client.template.MergingTemplateLoader.load(MergingTemplateLoader.java:50) ~[?:?] at org.opennms.features.jest.client.template.CachingTemplateLoader$1.load(CachingTemplateLoader.java:51) ~[?:?] at org.opennms.features.jest.client.template.CachingTemplateLoader$1.load(CachingTemplateLoader.java:48) ~[?:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) ~[?:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) ~[?:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) ~[?:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) ~[?:?] ... 10 more

Interestingly, with Horizon 26.0.0, the alarm history feature works as expected, meaning something changed recently broke it.

Acceptance / Success Criteria

None

Attachments

2
  • 15 May 2020, 09:39 PM
  • 15 May 2020, 05:42 PM

Lucidchart Diagrams

Activity

Chandra Gorantla May 19, 2020 at 2:12 PM

Alejandro Galue May 15, 2020 at 9:41 PM

I've been told that Fedora 32 has some fans, and Docker doesn't run on that version. So, I've included a .tar.gz with a test lab that uses Vagrant/Ansible to set up a VM with Fedora 32 and OpenJDK 11, Elasticsearch 7.6.1, PostgreSQL 12 and OpenNMS with the Alarms History plugin installed.

Only VirtualBox and Vagrant are required to be installed on your machine.

Chandra Gorantla May 15, 2020 at 8:54 PM

Looks like the issue is reproducible only when indexPrefix is set

Ronny Trommer May 15, 2020 at 8:16 PM

I couldn't verify this, I see Alarms coming into my ElasticSearch. This is the content of my org.opennms.features.alarms.history.elastic.cfg:

elasticUrl = http://elastic:9200 elasticIndexStrategy=hourly settings.index.number_of_replicas = 0 connTimeout = 30000 readTimeout = 300000

I just a few gigs in there and no replication and I use the image: opennms/horizon:26.1.0 image.

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created May 15, 2020 at 5:42 PM
Updated May 19, 2020 at 4:05 PM
Resolved May 19, 2020 at 4:05 PM

Flag notifications