Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Nightingale
提交
3428b11e
N
Nightingale
项目概览
jobily
/
Nightingale
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
Nightingale
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3428b11e
编写于
12月 23, 2021
作者:
U
Ulric Qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
configuration for metrics.yaml and templates
上级
f661a6bd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
22 addition
and
6 deletion
+22
-6
docker/n9eetc/server.conf
docker/n9eetc/server.conf
+1
-0
docker/n9eetc/webapi.conf
docker/n9eetc/webapi.conf
+3
-0
etc/server.conf
etc/server.conf
+1
-0
etc/webapi.conf
etc/webapi.conf
+3
-0
src/server/config/config.go
src/server/config/config.go
+1
-0
src/server/engine/notify.go
src/server/engine/notify.go
+7
-5
src/webapi/config/config.go
src/webapi/config/config.go
+1
-0
src/webapi/router/router_metric_desc.go
src/webapi/router/router_metric_desc.go
+5
-1
未找到文件。
docker/n9eetc/server.conf
浏览文件 @
3428b11e
...
...
@@ -54,6 +54,7 @@ Interval = 1000
[
Alerting
]
NotifyScriptPath
=
"./etc/script/notify.py"
NotifyConcurrency
=
100
TemplatesDir
=
"./etc/template"
[
Alerting
.
RedisPub
]
Enable
=
false
...
...
docker/n9eetc/webapi.conf
浏览文件 @
3428b11e
...
...
@@ -7,6 +7,9 @@ RunMode = "release"
# do not change
AdminRole
=
"Admin"
# metrics descriptions
MetricsYamlFile
=
"./etc/metrics.yaml"
# Linkage with notify.py script
NotifyChannels
= [
"email"
,
"dingtalk"
,
"wecom"
,
"feishu"
]
...
...
etc/server.conf
浏览文件 @
3428b11e
...
...
@@ -57,6 +57,7 @@ Interval = 1000
[
Alerting
]
NotifyScriptPath
=
"./etc/script/notify.py"
NotifyConcurrency
=
100
TemplatesDir
=
"./etc/template"
[
Alerting
.
RedisPub
]
Enable
=
false
...
...
etc/webapi.conf
浏览文件 @
3428b11e
...
...
@@ -7,6 +7,9 @@ RunMode = "release"
# do not change
AdminRole
=
"Admin"
# metrics descriptions
MetricsYamlFile
=
"./etc/metrics.yaml"
# Linkage with notify.py script
NotifyChannels
= [
"email"
,
"dingtalk"
,
"wecom"
,
"feishu"
]
...
...
src/server/config/config.go
浏览文件 @
3428b11e
...
...
@@ -113,6 +113,7 @@ type HeartbeatConfig struct {
type
Alerting
struct
{
NotifyScriptPath
string
NotifyConcurrency
int
TemplatesDir
string
RedisPub
RedisPub
}
...
...
src/server/engine/notify.go
浏览文件 @
3428b11e
...
...
@@ -44,15 +44,17 @@ var fns = template.FuncMap{
}
func
initTpls
()
error
{
tplDir
:=
path
.
Join
(
runner
.
Cwd
,
"etc"
,
"template"
)
if
config
.
C
.
Alerting
.
TemplatesDir
==
""
{
config
.
C
.
Alerting
.
TemplatesDir
=
path
.
Join
(
runner
.
Cwd
,
"etc"
,
"template"
)
}
filenames
,
err
:=
file
.
FilesUnder
(
tpl
Dir
)
filenames
,
err
:=
file
.
FilesUnder
(
config
.
C
.
Alerting
.
Templates
Dir
)
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"failed to exec FilesUnder"
)
}
if
len
(
filenames
)
==
0
{
return
errors
.
New
(
"no tpl files under "
+
tpl
Dir
)
return
errors
.
New
(
"no tpl files under "
+
config
.
C
.
Alerting
.
Templates
Dir
)
}
tplFiles
:=
make
([]
string
,
0
,
len
(
filenames
))
...
...
@@ -63,11 +65,11 @@ func initTpls() error {
}
if
len
(
tplFiles
)
==
0
{
return
errors
.
New
(
"no tpl files under "
+
tpl
Dir
)
return
errors
.
New
(
"no tpl files under "
+
config
.
C
.
Alerting
.
Templates
Dir
)
}
for
i
:=
0
;
i
<
len
(
tplFiles
);
i
++
{
tplpath
:=
path
.
Join
(
tpl
Dir
,
tplFiles
[
i
])
tplpath
:=
path
.
Join
(
config
.
C
.
Alerting
.
Templates
Dir
,
tplFiles
[
i
])
tpl
,
err
:=
template
.
New
(
tplFiles
[
i
])
.
Funcs
(
fns
)
.
ParseFiles
(
tplpath
)
if
err
!=
nil
{
...
...
src/webapi/config/config.go
浏览文件 @
3428b11e
...
...
@@ -77,6 +77,7 @@ type Config struct {
RunMode
string
I18N
string
AdminRole
string
MetricsYamlFile
string
ContactKeys
[]
ContactKey
NotifyChannels
[]
string
Log
logx
.
Config
...
...
src/webapi/router/router_metric_desc.go
浏览文件 @
3428b11e
...
...
@@ -12,7 +12,11 @@ import (
)
func
metricsDescGetFile
(
c
*
gin
.
Context
)
{
fp
:=
path
.
Join
(
runner
.
Cwd
,
"etc"
,
"metrics.yaml"
)
fp
:=
config
.
C
.
MetricsYamlFile
if
fp
==
""
{
fp
=
path
.
Join
(
runner
.
Cwd
,
"etc"
,
"metrics.yaml"
)
}
if
!
file
.
IsExist
(
fp
)
{
c
.
String
(
404
,
"%s not found"
,
fp
)
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录