跳至主要內容

3 zabbix添加报警媒介

Clay监控Zabbix约 189 字小于 1 分钟

3 zabbix添加报警媒介

zabbix添加报警媒介

进入zabbix-web,点击Administrator-->Media types-->Create Media type

添加Email报警

添加钉钉报警

推荐文章

Zabbix使用JavaScript配置Webhook发送告警通知open in new window

image-20200115103302741

图中Script内容如下

try {
    Zabbix.Log(4, 'dingding webhook script value='+value)
 
    var result = {
        'tags': {
            'endpoint': 'ding'
        }
    },
    params = JSON.parse(value),
    req = new CurlHttpRequest(),
    fields = {},
    resp;
 
    req.AddHeader('Content-Type: application/json');
 
    fields.msgtype = params.msgtype;
    fields.text = {
      "content":params.content
    };
    resp = req.Post('https://oapi.dingtalk.com/robot/send?access_token=1163d78d7b8a324d2f5b284414da8e93560008689744495ab4ad3eae14bdd642',
        JSON.stringify(fields)
    );
 
    if (req.Status() != 201) {
        throw 'Response code: '+req.Status();
    }
 
    resp = JSON.parse(resp);
    result.tags.issue_id = resp.id;
    result.tags.issue_key = resp.key;
} catch (error) {
    Zabbix.Log(4, 'jira issue creation failed json : '+JSON.stringify({"fields": fields}));
    Zabbix.Log(4, 'jira issue creation failed : '+error);
 
    result = {};
}
 
return JSON.stringify(result);

参考官方文档:https://www.zabbix.com/documentation/current/manual/config/notifications/media/webhook

添加完告警媒介,就可以给用户Administrator用户,添加这两个报警媒介了。