INFO-企业微信webhook报警

适用模块

报警组件 easyalert

具体说明

企业微信机器人告警信息发至群组

使用示例

一、获取群机器人信息
1、群管理添加机器人
2、查看机器人webhook 地址

INFO-企业微信webhook报警 - 图1 INFO-企业微信webhook报警 - 图2

调试参照: https://developer.work.weixin.qq.com/document/path/99110

二、easyops advanced配置

1、template.channel.conf:

3 = {
  id = 6
  name = yixin
  clz = "qw-webhook"
  text = "企微-webhook"
  enable = true
}

2、添加template.plugin_qw_webhook.conf string类型,

下属配置url换成webhook 地址

name = "qw-webhook"
post = true
url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxx"
//
setting = {
  wrap = "\n"
}
//
command = """
  function replace(String a){
    if(a == null){
      return a;
    } else {
      return org.apache.commons.lang3.StringUtils.replace(a, wrap, "\\n");
    }
  }
  content = replace(content);
"""
header = {
}

param = {
}

body = {
  "msgtype": "text",
  "text": {
    "content": "#{content}"
  }
}

3、更新当前配置组-批量应用该版本-同步配置并重启服务

INFO-企业微信webhook报警 - 图3


作者:林帅