{"id":40976576,"url":"https://github.com/bougou/alertmanager-webhook-adapter","last_synced_at":"2026-01-22T06:52:48.527Z","repository":{"id":53895040,"uuid":"355049439","full_name":"bougou/alertmanager-webhook-adapter","owner":"bougou","description":"A general webhook server for receiving Prometheus Alertmanager's notifications and send them through different channel types.","archived":false,"fork":false,"pushed_at":"2025-09-10T08:03:07.000Z","size":3503,"stargazers_count":60,"open_issues_count":0,"forks_count":18,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-10T11:06:20.460Z","etag":null,"topics":["alertmanager","prometheus","webhook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bougou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-06T03:51:30.000Z","updated_at":"2025-09-10T07:36:01.000Z","dependencies_parsed_at":"2024-06-19T13:35:01.651Z","dependency_job_id":"6ddb9e67-9dba-47f7-a899-b6e0272f1fcc","html_url":"https://github.com/bougou/alertmanager-webhook-adapter","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"5cbf4079858533b3afe6a92bed43f693af90805a"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/bougou/alertmanager-webhook-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougou%2Falertmanager-webhook-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougou%2Falertmanager-webhook-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougou%2Falertmanager-webhook-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougou%2Falertmanager-webhook-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bougou","download_url":"https://codeload.github.com/bougou/alertmanager-webhook-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougou%2Falertmanager-webhook-adapter/sbom","scorecard":{"id":249012,"data":{"date":"2025-08-11","repo":{"name":"github.com/bougou/alertmanager-webhook-adapter","commit":"abbef89a912aceedce54872c569bb97a60919f27"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release-binary.yaml:1","Warn: no topLevel permission defined: .github/workflows/release-docker.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release-docker.yaml:12"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.1.9 not signed: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/176046837","Warn: release artifact v1.1.8 not signed: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/167587190","Warn: release artifact v1.1.7 not signed: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/156830588","Warn: release artifact v1.1.6 not signed: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/113343460","Warn: release artifact v1.1.5 not signed: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/103763369","Warn: release artifact v1.1.9 does not have provenance: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/176046837","Warn: release artifact v1.1.8 does not have provenance: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/167587190","Warn: release artifact v1.1.7 does not have provenance: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/156830588","Warn: release artifact v1.1.6 does not have provenance: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/113343460","Warn: release artifact v1.1.5 does not have provenance: https://api.github.com/repos/bougou/alertmanager-webhook-adapter/releases/103763369"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-binary.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-binary.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-binary.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-binary.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-binary.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-binary.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-docker.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-docker.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-docker.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-docker.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-docker.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-docker.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-docker.yaml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-docker.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-docker.yaml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/bougou/alertmanager-webhook-adapter/release-docker.yaml/main?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating golang:1.18 to golang:1.18@sha256:50c889275d26f816b5314fc99f55425fa76b18fcaf16af255f5d57f09e1f48da","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0619 / GHSA-r48q-9g5r-8q2h","Warn: Project is vulnerable to: GO-2022-0968 / GHSA-gwc9-m7rh-j2ww","Warn: Project is vulnerable to: GO-2021-0356 / GHSA-8c26-wmh5-6g9v","Warn: Project is vulnerable to: GO-2024-2961","Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8","Warn: Project is vulnerable to: GO-2021-0113 / GHSA-ppp9-7jff-5vj2","Warn: Project is vulnerable to: GO-2022-1059 / GHSA-69ch-w2m2-3vjp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T08:07:29.477Z","repository_id":53895040,"created_at":"2025-08-17T08:07:29.477Z","updated_at":"2025-08-17T08:07:29.477Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28657376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alertmanager","prometheus","webhook"],"created_at":"2026-01-22T06:52:48.004Z","updated_at":"2026-01-22T06:52:48.519Z","avatar_url":"https://github.com/bougou.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alertmanager-webhook-adapter\n\nA general webhook server for receiving [Prometheus AlertManager](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config)'s notifications and send them through different channel types.\n\n\n## Supported Notification Channels\n\n- `weixin`, Weixin Group Bot / 企业微信群机器人\n\n  ```\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=weixin\u0026token={token}\n  ```\n\n- `dingtalk`, Dingtalk Group Bot / 钉钉群机器人\n\n  ```\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=dingtalk\u0026token={token}\n  ```\n\n- `feishu`, Feishu Group Bot / 飞书群机器人\n\n  ```\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=feishu\u0026token={token}\n  ```\n\n- `weixinapp`, Weixin Application / 企业微信应用\n\n  ```bash\n  # Must specify one of to_user, to_party, to_tag parameter\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=weixinapp\u0026corp_id={corp_id}\u0026agent_id={agent_id}\u0026agent_secret={agent_secret}\u0026to_user={user_id}\u0026to_party={party_id}\u0026to_tag={tag_id}\n\n  # to_user 指定接收消息的成员，成员 ID 列表（多个接收者用 '|' 分隔，最多支持 1000 个）\n  # 指定为 \"@all\"，则向该企业应用的全部成员发送\n\n  # to_party 指定接收消息的部门，部门 ID 列表，多个接收者用 '|' 分隔，最多支持 100 个\n  # 当 to_user 为 \"@all\" 时忽略本参数\n\n  # to_tag 指定接收消息的标签，标签 ID  列表，多个接收者用 '|' 分隔，最多支持 100 个\n  # 当 to_user 为 \"@all\" 时忽略本参数\n  ```\n\n- `slack`, Slack App\n\n  ```\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=slack\u0026token=\u003ctoken\u003e\u0026channel=\u003cchannel\u003e\n  ```\n\n- `discord-webhook`, Discord Webhook\n\n  ```bash\n  http(s)://{this-webhook-server-addr}/webhook/send?channel_type=discord-webhook\u0026id={id}\u0026token={token}\n\n  # discord webhook url:\n  # https://discord.com/api/webhooks/{id}/{token}\n  # https://discord.com/api/webhooks/12673xx/adruxxx\n  ```\n\n\u003e More is comming...\n\n## Run\n\n### Build and Run\n\n```bash\n$ cd cmd/alertmanager-webhook-adapter\n$ go build -v -x\n\n$ ./alertmanager-webhook-adapter\n\n# see help\n$ ./alertmanager-webhook-adapter -h\n\n# Add signature for sent messages\n$ ./alertmanager-webhook-adapter --listen-address=:8060 --signature \"Anything-You-Like\"\n# the signature will be added to the beginning of the message:\n# 【Anything-You-Like】this-is-the-xxxxxxxxxx-message\n```\n\n### Start as systemd service\n\n```bash\n# Install the binary alertmanager-webhook-adapter file to some directory\n# like /usr/local/bin/alertmanager-webhook-adapter\n# and chmod +x /usr/local/bin/alertmanager-webhook-adapter\n\n$ cp deploy/alertmanager-webhook-adapter.service /etc/systemd/system/\n\n# make sure the bin path to be consistent\n# ExecStart=\n$ vim /etc/systemd/system/alertmanager-webhook-adapter.service\n\n$ systemctl daemon-reload\n$ systemctl start\n```\n\n### Run as Docker container\n\n```bash\n# expose the host port (127.0.0.1:8090) to container port (8090)\ndocker run --rm -it -p 127.0.0.1:8090:8090 bougou/alertmanager-webhook-adapter:v1.1.10\n\ndocker run --rm -it -p 127.0.0.1:8090:8090 bougou/alertmanager-webhook-adapter:v1.1.10 --signature MyIDC --lang zh --debug\n```\n\n### Run in K8S\n\nApply manifests:\n\n```bash\ncd deploy/k8s\nkubectl apply -f deployment.yaml\nkubectl apply -f service.yaml\n```\n\nOr Deploy with Helm\n\n```bash\n# prepare custom values.yaml\n# see: https://github.com/bougou/alertmanager-webhook-adapter/blob/main/deploy/charts/alertmanager-webhook-adapter/values.yaml\nvim values.yaml\n\nhelm repo add bougoucharts https://bougou.github.io/charts\nhelm repo update\n\nhelm upgrade alertmanager-webhook-adapter \\\n  bougoucharts/alertmanager-webhook-adapter \\\n  --install \\\n  --namespace infra \\\n  --version v1.0.1 \\\n  --values values.yaml\n```\n\n## Configure Alertmanager to send alert messages to this webhook server\n\n```yaml\n- name: 'sre-team'\n  webhook_configs:\n  - url: \"http://10.0.0.1:8090/webhook/send?channel_type=weixin\u0026token=1234-1234-1234\"\n```\n\n## Command\n\n```\n$ ./alertmanager-webhook-adapter -h\nalertmanager-webhook-adapter\n\nUsage:\n  alertmanager-webhook-adapter [flags]\n\nFlags:\n  -h, --help                    help for alertmanager-webhook-adapter\n  -l, --listen-address string   the address to listen (default \"0.0.0.0:8090\")\n  -s, --signature string        the signature (default \"未知\")\n  -n, --tmpl-default string     the default tmpl name\n  -d, --tmpl-dir string         the tmpl dir\n      --tmpl-lang string        the language for template filename\n  -t, --tmpl-name string        the tmpl name\n```\n\n## Builtin Templates Notification Screenshots\n\n- [Chinese](./docs/screenshot-zh.md)\n\n| WeixinGroupBot                                | WeixinApp                                        | DingTalkGroupBot                                | FeishuGroupBot                                |\n| --------------------------------------------- | ------------------------------------------------ | ----------------------------------------------- | --------------------------------------------- |\n| \u003cimg src=\"./docs/weixin_en.png\" width=\"200\"/\u003e | \u003cimg src=\"./docs/weixinapp_en.png\" width=\"200\"/\u003e | \u003cimg src=\"./docs/dingtalk_en.png\" width=\"200\"/\u003e | \u003cimg src=\"./docs/feishu_en_2.png\" width=\"200\"/\u003e |\n\n| Slack App                                    |\n| -------------------------------------------- |\n| \u003cimg src=\"./docs/slack_en.png\" width=\"200\"/\u003e |\n\n## Custom Templates\n\nThe project already has builtin templates for all supported notification channels.\nBut you can use your own template file(s) to override those defaults.\n\nYou can use the following three options.\n\n-  `--tmpl-dir (-d)`\n-  `--tmpl-name (-t)`\n-  `--tmpl-default (-n)`\n\nThe `--tmpl-dir` is a MUST if you want to load your custom templates. `--tmpl-name` and `--tmpl-default` is optional. So, there are THREE use cases when combining those options.\n\n1. `--tmpl-dir \u003csomepath\u003e`\n2. `--tmpl-dir \u003csomepath\u003e --tmpl-name \u003ctmplname\u003e`\n3. `--tmpl-dir \u003csomepath\u003e --tmpl-default \u003ctmplname\u003e`\n\n\u003e If `--tmpl-name` and `--tmpl-default` are both specified, `--tmpl-default` will be ignored.\n\nThese three use cases are used for different purposes.\n\n### `--tmpl-dir`\n\n\u003e **Purpose**: Use different template files for different channels\n\nFirst, create a dir to store your template files, like `templates`. And then put your template files under the template dir.\n\nThe program will **try to search `\u003cchannel\u003e.tmpl` files** under the tmpl dir for all supported channels,\nand use the founded file as the template for the corresponding channel. If not found, use builtin template.\n\n```bash\n$ touch templates/feishu.tmpl\n$ touch templates/weixin.tmpl\n\n# use templates/feishu.tmpl for feishu channel\n# use templates/weixin.tmpl for weixin channel,\n# use builtin templates for other channels.\n$ ./alertmanager-webhook-adapter -s Bougou --tmpl-dir ./templates/\n```\n\n### `--tmpl-dir` and `--tmpl-name`\n\n\u003e **Purpose**: Use one custom template for all channels.\n\nCreate your own template file, like `custom.tmpl`, and put it under the template dir.\nThe filename with suffix removed will be the template name and be used as value of the `--tmpl-name` parameter.\n\nThe program will **try to search `\u003ctmplName\u003e.tmpl` file** under the tmpl dir.\nThe selected tmpl file will be used for all notification channels. If not found, error and exit.\n\n```bash\n# use templates/custom.tmpl for all channels.\n$ ./alertmanager-webhook-adapter -s Bougou --tmpl-dir ./templates/ --tmpl-name custom\n```\n\n### `--tmpl-dir` and `--tmpl-default`\n\n\u003e **Purpose**: Use different template files for only several channels, and use an extra template file for all other channels.\n\n```bash\n$ touch templates/feishu.tmpl\n$ touch templates/weixin.tmpl\n\n$ touch templates/default.tmpl\n\n# use templates/feishu.tmpl for feishu channel\n# use templates/weixin.tmpl for weixin channel,\n# use templates/default.tmpl for other channels.\n$ ./alertmanager-webhook-adapter -s Bougou --tmpl-dir ./templates/ --tmpl-default default\n```\n\n### Template Content\n\nThe template file should use an [`AlertmanagerWebhookMessage`](./pkg/models/alert.go) object as the input data.\n\n```go\ntype AlertmanagerWebhookMessage struct {\n\tVersion         string           `json:\"version\"`\n\tGroupKey        *json.RawMessage `json:\"groupKey\"`\n\tTruncatedAlerts int              `json:\"truncatedAlerts\"`\n\n\tStatus            string `json:\"status\"`\n\tReceiver          string `json:\"receiver\"`\n\tAlerts            Alerts `json:\"alerts\"`\n\tGroupLabels       KV     `json:\"groupLabels\"`\n\tCommonLabels      KV     `json:\"commonLabels\"`\n\tCommonAnnotations KV     `json:\"commonAnnotations\"`\n\tExternalURL       string `json:\"externalURL\"`\n\n\tMessageAt time.Time `json:\"messageAt\"` // the time the webhook message was received\n\tSignature string    `json:\"signature\"` // 签名，如发送短信时出现在内容最前面【】\n}\n```\n\nAll template files MUST define the following template parts in the template file.\n\n- `prom.title`\n- `prom.text`\n- `prom.markdown`\n\n## Language for template files\n\nWhen loading template files, the program defaults to try to load files with name `\u003cchannelName\u003e.tmpl` or `\u003ctmplName\u003e.tmpl` or `\u003ctmplDefault\u003e.tmpl`.\n\nBut you can specify the option `--tmpl-lang \u003clang\u003e` to change the loading rule.\n\nIf `--tmpl-lang \u003clang\u003e` is specified, **and the specified lang is NOT equal to `en`**, the program will try to load files with name `\u003cchannelName\u003e.\u003clang\u003e.tmpl` or `\u003ctmplName\u003e.\u003clang\u003e.tmpl` or `\u003ctmplDefault\u003e.\u003clang\u003e.tmpl`.\nIf `\u003clang\u003e` equals to `en`, the default loading rule is NOT changed.\n\nThe `\u003clang\u003e` can be any string, just make sure it matches your desired file names.\n\nThis project already builtin supports two languages, `en` for english, `zh` for chinese. It defaults to `en` if `--tmpl-lang` is not specified.\n\n\u003e The `--tmpl-lang` only impacts which files will be loaded, it does not care the contents of the files.\n\n## How AlertInstance is determined?\n\nThe default notification templates will try its best to print the alert instance information for each alert.\nThe alert instance is determined from the labels of the alerts.\n\nThe following labels of the alerts are sought by priority order and selected as \"alert instance\" if the label is found.\n\n- `alertinstance`\n- `instance`\n- `node`\n- `nodename`\n- `host`\n- `hostname`\n- `ip`\n\nIn prometheus, most metrics may provide `instance`, or `node` or `ip` label, but its value may not be suitable for alert information. Then, I recommend to use\nthe following two methods to add an extra `alertinstance` label when writing alert rules.\n\n1. Use PromQL function [`label_join`](https://prometheus.io/docs/prometheus/latest/querying/functions/#label_join), eg:\n\n    ```yaml\n    - alert: KubePodCrashLooping\n      expr: label_join(max_over_time(kube_pod_container_status_waiting_reason{reason=\"CrashLoopBackOff\", job=\"kube-state-metrics\", namespace=~\".*\"}[5m]) \u003e= 1, 'alertinstance', '/', 'namespace', 'pod')\n      for: 15m\n      labels:\n        severity: warning\n      annotations:\n        description: 'Pod {{ $labels.namespace }}/{{ $labels.pod }} ({{ $labels.container }}) is in waiting state (reason: \"CrashLoopBackOff\").'\n        summary: Pod is crash looping.\n    ```\n\n2. (Preferred) Directly add `alertinstance` label, eg:\n\n    ```yaml\n    - alert: KubePodCrashLooping\n      expr: max_over_time(kube_pod_container_status_waiting_reason{reason=\"CrashLoopBackOff\", job=\"kube-state-metrics\", namespace=~\".*\"}[5m]) \u003e= 1\n      for: 15m\n      labels:\n        severity: warning\n        alertinstance: '{{ $labels.namespace }}/{{ $labels.pod }}'\n      annotations:\n        description: 'Pod {{ $labels.namespace }}/{{ $labels.pod }} ({{ $labels.container }}) is in waiting state (reason: \"CrashLoopBackOff\").'\n        summary: Pod is crash looping.\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbougou%2Falertmanager-webhook-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbougou%2Falertmanager-webhook-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbougou%2Falertmanager-webhook-adapter/lists"}