Skip to content

Alertmanager native integration jira problem #4293

Open
@OlegF31

Description

@OlegF31

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions