当前位置:网站首页>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端接收成功:

边栏推荐
- How to find the movie and TV clips with the same lines? These 8 movies search for artifact, and find the corresponding segment in one line
- Nmcli team bridge basic configuration
- 浏览器cookie转selenium cookie登录
- 微服务之配置管理中心
- Take stock of some easy-to-use and niche markdown editors
- 私藏干货分享:关于企业架构中如何进行平台化
- How to open an account for CSI 500 stock index futures, what are the regular domestic stock index futures platforms, and where is the safest place to open an account?
- 全球最强截图软件 Snipaste
- Unlock the secret of C language key words (issue 6)
- 解开C语言的秘密《关键字》(第六期)
猜你喜欢

让学指针变得更简单(二)

Sword finger offer 04 Find in 2D array

推荐系统的下一步?阿里时空聚合GNN,效果吊打LightGCN!

Neo4j: basic introduction (I) installation and use

一个有趣的网络掩码的实验

Interview shock 60: what will cause MySQL index invalidation?

It is so simple to remove the payment restrictions on VIP, YuQue and Zhihu in Baidu Library

nmcli team bridge 基本配置

Nifi from introduction to practice (nanny level tutorial) - identity authentication

Sorting out XXL job learning
随机推荐
Write it down once Net analysis of a property management background service stuck
Unlock the secret of C language key words (issue 6)
Thymeleaf的配置
Master formula
【粉丝福利】今天给大家介绍一个白捡钱的方法-可转债,本人亲自验证,每年每人能获利1500元
Secyun won the "2022 AI analysis · it operation and maintenance vendor panorama report" as the representative vendor of intelligent operation and maintenance aiops Market
Neo4j:入门基础(一)之安装与使用
MySQL high level statements (I)
Quanzhi A13 tossing memo
MIT6.031 软件构造 Reading7阅读笔记Designing Specifications(设计规范)
MySQL高阶语句(一)
秒云荣获《2022爱分析 · IT运维厂商全景报告》智能运维AIOps市场代表厂商
Hibernate operation Oracle database primary key auto increment
Dm8: Dameng database - lock timeout
关于枚举类的两种用法
Minimum editing distance (linear DP writing method)
picocli-入门
Industry insight - how should brand e-commerce reshape growth under the new retail format?
Pyqt, pyside slot functions are executed twice
Topic38——56. 合并区间