Operations 7 min read

Configure Alertmanager to Send Alerts to Email, DingTalk, and WeChat

This guide walks you through modifying Alertmanager’s configuration to deliver alerts via QQ email, DingTalk chat‑bot webhooks, and Enterprise WeChat, including SMTP settings, webhook plugin installation, and the required wechat_configs parameters for seamless integration.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Configure Alertmanager to Send Alerts to Email, DingTalk, and WeChat

Configure Alertmanager to Send Alerts to Email

First, edit alertmanager.yml to use an SMTP server for email notifications. The example below uses a 163.com mailbox:

global:
  resolve_timeout: 1m
  smtp_smarthost: 'smtp.163.com:25'
  smtp_from: '[email protected]'
  smtp_auth_username: '15011572657'
  smtp_auth_password: 'BDBPRMLNZGKWRFJP'
  smtp_require_tls: false

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 10m
  receiver: default-receiver

receivers:
- name: 'default-receiver'
  email_configs:
  - to: '[email protected]'
    send_resolved: true

Key fields explained: smtp_smarthost: address and port of the SMTP server. smtp_from: the sender address. smtp_auth_username and smtp_auth_password: authentication credentials (the password is an SMTP authorization code, not the login password). to under email_configs: the recipient mailbox; replace with your own address.

Configure Alertmanager to Send Alerts to DingTalk

1. Create a custom robot in the desktop version of DingTalk and obtain its webhook URL.

Example webhook URL:

https://oapi.dingtalk.com/robot/send?access_token=9c03ff1f47b1d15a10d852398cafb84f8e81ceeb1ba557eddd8a79e5a5e5548e

2. Download and install the DingTalk webhook plugin for Prometheus:

tar zxvf prometheus-webhook-dingtalk-0.3.0.linux-amd64.tar.gz

The plugin archive is hosted at:

https://pan.baidu.com/s/1_HtVZsItq2KsYvOlkIP9DQ (extraction code: d59o)

3. Start the plugin on the master node:

nohup ./prometheus-webhook-dingtalk \
  --web.listen-address="0.0.0.0:8060" \
  --ding.profile="cluster1=https://oapi.dingtalk.com/robot/send?access_token=9c03ff1f47b1d15a10d852398cafb84f8e81ceeb1ba557eddd8a79e5a5e5548e" &

4. Add a DingTalk receiver to alertmanager.yml:

global:
  resolve_timeout: 1m
  smtp_smarthost: 'smtp.163.com:25'
  smtp_from: '[email protected]'
  smtp_auth_username: '15011572657'
  smtp_auth_password: 'BDBPRMLNZGKWRFJP'
  smtp_require_tls: false

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 10m
  receiver: cluster1

receivers:
- name: cluster1
  webhook_configs:
  - url: 'http://192.168.124.16:8060/dingtalk/cluster1/send'
    send_resolved: true

Configure Alertmanager to Send Alerts to Enterprise WeChat

1. Register an Enterprise WeChat account at https://work.weixin.qq.com/, create an application (e.g., named wechat), and note the following credentials: corp_id: your enterprise CorpID (e.g., wwa82df90a693abb15) agent_id: the application’s AgentId (e.g., 1000003) api_secret: the application’s Secret (e.g., Ov5SWq_JqrolsOj6dD4Jg9qaMu1TTaDzVTCrXHcjlFs)

2. Update alertmanager.yml with a wechat_configs block:

global:
  smtp_smarthost: 'smtp.163.com:25'
  smtp_from: '[email protected]'
  smtp_auth_username: '15011572657'
  smtp_auth_password: '1989317li'
  smtp_require_tls: false

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 3m
  receiver: "prometheus"

receivers:
- name: 'prometheus'
  wechat_configs:
  - corp_id: wwa82df90a693abb15
    to_user: '@all'
    agent_id: 1000003
    api_secret: Ov5SWq_JqrolsOj6dD4Jg9qaMu1TTaDzVTCrXHcjlFs

Parameter meanings: corp_id: identifies the enterprise. api_secret (or secret): the application secret used for authentication. agent_id: the ID of the created WeChat application. to_user: set to @all to broadcast alerts to all members. wechat (the name of the custom app) must match the receiver name in the route section.

After saving the configuration, reload Alertmanager. Alerts will now be delivered to the specified email address, DingTalk group, and Enterprise WeChat users.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

monitoringKubernetesDevOpsWeChatDingTalk
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.