Commit 188bc08b authored by Node- 门 忠鑫's avatar Node- 门 忠鑫

# 修改策略配置文件的位置

parent b9e2a758
...@@ -2,14 +2,15 @@ package alarm ...@@ -2,14 +2,15 @@ package alarm
import ( import (
"encoding/json" "encoding/json"
"git.quantgroup.cn/DevOps/enoch/service/conf"
"git.quantgroup.cn/DevOps/enoch/service/log" "git.quantgroup.cn/DevOps/enoch/service/log"
"io/ioutil" "io/ioutil"
) )
func Load() { func Load() {
data,err := ioutil.ReadFile("service/conf/dev/tsconfig.json") data,err := ioutil.ReadFile(conf.GlobalConfig.StrategyConfPath)
if err != nil { if err != nil {
logger.Error.Fatal("未找配置文件") logger.Error.Fatal("未找配置文件")
} }
strategies := make([]Strategy, 0) strategies := make([]Strategy, 0)
......
...@@ -47,23 +47,15 @@ func senderDingDing(title string, info string, receiver [] string) { ...@@ -47,23 +47,15 @@ func senderDingDing(title string, info string, receiver [] string) {
} }
} }
type dinDingMsg struct {
MsgType string `json:"msgtype"`
Link link `json:"link"`
}
type link struct {
Title string `json:"title"`
Text string `json:"text"`
MessageUrl string `json:"messageUrl"`
}
func buildDingDingMsg(title string, info string) []byte { func buildDingDingMsg(title string, info string) []byte {
msg := dinDingMsg{ msg := DinDingMsg{
MsgType: "link", MsgType: "link",
Link: link{ Link: Link{
Title: title, Title: title,
Text: info, Text: info,
MessageUrl: "https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.Rqyvqo&treeId=257&articleId=105735&docType=1", MessageUrl: "http://172.20.6.33:3000/d/y1Ju2slik/apdexlist?refresh=1m&orgId=1",
}, },
} }
......
...@@ -34,4 +34,13 @@ type Notice struct { ...@@ -34,4 +34,13 @@ type Notice struct {
Interval int64 `json:"interval"` //相同的(同服务/主机,同策略)报警发送间隔 单位 秒 Interval int64 `json:"interval"` //相同的(同服务/主机,同策略)报警发送间隔 单位 秒
Receiver []string //接收者,dingDing 则为webHookUrl, mail 则为邮箱 Receiver []string //接收者,dingDing 则为webHookUrl, mail 则为邮箱
} }
type DinDingMsg struct {
MsgType string `json:"msgtype"`
Link Link `json:"link"`
}
type Link struct {
Title string `json:"title"`
Text string `json:"text"`
MessageUrl string `json:"messageUrl"`
}
...@@ -9,6 +9,7 @@ type Config struct { ...@@ -9,6 +9,7 @@ type Config struct {
Redis Redis `json:"redis"` Redis Redis `json:"redis"`
Kafka Kafka `json:"kafka"` Kafka Kafka `json:"kafka"`
InfluxDb InfluxDb `json:"influx_db"` InfluxDb InfluxDb `json:"influx_db"`
StrategyConfPath string `json:"strategy_conf_path"`
} }
type Redis struct { type Redis struct {
......
[
{
"name": "apdex",
"sql": "select (mean(sat)+mean(tol))/mean(ct_all) as cu from apdex where time > now() - 3m group by sys_name fill(0);",
"sql_len": 1,
"type": 2,
"operator": "Less",
"alter_value": [
"0"
],
"tag": [
"sys_name"
],
"ignore_tag": {
"msg": true
},
"personal_alter_value": {
"gu-bei": [
"1"
]
},
"notice": {
"sender": 120,
"interval": 1,
"receiver": [
"https://oapi.dingtalk.com/robot/send?access_token=9ffab8e4ae5f94e0fbf84aa91c9cb474d9e3d5bd0bb3c2daffe4cdfe0c2cbbc7",
"https://oapi.dingtalk.com/robot/send?access_token=50cab90234d56e4151ef58132714482ce20f2dce791b2a492439fdfa5fc092ca"
],
"link":"http://172.20.6.33:3000/d/Qvs4cB_iz/server?from=now-1h&to=now&refresh=5m&orgId=1&var-sysName=xyqb-user2"
}
}
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment