场景
- 大数据工作流的任务失败告警
- 大数据服务节点监控告警
创建企业微信机器人
- 创建群聊
- 在群聊里添加机器人
 - 创建完成后,点击配置说明
 - 查看语法
 - 文本类型的数据格式

说明 创建群聊要拉2个人,创建后可以将另外2人移出,群聊就只剩自己和机器人了😓
CentOS7安装curl
yum -y install curl
man curl
命令参数 | 原文 | 说明 |
---|
-H, --header <header> | (HTTP) Extra header to use when getting a web page | 超文本传输协议的消息头 | -d, --data <data> | Sends the specified data in a POST request to the HTTP server | 在POST请求中发送指定的数据到HTTP服务器 |
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXXXXXXXXXXXXXXXXXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "hello world"
}
}'
Python实现curl功能
import requests
import json
url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXXXXXXXXXXXXXXXXXXXXXXXXX'
headers = {'content-type': 'application/json'}
data = {
"msgtype": "text",
"text": {
"content": "xxx工作流的yyy节点执行失败",
"mentioned_list": ["某群成员", "@all"],
}
}
data = json.dumps(data)
print(requests.post(url=url, headers=headers, data=data))
效果 
Zabbix监控DolphinScheduler节点并告警
背景:DolphinScheduler经常挂,尤其WorkerServer,尝试调整DS的心跳时间和内存,但是死性不改 DS挂掉原因,多数是连不上CDH长期不良的ZooKeeper;此外,内存不够也会导致DS挂掉,调大内存后治好了
报错日志截取:
org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConnectionStateListener:[50] - Registry suspended
org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient:[545] - registry connection state is SUSPENDED, ready to retry connection
org.apache.curator.ConnectionState:[376] - Session expired event received
org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient:[552] - registry connection state is DISCONNECTED, ready to stop myself
org.apache.dolphinscheduler.server.master.processor.queue.StateEventResponseService:[115] - persist task error
java.lang.InterruptedException: null
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2048)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at org.apache.dolphinscheduler.server.master.processor.queue.StateEventResponseService$StateEventResponseWorker.run(StateEventResponseService.java:112)
1、创建模板
配置=>模板=>创建模板 
2、模板里创建监控项
模板=>选中刚才创建的模板=>监控项=>创建监控项 
ps -df | grep org.apache.dolphinscheduler.server.worker.WorkerServer
以监控WorkerServer为例,org.apache.dolphinscheduler.server.worker.WorkerServer 可以精准定位WorkerServer 
键值填写proc.num[,,all,WorkerServer] 
3、模板里创建触发器
切换到触发器=>创建触发器 
添加表达式 
条件 
4、动作
配置=>动作=>创建动作 
切换到操作,添加操作 
填写操作 
5、批量主机添加模板
配置=>主机=>点选主机=>批量更新 
模板=>勾选模板链接=>选择之前创建的模板 
6、测试
杀掉WorkerServer进程,然后看看企业微信是否告警 
7、自动重启DS服务进程(未搞掂)
cd /opt/module/dolphinscheduler/bin/;./stop-all.sh;./start-all.sh
|