discord.tmpl


Overview

The `discord.tmpl` file is a Go template used by the Alertmanager component of the monitoring system to format alert notifications sent to Discord channels. Its primary purpose is to generate human-readable and well-structured alert messages that provide clear context about the status and details of alerts triggered by Prometheus.

This template is part of the alerting configuration for the ShapeShift Unchained platform, enabling the delivery of timely and informative alerts directly into Discord channels. It complements the alert routing and notification logic defined in Alertmanager’s configuration, ensuring that messages are clear, concise, and actionable for the on-call teams.


Detailed Explanation

The file defines two template blocks:

1. discord.title


2. discord.message


Implementation Details


Interaction with Other System Components


Usage Example in Alertmanager Configuration

receivers:
  - name: "discord_critical"
    webhook_configs:
    - url: "https://discord.com/api/webhooks/..."
      send_resolved: true
      http_config:
        # ...
      message: |
        {{ template "discord.message" . }}
      title: |
        {{ template "discord.title" . }}

Visual Diagram

flowchart TD
    A[Alertmanager] -->|Passes Alert Group| B["discord.title" Template]
    A -->|Passes Alert Group| C["discord.message" Template]
    B --> D[Formatted Title String]
    C --> E[Formatted Message Body]
    D & E --> F[Discord Notification Payload]
    F --> G[Discord Webhook]
    G --> H[Discord Channel]

    subgraph Template Rendering
        B
        C
    end

    style A fill:#f9f,stroke:#333,stroke-width:1px
    style G fill:#4f8ef7,stroke:#333,stroke-width:1px,color:#fff
    style H fill:#7289da,stroke:#333,stroke-width:1px,color:#fff

Summary


*End of documentation for `discord.tmpl`*