Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 2.46 KB

kafka.adoc

File metadata and controls

63 lines (44 loc) · 2.46 KB

OpenNMS Kafka Datasource

Overview

The OpenNMS Kafka Datasource is used when ALEC is deployed in a distributed installation.

The Kafka data source integrates with OpenNMS by leveraging the Kafka Producer and Kafka Event Consumer features.

The Kafka Producer feature is used to forward alarms, nodes and topology data encoded in protocol buffers to several topics. The Kafka Datasource consumes from these topics and provides ALEC with a feed of alarms and inventory.

Topics

The following properties can be used to configure the names of the Kafka topics used. These topics are expected to exist in the Kafka broker for the datasource to operate.

Property Default Value Description

alarmTopic

alarms

Alarms managed by OpenNMS

alarmFeedbackTopic

alarmFeedback

Alarm feedback managed by OpenNMS

edgesTopic

edges

Topology managed by OpenNMS

nodeTopic

nodes

Node inventory managed by OpenNMS

eventSinkTopic

OpenNMS.Sink.Events

Used to forward events to OpenNMS

inventoryTopic

alec-inventory

Used to maintain inventory state

Scripted extensions

Config

To update the bundle configuration and point to a script on the file system, you must update the scriptFile property of the org.opennms.alec.datasource.opennms.kafka PID.

config:edit org.opennms.alec.datasource.opennms.kafka
config:property-set scriptFile /tmp/inventory.groovy
config:update

API

There are three methods exposed to the InventoryObject script.

As the Edges and Nodes are received on the Kafka topic, the following methods are invoked respectively, giving the opportunity to derive a list of inventory objects.

InventoryObjects edgeToInventory(TopologyEdge edge)
List<InventoryObject> toInventoryObjects(OpennmsModelProtos.Node node)

When Alarms arrive on the Kafka topic, the following method is invoked. The EnrichedAlarm type contains both a reference to an InventoryObject Type and a reference to an InventoryObject Identifier.

Together, these denote the InventoryObject the Alarm will be attached to. Additionally, the EnrichedAlarm contains a list of inventory objects so multiple objects can be derived from the alarm.

EnrichedAlarm enrichAlarm(OpennmsModelProtos.Alarm alarm)