Skip to content

Commit fcaf4af

Browse files
author
zhongming Fan
committed
sql: config up
1 parent cc28d2e commit fcaf4af

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

collector/default_metrics.toml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[[metric]]
2+
context = "uptime"
3+
labels = [ "inst_id", "node_name", "instance_name"]
4+
metricsdesc = { seconds = "instance uptime" }
5+
request = "SELECT instance_number AS inst_id, host_name AS node_name, instance_name, (SYSDATE - startup_time) * 86400 AS seconds FROM v$instance"
6+
17
[[metric]]
28
context = "sessions"
39
labels = [ "status", "type" ]
@@ -16,9 +22,9 @@ ignorezeroresult = true
1622

1723
[[metric]]
1824
context = "asm_diskgroup"
19-
labels = [ "name" ]
20-
metricsdesc = { total = "Total size of ASM disk group.", free = "Free space available on ASM disk group." }
21-
request = "SELECT name,total_mb*1024*1024 as total,free_mb*1024*1024 as free FROM v$asm_diskgroup_stat where exists (select 1 from v$datafile where name like '+%')"
25+
labels = [ "diskgroup_name" ]
26+
metricsdesc = { total = "Total size of ASM disk group.", free = "Free space available on ASM disk group.", usage = "Percentage of ASM disk group used."}
27+
request = "SELECT name as diskgroup_name,total_mb*1024*1024 as total,free_mb*1024*1024 as free, (1 - free_mb / total_mb) * 100 as usage FROM v$asm_diskgroup_stat where exists (select 1 from v$datafile where name like '+%')"
2228
ignorezeroresult = true
2329

2430
[[metric]]
@@ -34,19 +40,17 @@ request = "SELECT COUNT(*) as count FROM v$process"
3440

3541
[[metric]]
3642
context = "wait_time"
37-
labels = ["wait_class","con_id"]
38-
metricsdesc = { time_waited_sec_total="counter metric from system_wait_class view in Oracle." }
39-
metricstype = { time_waited_sec_total = "counter" }
43+
metricsdesc = { value="Generic counter metric from v$waitclassmetric view in Oracle." }
4044
fieldtoappend= "wait_class"
4145
request = '''
42-
select
43-
wait_class,
44-
round(time_waited/100,3) time_waited_sec_total,
45-
con_id
46-
from v$system_wait_class
47-
where wait_class <> 'Idle'
46+
SELECT
47+
n.wait_class as WAIT_CLASS,
48+
round(m.time_waited*10/(m.INTSIZE_CSEC),3) as VALUE
49+
FROM
50+
v$waitclassmetric m, v$system_wait_class n
51+
WHERE
52+
m.wait_class_id=n.wait_class_id AND n.wait_class != 'Idle'
4853
'''
49-
ignorezeroresult = true
5054

5155
[[metric]]
5256
context = "tablespace"
@@ -65,6 +69,31 @@ WHERE dtum.tablespace_name = dt.tablespace_name
6569
ORDER by tablespace
6670
'''
6771

72+
73+
[[metric]]
74+
context = "pga"
75+
metricsdesc = { total = "Generic counter metric of aggregate PGA target parameter in Oracle.", used = "Generic counter metric of total PGA allocated in Oracle.", used_percent = "Gauge metric showing as a percentage of how much of the PGA has been used." }
76+
request = '''
77+
SELECT
78+
(SELECT value FROM v$pgastat WHERE name = 'aggregate PGA target parameter') AS total,
79+
(SELECT value FROM v$pgastat WHERE name = 'total PGA allocated') AS used,
80+
(SELECT value FROM v$pgastat WHERE name = 'total PGA allocated') / (SELECT value FROM v$pgastat WHERE name = 'aggregate PGA target parameter') * 100 AS used_percent
81+
FROM
82+
dual
83+
'''
84+
85+
[[metric]]
86+
context = "sga"
87+
metricsdesc = { total = "Generic counter metric of total SGA size in Oracle.", free = "Generic counter metric of free SGA memory in Oracle.", used_percent = "Gauge metric showing as a percentage of how much of the SGA has been used." }
88+
request = '''
89+
SELECT
90+
(SELECT SUM(value) FROM v$sga) AS total,
91+
(SELECT SUM(bytes) FROM v$sgastat WHERE name = 'free memory') AS free,
92+
((SELECT SUM(value) FROM v$sga) - (SELECT SUM(bytes) FROM v$sgastat WHERE name = 'free memory')) / (SELECT SUM(value) FROM v$sga) * 100 AS used_percent
93+
FROM
94+
dual
95+
'''
96+
6897
[[metric]]
6998
context = "db_system"
7099
labels = [ "name" ]

0 commit comments

Comments
 (0)