monitor_ob.yaml 19.0 KB
Newer Older
W
wangzelin.wzl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
obInputBasic: &obInputBasic
  plugin: mysqlTableInput
  config:
    timeout: 10s
    pluginConfig:
      maintainCacheThreads: 4
      connection:
        url: ${monagent.ob.monitor.user}:${monagent.ob.monitor.password}@tcp(127.0.0.1:${monagent.ob.sql.port})/oceanbase?interpolateParams=true
        maxIdle: 2
        maxOpen: 32
      defaultConditionValues:
        ob_svr_ip: ${monagent.host.ip}
        ob_svr_port: ${monagent.ob.rpc.port}
X
xueran 已提交
14 15 16
        ob_is_rootservice: false
        ob_is_v4: false
        ob_is_v3: false
W
wangzelin.wzl 已提交
17
      collectConfig:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

        - sql: select ob_version() REGEXP '^4' as ob_is_v4
          name: ob_is_v4
          conditionValues:
            ob_is_v4: ob_is_v4
        - sql: select ob_version() REGEXP '^3' as ob_is_v3
          name: ob_is_v3
          conditionValues:
            ob_is_v3: ob_is_v3
        - name: ob_role
          sqlSlowThreshold: 100ms
          metrics:
            is_rootserver: with_rootserver
          conditionValues:
            ob_is_rootservice: with_rootserver
33
          conditions: [ ob_is_v3 ]
X
xueran 已提交
34 35 36 37 38 39 40 41 42
          params: [ ob_svr_ip, ob_svr_port ]
          sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ with_rootserver from __all_server where svr_ip = ? and svr_port = ?

        - name: ob_role
          sqlSlowThreshold: 100ms
          metrics:
            is_rootserver: with_rootserver
          conditionValues:
            ob_is_rootservice: with_rootserver
43
          conditions: [ ob_is_v4 ]
X
xueran 已提交
44 45
          params: [ ob_svr_ip, ob_svr_port ]
          sql: select (case when with_rootserver='YES' then 1 else 0 end) as with_rootserver from DBA_OB_SERVERS where svr_ip = ? and svr_port = ?
46

W
wangzelin.wzl 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, cache_name, cache_size from __all_virtual_kvcache_info, __all_tenant where __all_tenant.tenant_id = __all_virtual_kvcache_info.tenant_id and svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_cache
          tags:
            tenant_name: tenant_name
            cache_name: cache_name
          metrics:
            size_bytes: cache_size
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, tenant_id, stat_id, value from v$sysstat, __all_tenant where stat_id IN (10000, 10001, 10002, 10003, 10005, 10006, 140002, 140003, 140005, 140006, 60019, 60020, 60024, 80040, 80041, 130000, 130001, 130002, 130004, 20001, 20002, 30000, 30001, 30002, 30005, 30006, 40000, 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 50000, 50001, 50008, 50009, 60000, 60001, 60002, 60003, 60004, 60005, 60019, 60020, 60021, 60022, 60023, 60024, 80057) and (con_id > 1000 or con_id = 1) and __all_tenant.tenant_id = v$sysstat.con_id and class < 1000
          name: ob_sysstat
          tags:
            tenant_name: tenant_name
            tenant_id: tenant_id
            stat_id: stat_id
          metrics:
            value: value
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000) */ tenant_name, 1 as role, case when cnt is null then 0 else cnt end as cnt from (select __all_tenant.tenant_name, t1.cnt from __all_tenant left join (select tenant_id, count(*) as cnt from __all_virtual_partition_info where svr_ip = ? and svr_port = ? group by tenant_id) t1 on __all_tenant.tenant_id = t1.tenant_id) t2
          params: [ob_svr_ip, ob_svr_port]
C
chris-sun-star 已提交
65
          conditions: [ ob_is_v3 ]
W
wangzelin.wzl 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
          name: ob_partition
          tags:
            tenant_name: tenant_name
            role: role
          metrics:
            num: cnt
          enableCache: true
          cacheExpire: 1h
          cacheDataExpire: 2h
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ group_concat(svr_ip SEPARATOR ',') as servers, status, count(1) as cnt from __all_server group by status
          name: ob_server
          tags:
            server_ips: servers
            status: status
          metrics:
            num: cnt
          enableCache: true
          cacheExpire: 60s
          cacheDataExpire: 120s
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000)  */ tenant_name, count(*)  as cnt from gv$table group by tenant_id
          name: ob_table
