Skip to content

Commit b3cb1da

Browse files
yksituiSecloud
authored andcommitted
fix(sqlserver): 修复SQLserver巡检的一些问题 #8609
1 parent 8f0196e commit b3cb1da

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

dbm-ui/backend/db_periodic_task/local_tasks/sqlserver/check_app_setting_data.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def fix_app_setting_data(cluster: Cluster, instance: StorageInstance, sync_mode:
7575
if status:
7676
is_fix = 1
7777
SqlserverCheckAppSettingReport.objects.create(
78+
bk_cloud_id=cluster.bk_cloud_id,
79+
bk_biz_id=cluster.bk_biz_id,
7880
cluster=cluster.name,
7981
cluster_type=cluster.cluster_type,
8082
instance_host=instance.machine.ip,
@@ -132,6 +134,8 @@ def add_app_setting_data(cluster: Cluster, instance: StorageInstance):
132134
msg = "fix successfully"
133135

134136
SqlserverCheckAppSettingReport.objects.create(
137+
bk_cloud_id=cluster.bk_cloud_id,
138+
bk_biz_id=cluster.bk_biz_id,
135139
cluster=cluster.name,
136140
cluster_type=cluster.cluster_type,
137141
instance_host=instance.machine.ip,
@@ -156,6 +160,8 @@ def check_app_setting_data(self, cluster: Cluster):
156160
if data is None:
157161
# 如果返回是空则,则大概率是访问异常,录入异常信息,跳过这次的校验
158162
SqlserverCheckAppSettingReport.objects.create(
163+
bk_cloud_id=cluster.bk_cloud_id,
164+
bk_biz_id=cluster.bk_biz_id,
159165
cluster=cluster.name,
160166
cluster_type=cluster.cluster_type,
161167
instance_host=instance.machine.ip,
@@ -201,6 +207,8 @@ def check_user(master_instance: StorageInstance, slave_instance: StorageInstance
201207
)
202208
if not status:
203209
SqlserverCheckUserSyncReport.objects.create(
210+
bk_cloud_id=cluster.bk_cloud_id,
211+
bk_biz_id=cluster.bk_biz_id,
204212
cluster=cluster.name,
205213
cluster_type=cluster.cluster_type,
206214
instance_host=slave_instance.machine.ip,
@@ -224,6 +232,8 @@ def check_job(master_instance: StorageInstance, slave_instance: StorageInstance,
224232
)
225233
if not status:
226234
SqlserverCheckJobSyncReport.objects.create(
235+
bk_cloud_id=cluster.bk_cloud_id,
236+
bk_biz_id=cluster.bk_biz_id,
227237
cluster=cluster.name,
228238
cluster_type=cluster.cluster_type,
229239
instance_host=slave_instance.machine.ip,
@@ -247,6 +257,8 @@ def check_link_server(master_instance: StorageInstance, slave_instance: StorageI
247257
)
248258
if not status:
249259
SqlserverCheckLinkServerReport.objects.create(
260+
bk_cloud_id=cluster.bk_cloud_id,
261+
bk_biz_id=cluster.bk_biz_id,
250262
cluster=cluster.name,
251263
cluster_type=cluster.cluster_type,
252264
instance_host=slave_instance.machine.ip,
@@ -265,6 +277,8 @@ def check_job_is_disabled(cluster: Cluster):
265277
if not status:
266278
# 只有异常才记录
267279
SqlserverCheckSysJobStatuReport.objects.create(
280+
bk_cloud_id=cluster.bk_cloud_id,
281+
bk_biz_id=cluster.bk_biz_id,
268282
cluster=cluster.name,
269283
cluster_type=cluster.cluster_type,
270284
instance_host=instance.machine.ip,

dbm-ui/backend/flow/utils/sqlserver/sqlserver_db_function.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,10 @@ def check_sys_job_status(cluster: Cluster, instance: StorageInstance):
818818
"""
819819
获取实例的系统JOB状态信息
820820
"""
821-
sql = "select name, enabled from msdb.dbo.sysjobs where name like 'TC_%'"
821+
sql = (
822+
"select name, enabled from msdb.dbo.sysjobs where name like 'TC_%' and name "
823+
"not in('TC_SNAPSHOT_DAY','TC_SNAPSHOT_ONE','TC_REPORT_LOAD')"
824+
)
822825
ret = base_sqlserver_drs(bk_cloud_id=cluster.bk_cloud_id, instances=[instance.ip_port], sqls=[sql])
823826
msg = ""
824827
if ret[0]["error_msg"]:

0 commit comments

Comments
 (0)