Skip to content

Commit 9f0b61d

Browse files
committed
feat(mongodb): DBHA告警独立出来 TencentBlueKing#10178
1 parent 94b40e5 commit 9f0b61d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

dbm-services/common/dbha/ha-module/constvar/constant.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ const (
376376
DBHAEventSQLserverSwitchSucc = "dbha_sqlserver_switch_ok"
377377
// DBHAEventSQLserverSwitchErr TODO
378378
DBHAEventSQLserverSwitchErr = "dbha_sqlserver_switch_err"
379+
// DBHAEventMongosSwitchSucc TODO
380+
DBHAEventMongosSwitchSucc = "dbha_mongos_switch_succ"
381+
// DBHAEventMongosSwitchErr TODO
382+
DBHAEventMongosSwitchErr = "dbha_mongos_switch_err"
379383
// DBHAEventDetectRedisAuth TODO
380384
DBHAEventDetectRedisAuth = "dbha_detect_redis_auth_fail"
381385
// DBHAEventDetectSSHAuth TODO

dbm-services/common/dbha/ha-module/monitor/monitor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ func GetMonitorInfoBySwitch(ins dbutil.DataBaseSwitch, succ bool) MonitorInfo {
223223
} else {
224224
eventName = constvar.DBHAEventSQLserverSwitchErr
225225
}
226+
case constvar.Mongos:
227+
if succ {
228+
eventName = constvar.DBHAEventMongosSwitchSucc
229+
} else {
230+
eventName = constvar.DBHAEventMongosSwitchErr
231+
}
226232
default:
227233
if succ {
228234
eventName = constvar.DBHAEventMysqlSwitchSucc

dbm-ui/backend/db_services/redis/autofix/watcher.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ def save_ignore_host(switched_host: RedisSwitchHost, msg):
273273
msgs[_("BKID")] = switched_host.bk_biz_id
274274
msgs[_("故障IP")] = switched_host.ip
275275
msgs[_("实例类型")] = switched_host.instance_type
276-
msgs[_("ByDBHA")] = _(
277-
"待切换的实例:{}".format(list(set(switched_host.cluster_ports) - set((switched_host.sw_result))))
276+
msgs[_("待DBHA切换")] = _(
277+
"TODO:{};失败:{}".format(
278+
list(set(switched_host.cluster_ports) - set((switched_host.sw_result.get("success", [])))),
279+
(switched_host.sw_result.get("failed", [])),
280+
)
278281
)
279282
send_msg_2_qywx(title, msgs)

0 commit comments

Comments
 (0)