提交 68eb9d9e 编写于 作者: A alv00

add metric 'ob_role_with_rootserver',change the 'condition' in monitor_ob.yaml...

add metric 'ob_role_with_rootserver',change the 'condition' in monitor_ob.yaml from string type to array type to support multi-condition configuration
上级 39649e99
...@@ -30,7 +30,7 @@ obInputBasic: &obInputBasic ...@@ -30,7 +30,7 @@ obInputBasic: &obInputBasic
is_rootserver: with_rootserver is_rootserver: with_rootserver
conditionValues: conditionValues:
ob_is_rootservice: with_rootserver ob_is_rootservice: with_rootserver
condition: ob_is_v3 conditions: [ ob_is_v3 ]
params: [ ob_svr_ip, ob_svr_port ] 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 = ? sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ with_rootserver from __all_server where svr_ip = ? and svr_port = ?
...@@ -40,9 +40,10 @@ obInputBasic: &obInputBasic ...@@ -40,9 +40,10 @@ obInputBasic: &obInputBasic
is_rootserver: with_rootserver is_rootserver: with_rootserver
conditionValues: conditionValues:
ob_is_rootservice: with_rootserver ob_is_rootservice: with_rootserver
condition: ob_is_v4 conditions: [ ob_is_v4 ]
params: [ ob_svr_ip, ob_svr_port ] 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 = ? 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 = ?
- 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 = ? - 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] params: [ob_svr_ip, ob_svr_port]
name: ob_cache name: ob_cache
...@@ -82,7 +83,7 @@ obInputBasic: &obInputBasic ...@@ -82,7 +83,7 @@ obInputBasic: &obInputBasic
cacheDataExpire: 120s cacheDataExpire: 120s
- sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(100000000) */ tenant_name, count(*) as cnt from gv$table group by tenant_id - 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 name: ob_table
condition: ob_is_v3 ob_is_rootservice conditions: [ ob_is_v3, ob_is_rootservice ]
tags: tags:
tenant_name: tenant_name tenant_name: tenant_name
metrics: metrics:
...@@ -92,7 +93,7 @@ obInputBasic: &obInputBasic ...@@ -92,7 +93,7 @@ obInputBasic: &obInputBasic
cacheDataExpire: 2h 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 - 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 name: ob_table
condition: ob_is_v4 ob_is_rootservice conditions: [ ob_is_v4, ob_is_rootservice ]
tags: tags:
tenant_name: tenant_name tenant_name: tenant_name
metrics: metrics:
...@@ -117,7 +118,7 @@ obInputBasic: &obInputBasic ...@@ -117,7 +118,7 @@ obInputBasic: &obInputBasic
current_timestamp: current current_timestamp: current
- 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 - 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
name: ob_plan_cache name: ob_plan_cache
condition: ob_is_v3 conditions: [ ob_is_v3 ]
tags: tags:
tenant_name: tenant_name tenant_name: tenant_name
metrics: metrics:
...@@ -126,7 +127,8 @@ obInputBasic: &obInputBasic ...@@ -126,7 +127,8 @@ obInputBasic: &obInputBasic
hit_total: hit_count hit_total: hit_count
- 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 - 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 name: ob_plan_cache
condition: ob_is_v4 condition: [ ob_is_v4 ]
tags: tags:
tenant_name: tenant_name tenant_name: tenant_name
metrics: metrics:
...@@ -182,7 +184,7 @@ obInputExtra: &obInputExtra ...@@ -182,7 +184,7 @@ obInputExtra: &obInputExtra
is_rootserver: with_rootserver is_rootserver: with_rootserver
conditionValues: conditionValues:
ob_is_rootservice: with_rootserver ob_is_rootservice: with_rootserver
condition: ob_is_v3 conditions: [ ob_is_v3 ]
params: [ ob_svr_ip, ob_svr_port ] 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 = ? sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ with_rootserver from __all_server where svr_ip = ? and svr_port = ?
...@@ -192,10 +194,9 @@ obInputExtra: &obInputExtra ...@@ -192,10 +194,9 @@ obInputExtra: &obInputExtra
is_rootserver: with_rootserver is_rootserver: with_rootserver
conditionValues: conditionValues:
ob_is_rootservice: with_rootserver ob_is_rootservice: with_rootserver
condition: ob_is_v4 conditions: [ ob_is_v4 ]
params: [ ob_svr_ip, ob_svr_port ] 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 = ? 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 = ?
- sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ count(*) as cnt from v$unit - sql: select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ count(*) as cnt from v$unit
name: ob_unit name: ob_unit
metrics: metrics:
...@@ -230,17 +231,17 @@ obInputExtra: &obInputExtra ...@@ -230,17 +231,17 @@ obInputExtra: &obInputExtra
- 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 = ? - 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] params: [ob_svr_ip, ob_svr_port]
name: ob_trans name: ob_trans
condition: ob_is_rootservice conditions: [ ob_is_rootservice ]
metrics: metrics:
expire_num: cnt 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) - 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 name: ob_index
condition: ob_is_v3 ob_is_rootservice conditions: [ ob_is_v3, ob_is_rootservice]
metrics: metrics:
error_num: cnt 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) - 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 name: ob_index
condition: ob_is_v4 ob_is_rootservice conditions: [ob_is_v4, ob_is_rootservice ]
metrics: metrics:
error_num: cnt 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 = ? - 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 = ?
......
...@@ -14,7 +14,6 @@ package mysql ...@@ -14,7 +14,6 @@ package mysql
import ( import (
"database/sql" "database/sql"
"strings"
"sync" "sync"
"time" "time"
...@@ -65,7 +64,7 @@ type TableCollectConfig struct { ...@@ -65,7 +64,7 @@ type TableCollectConfig struct {
Name string `yaml:"name"` Name string `yaml:"name"`
Sql string `yaml:"sql"` Sql string `yaml:"sql"`
Params []string `yaml:"params"` Params []string `yaml:"params"`
Condition string `yaml:"condition"` Conditions []string `yaml:"conditions"`
TagColumnMap map[string]string `yaml:"tags"` TagColumnMap map[string]string `yaml:"tags"`
MetricColumnMap map[string]string `yaml:"metrics"` MetricColumnMap map[string]string `yaml:"metrics"`
ConditionValueColumnMap map[string]string `yaml:"conditionValues"` ConditionValueColumnMap map[string]string `yaml:"conditionValues"`
...@@ -275,9 +274,8 @@ func (t *TableInput) collectData(config *TableCollectConfig) []metric.Metric { ...@@ -275,9 +274,8 @@ func (t *TableInput) collectData(config *TableCollectConfig) []metric.Metric {
func (t *TableInput) doCollect(config *TableCollectConfig, metricChan chan metric.Metric, wg *sync.WaitGroup) { func (t *TableInput) doCollect(config *TableCollectConfig, metricChan chan metric.Metric, wg *sync.WaitGroup) {
defer wg.Done() defer wg.Done()
currentTime := time.Now() currentTime := time.Now()
if len(config.Condition) > 0 { if len(config.Conditions) > 0 {
conditionArray := strings.Split(config.Condition, " ") for _, condition := range config.Conditions {
for _, condition := range conditionArray {
value, found := t.ConditionValueMap.Load(condition) value, found := t.ConditionValueMap.Load(condition)
if !found { if !found {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册