87
          conditions: [ ob_is_v3, ob_is_rootservice ]
88 89 90 91 92 93 94 95 96
          tags:
            tenant_name: tenant_name
          metrics:
            num: cnt
          enableCache: true
          cacheExpire: 1h
          cacheDataExpire: 2h
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000)  */ tenant_name, count(*)  as cnt from CDB_TABLES join __all_tenant on CDB_TABLES.con_id = __all_tenant.tenant_id group by con_id
          name: ob_table
97
          conditions: [ ob_is_v4, ob_is_rootservice ]
W
wangzelin.wzl 已提交
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
          tags:
            tenant_name: tenant_name
          metrics:
            num: cnt
          enableCache: true
          cacheExpire: 1h
          cacheDataExpire: 2h
        - sql: select  /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ case when cnt is null then 0 else cnt end as cnt, tenant_name from (select __all_tenant.tenant_name, cnt from __all_tenant left join (select count(*) as cnt, tenant as tenant_name from __all_virtual_processlist where svr_ip = ? and svr_port = ? group by tenant) t1 on __all_tenant.tenant_name = t1.tenant_name) t2
          params: [ob_svr_ip, ob_svr_port]
          name: ob_active_session
          tags:
            tenant_name: tenant_name
          metrics:
            num: cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ zone, name, value, time_to_usec(now()) as current from __all_zone
          name: ob_zone
          tags:
            zone: zone
            name: name
          metrics:
            stat: value
            current_timestamp: current
X
xueran 已提交
120
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, mem_used, access_count, hit_count from v$plan_cache_stat join __all_tenant on v$plan_cache_stat.tenant_id = __all_tenant.tenant_id group by tenant_name
W
wangzelin.wzl 已提交
121
          name: ob_plan_cache
122
          conditions: [ ob_is_v3 ]
123 124 125 126 127 128
          tags:
            tenant_name: tenant_name
          metrics:
            memory_bytes: mem_used
            access_total: access_count
            hit_total: hit_count
X
xueran 已提交
129 130
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, mem_used, access_count, hit_count from V$OB_PLAN_CACHE_STAT join __all_tenant on V$OB_PLAN_CACHE_STAT.tenant_id = __all_tenant.tenant_id group by tenant_name
          name: ob_plan_cache
131 132
          condition: [ ob_is_v4 ]

W
wangzelin.wzl 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145
          tags:
            tenant_name: tenant_name
          metrics:
            memory_bytes: mem_used
            access_total: access_count
            hit_total: hit_count
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, sum(total_waits) as total_waits, sum(time_waited_micro) / 1000000 as time_waited from v$system_event join __all_tenant on v$system_event.con_id = __all_tenant.tenant_id where v$system_event.wait_class <> 'IDLE' group by tenant_name
          name: ob_waitevent
          tags:
            tenant_name: tenant_name
          metrics:
            wait_total: total_waits
            wait_seconds_total: time_waited
146 147 148
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ __all_tenant.tenant_name as tenant_name, cast(v_acc_response_time.response_time / 1000000 as float) as response_time_seconds,  v_acc_response_time.count as bucket, case when  v_acc_response_time.response_time = (select max(response_time) from __all_virtual_query_response_time) then v_acc_response_time.count else null end as count, case when  v_acc_response_time.response_time = (select max(response_time) from __all_virtual_query_response_time) then cast(v_acc_response_time.sum / 1000000 as float) else null end as sum from (select b.tenant_id, b.response_time  as response_time, sum(a.count) as count, sum(a.total) as sum from  __all_virtual_query_response_time a,  __all_virtual_query_response_time b where a.response_time <= b.response_time and a.svr_ip = b.svr_ip and a.svr_port = b.svr_port and b.svr_ip = ? and b.svr_port = ? group by b.tenant_id, b.response_time) v_acc_response_time,  __all_tenant where v_acc_response_time.tenant_id = __all_tenant.tenant_id;
          params: [ob_svr_ip, ob_svr_port]
          name: ob_query_response_time_seconds
