Export CMDB objects to OpenNMS

With Exportd, DATAGERRY can export CMDB objects to external systems like monitoring systems, ticket systems, configuration management, and many many more. One of the supported external systems is the monitoring system OpenNMS. DATAGERRY can create (and of course update and delete) OpenNMS nodes from CMDB objects. In this article, we want to give you an example configuration.

Our Example Types
In our example, we defined the two types router and location in DATAGERRY. A router has a hostname, IP and some further fields with additional informations. Every router is connected to a location object, which has informations like city, street, country and some more. In the screenshots below, you can see two example objects:

Prepare OpenNMS
For exporting objects to OpenNMS, DATAGERRY will access the REST API of OpenNMS. So, we need access to the WebUI of OpenNMS from our DATAGERRY setup and a valid OpenNMS user with username and password. If you need some background information about the OpenNMS REST API, please have a look at the OpenNMS Developers Guide. In our case, we used OpenNMS Horizon 25, but older versions are also fine.

Configuring the Export: Basics and Sources
To configure the export in DATAGERRY, choose “Exportd Job Settings” from the menu and create a new export job. At first, set a label for the job and choose “Push” as type:

In a second step, we’ll define the objects, that should be exported to OpenNMS. In our case we want to export all objects of type Router, where the checkbox “Monitoring” is checked as you can see in the following example:

To achieve that, we’ll add a source to the Export Job and choose type “Router” with the condition “monitoring”, “==”, “True”. This will export all routers with the monitoring flag.

Configuring the Export: Destinations
After that, we need to configure the details about our OpenNMS setup. Add an export destination and choose ExternalSystemOpenNMS as export class. After that, configure the parameters for the connection with OpenNMS:

If you move the mouse over the info icons in the parameter list, you got some additional informations. For the export to OpenNMS, we need to know the REST URL, a username and password, the provisioning requisition and also a list of services (like ICMP and SNMP in our example), that should be bound on the created nodes. It is also possible to export SNMP configuration (at the moment we support SNMPv1 and v2c only) to OpenNMS. Simply set the parameter exportSnmpConfig to true.
You can also configure multiple destinations within one export job in DATAGERRY. So, if you have for example a primary and backup OpenNMS, add another destination for your second OpenNMS system.

Configuring the Export: Variables
After configuring the destinations, we need to setup Export Variables. This is a mapping between the fields of DATAGERRY objects and some values we need for OpenNMS nodes. For an OpenNMS node, we need to set the nodelabel, an IP address and optionally a set of asset informations and surveillance categories. You can find an example configuration for an Export Variable below:

In this example, we set the variable nodelabel (the nodelabel in OpenNMS), and will use the value of the field hostname. The value of a variable uses Jinja2 syntax. You can access the public id of an object, the value object fields and even access fields of referenced objects. Have a look at the following examples:

# access the ID of the current object

# access the field "hostname" of the current object

# dereference an object reference in field "location" (access the field "city" of the referenced object)
# max 3 levels were dereferenced

For an export to OpenNMS, the following variables can be set:

You can get this overview shown above by clicking on the blue “Variable Helpers” button. For our case, we set nodelabel, ip and the asset field city:

Configuring the Export: Trigger
As a last point of configuring the Export Job, we can setup the scheduling. At the moment, Export Jobs can be triggered manually in the WebUI of DATAGERRY or event-based, if one of the source object was added, updated or deleted. The configuration is simple, just enable or disable the event based export.

Aaaannnd Action!
After setting up the Export Job, we just added a new router in DATAGERRY. After a few seconds - thanks to the event based scheduling - we can find the router as a new node in OpenNMS Horizon.

1 Like

I like exporting routers! :slight_smile:

I am trying this export but I am facing a problem with the dereference.

For two levels its:


However, in my case i need to reference an object inside another object.

I have tried declaring it as:


But it does not work…

What am I missing?

Hi @kbetsis,

your syntax seems to be correct. Can you re-check, if the field country in your case really is a reference field?

In version 1.4 you can also use the new template helper button to configure references:

1 Like

Honest, reply… it got fixed with the help button.
Don’t know why it wasn’t working before…

Really helpful button!!!Nice.

1 Like