|
| 1 | +metrics: |
| 2 | + - context: "sessions" |
| 3 | + labels: [ "inst_id", "status", "type" ] |
| 4 | + metricsdesc: |
| 5 | + value: "Gauge metric with count of sessions by inst_id, status and type." |
| 6 | + request: | |
| 7 | + select inst_id, status, type, count(*) as value |
| 8 | + from gv$session |
| 9 | + group by inst_id, status, type |
| 10 | +
|
| 11 | + - context: "resource" |
| 12 | + labels: [ "inst_id", "resource_name" ] |
| 13 | + metricsdesc: |
| 14 | + current_utilization: "Generic counter metric from gv$resource_limit view in Oracle (current value)." |
| 15 | + limit_value: "Generic counter metric from v$resource_limit view in Oracle (UNLIMITED: -1)." |
| 16 | + request: | |
| 17 | + select inst_id, resource_name, current_utilization, |
| 18 | + case when trim(limit_value) like 'UNLIMITED' then '-1' else trim(limit_value) end as limit_value |
| 19 | + from gv$resource_limit |
| 20 | + group by inst_id, resource_name, current_utilization, limit_value |
| 21 | + ignorezeroresult: true |
| 22 | + |
| 23 | + - context: "asm_diskgroup" |
| 24 | + labels: [ "inst_id", "name" ] |
| 25 | + metricsdesc: |
| 26 | + total: "Total size of ASM disk group." |
| 27 | + free: "Free space available on ASM disk group." |
| 28 | + request: | |
| 29 | + select inst_id, name, total_mb*1024*1024 as total, free_mb*1024*1024 as free |
| 30 | + from gv$asm_diskgroup_stat |
| 31 | + where exists (select 1 from gv$datafile where name like '+%') |
| 32 | + and inst_id = (select max(inst_id) from gv$instance) |
| 33 | + group by inst_id, name, total_mb, free_mb |
| 34 | + ignorezeroresult: true |
| 35 | + |
| 36 | + - context: "activity" |
| 37 | + labels: [ "inst_id" ] |
| 38 | + metricsdesc: |
| 39 | + value: "Generic counter metric from gv$sysstat view in Oracle." |
| 40 | + fieldtoappend: "name" |
| 41 | + request: | |
| 42 | + select inst_id, name, value from gv$sysstat |
| 43 | + where name in ('parse count (total)', 'execute count', 'user commits', 'user rollbacks') |
| 44 | + group by inst_id, name, value |
| 45 | +
|
| 46 | + - context: "process" |
| 47 | + labels: [ "inst_id" ] |
| 48 | + metricsdesc: |
| 49 | + count: "Gauge metric with count of processes." |
| 50 | + request: | |
| 51 | + select inst_id, count(*) as count |
| 52 | + from gv$process |
| 53 | + group by inst_id |
| 54 | +
|
| 55 | + - context: "wait_time" |
| 56 | + labels: [ "inst_id", "wait_class", "con_id" ] |
| 57 | + metricsdesc: |
| 58 | + time_waited_sec_total: "counter metric from system_wait_class view in Oracle." |
| 59 | + metricstype: |
| 60 | + time_waited_sec_total: "counter" |
| 61 | + fieldtoappend: "wait_class" |
| 62 | + request: | |
| 63 | + select |
| 64 | + inst_id, |
| 65 | + wait_class, |
| 66 | + round(time_waited/100,3) time_waited_sec_total, |
| 67 | + con_id |
| 68 | + from gv$system_wait_class |
| 69 | + where wait_class <> 'Idle' |
| 70 | + group by inst_id, wait_class, con_id, round(time_waited/100,3) |
| 71 | + ignorezeroresult: true |
| 72 | + |
| 73 | + - context: "tablespace" |
| 74 | + labels: [ "tablespace", "type" ] |
| 75 | + metricsdesc: |
| 76 | + bytes: "Generic counter metric of tablespaces bytes in Oracle." |
| 77 | + max_bytes: "Generic counter metric of tablespaces max bytes in Oracle." |
| 78 | + free: "Generic counter metric of tablespaces free bytes in Oracle." |
| 79 | + used_percent: "Gauge metric showing as a percentage of how much of the tablespace has been used." |
| 80 | + request: | |
| 81 | + SELECT |
| 82 | + dt.tablespace_name as tablespace, |
| 83 | + dt.contents as type, |
| 84 | + dt.block_size * dtum.used_space as bytes, |
| 85 | + dt.block_size * dtum.tablespace_size as max_bytes, |
| 86 | + dt.block_size * (dtum.tablespace_size - dtum.used_space) as free, |
| 87 | + dtum.used_percent |
| 88 | + FROM dba_tablespace_usage_metrics dtum, dba_tablespaces dt |
| 89 | + WHERE dtum.tablespace_name = dt.tablespace_name |
| 90 | + and dt.contents != 'TEMPORARY' |
| 91 | + union |
| 92 | + SELECT |
| 93 | + dt.tablespace_name as tablespace, |
| 94 | + 'TEMPORARY' as type, |
| 95 | + dt.tablespace_size - dt.free_space as bytes, |
| 96 | + dt.tablespace_size as max_bytes, |
| 97 | + dt.free_space as free, |
| 98 | + ((dt.tablespace_size - dt.free_space) / dt.tablespace_size) |
| 99 | + FROM dba_temp_free_space dt |
| 100 | + order by tablespace |
| 101 | +
|
| 102 | + - context: "db_system" |
| 103 | + labels: [ "inst_id", "name" ] |
| 104 | + metricsdesc: |
| 105 | + value: "Database system resources metric" |
| 106 | + request: | |
| 107 | + select inst_id, name, value |
| 108 | + from gv$parameter |
| 109 | + where name in ('cpu_count', 'sga_max_size', 'pga_aggregate_limit') |
| 110 | + group by inst_id, name, value |
| 111 | +
|
| 112 | + - context: "db_platform" |
| 113 | + labels: [ "inst_id", "platform_name" ] |
| 114 | + metricsdesc: |
| 115 | + value: "Database platform" |
| 116 | + request: | |
| 117 | + SELECT inst_id, platform_name, 1 as value |
| 118 | + FROM gv$database |
| 119 | + GROUP BY inst_id, platform_name |
| 120 | +
|
| 121 | + - context: "top_sql" |
| 122 | + labels: [ "inst_id", "sql_id", "sql_text" ] |
| 123 | + metricsdesc: |
| 124 | + elapsed: "SQL statement elapsed time running" |
| 125 | + request: | |
| 126 | + select * from ( |
| 127 | + select inst_id, sql_id, elapsed_time / 1000000 as elapsed, substrb(replace(sql_text,'',' '),1,55) as sql_text |
| 128 | + from gv$sqlstats |
| 129 | + order by elapsed_time desc |
| 130 | + ) where rownum <= 15 |
| 131 | + ignorezeroresult: true |
| 132 | + # scrapeinterval: "5m" |
| 133 | + |
| 134 | + - context: "cache_hit_ratio" |
| 135 | + labels: [ "inst_id", "cache_hit_type" ] |
| 136 | + metricsdesc: |
| 137 | + value: "Cache Hit Ratio" |
| 138 | + request: | |
| 139 | + select metric_name cache_hit_type, value |
| 140 | + from gv$sysmetric |
| 141 | + where group_id=2 and metric_id in (2000,2050,2112,2110) |
| 142 | + ignorezeroresult: true |
0 commit comments