W
wangzelin.wzl 已提交
149 150
          tags:
            tenant_name: tenant_name
151
            le: response_time_seconds
W
wangzelin.wzl 已提交
152
          metrics:
153
            bucket: bucket
W
wangzelin.wzl 已提交
154
            count: count
155
            sum: sum
W
wangzelin.wzl 已提交
156 157 158 159 160 161 162 163 164 165 166 167 168 169

obInputExtra: &obInputExtra
  plugin: mysqlTableInput
  config:
    timeout: 10s
    pluginConfig:
      maintainCacheThreads: 4
      connection:
        url: ${monagent.ob.monitor.user}:${monagent.ob.monitor.password}@tcp(127.0.0.1:${monagent.ob.sql.port})/oceanbase?interpolateParams=true
        maxIdle: 2
        maxOpen: 32
      defaultConditionValues:
        ob_svr_ip: ${monagent.host.ip}
        ob_svr_port: ${monagent.ob.rpc.port}
X
xueran 已提交
170 171 172
        ob_is_rootservice: false
        ob_is_v4: false
        ob_is_v3: false
W
wangzelin.wzl 已提交
173
      collectConfig:
174 175 176 177 178 179 180 181 182 183 184 185 186 187
        - sql: select ob_version() REGEXP '^4' as ob_is_v4
          name: ob_is_v4
          conditionValues:
            ob_is_v4: ob_is_v4
        - sql: select ob_version() REGEXP '^3' as ob_is_v3
          name: ob_is_v3
          conditionValues:
            ob_is_v3: ob_is_v3
        - name: ob_role
          sqlSlowThreshold: 100ms
          metrics:
            is_rootserver: with_rootserver
          conditionValues:
            ob_is_rootservice: with_rootserver
188
          conditions: [ ob_is_v3 ]
X
xueran 已提交
189 190 191 192 193 194 195 196 197
          params: [ ob_svr_ip, ob_svr_port ]
          sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ with_rootserver from __all_server where svr_ip = ? and svr_port = ?

        - name: ob_role
          sqlSlowThreshold: 100ms
          metrics:
            is_rootserver: with_rootserver
          conditionValues:
            ob_is_rootservice: with_rootserver
198
          conditions: [ ob_is_v4 ]
X
xueran 已提交
199 200
          params: [ ob_svr_ip, ob_svr_port ]
          sql: select (case when with_rootserver='YES' then 1 else 0 end) as with_rootserver from DBA_OB_SERVERS where svr_ip = ? and svr_port = ?
W
wangzelin.wzl 已提交
201 202
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ count(*) as cnt from v$unit
          name: ob_unit
C
chris-sun-star 已提交
203 204 205 206 207 208
          conditions: [ ob_is_v3 ]
          metrics:
            num: cnt
        - sql: select /*+ MONITOR_AGENT */ count(*) as cnt from V$OB_UNITS
          name: ob_unit
          conditions: [ ob_is_v4 ]
W
wangzelin.wzl 已提交
209 210 211 212 213 214 215 216 217 218 219 220 221 222
          metrics:
            num: cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ total_size, free_size from __all_virtual_disk_stat where svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_disk
          metrics:
            total_bytes: total_size
            free_bytes: free_size
          enableCache: true
          cacheExpire: 1h
          cacheDataExpire: 2h
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ cpu_total,cpu_assigned,mem_total,mem_assigned,disk_total,disk_assigned,unit_num,migrating_unit_num,cpu_assigned_percent, mem_assigned_percent, disk_assigned_percent from __all_virtual_server_stat where svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_server_resource
C
chris-sun-star 已提交
223
          conditions: [ ob_is_v3 ]
