rabbit
对接各种hook的中间组件
3.8K
env: dev # dev、test、prod、local
server:
name: moon-rabbit
metadata:
description: 是moon监控系列的消息组件,可以独立部署,接受任意的hook消息,并支持邮件、钉钉、企业微信、飞书等告警
background: 寓意为月宫中的玉兔,专门用于消息通知
http:
addr: 0.0.0.0:8000
timeout: 2s
grpc:
addr: 0.0.0.0:9000
timeout: 2s
data:
cache:
# redis:
# network: "tcp"
# addr: 127.0.0.1:6379
# db: 0
# password: ""
# read_timeout: 0.2s
# write_timeout: 0.2s
# dial_timeout: 0.2s
nutsDB:
path: ./tmp/nutsdb
bucket: test
templates:
email: |
<h1>{{.Title}}</h1>
<p>{{.Content}}</p>
dingTalk: |
{
"at": {
"atUserIds":[
"014728255240768602"
],
"isAtAll": {{.IsAtAll}}
},
"text": {
"content":"我就是我, {{.Content}}"
},
"msgtype":"text"
}
global_email_config:
host: smtp.163.com
port: 25
user:
pass:
# receiver对象中,content优先级高于template,如果配置了content, 则使用自己的content作为发送内容
receivers:
test:
emails:
- to: "接受的邮件地址"
subject: "Moon监控测试告警"
content: ""
template: "email"
contentType: "text/plain"
cc:
attachUrl:
hooks:
- dingTalk:
webhook: "https://oapi.dingtalk.com/robot/send?access_token="
secret: ""
content: ""
template: "dingTalk"
- feiShu:
webhook: "这里填飞书webhook"
secret: ""
content: ""
template: "这里选择飞书模板key"
- wechatWork:
webhook: "这里填企业微信webhook"
content: ""
template: "这里选择企业微信模板key"
- other:
webhook: "这里填自定义的webhook"
content: ""
template: "这里选择自定义的模板key"
test1是配置中的receivers路由对象, body内容为任意json格式字符串
curl --location 'http://localhost:8000/v1/hook/send/test1' \
--header 'Content-Type: application/json' \
--data '{
"Title": "我是Title",
"Content": "我是Content",
"IsAtAll": true
}'
curl --location 'http://localhost:8000/v1/rabbit/push/config' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data-raw '{
"receivers": {
"test1": {
"hooks": [
{
"dingTalk": {
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=xx",
"secret": "xx",
"template": "dingTalk"
}
}
],
"emails": [
{
"to": "[email protected]",
"subject": "Moon监控测试告警test1",
"template": "email",
"contentType": "text/plain"
}
]
}
},
"templates": {
"dingTalk": "{\n \"at\": {\n \"atUserIds\":[\n \"014728255240768602\"\n ],\n \"isAtAll\": {{.IsAtAll}}\n },\n \"text\": {\n \"content\":\"我就是我, {{.Content}}\"\n },\n \"msgtype\":\"text\"\n}\n",
"email": "<h1>{{.Title}}</h1>\n<p>{{.Content}}</p>\n"
}
}'
Content type
Image
Digest
sha256:a2c52a27b…
Size
56.1 MB
Last updated
over 1 year ago
docker pull aidemoonio/rabbit