Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 2.02 KB

direct.adoc

File metadata and controls

57 lines (36 loc) · 2.02 KB

OpenNMS Direct Datasource

Overview

The OpenNMS Direct Datasource is used when ALEC is deployed in a monolithic installation. It runs in the same JVM as OpenNMS and acts upon new Alarms and Nodes using the APIs provided by the OIA.

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.direct PID.

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

API

There are three methods exposed to the InventoryObject script: One is Alarm focussed and the other two are Inventory focussed.

Alarms

When an Alarm from OpenNMS arrives via the DirectAlarmDatasource, it is directly mapped from its OpenNMS type to the corresponding ALEC type. During this mapping, you can modify the ModelObjectType or the ModelObjectIdentifier of the InventoryObject that the Alarm will be associated with.

overrideTypeAndInstance
void overrideTypeAndInstance(ImmutableAlarm.Builder alarmBuilder, Alarm alarm);

Inventory

As Nodes arrive via the DirectInventoryDatasource and are Mapped from their OpenNMS type to the internal ALEC type, there is an opportunity to derive InventoryObjects.

createInventoryObjects - Node

Each Node from OpenNMS is passed to the method below to derive InventoryObjects.

List<InventoryObject> nodeToInventory(Node node);

As Alarms arrive on the Inventory Datasource, they are also processed to derive a List of InventoryObjects. If there is a Node in the node attribute of the alarm, the above method will be invoked. If there is no Node on the Alarm, the method below will be invoked.

createInventoryObjects - Alarm

As each Alarm from OpenNMS is received by ALEC, there is an opportunity to derive InventoryObjects.

List<InventoryObject> alarmToInventory(Alarm alarm);