|
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +[[metric]] |
| 6 | +context = "ownership" |
| 7 | +metricsdesc = { inst_id = "Owner instance of the current queues." } |
| 8 | +request = ''' |
| 9 | +SELECT |
| 10 | + inst_id |
| 11 | +FROM |
| 12 | + gv$persistent_queues |
| 13 | +WHERE |
| 14 | + ROWNUM < 2 |
| 15 | +''' |
| 16 | + |
| 17 | +[[metric]] |
| 18 | +context = "teq" |
| 19 | +metricsdesc = { curr_inst_id = "ID of current instance" } |
| 20 | +request = "SELECT instance_number AS curr_inst_id FROM v$instance" |
| 21 | + |
| 22 | +[[metric]] |
| 23 | +context = "teq" |
| 24 | +labels = ["inst_id"] |
| 25 | +metricsdesc = { total_queues = "Total number of queues"} |
| 26 | +request = ''' |
| 27 | +SELECT |
| 28 | + inst_id, |
| 29 | + COUNT(*) AS total_queues |
| 30 | +FROM |
| 31 | + ( |
| 32 | + SELECT DISTINCT |
| 33 | + t1.inst_id, |
| 34 | + t2.queue_name |
| 35 | + FROM |
| 36 | + gv$persistent_subscribers t1 |
| 37 | + JOIN gv$persistent_queues t2 ON t1.queue_id = t2.queue_id |
| 38 | + ) |
| 39 | +GROUP BY |
| 40 | + inst_id |
| 41 | +''' |
| 42 | + |
| 43 | + |
| 44 | +[[metric]] |
| 45 | +context = "teq" |
| 46 | +labels = ["inst_id"] |
| 47 | +metricsdesc = { total_subscribers = "Total number of subscribers"} |
| 48 | +request = ''' |
| 49 | +SELECT |
| 50 | + inst_id, |
| 51 | + COUNT(*) AS total_subscribers |
| 52 | +FROM |
| 53 | + ( |
| 54 | + SELECT DISTINCT |
| 55 | + inst_id, |
| 56 | + subscriber_id |
| 57 | + FROM |
| 58 | + gv$persistent_subscribers |
| 59 | + ) |
| 60 | +GROUP BY |
| 61 | + inst_id |
| 62 | +''' |
| 63 | + |
| 64 | +[[metric]] |
| 65 | +context = "teq" |
| 66 | +labels = ["inst_id", "queue_name", "subscriber_name"] |
| 67 | +metricsdesc = { enqueued_msgs = "Total enqueued messages.", dequeued_msgs = "Total dequeued messages.", remained_msgs = "Total remained messages.", time_since_last_dequeue = "Time since last dequeue.", estd_time_to_drain_no_enq = "Estimated time to drain if no enqueue.", message_latency_1 = "Message latency for last 5 mins.", message_latency_2 = "Message latency for last 1 hour.", message_latency_3 = "Message latency for last 5 hours."} |
| 68 | +request = ''' |
| 69 | +SELECT DISTINCT |
| 70 | + t1.inst_id, |
| 71 | + t1.queue_id, |
| 72 | + t2.queue_name, |
| 73 | + t1.subscriber_id AS subscriber_name, |
| 74 | + t1.enqueued_msgs, |
| 75 | + t1.dequeued_msgs, |
| 76 | + t1.remained_msgs, |
| 77 | + t1.message_latency_1, |
| 78 | + t1.message_latency_2, |
| 79 | + t1.message_latency_3 |
| 80 | +FROM |
| 81 | + ( |
| 82 | + SELECT |
| 83 | + inst_id, |
| 84 | + queue_id, |
| 85 | + subscriber_id, |
| 86 | + SUM(enqueued_msgs) AS enqueued_msgs, |
| 87 | + SUM(dequeued_msgs) AS dequeued_msgs, |
| 88 | + SUM(enqueued_msgs - dequeued_msgs) AS remained_msgs, |
| 89 | + AVG(10) AS message_latency_1, |
| 90 | + AVG(20) AS message_latency_2, |
| 91 | + AVG(30) AS message_latency_3 |
| 92 | + FROM |
| 93 | + gv$persistent_subscribers |
| 94 | + GROUP BY |
| 95 | + queue_id, |
| 96 | + subscriber_id, |
| 97 | + inst_id |
| 98 | + ) t1 |
| 99 | + JOIN gv$persistent_queues t2 ON t1.queue_id = t2.queue_id |
| 100 | +''' |
| 101 | + |
| 102 | + |
| 103 | +[[metric]] |
| 104 | +context = "sessions" |
| 105 | +labels = ["inst_id", "status", "type"] |
| 106 | +metricsdesc = { value = "Gauge metric with count of sessions by status and type." } |
| 107 | +request = ''' |
| 108 | +SELECT |
| 109 | + inst_id, |
| 110 | + status, |
| 111 | + type, |
| 112 | + COUNT(*) AS value |
| 113 | +FROM |
| 114 | + gv$session |
| 115 | +GROUP BY |
| 116 | + status, |
| 117 | + type, |
| 118 | + inst_id |
| 119 | +''' |
| 120 | + |
| 121 | + |
| 122 | +[[metric]] |
| 123 | +context = "asm_diskgroup" |
| 124 | +labels = ["inst_id", "name"] |
| 125 | +metricsdesc = { total = "Total size of ASM disk group.", free = "Free space available on ASM disk group." } |
| 126 | +request = ''' |
| 127 | +SELECT |
| 128 | + inst_id, |
| 129 | + name, |
| 130 | + total_mb * 1024 * 1024 AS total, |
| 131 | + free_mb * 1024 * 1024 AS free |
| 132 | +FROM |
| 133 | + gv$asm_diskgroup |
| 134 | +''' |
| 135 | +ignorezeroresult = true |
| 136 | + |
| 137 | + |
| 138 | +[[metric]] |
| 139 | +context = "activity" |
| 140 | +labels = ["inst_id", "name"] |
| 141 | +metricsdesc = { value = "Generic counter metric from gv$sysstat view in Oracle." } |
| 142 | +request = ''' |
| 143 | +SELECT |
| 144 | + inst_id, |
| 145 | + name, |
| 146 | + value |
| 147 | +FROM |
| 148 | + gv$sysstat |
| 149 | +WHERE |
| 150 | + name IN ( |
| 151 | + 'parse count (total)', |
| 152 | + 'execute count', |
| 153 | + 'user commits', |
| 154 | + 'user rollbacks' |
| 155 | + ) |
| 156 | +''' |
| 157 | + |
| 158 | + |
| 159 | +[[metric]] |
| 160 | +context = "process" |
| 161 | +labels = ["inst_id"] |
| 162 | +metricsdesc = { count = "Gauge metric with count of processes." } |
| 163 | +request = ''' |
| 164 | +SELECT |
| 165 | + inst_id, |
| 166 | + COUNT(*) AS count |
| 167 | +FROM |
| 168 | + gv$process |
| 169 | +GROUP BY |
| 170 | + inst_id |
| 171 | +''' |
| 172 | + |
| 173 | +[[metric]] |
| 174 | +context = "wait_class" |
| 175 | +labels = ["inst_id", "wait_class"] |
| 176 | +metricsdesc = { total_waits = "Number of times waits of the class occurred", time_waited = "Amount of time spent in the wait by all sessions in the instance" } |
| 177 | +request = ''' |
| 178 | +SELECT |
| 179 | + inst_id, |
| 180 | + wait_class, |
| 181 | + total_waits, |
| 182 | + time_waited |
| 183 | +FROM |
| 184 | + gv$system_wait_class |
| 185 | +''' |
| 186 | + |
| 187 | +[[metric]] |
| 188 | +context = "system" |
| 189 | +labels = ["inst_id", "stat_name"] |
| 190 | +metricsdesc = { value = "os metric from gv$osstat view in Oracle." } |
| 191 | +request = ''' |
| 192 | +SELECT |
| 193 | + inst_id, |
| 194 | + stat_name, |
| 195 | + value |
| 196 | +FROM |
| 197 | + gv$osstat |
| 198 | +WHERE |
| 199 | + upper(stat_name) IN ( |
| 200 | + 'NUM_CPUS', |
| 201 | + 'LOAD', |
| 202 | + 'IDLE_TIME', |
| 203 | + 'BUSY_TIME', |
| 204 | + 'USER_TIME', |
| 205 | + 'PHYSICAL_MEMORY_BYTES', |
| 206 | + 'FREE_MEMORY_BYTES' |
| 207 | + ) |
| 208 | +''' |
| 209 | + |
| 210 | +[[metric]] |
| 211 | +context = "system_network" |
| 212 | +labels = ["inst_id"] |
| 213 | +metricsdesc = { received_from_client = "Bytes received from client.", sent_to_client = "Bytes sent to client." } |
| 214 | +request = ''' |
| 215 | +SELECT |
| 216 | + t1.inst_id AS inst_id, |
| 217 | + t1.received_from_client AS received_from_client, |
| 218 | + t2.sent_to_client AS sent_to_client |
| 219 | +FROM |
| 220 | + ( |
| 221 | + SELECT |
| 222 | + inst_id, |
| 223 | + value AS received_from_client |
| 224 | + FROM |
| 225 | + gv$sysstat |
| 226 | + WHERE |
| 227 | + lower(name) LIKE '%received via sql*net from client%' |
| 228 | + ORDER BY |
| 229 | + value DESC |
| 230 | + ) t1 |
| 231 | + LEFT JOIN ( |
| 232 | + SELECT |
| 233 | + inst_id, |
| 234 | + value AS sent_to_client |
| 235 | + FROM |
| 236 | + gv$sysstat |
| 237 | + WHERE |
| 238 | + lower(name) LIKE '%sent via sql*net to client%' |
| 239 | + ORDER BY |
| 240 | + value DESC |
| 241 | + ) t2 ON t1.inst_id = t2.inst_id |
| 242 | +''' |
0 commit comments