OpenNMS Direct Datasource
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.
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
There are three methods exposed to the InventoryObject script: One is Alarm focussed and the other two are Inventory focussed.
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.
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.