|
| 1 | +[[metric]] |
| 2 | +context = "diskgroup_size" |
| 3 | +labels = [ "inst_id", "node_name" , "instance_name", "diskgroup_name" ] |
| 4 | +metricsdesc = { total = "Total size of ASM disk group in MB.", free = "Free space available on ASM disk group in MB." } |
| 5 | +request = ''' |
| 6 | +SELECT instance_number AS inst_id, |
| 7 | + host_name AS node_name, |
| 8 | + instance_name, |
| 9 | + name AS diskgroup_name, |
| 10 | + total_mb * 1024 * 1024 AS total, |
| 11 | + free_mb * 1024 * 1024 AS free |
| 12 | + FROM v$asm_diskgroup_stat, v$instance |
| 13 | +''' |
| 14 | +ignorezeroresult = true |
| 15 | + |
| 16 | +[[metric]] |
| 17 | +context = "asmuptime" |
| 18 | +labels = [ "inst_id", "node_name", "instance_name"] |
| 19 | +metricsdesc = { uptime = "ASM uptime" } |
| 20 | +request = ''' |
| 21 | +SELECT instance_number AS inst_id, |
| 22 | + host_name AS node_name, |
| 23 | + instance_name, |
| 24 | + (SYSDATE - startup_time) * 86400 AS uptime |
| 25 | + FROM v$instance |
| 26 | +''' |
| 27 | + |
| 28 | +#[[metric]] |
| 29 | +#context = "asm_dg_stat" |
| 30 | +#labels = [ "inst_id", "diskgroup_name", "node_name", "instance_name" ] |
| 31 | +#metricsdesc = { reads = "Total number of I/O read requests for the DG.", writes = "Total number of I/O write requests for the DG.", bytes_read = "Total number of bytes read from the DG", bytes_written = "Total number of bytes written from the DG", iops = "Total number of I/O requests for the DG" } |
| 32 | +#metricstype = { reads = "counter", writes = "counter", bytes_read = "counter", bytes_written = "counter", iops = "counter" } |
| 33 | +#request = ''' |
| 34 | +# SELECT i.instance_number AS inst_id, |
| 35 | +# i.host_name AS node_name, |
| 36 | +# i.instance_name, |
| 37 | +# g.name AS diskgroup_name, |
| 38 | +# SUM (ds.reads) AS reads, |
| 39 | +# SUM (ds.writes) AS writes, |
| 40 | +# SUM (ds.bytes_read) AS bytes_read, |
| 41 | +# SUM (ds.bytes_written) AS bytes_written, |
| 42 | +# SUM (ds.reads + ds.writes) AS iops |
| 43 | +# FROM v$asm_disk_stat ds, v$asm_diskgroup_stat g, v$instance i |
| 44 | +# WHERE ds.mount_status = 'CACHED' AND ds.group_number = g.group_number |
| 45 | +#GROUP BY i.instance_number, |
| 46 | +# i.host_name, |
| 47 | +# i.instance_name, |
| 48 | +# g.name |
| 49 | +#''' |
| 50 | + |
| 51 | +[[metric]] |
| 52 | +context = "asm_disk_stat" |
| 53 | +labels = [ "inst_id", "node_name", "instance_name", "diskgroup_name", "disk_number", "failgroup", "path" ] |
| 54 | +metricsdesc = { reads = "Total number of I/O read requests for the DG.", writes = "Total number of I/O write requests for the DG.", read_time = "Total I/O time (in hundreths of a second) for read requests for the disk", write_time = "Total I/O time (in hundreths of a second) for write requests for the disk", bytes_read = "Total number of bytes read from the DG", bytes_written = "Total number of bytes written from the DG", iops = "Total number of I/O requests for the DG" } |
| 55 | +metricstype = { reads = "counter", writes = "counter", bytes_read = "counter", read_time = "counter", write_time = "counter", bytes_written = "counter", iops = "counter" } |
| 56 | +request = ''' |
| 57 | + SELECT i.instance_number AS inst_id, |
| 58 | + i.host_name AS node_name, |
| 59 | + i.instance_name, |
| 60 | + g.name AS diskgroup_name, |
| 61 | + ds.disk_number AS disk_number, |
| 62 | + ds.failgroup AS failgroup, |
| 63 | + ds.reads AS reads, |
| 64 | + ds.writes AS writes, |
| 65 | + ds.read_time * 1000 AS read_time, |
| 66 | + ds.write_time * 1000 AS write_time, |
| 67 | + ds.bytes_read AS bytes_read, |
| 68 | + ds.bytes_written AS bytes_written, |
| 69 | + REGEXP_REPLACE (ds.PATH, '.*/\', '\') AS PATH, |
| 70 | + ds.reads + ds.writes AS iops |
| 71 | + FROM v$asm_disk_stat ds, v$asm_diskgroup_stat g, v$instance i |
| 72 | + WHERE ds.mount_status = 'CACHED' AND ds.group_number = g.group_number |
| 73 | +''' |
| 74 | + |
| 75 | +[[metric]] |
| 76 | +context = "asm_space_consumers" |
| 77 | +labels = [ "inst_id", "diskgroup_name", "node_name", "instance_name", "sid", "file_type" ] |
| 78 | +metricsdesc = { size_mb = "Total space usage by db by file_type" , files = "Number of files by db by type" } |
| 79 | +request = ''' |
| 80 | + SELECT i.instance_number AS inst_id, |
| 81 | + i.host_name AS node_name, |
| 82 | + i.instance_name, |
| 83 | + gname AS diskgroup_name, |
| 84 | + dbname AS sid, |
| 85 | + file_type, |
| 86 | + ROUND (SUM (space) / 1024 / 1024) size_mb, |
| 87 | + COUNT (*) AS files |
| 88 | + FROM v$instance i, |
| 89 | + (SELECT gname, |
| 90 | + REGEXP_SUBSTR (full_alias_path, |
| 91 | + '[[:alnum:]_]*', |
| 92 | + 1, |
| 93 | + 4) dbname, |
| 94 | + file_type, |
| 95 | + space, |
| 96 | + aname, |
| 97 | + system_created, |
| 98 | + alias_directory |
| 99 | + FROM ( SELECT CONCAT ('+' || gname, |
| 100 | + SYS_CONNECT_BY_PATH (aname, '/')) |
| 101 | + full_alias_path, |
| 102 | + system_created, |
| 103 | + alias_directory, |
| 104 | + file_type, |
| 105 | + space, |
| 106 | + LEVEL, |
| 107 | + gname, |
| 108 | + aname |
| 109 | + FROM (SELECT b.name gname, |
| 110 | + a.parent_index pindex, |
| 111 | + a.name aname, |
| 112 | + a.reference_index rindex, |
| 113 | + a.system_created, |
| 114 | + a.alias_directory, |
| 115 | + c.TYPE file_type, |
| 116 | + c.space |
| 117 | + FROM v$asm_alias a, v$asm_diskgroup b, v$asm_file c |
| 118 | + WHERE a.group_number = b.group_number |
| 119 | + AND a.group_number = c.group_number(+) |
| 120 | + AND a.file_number = c.file_number(+) |
| 121 | + AND a.file_incarnation = c.incarnation(+)) |
| 122 | + START WITH (MOD (pindex, POWER (2, 24))) = 0 |
| 123 | + AND rindex IN |
| 124 | + (SELECT a.reference_index |
| 125 | + FROM v$asm_alias a, v$asm_diskgroup b |
| 126 | + WHERE a.group_number = |
| 127 | + b.group_number |
| 128 | + AND (MOD (a.parent_index, |
| 129 | + POWER (2, 24))) = |
| 130 | + 0) |
| 131 | + CONNECT BY PRIOR rindex = pindex) |
| 132 | + WHERE NOT file_type IS NULL AND system_created = 'Y') |
| 133 | +GROUP BY i.instance_number, |
| 134 | + i.host_name, |
| 135 | + i.instance_name, |
| 136 | + gname, |
| 137 | + dbname, |
| 138 | + file_type |
| 139 | +''' |
0 commit comments