W
wangzelin.wzl 已提交
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
          metrics:
            cpu: cpu_total
            cpu_assigned: cpu_assigned
            memory_bytes: mem_total
            memory_assigned_bytes: mem_assigned
            disk_bytes: disk_total
            disk_assigned_bytes: disk_assigned
            unit_num: unit_num
            migrating_unit_num: migrating_unit_num
            cpu_assigned_percent: cpu_assigned_percent
            memory_assigned_percent: mem_assigned_percent
            disk_assigned_percent: disk_assigned_percent
          enableCache: true
          cacheExpire: 60s
          cacheDataExpire: 120s
C
chris-sun-star 已提交
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
        - sql: select /* MONITOR_AGENT */ cpu_capacity_max as cpu_total,cpu_assigned_max as cpu_assigned,mem_capacity as mem_total,mem_assigned as mem_assigned,data_disk_capacity as disk_total, (cpu_assigned_max / cpu_capacity_max) as cpu_assigned_percent, (mem_assigned / mem_capacity) as mem_assigned_percent from GV$OB_SERVERS where svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_server_resource
          conditions: [ ob_is_v4 ]
          metrics:
            cpu: cpu_total
            cpu_assigned: cpu_assigned
            memory_bytes: mem_total
            memory_assigned_bytes: mem_assigned
            disk_bytes: disk_total
            cpu_assigned_percent: cpu_assigned_percent
            memory_assigned_percent: mem_assigned_percent
          enableCache: true
          cacheExpire: 60s
          cacheDataExpire: 120s
W
wangzelin.wzl 已提交
254 255 256
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ count(1) as cnt from __all_virtual_trans_stat where part_trans_action > 2 and ctx_create_time < date_sub(now(), interval 600 second) and svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_trans
257
          conditions: [ ob_is_rootservice ]
W
wangzelin.wzl 已提交
258 259 260 261
          metrics:
            expire_num: cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000)  */ count(*) as cnt from gv$table where table_type in (5) and index_status in (5, 6)
          name: ob_index
262
          conditions: [ ob_is_v3, ob_is_rootservice]
263 264 265 266
          metrics:
            error_num: cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000)  */ count(*) as cnt from CDB_INDEXES where table_type in (5) and status in (5, 6)
          name: ob_index
267
          conditions: [ob_is_v4, ob_is_rootservice ]
W
wangzelin.wzl 已提交
268 269 270 271 272
          metrics:
            error_num: cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ __all_tenant.tenant_name,  active, total, freeze_trigger, freeze_cnt from gv$memstore, __all_tenant  where gv$memstore.tenant_id = __all_tenant.tenant_id and ip = ? and port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_memstore
C
chris-sun-star 已提交
273 274 275 276 277 278 279 280 281 282 283 284
          conditions: [ ob_is_v3 ]
          tags:
            tenant_name: tenant_name
          metrics:
            active_bytes: active
            total_bytes: total
            freeze_trigger_bytes: freeze_trigger
            freeze_times: freeze_cnt
        - sql: select /* MONITOR_AGENT */ __all_tenant.tenant_name, active_span as active, memstore_used as total, freeze_trigger, freeze_cnt from GV$OB_MEMSTORE, __all_tenant where GV$OB_MEMSTORE.tenant_id = __all_tenant.tenant_id and svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_memstore
          conditions: [ ob_is_v4 ]
W
wangzelin.wzl 已提交
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
          tags:
            tenant_name: tenant_name
          metrics:
            active_bytes: active
            total_bytes: total
            freeze_trigger_bytes: freeze_trigger
            freeze_times: freeze_cnt
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ sum(hold) as hold, sum(used) as used from __all_virtual_memory_info where tenant_id = 500 and svr_ip = ? and svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_tenant500_memory
          metrics:
            hold_bytes: hold
            used_bytes: used
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, __all_unit_config.name, max_cpu, min_cpu, max_memory, min_memory, max_iops, min_iops, max_disk_size, max_session_num from __all_tenant, __all_resource_pool, __all_unit_config, __all_unit  where __all_tenant.tenant_id = __all_resource_pool.tenant_id and __all_resource_pool.unit_config_id = __all_unit_config.unit_config_id and __all_unit.resource_pool_id = __all_resource_pool.resource_pool_id and __all_unit.svr_ip = ? and __all_unit.svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_unit_config
C
chris-sun-star 已提交
301
          conditions: [ ob_is_v3 ]
