The
Jira Service Management Connector supports problem detection and alerting and notification use cases.
To alert on Dynatrace problems in Jira Service Management, use the ready-made workflow template Send problem as alert to Jira Service Management. The template is a starting point for both fine-tuning your notification content, and the heavier work of mapping the Davis problem data structure to the Atlassian Jira Service Management operations REST API.
The Send problem as alert to Jira Service Management workflow template combines a simple workflow, its problem trigger, and the mappings for each input field of the Send alert action.
To find and create this simple workflow from the template, follow the steps in the workflow template page.
The template sets the trigger's Minimum duration to 5 minutes, which postpones triggering so short-lived problems never raise an alert. The trigger's Event category setting still matches almost every category.
The trigger uses the following values:
active and closed.
The same workflow can create and close alerts.Info.5 minutes to avoid alerting for short-lived problems.Send alert actionThe Jira Service Management Send alert action creates, updates, acknowledges, and closes JSM alerts automatically based on events.
The action uses Jinja expressions for workflows to populate the input fields with dynamic Davis problem data.
The action uses the following values:
JSM connection: Select one of the JSM connections that you created during setup.
Message: This mapping uses the Problem title or a default generic value.
{{ event()["event.name"] | default("Dynatrace problem") }}
Priority: The mapping translates Dynatrace problem severity to JSM priority. One of P1, P2, P3, P4, or P5. It defaults to P3 if no mapping matches.
{% set priority = {"1": "P1","2": "P2","3": "P3","4": "P4","5": "P5"}%}{% set severity = event().get("event.severity") %}{{ priority.get(severity | string | trim, "P3") }}
State: ACTIVE problems create new alerts, whereas CLOSED problems close alerts in JSM.
{% set status = event().get("event.status") %}{% set jsmState = "UNKNOWN" %}{% if status == "ACTIVE" %}{% set jsmState = "CREATE" %}{% elif status == "CLOSED" %}{% set jsmState = "CLOSE" %}{% endif %}{{ jsmState }}
Tags: The mapping collects all values from each primary Grail tag property into a comma-separated string.
{% set ns = namespace(pairs=[]) %}{% for key, value in event().items() if key.startswith('primary_tags.') %}{% if value is iterable and value is not string %}{% for v in value %}{% set ns.pairs = ns.pairs + [key[13:] ~ ':' ~ v] %}{% endfor %}{% else %}{% set ns.pairs = ns.pairs + [key[13:] ~ ':' ~ value] %}{% endif %}{% endfor %}{{ ns.pairs | join(', ') }}
Consider the following example using a set of primary Grail tags on the Davis problem.
"primary_tags.team": ["biz_team"],"primary_tags.app": ["biz_backend", "biz_frontend"],"primary_tags.stage": ["production"],
After evaluating the expression, the workflow passes the resulting value to the send alert action.
team:biz_team, app:biz_backend, app:biz_frontend, stage:production
Alias: The identifier for deduplication and referencing of alerts in JSM.
The mapping uses the environment ID and the problem's display_id because these IDs stay the same across updates to the same problem and correctly identify your Dynatrace environment.
{{ environment()['id'] }} {{ event()["display_id"] | default("") }}
Note: Depending on the state of the problem, the mapping adds a different note. For a newly created alert, it includes a header, a link to the problem in Dynatrace, and a link to the Dynatrace workflow. When an alert is closed, it adds a note about the recovered affected entities.
{% set note = "" %}{% set status = event().get("event.status") %}{% if status == "ACTIVE" %}{% set note %}New alert for Problem {{ event()["display_id"] | default("") }} created.Problem link: {{ problem_link() | default("") }}Workflow link: {{ execution()["workflow"]["link"] }}{% endset %}{% elif status == "CLOSED" %}{% set note %}Alert for Problem closed.{% if event().get("smartscape.affected_entities") %}All {{ event()["smartscape.affected_entities"] | length }} entities recovered.{% endif %}{% endset %}{% endif %}{{ note | trim }}
Description: The textual description of the alert using the Davis problem description.
Responders: The template leaves this field empty deliberately, because the IDs are custom to each Jira Service Management cloud instance. You can refer to the Atlassian Jira Service Management operations REST API documentation for instructions on retrieving the ID of a user, team, schedule, or escalation.
For more information on the structure of the input field, see send alert action documentation.
This field takes effect only if you use a global integration instead of a team integration.
Actions: The template leaves this field empty as well. Add the names of any custom alert actions you want to expose on the alert.
Extra Properties: This field shows a set of problem properties in the details section of the JSM alert.
{% set rce = event().get("root_cause.smartscape_entity") %}{% set root_cause = (rce.name ~ " (" ~ rce.id ~ ")") if rce else "" %}{% set aes = event().get("smartscape.affected_entities") %}{% if aes is sequence and aes is not string %}{% set affected_entities = [] %}{% for ae in aes %}{% set _ = affected_entities.append(ae.name ~ " (" ~ ae.id ~ ")") %}{% endfor %}{% endif %}{% set res = event().get("smartscape.related_entities") %}{% if res is sequence and res is not string %}{% set related_entities = [] %}{% for re in res %}{% set _ = related_entities.append(re.name ~ " (" ~ re.id ~ ")") %}{% endfor %}{% endif %}{"affected_users_count": {{ event()['dt.davis.affected_users_count'] | default('0') }},"impact_level": "{{ event()['dt.davis.impact_level'] | default([]) | join(', ') }}","problem_category": "{{ event()['event.category'] | default('') }}","severity": {{ event()['event.severity'] | default('4') }},"root_cause_entity": "{{ root_cause }}","affected_entities": "{{ affected_entities | join(', ') }}","related_entities": "{{ related_entities | join(', ') }}"}
Entity: The name of the root cause entity, or the names of all affected entities, if no root cause was identified.
{% set entity = "" %}{% if event().get("root_cause.smartscape_entity") %}{% set entity = event()["root_cause.smartscape_entity"]["name"] | default("") %}{% elif event().get("smartscape.affected_entities") and event()["smartscape.affected_entities"] | length >= 1 %}{% set entity = event()["smartscape.affected_entities"] | map(attribute="name") | join(", ") %}{% endif %}{{ entity }}
Custom alert properties: Custom alert-processing rules in JSM can use this field, or you can use it to propagate additional information. The example adds the ID of the triggering event.
{"event.id": "{{ event()['event.id'] | default('') }}"}