当前位置:网站首页>zabbix支持钉钉报警
zabbix支持钉钉报警
2022-06-27 12:27:00 【(~ ̄▽ ̄)~凤凰涅槃】
安装zabbix-server ,zabbix-agent 服务端和启动就不类说了
Zabbix 钉钉自动监控报警
创建钉钉报警机器人







把webhook的地址记录下来
创建报警脚本
[[email protected]-server ~]# cd /usr/lib/zabbix/alertscripts
[[email protected]-server alertscripts]# vim dingding.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: sxdswc999
import requests
import json
import sys
import os
headers = {
'Content-Type': 'application/json;charset=utf-8'}
api_url = "这里是你的URL"
def msg(text):
json_text= {
"msgtype": "text",
"text": {
"content": text
},
"at": {
"atMobiles": [
""
],
"isAtAll": False
}
}
print (requests.post(api_url,json.dumps(json_text),headers=headers).content)
if __name__ == '__main__':
text = sys.argv[1]
msg(text)
安装python-pip和requests库
[[email protected] alertscripts]# yum -y install epel-release
[[email protected] alertscripts]# yum -y install python3-pip
[[email protected] alertscripts]# pip3 install requests
测试脚本是否可行
[[email protected] alertscripts]# python3 dingding.py “Zabbix test”
{
"errcode":0,"errmsg":"ok"}

pc端接收成功:

创建新的报警媒介:

![[]](/img/f9/5e900c146336ca6b04f408bad78ccc.png)

关联媒介


设置动作



钉钉报警测试
[[email protected] ~]# systemctl stop nginx

PC端接收成功:

边栏推荐
- Time management understood after being urged to work at home
- Threejs' ambient light + point light + parallel light + spherical light and Hepler understanding + shadow ()
- 【医学分割】unet3+
- A brief talk on cordola tree
- MIT6.031 软件构造 Reading7阅读笔记Designing Specifications(设计规范)
- gcc编译动态库和静态库
- 想学好C语言,操作符也很重要
- 微服务拆分
- picocli-入门
- hibernate操作oracle数据库 主键自增
猜你喜欢

JMETER连接DM8

Uni app develops wechat applet to dynamically render pages and dynamically change the order of page component modules

阿里一个面试题:使用两个线程,交替输出字母和数字

Sorting out XXL job learning

Esp32s3 iperf routine test esp32s3 throughput test

亚马逊测评掉评、留不上评是怎么回事呢?要如何应对?
Interview shock 60: what will cause MySQL index invalidation?

Topic37——64. Minimum path sum

The world's fastest download tool XDM

私藏干货分享:关于企业架构中如何进行平台化
随机推荐
Interview shock 60: what will cause MySQL index invalidation?
xxl-job学习梳理
Take stock of some easy-to-use and niche markdown editors
esp32s3 IPERF例程测试 esp32s3吞吐量测试
中证500股指期货怎么开户,国内正规的股指期货平台有哪些,在哪里开户最安全?
log4j.properties的配置详解
Win10彻底永久关闭自动更新的步骤
Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
阿里一个面试题:使用两个线程,交替输出字母和数字
大小端字节序
亚马逊测评掉评、留不上评是怎么回事呢?要如何应对?
ssh服务器配置文件sshd_config 及操作
【医学分割】unet3+
Pyqt, pyside slot functions are executed twice
Topic37——64. Minimum path sum
数据库的复习总结
全球最强截图软件 Snipaste
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
uni-app 使用escook/request-miniprogram插件发请求说明
application. Configuration information of properties