Entities Datasource

General

Use the entities datasource to retrieve entity model objects from OpenNMS. It currently supports alarms and nodes.

(For an example of the entities datasource in action, see Creating a Filter Panel).

Datasource queries

The behavior of this datasource changes depending on which entity is chosen. Attributes and values will change depending on the entity type.

Currently the entities datasource only allows a single target. Subsequent targets in the query editor will be ignored.

Template queries

To change the behavior of a template query, you can pass a field name to the attribute field to use as the display value of the variable.

If no attribute argument is given, the query will return the id attribute of the entity.

The default if the query field is empty is alarms() (return a list of alarm IDs).

alarms([attribute])

The alarms() function queries the OpenNMS alarms REST API.

locations()

The locations() query returns a list of all available node locations. Use this inside nodeFilter() to filter the number of nodes displayed by location.

Example variable expression
  • nodeFilter(location='Default')

  • nodeFilter(location='$location')

nodeFilter(<filterQuery>)

The nodeFilter() query returns a list of nodes which match the given filter expression.

The filter expression must be an existing node attribute and its corresponding value.

The value can be a constant or a variable.

Example
  • nodeFilter(<node_attribute>='<value>')

  • nodeFilter(location='Default')

  • nodeFilter(location='$location')

  • nodeFilter(location='$location' & label='localhost')

Separate multiple filter expressions with an '&' (<attribute1>=<value1> & <attribute2>=<value2> & …​).

nodes([attribute])

The nodes() function will query the OpenNMS node REST API to retrieve a list of unique values for a given attribute. You can use the result from this query in a nodeFilter() query to filter nodes in either an entity or performance datasource variable. To find a list of valid attributes, look at the http://HOSTNAME:8980/opennms/api/v2/nodes/properties endpoint of your OpenNMS server.

Example filtering nodes by the "region" asset record
  1. On your dashboard, create a variable called region and set the datasource to an entity datasource pointing to your server.

  2. Set the query to be nodes(assetRecord.region).

  3. Save the variable and return to the list of variables.

  4. Create a second variable called node and set the datasource to a performance datasource.

  5. Set the query to be nodeFilter(region='$region').

  6. Save the variable and return to your dashboard.

  7. As you change the "region" variable, the options in the "node" variable should update to show only the matching nodes.