alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Alertmanager native integration jira problem

Open OlegF31 opened this issue 1 year ago • 0 comments

Hello.

I am configuring Alertmanager native integration with Jira. Before upgrading to version 0.28.0, we were using the jira-ab receiver. We are using Jira Data Center.

  - api_url: http://hostname-jira/rest/api/2/
    description: '{{ template "jira.default.description" . }}'
    fields:
      components:
      - name: Monitoring
      customfield_10001: Auto-created by Alertmanager
    http_config:
      basic_auth:
        password: <pass>
        username: jiralert
    issue_type: Bug
    labels:
    - alertmanager
    - '{{ .CommonLabels.severity }}'
    priority: '{{ .CommonLabels.severity }}'
    project: MON
    reopen_duration: 1h
    reopen_transition: Reopen
    send_resolved: true
    summary: '{{ template "jira.default.summary" . }}'
  name: receiver-jira-dc

route:
  - continue: true
    group_by:
    - alertname
    - instance
    matchers:
    - alertname = "TestJiraAlert"
    receiver: receiver-jira-dc

However, when sending a test alert, I receive the following message:

time=2025-03-05T10:02:55.603Z level=WARN source=jira.go:145 msg="Truncated summary" integration=jira group_key="{}/{alertname=\"TestJiraAlert\"}:{alertname=\"TestJiraAlert\", instance=\"<name>:9100\"}" max_runes=255

It seems that the correct issue is not being found, and it tries to use the most recently resolved one. I suspect the issue is related to the template configuration.

{{ define "jira.summary" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join "," }}{{ end }}

{{ define "jira.description" }}{{ range .Alerts.Firing }}Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Source: {{ .GeneratorURL }}
{{ end }}
CommonLabels:
{{ range .CommonLabels.SortedPairs }} - {{ .Name }} = {{ .Value}}
{{ end }}
GroupLabels:
{{ range .GroupLabels.SortedPairs }} - {{ .Name }} = {{ .Value}}
{{ end }}
{{ end }}

I need help. What am I doing wrong?

OlegF31 avatar Mar 05 '25 10:03 OlegF31