Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alarm 模块从 redisli pop出event 后,反序列成im、mail 对象失败的问题 #697

Closed
WatchLucky opened this issue Mar 2, 2019 · 0 comments

Comments

@WatchLucky
Copy link

遇到的问题是这样:触发告警以后,第一天告警信息 大概率 是 接收人、告警内容为空,导致发不出告警
打印日志发现 PopAllIM 函数 里 reply, err := redis.String(rc.Do("RPOP", queue)) 得到的replay 无法发序列化成im 对象。
log.Debugf("PopAllIM reply : %v", reply)
err = json.Unmarshal([]byte(reply), &im)
if err != nil {
log.Error(err, reply)
continue
}
log.Debugf("反序列化 im : %s", im.String())

log 如下:
time="2019-03-02T11:29:30+08:00" level=debug msg="delete event older than 2009-03-04 11:29:30, rows affected:0"
time="2019-03-02T11:30:01+08:00" level=debug msg="PopAllIM reply : {"Status":"PROBLEM","Priority":0,"Endpoint":"aaa","Metric":"Slave_SQL_Running","Tags":"db=mysql,ipaddr=1.1.1.1,module=mysql,optsystem=linux,port=10001,project=tdnotice,role=slave","Func":"all(#1)","LeftValue":"0","Operator":"!=","RightValue":"1","Note":"MySQL从库SQL线程告警","Max":3,"Current":1,"Timestamp":"2019-03-02 11:30:00","Link":"http://127.0.0.1:8081/portal/template/view/4\",\"Occur\":1,\"Subscriber\":[\"xxx\",\"xxx\",\"xxx\"],\"Uic\":\"xxxx\"}"
time="2019-03-02T11:30:01+08:00" level=debug msg="反序列化 im : <Tos:, Content:>"

正常的replay 应该是 {"tos":"xxx,bbb,ccc","content":"[P0][OK][ccc][][MySQL从库SQL线程告警 all(#1) Slave_SQL_Running db=mysql,ipaddr=1.1.1.1 ,module=mysql,optsystem=linux,port=10001,project=tdnotice,role=slave 1!=1][O1 2019-03-02 11:14:00]"}"

求解

@laiwei laiwei closed this as completed Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants