
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
本镜像基于Prometheus Alertmanager构建,扩展了对企业***消息的支持,允许将监控告警通过企业微信API发送到指定群组或用户,提升告警通知的及时性和可达性。源代码托管于https://github.com/hai046/alertmanager%E3%80%82
wechat_,详见https://github.com/hai046/alertmanager/tree/master/examples/ha核心配置文件为alertmanager.yml,主要包含以下部分:
全局配置(global)
yamlglobal: wechat_api_url: 'https://qyapi.weixin.qq.com/cgi-bin/' # 企业微信API地址 wechat_api_secret: '#wechat_api_secret' # 企业微信应用密钥 wechat_api_corp_id: '#wechat corp id' # 企业微信企业ID resolve_timeout: 1m # 告警解决超时时间
路由配置(route)
yamlroute: group_by: ['application'] # 按标签分组 group_wait: 30s # 组内第一个告警等待时间 group_interval: 1m # 组内新告警间隔时间 repeat_interval: 1m # 重复告警间隔时间 receiver: 'groupWechat' # 默认接收器
接收器配置(receivers)
支持***和个人消息发送,示例:
yamlreceivers: - name: 'groupWechat' # 群组接收器 wechat_configs: - send_resolved: true # 发送告警解决通知 to_tag: '服务报警' # 标签标识 message_type: 'groupMarkdown' # 消息类型(群Markdown) message: '{{ template "wechat.default.groupMessage" . }}' # 消息模板 agent_id: '#wechat agent id' # 企业微信应用ID group_title: '{{ template "wechat.default.groupTitle" . }}' # 群聊标题 group_users: # 群成员列表 - haizhu - FengYu - name: 'wechat' # 个人接收器 wechat_configs: - send_resolved: true to_user: "xxx" # 接收用户ID to_tag: '服务报警' message_type: 'groupMarkdown' message: '{{ template "wechat.default.message" . }}' agent_id: '#wechat agent id'
告警抑制规则(inhibit_rules)
yamlinhibit_rules: - source_match: severity: 'critical' # 源告警级别 target_match: severity: 'warning' # 目标告警级别 equal: ['alertname', 'dev', 'instance'] # 匹配标签
1. 单容器运行
bashdocker run -d \ --name alertmanager-wechat \ -p 9093:9093 \ -v /path/to/alertmanager.yml:/etc/alertmanager/alertmanager.yml \ -v /path/to/templates:/etc/alertmanager/config \ ha046/alertmanager:latest
2. Docker Compose配置
yamlversion: '3' services: alertmanager: image: ha046/alertmanager:latest container_name: alertmanager-wechat ports: - "9093:9093" volumes: - ./alertmanager.yml:/etc/alertmanager/alertmanager.yml - ./templates:/etc/alertmanager/config restart: always
使用以下脚本发送测试告警:
bash#!/usr/bin/env bash alerts1='[ { "labels": { "application": "app1", "instance": "instance1", "groupTitle": "微服务测试" }, "startsAt": "2021-01-20T14:31:39.000Z", "endsAt": "2021-06-28T04:09:43.534Z", "annotations": { "summary": "summary info", "message": "message content" }, "generatorURL": "http://example.com" } ]' curl -XPOST -d"$alerts1" -H "Content-Type:application/json" http://localhost:9093/api/v2/alerts
执行脚本后,企业***将收到相应的告警通知。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务