feat: 支持修改邮件标题,告警转发默认关闭

This commit is contained in:
TsMask
2025-06-27 11:18:28 +08:00
parent e4c6a7c37a
commit 7c0f31168f
7 changed files with 79 additions and 31 deletions

View File

@@ -132,16 +132,17 @@ omc:
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
alarm:
alarmEmailForward:
enable: true
emailList:
enable: false
emailList: ""
title: "Alarm from OMC"
smtp: mail.smtp.com
port: 25
user: smtpext@smtp.com
password: "1000smtp@omc!"
tlsSkipVerify: true
alarmSMSForward:
enable: true
mobileList:
enable: false
mobileList: ""
smscAddr: "192.168.13.114:2775"
systemID: "omc"
password: "omc123"

View File

@@ -1,4 +1,29 @@
omc:
trace:
display: "NE Signaling Trace"
sort: 1
list:
- name: "enabled"
type: "bool"
value: "false"
access: "read-write"
filter: '{"0":"false","1":"true"}'
display: "Enable"
comment: "enable or disable NE signaling trace creation"
- name: "host"
type: "ipv4"
value: "172.16.5.100"
access: "read-write"
filter: '0~128'
display: "Host"
comment: "NE signaling trace host address"
- name: "port"
type: "int"
value: "33033"
access: "read-write"
filter: '3000~65530'
display: "Port"
comment: "NE signaling trace port"
alarmEmailForward:
display: "Alarm Email Forward Interface"
sort: 3
@@ -6,10 +31,17 @@ omc:
- name: "enable"
type: "bool"
value: "true"
access: "rw"
access: "rw"
filter: "true;false"
display: "Enable"
comment: "Is it enabled forward alarm with Email interface"
- name: "title"
type: "string"
value: ""
access: "rw"
filter: "0~64"
display: "Email Title"
comment: "string, no variable support"
- name: "emailList"
type: "string"
value: ""
@@ -59,7 +91,7 @@ omc:
- name: "enable"
type: "bool"
value: "true"
access: "rw"
access: "rw"
filter: "true;false"
display: "Enable"
comment: "Is it enabled forward alarm with SMS interface"
@@ -104,11 +136,11 @@ omc:
access: "rw"
filter: '{"0":"GSM7BIT","1":"ASCII","2":"BINARY8BIT1","3":"LATIN1","4":"BINARY8BIT2","6":"CYRILLIC","7":"HEBREW","8":"UCS2"}'
display: "Data Coding"
comment: "Short message coding type"
comment: "Short message coding type"
- name: "serviceNumber"
type: "string"
value: "OMC"
access: "rw"
filter: "3~20"
display: "Service Number"
comment: "It is the source address, the length is between 3 and 20"
comment: "It is the source address, the length is between 3 and 20"

View File

