Import Handlers
Meridian supports a number of import handlers to facilitate provisioning nodes from an external system (foreign source) into a requisition.
This is done in the ${OPENNMS_HOME}/etc/provisiond-configuration.xml
file by referencing a requisition’s location via a URL.
Most commonly, these URLs are files on the file system (file:${OPENNMS_HOME}/etc/imports/<my-requisition.xml>
) created through the Requisition UI.
However, these same requisitions for adding, updating, and deleting nodes can also come from external URLs.
For example, a requisition can be retrieved using the HTTP protocol.
In addition to the standard protocols supported by Java, we provide a series of custom URL handlers to help retrieve requisitions from external sources.
Generic handler
The generic handler is made available using URLs of the form: requisition://type?param=1;param=2
Use these URLs to invoke handlers, both locally and via a Minion. In addition to the type-specific parameters, all handlers support the following parameters:
Parameter | Description | Default |
---|---|---|
location |
The name of the location at which the handler should run. |
Default |
ttl |
The maximum number of milliseconds to wait for the handler when run remotely. |
20000 |
Use the opennms:show-import
command, available via the Karaf shell, to show the results of an import without persisting or triggering the import:
opennms:show-import -l MINION http url=http://127.0.0.1:8000/req.xml
Configuration
The configuration of the Provisioning system allows the definition of zero or more import requisitions, each with its own cron-based schedule.
This allows for automatic importing from various sources intended for integration with external URLs such as HTTP and/or DNS protocol handler.
A default configuration is provided in the Meridian etc/
directory and is called: provisiond-configuration.xml
.
This default configuration has an example for scheduling an import from a DNS server running on the localhost requesting nodes from the zone, localhost and will be imported once per day at midnight.
Not very practical, but is a good example to get you started.
<?xml version="1.0" encoding="UTF-8"?>
<provisiond-configuration xmlns="http://xmlns.opennms.org/xsd/config/provisiond-configuration"
foreign-source-dir="/opt/opennms/etc/foreign-sources"
requistion-dir="/opt/opennms/etc/imports"
importThreads="8" scanThreads="10" rescanThreads="10" writeThreads="8" >
<!--
http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
Field Name Allowed Values Allowed Special Characters
Seconds 0-59 , - * /
Minutes 0-59 , - * /
Hours 0-23 , - * /
Day-of-month 1-31 , - * ? / L W C
Month 1-12 or JAN-DEC , - * /
Day-of-Week 1-7 or SUN-SAT , - * ? / L C #
Year (Opt) empty, 1970-2099 , - * /
-->
<requisition-def import-name="localhost" import-url-resource="dns://localhost/localhost">
<cron-schedule>0 0 0 * * ? *</cron-schedule>
</requisition-def>
</provisiond-configuration>