实现监控节点在线状态

This commit is contained in:
刘祥超
2020-10-25 18:26:46 +08:00
parent 022aa174a4
commit 6a25cce772
7 changed files with 163 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ type MessageType = string
const (
MessageTypeHealthCheckFail MessageType = "HealthCheckFail"
MessageTypeNodeInactive MessageType = "NodeInactive"
)
type MessageDAO dbs.DAO
@@ -84,6 +85,12 @@ func (this *MessageDAO) CreateClusterMessage(clusterId int64, messageType Messag
return err
}
// 创建节点消息
func (this *MessageDAO) CreateNodeMessage(clusterId int64, nodeId int64, messageType MessageType, level string, body string, paramsJSON []byte) error {
_, err := this.createMessage(clusterId, nodeId, messageType, level, body, paramsJSON)
return err
}
// 删除某天之前的消息
func (this *MessageDAO) DeleteMessagesBeforeDay(dayTime time.Time) error {
day := timeutil.Format("Ymd", dayTime)