monitor_ob.yaml 16.2 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        - 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]
          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
86
          conditions: [ ob_is_v3, ob_is_rootservice ]
87 88 89 90 91 92 93 94 95
          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
96
          conditions: [ ob_is_v4, ob_is_rootservice ]
W
wangzelin.wzl 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
          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 已提交
119
        - 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 已提交
120
          name: ob_plan_cache
121
          conditions: [ ob_is_v3 ]
122 123 124 125 126 127
          tags:
            tenant_name: tenant_name
          metrics:
            memory_bytes: mem_used
            access_total: access_count
            hit_total: hit_count
X
xueran 已提交
128 129
        - 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
130 131
          condition: [ ob_is_v4 ]

W
wangzelin.wzl 已提交
132 133 134 135 136 137 138 139 140 141 142 143 144
          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
145 146 147
        - 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 已提交
148 149
          tags:
            tenant_name: tenant_name
150
            le: response_time_seconds
W
wangzelin.wzl 已提交
151
          metrics:
152
            bucket: bucket
W
wangzelin.wzl 已提交
153
            count: count
154
            sum: sum
W
wangzelin.wzl 已提交
155 156 157 158 159 160 161 162 163 164 165 166 167 168

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 已提交
169 170 171
        ob_is_rootservice: false
        ob_is_v4: false
        ob_is_v3: false
W
wangzelin.wzl 已提交
172
      collectConfig:
173 174 175 176 177 178 179 180 181 182 183 184 185 186
        - 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
187
          conditions: [ ob_is_v3 ]
X
xueran 已提交
188 189 190 191 192 193 194 195 196
          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
197
          conditions: [ ob_is_v4 ]
X
xueran 已提交
198 199
          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 已提交
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
        - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ count(*) as cnt from v$unit
          name: ob_unit
          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
          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
        - 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
234
          conditions: [ ob_is_rootservice ]
W
wangzelin.wzl 已提交
235 236 237 238
          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
239
          conditions: [ ob_is_v3, ob_is_rootservice]
240 241 242 243
          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
244
          conditions: [ob_is_v4, ob_is_rootservice ]
W
wangzelin.wzl 已提交
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
          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
          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
          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
X
xueran 已提交
278
        - 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 已提交
279 280 281 282 283
          name: ob_latch
          tags:
            tenant_name: tenant_name
            tenant_id: tenant_id
            name: name
X
xueran 已提交
284
            latch_no: latch_no
W
wangzelin.wzl 已提交
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
          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