-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: jikun.zhang <[email protected]>
- Loading branch information
jikun.zhang
committed
Nov 29, 2024
1 parent
de8381a
commit 8a63cf8
Showing
6 changed files
with
24 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import ( | |
) | ||
|
||
// SendEmail | ||
func SendEmail(EmailBody, Emails, logsign string) string { | ||
func SendEmail(EmailBody, Emails, EmailTitle, logsign string) string { | ||
open := beego.AppConfig.String("open-email") | ||
if open != "1" { | ||
logs.Info(logsign, "[email]", "email未配置未开启状态,请先配置open-email为1") | ||
|
@@ -20,7 +20,7 @@ func SendEmail(EmailBody, Emails, logsign string) string { | |
serverPort, _ := beego.AppConfig.Int("Email_port") | ||
fromEmail := beego.AppConfig.String("Email_user") | ||
Passwd := beego.AppConfig.String("Email_password") | ||
EmailTitle := beego.AppConfig.String("Email_title") | ||
//EmailTitle := beego.AppConfig.String("Email_title") | ||
//Emails= [email protected],[email protected],[email protected] | ||
SendToEmails := []string{} | ||
m := gomail.NewMessage() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,15 @@ | |
`示例:http://[prometheusalert_url]:8080/prometheusalert?type=dd&tpl=prometheus-dd&ddurl=https://oapi.dingtalk.com/robot/send?access_token=xxxx,https://oapi.dingtalk.com/robot/send?access_token=xxxxxx,https://oapi.dingtalk.com/robot/send?access_token=xxxxxx&rr=true&split=false` | ||
|
||
|
||
#### 5.自定义模板使用的是go语言的template模版,可以参考默认模版的一些语法来进行自定义。 | ||
#### 5.url参数新增 `emailtitle=运维监控中心`,该参数仅针对email有效,作用是替换app.conf中的Email_title邮件标题配置,实现动态定义邮件标题 | ||
|
||
#### 6.模版数据等信息均存储在程序目录的下的`db/PrometheusAlertDB.db`中。 | ||
注意:此参数如设置为`split=false`,则PrometheusAlert web页面的路由和告警记录等功能将自动关闭,请谨慎。 | ||
|
||
`示例:http://[prometheusalert_url]:8080/prometheusalert?type=email&tpl=prometheus-email&[email protected]&emailtitle=运维监控中心` | ||
|
||
|
||
#### 6.自定义模板使用的是go语言的template模版,可以参考默认模版的一些语法来进行自定义。 | ||
|
||
#### 7.模版数据等信息均存储在程序目录的下的`db/PrometheusAlertDB.db`中。 | ||
|
||
#### 7.关于优先级问题:路由功能 > URL参数 > app.conf | ||
#### 8.关于优先级问题:路由功能 > URL参数 > app.conf |