alarm_msg.go 555 B

123456789101112131415161718192021222324
  1. package alarm_msg
  2. import (
  3. "encoding/json"
  4. "eta_gn/eta_report/utils"
  5. "github.com/rdlucklib/rdluck_tools/http"
  6. )
  7. func SendAlarmMsg(msgBody string, level int) {
  8. if utils.AlarmMsgUrl == "" {
  9. return
  10. }
  11. params := make(map[string]interface{})
  12. params["ProjectName"] = utils.APPNAME
  13. params["RunMode"] = utils.RunMode
  14. params["MsgBody"] = msgBody
  15. params["Level"] = level
  16. param, err := json.Marshal(params)
  17. if err != nil {
  18. utils.FileLog.Info("SendAlarmMsg json.Marshal Err:" + err.Error())
  19. return
  20. }
  21. http.Post(utils.AlarmMsgUrl, string(param))
  22. }