Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
enoch
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
enoch
Commits
188bc08b
Commit
188bc08b
authored
Mar 26, 2019
by
Node- 门 忠鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 修改策略配置文件的位置
parent
b9e2a758
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
48 deletions
+17
-48
load.go
service/alarm/load.go
+3
-2
notice_engine.go
service/alarm/notice_engine.go
+4
-12
strategy.go
service/alarm/strategy.go
+9
-0
config.go
service/conf/config.go
+1
-0
tsconfig.json
service/conf/dev/tsconfig.json
+0
-34
No files found.
service/alarm/load.go
View file @
188bc08b
...
@@ -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
)
...
...
service/alarm/notice_engine.go
View file @
188bc08b
...
@@ -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
:=
d
inDingMsg
{
msg
:=
D
inDingMsg
{
MsgType
:
"link"
,
MsgType
:
"link"
,
Link
:
l
ink
{
Link
:
L
ink
{
Title
:
title
,
Title
:
title
,
Text
:
info
,
Text
:
info
,
MessageUrl
:
"http
s://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"
,
},
},
}
}
...
...
service/alarm/strategy.go
View file @
188bc08b
...
@@ -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"`
}
service/conf/config.go
View file @
188bc08b
...
@@ -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
{
...
...
service/conf/dev/tsconfig.json
deleted
100644 → 0
View file @
b9e2a758
[
{
"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"
}
}
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment