mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(monitor): modify notify alertInfo and alertOk detach resource
1.修复报警信息中>等被转义的问题 2.针对:host_raid.adapter和smart_device.exit_status 只能出现alerting和nodata 两种报警状态。在queryCondition的查询逻辑下,nodata情况也进行detach操作 3.修复报警记录中报警策略翻译异常的问题
This commit is contained in:
@@ -91,7 +91,9 @@ func getTemplate(ctx context.Context, topic string, contType string, channel npk
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tmp, err := template.New(key).Parse(string(cont))
|
||||
tmp := template.New(key)
|
||||
tmp.Funcs(template.FuncMap{"unescaped": unescaped})
|
||||
tmp, err = tmp.Parse(string(cont))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -100,6 +102,10 @@ func getTemplate(ctx context.Context, topic string, contType string, channel npk
|
||||
return templatesTable[key], nil
|
||||
}
|
||||
|
||||
func unescaped(str string) template.HTML {
|
||||
return template.HTML(str)
|
||||
}
|
||||
|
||||
func getContent(ctx context.Context, topic string, contType string, channel npk.TNotifyChannel, data jsonutils.JSONObject) (string, error) {
|
||||
if channel == npk.NotifyByWebhook {
|
||||
return "", nil
|
||||
|
||||
Reference in New Issue
Block a user