Skip to content

Commit

Permalink
fixed mail send error bug, config bug, send_sms.sh name bug (#30)
Browse files Browse the repository at this point in the history
* fixed shell file name error

* fixed mail list bug

* fixed default web with agent hostname config different bug

* Optimized: default file execute permission

* Upgrade: mail tls options support
  • Loading branch information
codezm authored Feb 23, 2020
1 parent 7c30499 commit 313b3c2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions configs/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ alarm: #告警判断组件,为true表示使用alarm组件
cluster:
node-1: "127.0.0.1:1986"
monitorMap:
default: ["hostname1"] #数组中的字符串需要和agent所在机器的hostname相同
default: ["127.0.0.1"] #数组中的字符串需要和agent所在机器的hostname相同
falcon: #open-falcon接收数据的地址,为true表示要向falcon推送数据
enable: false
addr: "http://falcon.transfer.addr/api/push"
interval: 60
internalDns: #如果为true,表示使用自己的dns解析来解析域名
enable: false
cmd: "./script/dsn.sh"
cmd: "./script/dsn.sh"
1 change: 1 addition & 0 deletions modules/alarm/g/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type SmtpConfig struct {
Username string `yaml:"username"`
Password string `yaml:"password"`
From string `yaml:"from"`
Tls bool `yaml:"tls"`
}

var (
Expand Down
3 changes: 2 additions & 1 deletion modules/alarm/sender/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func SendMail(mail *g.Mail) {
<-MailWorkerChan
}()

s := smtp.New(g.Config.Smtp.Addr, g.Config.Smtp.Username, g.Config.Smtp.Password)
//s := smtp.New(g.Config.Smtp.Addr, g.Config.Smtp.Username, g.Config.Smtp.Password)
s := smtp.NewSMTP(g.Config.Smtp.Addr, g.Config.Smtp.Username, g.Config.Smtp.Password, g.Config.Smtp.Tls, false, false)
err := s.SendMail(g.Config.Smtp.From, strings.Replace(mail.Tos, ",", ";", -1), mail.Subject, mail.Content, "text")
if err != nil {
log.Println(err, "tos:", mail.Tos)
Expand Down
2 changes: 1 addition & 1 deletion modules/alarm/sender/sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func sendSms(phone string, sms string) {
<-SmsWorkerChan
}()

sms_shell := path.Join(file.SelfDir(), "script", "send.sms.sh")
sms_shell := path.Join(file.SelfDir(), "script", "sms.sh")
if !file.IsExist(sms_shell) {
log.Printf("%s not found", sms_shell)
return
Expand Down
1 change: 1 addition & 0 deletions modules/web/api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (this *Web) GetUsersByTeam(req string, reply *UsersResponse) error {
Id: user.Id,
Name: user.Name,
Cnname: user.Cnname,
Email: user.Email,
Phone: user.Phone,
Wechat: user.Wechat,
Role: user.Role,
Expand Down
Empty file modified script/dns.sh
100644 → 100755
Empty file.
Empty file modified script/sms.sh
100644 → 100755
Empty file.

0 comments on commit 313b3c2

Please sign in to comment.