W
wangzelin.wzl 已提交
302 303 304 305 306 307 308 309 310 311 312 313
          tags:
            tenant_name: tenant_name
            unit_config_name: name
          metrics:
            max_cpu: max_cpu
            min_cpu: min_cpu
            max_memory_bytes: max_memory
            min_memory_bytes: min_memory
            max_iops: max_iops
            min_iops: min_iops
            max_disk_size_bytes: max_disk_size
            max_session_num: max_session_num
C
chris-sun-star 已提交
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
        - sql: select /* MONITOR_AGENT */ __all_tenant.tenant_name, DBA_OB_UNIT_CONFIGS.name, DBA_OB_UNIT_CONFIGS.max_cpu, DBA_OB_UNIT_CONFIGS.min_cpu, DBA_OB_UNIT_CONFIGS.memory_size as max_memory, DBA_OB_UNIT_CONFIGS.max_iops, DBA_OB_UNIT_CONFIGS.min_iops from __all_tenant, DBA_OB_RESOURCE_POOLS, DBA_OB_UNIT_CONFIGS, DBA_OB_UNITS  where DBA_OB_RESOURCE_POOLS.tenant_id = __all_tenant.tenant_id and DBA_OB_RESOURCE_POOLS.unit_config_id = DBA_OB_UNIT_CONFIGS.unit_config_id and DBA_OB_UNITS.resource_pool_id = DBA_OB_RESOURCE_POOLS.resource_pool_id and DBA_OB_UNITS.svr_ip = ? and DBA_OB_UNITS.svr_port = ?
          params: [ob_svr_ip, ob_svr_port]
          name: ob_unit_config
          conditions: [ ob_is_v4 ]
          tags:
            tenant_name: tenant_name
            unit_config_name: name
          metrics:
            max_cpu: max_cpu
            min_cpu: min_cpu
            max_memory_bytes: max_memory
            min_memory_bytes: min_memory
            max_iops: max_iops
            min_iops: min_iops
          enableCache: true
          cacheExpire: 60s
X
xueran 已提交
330
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_name, tenant_id, `latch#` as latch_no, name, gets, misses, sleeps, immediate_gets, immediate_misses, spin_gets, wait_time / 1000000 as wait_time from v$latch, __all_tenant where __all_tenant.tenant_id = v$latch.con_id
W
wangzelin.wzl 已提交
331 332 333 334 335
          name: ob_latch
          tags:
            tenant_name: tenant_name
            tenant_id: tenant_id
            name: name
X
xueran 已提交
336
            latch_no: latch_no
W
wangzelin.wzl 已提交
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
          metrics:
            get_total: gets
            miss_total: misses
            sleep_total: sleeps
            immediate_get_total: immediate_gets
            immediate_miss_total: immediate_misses
            spin_get_total: spin_gets
            wait_seconds_total: wait_time

retagProcessor: &retagProcessor
  plugin: retagProcessor
  config:
    timout: 10s
    pluginConfig:
      newTags:
        app: OB
        obzone: ${monagent.ob.zone.name}
        svr_ip: ${monagent.host.ip}
        ob_cluster_id: ${monagent.ob.cluster.id}
        ob_cluster_name: ${monagent.ob.cluster.name}

prometheusExporter: &prometheusExporter
  plugin: prometheusExporter
  config:
    timout: 10s
    pluginConfig:
      formatType: fmtText

modules:
  - module: monitor.ob
    moduleType: monagent.pipeline
    process: monagent
    config:
      name: monitor.ob
      status: ${monagent.pipeline.ob.status}
      pipelines:
        - name: ob_basic
          config:
            scheduleStrategy: trigger
            exposeUrl: /metrics/ob/basic
          structure:
            inputs:
              - <<: *obInputBasic
            processors:
              - <<: *retagProcessor
            exporter:
              <<: *prometheusExporter
        - name: ob_extra
          config:
            scheduleStrategy: trigger
            exposeUrl: /metrics/ob/extra
          structure:
            inputs:
              - <<: *obInputExtra
            processors:
              - <<: *retagProcessor
            exporter:
              <<: *prometheusExporter