Skip to content

Commit

Permalink
fix(sqlserver): 修复SQLserver巡检的一些问题 #8609
Browse files Browse the repository at this point in the history
  • Loading branch information
yksitu authored and iSecloud committed Dec 13, 2024
1 parent 8f0196e commit b3cb1da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def fix_app_setting_data(cluster: Cluster, instance: StorageInstance, sync_mode:
if status:
is_fix = 1
SqlserverCheckAppSettingReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=instance.machine.ip,
Expand Down Expand Up @@ -132,6 +134,8 @@ def add_app_setting_data(cluster: Cluster, instance: StorageInstance):
msg = "fix successfully"

SqlserverCheckAppSettingReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=instance.machine.ip,
Expand All @@ -156,6 +160,8 @@ def check_app_setting_data(self, cluster: Cluster):
if data is None:
# 如果返回是空则,则大概率是访问异常,录入异常信息,跳过这次的校验
SqlserverCheckAppSettingReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=instance.machine.ip,
Expand Down Expand Up @@ -201,6 +207,8 @@ def check_user(master_instance: StorageInstance, slave_instance: StorageInstance
)
if not status:
SqlserverCheckUserSyncReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=slave_instance.machine.ip,
Expand All @@ -224,6 +232,8 @@ def check_job(master_instance: StorageInstance, slave_instance: StorageInstance,
)
if not status:
SqlserverCheckJobSyncReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=slave_instance.machine.ip,
Expand All @@ -247,6 +257,8 @@ def check_link_server(master_instance: StorageInstance, slave_instance: StorageI
)
if not status:
SqlserverCheckLinkServerReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=slave_instance.machine.ip,
Expand All @@ -265,6 +277,8 @@ def check_job_is_disabled(cluster: Cluster):
if not status:
# 只有异常才记录
SqlserverCheckSysJobStatuReport.objects.create(
bk_cloud_id=cluster.bk_cloud_id,
bk_biz_id=cluster.bk_biz_id,
cluster=cluster.name,
cluster_type=cluster.cluster_type,
instance_host=instance.machine.ip,
Expand Down
5 changes: 4 additions & 1 deletion dbm-ui/backend/flow/utils/sqlserver/sqlserver_db_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,10 @@ def check_sys_job_status(cluster: Cluster, instance: StorageInstance):
"""
获取实例的系统JOB状态信息
"""
sql = "select name, enabled from msdb.dbo.sysjobs where name like 'TC_%'"
sql = (
"select name, enabled from msdb.dbo.sysjobs where name like 'TC_%' and name "
"not in('TC_SNAPSHOT_DAY','TC_SNAPSHOT_ONE','TC_REPORT_LOAD')"
)
ret = base_sqlserver_drs(bk_cloud_id=cluster.bk_cloud_id, instances=[instance.ip_port], sqls=[sql])
msg = ""
if ret[0]["error_msg"]:
Expand Down

0 comments on commit b3cb1da

Please sign in to comment.