@@ -133,9 +133,9 @@ INSERT INTO `ne_config` VALUES (241, 'CBC', 'amfProfile', 'AMF Profile', 'array'
INSERT INTO `ne_config` VALUES (242, 'CBC', 'mmeProfile', 'MME Profile', 'array', '[{\"access\":\"read-only\",\"comment\":\"0~15\",\"display\":\"Index\",\"filter\":\"0~15\",\"name\":\"index\",\"type\":\"int\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"NF Name\",\"filter\":\"0~64\",\"name\":\"name\",\"type\":\"string\",\"value\":\"MME\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"MME URI\",\"filter\":\"0~64\",\"name\":\"uri\",\"type\":\"string\",\"value\":\"sctp://192.168.1.1:9090\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"PLMN ID\",\"filter\":\"^[0-9]{5,6}$\",\"name\":\"plmnId\",\"type\":\"regex\",\"value\":\"00101\"},{\"access\":\"read-write\",\"comment\":\"0~16777215\",\"display\":\"TAC\",\"filter\":\"0~8\",\"name\":\"tac\",\"type\":\"string\",\"value\":\"1\"}]', 5, '', 1724327154504, 'public');
-- OMC parameter config
INSERT INTO `ne_config` VALUES (260, 'OMC', 'alarmEmailForward', 'Alarm Email Forward Interface', 'list', '[{\"access\":\"rw\",\"comment\":\"Is it enabled forward alarm with Email interface\",\"display\":\"Enable\",\"filter\":\"true;false\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"true\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Email List\",\"filter\":\"\",\"name\":\"emailList\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"Email SMTP server\",\"display\":\"SMTP Server\",\"filter\":\"\",\"name\":\"smtp\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Port\",\"filter\":\"0~65535\",\"name\":\"port\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"User\",\"filter\":\"\",\"name\":\"user\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Password\",\"filter\":\"\",\"name\":\"password\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"If skip TLS verify (true/false)\",\"display\":\"TLS Skip Verify\",\"filter\":\"true;false\",\"name\":\"tlsSkipVerify\",\"type\":\"bool\",\"value\":\"true\"}]', 3, '', 1725505025649, 'public');
INSERT INTO `ne_config` VALUES (261, 'OMC', 'alarmSMSForward', 'Alarm SMS Forward Interface', 'list', '[{\"access\":\"rw\",\"comment\":\"Is it enabled forward alarm with SMS interface\",\"display\":\"Enable\",\"filter\":\"true;false\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"true\"},{\"access\":\"rw\",\"comment\":\"Multiple mobile separated by commas\",\"display\":\"Mobile List\",\"filter\":\"\",\"name\":\"mobileList\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"The SMSC SMPP Address\",\"display\":\"SMSC Address\",\"filter\":\"\",\"name\":\"smscAddr\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"System ID\",\"filter\":\"\",\"name\":\"systemID\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Password\",\"filter\":\"\",\"name\":\"password\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"System Type\",\"filter\":\"\",\"name\":\"systemType\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"Short message coding type\",\"display\":\"Data Coding\",\"filter\":\"{\\\"0\\\":\\\"GSM7BIT\\\",\\\"1\\\":\\\"ASCII\\\",\\\"2\\\":\\\"BINARY8BIT1\\\",\\\"3\\\":\\\"LATIN1\\\",\\\"4\\\":\\\"BINARY8BIT2\\\",\\\"6\\\":\\\"CYRILLIC\\\",\\\"7\\\":\\\"HEBREW\\\",\\\"8\\\":\\\"UCS2\\\"}\",\"name\":\"dataCoding\",\"type\":\"enum\",\"value\":\"GSM7BIT\"},{\"access\":\"rw\",\"comment\":\"It is the source address, the length is between 3 and 20\",\"display\":\"Service Number\",\"filter\":\"3~20\",\"name\":\"serviceNumber\",\"type\":\"string\",\"value\":\"OMC\"}]', 4, '', 1727664057261, 'public');
INSERT INTO `ne_config` VALUES (262, 'OMC', 'trace', 'NE Signaling Trace', 'list', '[{\"access\":\"read-write\",\"comment\":\"enable or disable NE signaling trace creation\",\"display\":\"Enable\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enabled\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"NE signaling trace host address\",\"display\":\"Host\",\"filter\":\"0~128\",\"name\":\"host\",\"type\":\"ipv4\",\"value\":\"172.16.5.100\"},{\"access\":\"read-write\",\"comment\":\"NE signaling trace port\",\"display\":\"Port\",\"filter\":\"3000~65530\",\"name\":\"port\",\"type\":\"int\",\"value\":\"33033\"}]', 1, '', 1748570559170, 'public');
INSERT INTO `ne_config` VALUES (260, 'OMC', 'alarmEmailForward', 'Alarm Email Forward Interface', 'list', '[{\"access\":\"rw\",\"comment\":\"Is it enabled forward alarm with Email interface\",\"display\":\"Enable\",\"filter\":\"true;false\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"true\"},{\"access\":\"rw\",\"comment\":\"string, no variable support\",\"display\":\"Email Title\",\"filter\":\"0~64\",\"name\":\"title\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Email List\",\"filter\":\"\",\"name\":\"emailList\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"Email SMTP server\",\"display\":\"SMTP Server\",\"filter\":\"\",\"name\":\"smtp\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Port\",\"filter\":\"0~65535\",\"name\":\"port\",\"type\":\"int\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"User\",\"filter\":\"\",\"name\":\"user\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Password\",\"filter\":\"\",\"name\":\"password\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"If skip TLS verify (true/false)\",\"display\":\"TLS Skip Verify\",\"filter\":\"true;false\",\"name\":\"tlsSkipVerify\",\"type\":\"bool\",\"value\":\"true\"}]', 3, '', 1750991610187, 'public');
INSERT INTO `ne_config` VALUES (261, 'OMC', 'alarmSMSForward', 'Alarm SMS Forward Interface', 'list', '[{\"access\":\"rw\",\"comment\":\"Is it enabled forward alarm with SMS interface\",\"display\":\"Enable\",\"filter\":\"true;false\",\"name\":\"enable\",\"type\":\"bool\",\"value\":\"true\"},{\"access\":\"rw\",\"comment\":\"Multiple mobile separated by commas\",\"display\":\"Mobile List\",\"filter\":\"\",\"name\":\"mobileList\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"The SMSC SMPP Address\",\"display\":\"SMSC Address\",\"filter\":\"\",\"name\":\"smscAddr\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"System ID\",\"filter\":\"\",\"name\":\"systemID\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"Password\",\"filter\":\"\",\"name\":\"password\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"\",\"display\":\"System Type\",\"filter\":\"\",\"name\":\"systemType\",\"type\":\"string\",\"value\":\"\"},{\"access\":\"rw\",\"comment\":\"Short message coding type\",\"display\":\"Data Coding\",\"filter\":\"{\\\"0\\\":\\\"GSM7BIT\\\",\\\"1\\\":\\\"ASCII\\\",\\\"2\\\":\\\"BINARY8BIT1\\\",\\\"3\\\":\\\"LATIN1\\\",\\\"4\\\":\\\"BINARY8BIT2\\\",\\\"6\\\":\\\"CYRILLIC\\\",\\\"7\\\":\\\"HEBREW\\\",\\\"8\\\":\\\"UCS2\\\"}\",\"name\":\"dataCoding\",\"type\":\"enum\",\"value\":\"GSM7BIT\"},{\"access\":\"rw\",\"comment\":\"It is the source address, the length is between 3 and 20\",\"display\":\"Service Number\",\"filter\":\"3~20\",\"name\":\"serviceNumber\",\"type\":\"string\",\"value\":\"OMC\"}]', 4, '', 1750991610192, 'public');
INSERT INTO `ne_config` VALUES (262, 'OMC', 'trace', 'NE Signaling Trace', 'list', '[{\"access\":\"read-write\",\"comment\":\"enable or disable NE signaling trace creation\",\"display\":\"Enable\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"enabled\",\"type\":\"bool\",\"value\":\"false\"},{\"access\":\"read-write\",\"comment\":\"NE signaling trace host address\",\"display\":\"Host\",\"filter\":\"0~128\",\"name\":\"host\",\"type\":\"ipv4\",\"value\":\"172.16.5.100\"},{\"access\":\"read-write\",\"comment\":\"NE signaling trace port\",\"display\":\"Port\",\"filter\":\"3000~65530\",\"name\":\"port\",\"type\":\"int\",\"value\":\"33033\"}]', 1, '', 1750991610150, 'public');
-- 更新 SMSC 配置 2025521
INSERT INTO `ne_config` VALUES (280, 'SMSC', 'system', 'System', 'list', '[{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CDR Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"cdrFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SM Validity\",\"filter\":\"0-2147483647\",\"name\":\"smValidity\",\"type\":\"int\",\"value\":\"259200\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Log Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"logFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Enable or disable resend pending SMS to unattainable local users.\",\"display\":\"Local Polling Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"localPollingFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Enable or disable resend pending SMS to unattainable outbound roaming users.\",\"display\":\"Local Roaming Out Polling Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"localRoamingOutPollingFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Enable or disable resend pending SMS to unattainable inbound roaming users.\",\"display\":\"Visitor Roaming In Polling Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"visitorRoamingInPollingFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Enable or disable resend pending SMS to other unattainable users.\",\"display\":\"Other Polling Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"otherPollingFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Define the maximum port number that the queue of pending SMS may grow to.\",\"display\":\"Polling Number\",\"filter\":\"0-64\",\"name\":\"pollingNumber\",\"type\":\"int\",\"value\":\"64\"},{\"access\":\"read-write\",\"comment\":\"Specify the priority parameter of SM_RP_PRI. true = High; false = Low.\",\"display\":\"Priority Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"priorityFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"Enable or disable TP-Reply-Path parameter in the SMS-DELIVER data unit.\",\"display\":\"TP Reply Path Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"tpReplyPathFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SMSC Number\",\"filter\":\"0~32\",\"name\":\"smscNumber\",\"type\":\"string\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SMSC Domain\",\"filter\":\"0~16\",\"name\":\"smscDomain\",\"type\":\"string\",\"value\":\"0.0.0.0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"CSFB VoLTE Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"csfbVolteFlag\",\"type\":\"bool\",\"value\":\"1\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Camel Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"camelFlag\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"SCF Address\",\"filter\":\"0~16\",\"name\":\"scfAddress\",\"type\":\"string\",\"value\":\"0.0.0.0\"},{\"access\":\"read-write\",\"comment\":\"If add plus then set false\",\"display\":\"MT Id Format Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"mtIdFormatFlag\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"enable mcast sms\",\"display\":\"Mcast Flag\",\"filter\":\"{\\\"0\\\":\\\"false\\\",\\\"1\\\":\\\"true\\\"}\",\"name\":\"mcastFlag\",\"type\":\"bool\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Log Level\",\"filter\":\"{\\\"0\\\":\\\"none\\\",\\\"1\\\":\\\"error\\\",\\\"2\\\":\\\"debug\\\"}\",\"name\":\"logLevel\",\"type\":\"enum\",\"value\":\"0\"},{\"access\":\"read-write\",\"comment\":\"The MB sizeof log file\",\"display\":\"Log Size\",\"filter\":\"1-1000\",\"name\":\"logSize\",\"type\":\"int\",\"value\":\"200\"},{\"access\":\"read-write\",\"comment\":\"The number of log file\",\"display\":\"Log Number\",\"filter\":\"1-20\",\"name\":\"logNum\",\"type\":\"int\",\"value\":\"10\"},{\"access\":\"read-write\",\"comment\":\"\",\"display\":\"Log Directory\",\"filter\":\"0~128\",\"name\":\"logDir\",\"type\":\"string\",\"value\":\"/var/log/\"}]', 1, '', 1747799255683, 'public');

View File

@@ -17,6 +17,7 @@ import (
"be.ems/lib/services"
"be.ems/src/framework/constants"
"be.ems/src/framework/resp"
"be.ems/src/framework/utils/date"
neDataModel "be.ems/src/modules/network_data/model"
neDataService "be.ems/src/modules/network_data/service"
traceService "be.ems/src/modules/trace/service"
@@ -270,13 +271,14 @@ func PostAlarmFromNF(w http.ResponseWriter, r *http.Request) {
var activeAlarmNum int = 0
for _, alarmData := range *alarmArray {
log.Debug("alarmData:", alarmData)
tm, _ := time.Parse(time.RFC3339, alarmData.EventTime)
eventTimeGMT := date.ParseDateToStr(tm, date.YYYY_MM_DD_HH_MM_SS_GMT_TZ)
session := xEngine.NewSession()
defer session.Close()
if alarmData.AlarmStatus == AlarmStatusClear {
alarmData.ClearType = ClearTypeAutoClear
alarmData.ClearTime.Valid = true
tm, _ := time.Parse(time.RFC3339, alarmData.EventTime)
log.Debugf("EventTime:%s tm:%d tm-datetime:%s", alarmData.EventTime, tm, tm.Local().Format(time.DateTime))
alarmData.ClearTime.Time = tm
if IsNeedToAckAlarm(valueJson, &alarmData) {
@@ -471,7 +473,9 @@ func PostAlarmFromNF(w http.ResponseWriter, r *http.Request) {
}
session.Commit()
}
if config.GetYamlConfig().Alarm.EmailForward.Enable {
alarmData.EventTime = eventTimeGMT
if err = AlarmEmailForward(&alarmData); err != nil {
log.Error("Failed to AlarmEmailForward:", err)
}

View File

@@ -4,34 +4,41 @@ import (
"crypto/tls"
"fmt"
"strings"
"time"
"be.ems/lib/config"
"be.ems/lib/dborm"
"be.ems/lib/global"
"be.ems/lib/log"
neService "be.ems/src/modules/network_element/service"
"gopkg.in/gomail.v2"
)
func AlarmEmailForward(alarmData *Alarm) error {
log.Info("AlarmEmailForward processing... ")
neInfo := neService.NewNeInfo.SelectNeInfoByRmuid(alarmData.NeId)
alarmStatus := "Clear"
if alarmData.AlarmStatus == 1 {
alarmStatus = "Active"
}
severity := alarmData.OrigSeverity
subjectTime := fmt.Sprintf("%s-%s-%s", severity, alarmData.NeName, alarmData.AlarmTitle)
subjectTitle := config.GetYamlConfig().Alarm.EmailForward.Title
if subjectTitle == "" {
severity := alarmData.OrigSeverity
subjectTitle = fmt.Sprintf("%s-%s-%s", severity, alarmData.NeName, alarmData.AlarmTitle)
}
message := fmt.Sprintf(`
<p>Alarm information</p>
<p style="text-indent:2.5em">Sequence: %d</p>
<p style="text-indent:3em">NE name: %s</p>
<p style="text-indent:4em">Title: %s</p>
<p style="text-indent:3em">NE IP: %s</p>
<p style="text-indent:4em">Alarm Title: %s</p>
<p style="text-indent:2.5em">Severity: %s</p>
<p style="text-indent:1.5em">Event Time: %s</p>
<p style="text-indent:0.5em">Alarm Status: %s</p>
<p>Automatic sent by OMC, please do not reply!</p>
`, alarmData.AlarmSeq, alarmData.NeName, alarmData.AlarmTitle, alarmData.OrigSeverity, alarmData.EventTime, alarmStatus)
`, alarmData.AlarmSeq, alarmData.NeName, neInfo.IP, alarmData.AlarmTitle, alarmData.OrigSeverity, alarmData.EventTime, alarmStatus)
// message := fmt.Sprintf(`
// Alarm information
@@ -73,13 +80,14 @@ func AlarmEmailForward(alarmData *Alarm) error {
// return err
// }
emails := strings.Split(config.GetYamlConfig().Alarm.EmailForward.EmailList, ",")
eventTime := global.GetFmtTimeString(time.RFC3339, alarmData.EventTime, time.DateTime)
forwardLog := &dborm.AlarmForwardLog{
NeType: alarmData.NeType,
NeID: alarmData.NeId,
AlarmID: alarmData.AlarmId,
AlarmTitle: alarmData.AlarmTitle,
AlarmSeq: alarmData.AlarmSeq,
EventTime: alarmData.EventTime,
EventTime: eventTime,
ToUser: config.GetYamlConfig().Alarm.EmailForward.EmailList,
}
@@ -88,7 +96,7 @@ func AlarmEmailForward(alarmData *Alarm) error {
//m.SetHeader("To", "zhangshuzhong@agrandtech.com", "simonzhangsz@outlook.com") // 收件人,可以多个收件人,但必须使用相同的 SMTP 连接
//m.SetHeader("Cc", "******@qq.com") // 抄送,可以多个
//m.SetHeader("Bcc", "******@qq.com") // 暗送,可以多个
m.SetHeader("Subject", subjectTime) // 邮件主题
m.SetHeader("Subject", subjectTitle) // 邮件主题
// text/html 的意思是将文件的 content-type 设置为 text/html 的形式浏览器在获取到这种文件时会自动调用html的解析器对文件进行相应的处理。
// 可以通过 text/html 处理文本格式进行特殊处理,如换行、缩进、加粗等等

View File

@@ -157,6 +157,7 @@ type AlarmConfig struct {
EmailForward struct {
Enable bool `yaml:"enable" json:"enable"`
EmailList string `yaml:"emailList" json:"emailList"`
Title string `yaml:"title" json:"title"`
SMTP string `yaml:"smtp" json:"smtp"`
Port uint16 `yaml:"port" json:"port"`
User string `yaml:"user" json:"user"`

View File

@@ -47,8 +47,8 @@ database:
type: mysql
user: root
password: 1000omc@kp!
host: 192.168.2.211
port: 33066
host: 192.168.9.58
port: 13306
name: "tenants_db"
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
backup: ./database
@@ -58,8 +58,8 @@ redis:
dataSource:
# OMC system db
default:
port: 6379 # Redis port
host: "192.168.2.211" # Redis host
port: 16379 # Redis port
host: "192.168.9.58" # Redis host
password: "helloearth"
db: 10 # Redis db_num
# used to specify the default data source for multiple data resourece
@@ -75,11 +75,12 @@ mml:
bufferSize: 65535
mmlHome: ./mmlhome
# Tracking configuration
# track configuration for NE signaling trace
# host fill in the specific IP address
trace:
enabled: false
host: "172.16.5.100" # Fill in the specific IP address
port: 33033
enabled: false # trace enabled, default false
host: "172.16.5.100" # trace host, default 127.0.0.1
port: 33033 # trace port, default 33033
# NE config
ne:
@@ -136,16 +137,17 @@ omc:
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
alarm:
alarmEmailForward:
enable: true
emailList:
enable: false
emailList: ""
title: "Alarm from OMC"
smtp: mail.smtp.com
port: 25
user: smtpext@smtp.com
password: "1000smtp@omc!"
tlsSkipVerify: true
alarmSMSForward:
enable: true
mobileList: "1006,1008"
enable: false
mobileList: ""
smscAddr: "192.168.14.212:2775"
systemID: "123456"
password: "123456"