Git Product home page Git Product logo

a2w's Introduction

Alertmanager to WeCom

docker-image-ci

通过 企业微信机器人 发送 Alertmanager 通知。

使用方式

  1. 运行本项目:

    make run

    或是部署在 Docker 中:

    make docker-run

    或是直接使用 Docker Hub 中已发布的镜像:

    docker run --name a2w -d -p 5001:5001 rea1shane/a2w

    或是通过 Helm 部署在 Kubernetes 中:

    make helm-install

    查看项目使用说明:

    make help
  2. 在企业微信中创建机器人,在机器人的“webhook 地址”中获取 key 值,webhook 样式为:https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={key}

  3. 修改 Alertmanager 配置文件:

    route:
      receiver: "a2w"
    receivers:
      - name: "a2w"
        webhook_configs:
          - url: "http://{a2w_address}/send?key={key}"

演示

要想查看 A2W 的演示,请查看 demo 文件夹中的内容。

时区

程序使用本地时区格式化时间。

Docker 镜像的默认时区为 Asia/Shanghai。如果想要修改 Docker 镜像的时区,可以在 docker run 时使用参数 -e TZ={TIME_ZONE} 进行指定,如:

docker run --name a2w -d -p 5001:5001 -e TZ=Asia/Tokyo rea1shane/a2w

消息模板

消息模板决定了企业微信机器人发出的消息格式,修改 Makefile 中的 TEMPLATE 变量的值来选择模板。

模板的使用说明请看同路径下的同名 Markdown 文件,模板的效果图请看同路径下的同名图片文件。

因为企业微信机器人接口限制单条消息的最大长度为 4096,所以本软件会对大于此限制的长消息进行分段。如果你使用自定义模板,请在想要分段的地方留一个空行(在企业微信中,至少三个连续的 \n 才被认为是一个空行),以便本软件对消息进行正确的分段。

构建项目

编译二进制文件:

make build

或是构建 Docker 镜像:

make docker-build

a2w's People

Contributors

rea1shane avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

a2w's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.