Build and install the plugin into your local Maven repository using:
mvn clean install
Install the .kar file
cp assembly/kar/target/opennms-resync-plugin.kar /opt/opennms/deploy/
From the OpenNMS Karaf shell:
feature:install opennms-plugins-resync
Once installed, the plugin makes the following Karaf shell commands available:
- opennms-resync:set
- opennms-resync:get
You can also access the REST endpoint mounted by the plugin:
http://localhost:8980/opennms/rest/resync/ping
: Check if the plugin is installedhttp://localhost:8980/opennms/rest/resync/trigger
: To trigger a resync operation
The trigger
-endpoint provides two modes which can be selected by the mode
field: SET
or GET
.
There request for SET
mode looks like this:
Accept: application/json
Content-Type: application/json
{
"mode": "SET",
"resyncId": "my unique ID",
"node": "1",
"ipInterface": "127.0.0.1",
"attrs": {
".1.2.3.4.5": "all"
}
}
There request for GET
mode looks like this:
Accept: application/json
Content-Type: application/json
{
"mode": "GET",
"resyncId": "my unique ID",
"node": "1",
"ipInterface": "127.0.0.1",
"kind": "example-kind"
}
Where the kind
-field refers to an entry in the config file for get mode.
The plugin picks up the configuration of the OpenNMS Kafka Producer.
To configure which SNMP OIDs are sent on a SET
request, the OIDs and according values can be set in multiple ways:
- By setting node level meta-data in the context
requisition
and a key starting with the prefixresync:
. - By setting interface level meta-data in the context
requisition
and a key starting with the prefixresync:
. - By adding entries to the
attrs
property in the request.
To configure which SNMP OIDs to query on a GET
request, there is a config file which must exist on $OPENNMS_HOME/etc/resync-get.json
.
It has the following structure:
{
"example-kind": {
"columns": {
"param1": "1.3.6.0.0.1",
"param2": "1.3.6.0.0.2",
...
},
"parameters": {
"param3": "example value",
...
}
},
...
}
The configured event should not be configured to have a reduction key set. If a reduction key is required on the produced alarms, a special parameter in the event definition could be used. The value of this parameter is set as reduction key in the resulting alarm.
<events xmlns="http://xmlns.opennms.org/xsd/eventconf">
<event>
<parameter name="resync-reduction-key" value="%uei%:%snmphost%:%nodeid%:%parm[#2]%" expand="true"/>
</event>
</events>