Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SQL_INFO_SCHEMA_BASIC = ` select PARA_NAME, PARA_VALUE from SYS."V$DM_INI" where PARA_NAME = 'MAX_SESSIONS' or PARA_NAME = 'PORT_NUM'; ` // SQL_INFO_SCHEMA_THREAD = ` SELECT DISTINCT NAME as NAME, COUNT(*) AS NUM FROM V$THREADS GROUP BY NAME ORDER BY NUM DESC; ` // 查看达梦数据库运行状态 SQL_DM_STATUS = ` select status$ as status from v$instance; ` // 查询服务器信息 SQL_SYSTEM_INFO = ` select * from V$SYSTEMINFO; ` // 查看数据库是否有阻塞 SQL_SCHEMA_LOCK = ` select o.name,l.* from v$lock l,sysobjects o where l.table_id=o.id and blocked=1; ` // 等待事件 SQL_WAIT = `` /* 735-byte string literal not displayed */ // 表空间率 SQL_TABLES_SIZE_RATE = `` /* 657-byte string literal not displayed */ // 表空间使用率 SQL_TABLES_SIZE_USE_RATE = `` /* 515-byte string literal not displayed */ // 内存池使用情况 // SQL_MEMORY_USAGE = ` // select 'TOTAL' as NAME,(sum(total_size)/1024/1024) as TOTAL_MB ,NULL as mem_pool // from v$mem_pool // union all // select * from ( // select name,sum(total_size)/1024/1024 as TOTAL,count(1) as count // from v$mem_pool group by name order by 2 desc // ) where TOTAL>0; // ` SQL_MEMORY_USAGE = `` /* 155-byte string literal not displayed */ // 连接数 SQL_CONNECTION_NUMS = ` select count(*) as connection_nums from v$sessions; ` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct { config.InstanceConfig Address string `toml:"address"` Username string `toml:"username"` Password string `toml:"password"` // DBname string `toml:"dbname"` Port int64 `toml:"prot"` Parameters string `toml:"parameters"` TimeoutSeconds int64 `toml:"timeout_seconds"` Queries []QueryConfig `toml:"queries"` GlobalQueries []QueryConfig `toml:"-"` tls.ClientConfig // contains filtered or unexported fields }
插件实例的配置
func (*Instance) Gather ¶
func (ins *Instance) Gather(slist *types.SampleList)
收集 DM 数据库的各种指标,并将它们推送到 Catagraf 的 SampleList 中
type KingBase ¶
type KingBase struct { config.PluginConfig Instances []*Instance `toml:"instances"` Queries []QueryConfig `toml:"queries"` }
Catagraf 插件的配置,多个 Instance 实例,每个实例代表了一个 KingBase 数据库的连接
func (*KingBase) GetInstances ¶
返回所有 KingBase 插件实例的配置信息
type QueryConfig ¶
type QueryConfig struct { Mesurement string `toml:"mesurement"` LabelFields []string `toml:"label_fields"` MetricFields []string `toml:"metric_fields"` FieldToAppend string `toml:"field_to_append"` Timeout config.Duration `toml:"timeout"` Request string `toml:"request"` }
定义了要查询的数据指标的配置
Click to show internal directories.
Click to hide internal directories.