Ticket Forwarding
With ticket forwarding enabled, the plugin creates and updates incidents in ServiceNow through the Incident Table API (/api/now/table/incident).
The ticketer plugin must be enabled in OpenNMS, see Installation.
To create a case instead of an incident for some tickets, set a case filter.
-
A new OpenNMS ticket creates an incident. The
sys_idof the incident becomes the ticket ID. -
An updated or closed ticket updates the incident.
-
The alarm severity sets the impact and the urgency of the incident.
-
A resolved incident gets the close code and close notes.
-
When the node label matches a configuration item in the ServiceNow CMDB, the incident links to it.
-
Work notes hold the OpenNMS context: node label, node ID, IP address and alarm ID.
Ticket Filter
The ticket filter selects the alarms that can create an incident. It is a JEXL expression on the alarm and on its ticket. An empty filter, the default, lets every alarm create an incident.
alarm.reductionKey =~ 'uei.opennms.org/threshold/.*' or alarm.reductionKey =~ 'uei.opennms.org/nodes/nodeDown.*'
All alarm filter fields are available, plus these ticket fields:
| Field | Description |
|---|---|
|
Interface IP address |
|
Node ID |
|
Ticket user |
|
Custom attributes, a map |
alarm.reductionKey =~ 'uei.opennms.org/threshold/.*' and ticket.ipAddress =~ '192.168.1.*'
Incident Mapping
| Incident field | Source |
|---|---|
|
Node label and alarm log message, for example |
|
Alarm description |
|
Ticket user, when set |
|
Ticket state: OPEN is |
|
From the alarm severity, see the table below |
|
From the alarm severity, see the table below |
|
|
|
|
|
The sys_id of the configuration item whose name equals the node label |
|
OpenNMS context: instance ID, node label, node ID, IP address, alarm ID |
|
The configured close code, sent on resolve, see Incident Close Code |
|
|
You can change these values and set more incident fields with Incident Field Mappings.
Incident Field Mappings
Field mappings set columns of the incident when the plugin creates it.
The default mapping is one rule that sets category to Network.
The mappings are a JSON document.
You can type it, load it from a file, or restore the default.
The plugin does not limit the column names.
Do not map state or correlation_id.
The plugin sets these fields and uses them to track the incident.
Common uses:
-
Routing:
assignment_group,assigned_to -
Classification:
category,subcategory,business_service,service_offering -
Priority:
impact,urgency, to replace the values from the severity -
People:
caller_id,opened_by -
Content:
short_description,description,work_notes, to replace the text the plugin builds -
Custom columns:
u_*columns added by your ServiceNow administrators, orx_*columns from scoped applications
Use the column name, not the form label.
ServiceNow adds the prefix u_ to columns that an administrator creates.
A field with the label "Contact Number" is usually the column u_contact_number.
To find the name, right-click the field label on the incident form in ServiceNow and select Configure Dictionary.
The column must exist on the table.
ServiceNow ignores a column it does not know, without an error.
The mappings are a JSON array of rules:
[
{
"fields": {
"assignment_group": "Network Operations",
"u_contact_number": "555-0100"
}
},
{
"name": "lab nodes",
"filter": "alarm.node.location == 'Lab'",
"fields": {
"assignment_group": "Lab Support"
}
}
]
Each rule has:
-
fields, required: a map of column name to value. -
filter, optional: a JEXL condition with the same context as the Ticket Filter. A rule without a filter applies to every incident. -
name, optional: a label for the error messages.
The plugin applies every rule whose filter matches, in the given order.
A later rule replaces the value of an earlier one.
The example sets a default assignment group and replaces it for the nodes in the Lab location.
The plugin writes a default filter or mapping only at the first start, when the setting does not exist. A value that you clear and save stays empty after a restart. To get a default back, restore the default and save.
A value can contain JEXL expressions in ${…}:
[{"fields": {"u_node_label": "${alarm.node.label}", "u_source": "OpenNMS ${alarm.node.location}"}}]
A value that is one expression with the result null keeps the field as it is.
An example is ${alarm.node.label} for an alarm without a node.
So missing alarm data cannot clear a field that the default mapping or an earlier rule set.
To clear a field, give it the JSON value null:
[{"filter": "alarm.node.location == 'Lab'", "fields": {"cmdb_ci": null}}]
An expression ends at the first }.
Do not use JEXL map or set literals inside ${…}, because they contain }.
Values for Filters and Expressions
Rule filters and ${…} expressions use the same context as the Ticket Filter.
The alarm object is the Integration API alarm, ticket is the OpenNMS ticket.
| Expression | Value |
|---|---|
|
Alarm ID and reduction key |
|
Severity as label ( |
|
Alarm texts |
|
|
|
Managed object |
|
Times |
|
UEI of the last event |
|
Alarm attributes, a map |
|
True or false |
|
Node ID and label |
|
Requisition name and foreign ID |
|
Monitoring location |
|
List of node category names |
|
Node metadata entries |
|
Asset record, for example |
|
Values of the OpenNMS ticket |
|
Ticket attributes, a map |
Examples:
[
{"fields": {"u_requisition": "${alarm.node.foreignSource}"}},
{"filter": "alarm.node.categories.contains('Production')", "fields": {"urgency": "1"}},
{"filter": "alarm.node.foreignSource == 'customer-a'", "fields": {"assignment_group": "Customer A Desk"}}
]
|
ServiceNow sets the rules for the values, not the plugin:
|
Incident Close Code
When the plugin resolves an incident, after an alarm clear or a ticket close in OpenNMS, it sends the configured close code.
The default is Solution provided, the value that earlier plugin releases always sent.
Close codes differ between ServiceNow releases and instances. Zurich, for example, has no Solution provided.
The close code setting lists the close codes of the connected instance. Select the one your instance uses for a fix by the monitoring system.
The plugin reads the list with the integration user. No additional role is necessary.
When the stored close code is not on the instance, the plugin shows a warning at the ticket forwarding setting and at the close code setting.
Resolves fail until you select a code. The ticket log then shows the ServiceNow reply, for example Data Policy Exception: Resolution code mandatory.
To list the close codes with the REST API, use an admin user. The sys_choice table is closed to the itil role:
curl -u 'admin:<password>' \
"https://<your-instance>.service-now.com/api/now/table/sys_choice?sysparm_query=name=incident^element=close_code^inactive=false&sysparm_fields=label"
Incident Links on the Alarm Page
While ticket forwarding is enabled, the ticket ID on the OpenNMS alarm detail page links to the ServiceNow record (<instance-url>/task.do?sys_id=<ticket-id>).
ServiceNow opens an incident or a case in the form of its own table.
The plugin sets the link template from the instance URL.
You do not need to edit opennms.properties.
When you disable ticket forwarding, the plugin removes the link.
Automated Ticketing with Alarm Rules
| The plugin gives the ServiceNow integration. Automatic ticket creation and closure need the Drools alarm rules of OpenNMS. Without these rules, a user creates and closes tickets in the OpenNMS UI or through the REST API. |
OpenNMS has ticketing rules in $OPENNMS_HOME/etc/alarmd/drools-rules.d/alarmd.drl.
They are disabled by default.
To enable a rule, change enabled false to enabled true in the rule and restart OpenNMS.
| Rule | Function | Timing |
|---|---|---|
|
Creates an incident for a problem alarm and acknowledges the alarm. This is the main rule for automatic tickets. |
15 min after the alarm is stable |
|
Creates an incident for a CRITICAL alarm after a shorter wait. |
5 min after the alarm is stable |
|
Closes the incident when the alarm clears in OpenNMS. |
15 min after the clear |
|
Reads the incident state from ServiceNow and updates the ticket state in OpenNMS. |
Every 15 min |
|
Clears the alarm in OpenNMS when the incident is resolved or closed in ServiceNow. |
At once |
Recommended Rules
For most installations, enable all five rules:
-
createTickets: automatic incident creation -
closeClearedAlarmTickets: automatic incident closure when the alarm clears -
updateTicketsandclearAlarmsForClosedTickets: an incident resolved in ServiceNow clears the alarm in OpenNMS
The updateTickets rule reads the incident and maps the state as in Incident State to Ticket State.