Provision to OpenNMS

To use the requisition from PRIS in OpenNMS you have the following possibilities:

  • Use Provisiond cron jobs and import from PRIS in scheduled interval

  • Trigger an Event into OpenNMS to import nodes from a given PRIS URL.

Provisiond scheduled

Provisiond can be configured to provision a requisition from an URL on a configurable schedule. To configure Provisiond to provision a requisition from PRIS via http a configuration entry like the following can be used.

Configuration from OpenNMS Provisiond with provisiond-configuration.xml
<requisition-def import-name="myRouter" import-url-resource="http://localhost:8000/requisitions/myRouter">
  <cron-schedule>0 0 0 * * ? *</cron-schedule>
</requisition-def>

<requisition-def import-name="myServer" import-url-resource="http://localhost:8000/requisitions/myServer">
  <cron-schedule>0 0 1 * * ? *</cron-schedule>
</requisition-def>

Provision via Event

A special OpenNMS Event can be sent to OpenNMS to trigger provisioning of a requisition right away. Sending an event to OpenNMS in general can be achieved via the ReST API or the send-event.pl script.

The following example uses curl using the ReST API:

curl -u admin -X POST -d \
  "<event><uei>uei.opennms.org/internal/importer/reloadImport</uei> \
     <parms><parm> \
         <parmName>url</parmName><value>http://${PRIS_URL}:8000/requisitions/${REQUISITION}</value> \ (1)
     </parm></parms> \
   </event>" \
   -H "Content-Type: application/xml" http://${OPENNMS_IP}:8980/opennms/rest (2)
1 Replace the ${PRIS_URL} with the IP and port where you have PRIS running, replace ${REQUISITION} with the name of the requistion you want to import
2 Replace the ${OPENNMS_IP} with the IP or host name of your OpenNMS instance

The following example demonstrates the use of send-event.pl to emit the provisioning event.

If you want to send the Event from a remote system, consider the TCP port 5817 is by default just listening on local loopback interface. Opening the service to the network is a security risk, cause the communication is unauthenticated and plain text and strongly advice to use the ReST API with HTTPS instead.
./send-event.pl -p 'url http://localhost:8000/requisitions/myRouter' uei.opennms.org/internal/importer/reloadImport