Skip to content

Commit 87aace9

Browse files
author
zhongming Fan
committed
feat: add oracledb_unusable_index_count、 oracledb_invalid_objects_count
1 parent 99348c3 commit 87aace9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

collector/default_metrics.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,50 @@ from v$sysmetric
114114
where group_id=2 and metric_id in (2000,2050,2112,2110)
115115
'''
116116
ignorezeroresult = true
117+
118+
119+
### 新增指标 ###
120+
121+
[[metric]]
122+
context = "unusable_index"
123+
metricsdesc = { count = "Oracle数据库中不可用的索引数量" }
124+
request = '''
125+
SELECT
126+
ltrim(count(*)) as count
127+
FROM
128+
dba_indexes
129+
WHERE
130+
STATUS = 'UNUSABLE'
131+
AND owner IN (
132+
SELECT
133+
username
134+
FROM
135+
dba_users
136+
WHERE
137+
account_status = 'OPEN'
138+
AND username NOT IN ('SYS', 'SYSTEM')
139+
)
140+
'''
141+
142+
[[metric]]
143+
context = "invalid_objects"
144+
labels = [ "owner", "object_type", "status" ]
145+
metricsdesc = { count = "Oracle数据库中无效对象数量" }
146+
request = '''
147+
SELECT
148+
owner,
149+
object_type,
150+
status,
151+
COUNT(*) as count
152+
FROM
153+
dba_objects
154+
WHERE
155+
status <> 'VALID'
156+
GROUP BY
157+
owner, object_type, status
158+
ORDER BY
159+
owner, object_type, status
160+
'''
161+
ignorezeroresult = true
162+
163+

0 commit comments

Comments
 (0)