推特 阿里云技术文档正文

MySQL采集指标说明_采集数据类型说明_数据采集_时序数据库 InfluxDB® 版_时序时空数据库TSDB

admin 阿里云技术文档 2020-02-11 155 0
阿里云服务器优惠

MySQL采集指标说明

概述

InfluxDB®的采集工具支持采集来自MySQL服务器的统计数据,收集的数据分为以下六大类,分别存储在不同的measurement中,采集工具在不同的MySQL服务器上所采集到的measurement或field会略有不同。

measurement 采集数据
mysql 记录在MySQL上执行SHOW GLOBAL STATUSESSHOW SLAVE STATUSES后所得到的状态信息,包括global status和slave status(如有)。每个状态信息是mysql中的一个field,各个状态的解释可查看文档(英文中文)。
mysql_variables 记录在MySQL上执行SHOW GLOBAL VARIABLES后所得到的全局变量值。每个变量值是mysql_variables中的一个field,各个变量的解释可查看文档(英文中文)。
mysql_process_list 根据MySQL中的表格INFORMATION_SCHEMA.PROCESSLIST,采集每个用户在不同状态下的线程数量。具体的tag和field见下文。可查考MySQL文档
mysql_users 采集每个用户的连接数。具体的tag和field见下文。
mysql_user_statistics 采集每个用户的统计信息。具体的tag和field见下文。
mysql_table_schema 采集自增(auto-increment)列的值。具体的tag和field见下文。
mysql_innodb 采集MySQL的INFORMATION_SCHEMA.INNODB_METRICS表中状态为开启的计数器(counter)的值。具体的tag和field见下文。INFORMATION_SCHEMA.INNODB_METRICS提供InnoDB的性能信息,该表包含很多计数器。

measurement: mysql_process_list

tags

tag key 描述
host host name
server MySQL服务器的地址

fields

field key 数据类型 描述
threads_after_create integer 当线程在创建表的函数末尾处创建表时(包括内部临时表),发生该状态。即使由于某些错误无法创建表,也会使用该状态。
threads_altering_table integer 线程正在对一个MyISAM表处理ALTER TABLE … ENABLE KEYS
threads_analyzing integer 线程正在计算MyISAM表键分布(例如,ANALYZE TABLE)
threads_checking_permissions integer 线程正在检查服务器是否具有执行某个语句所需的权限
threads_checking_table integer 线程正在执行一个表检查操作
threads_cleaning_up integer 线程已经处理完一个命令,并准备释放内存和重置某些的状态变量
threads_closing_tables integer 线程正在将更改的表数据flush到磁盘并关闭已使用的表
threads_converting_heap_to_myisam integer 线程正在将内部临时表从内存转换到MyISAM表
threads_copying_to_tmp_table integer 服务器正在复制数据到临时表
threads_creating_sort_index integer 线程正在处理一个使用内部临时表解决问题的SELECT语句
threads_creating_table integer 线程正在创建一个表,包括创建临时表
threads_creating_tmp_table integer 线程正在内存或磁盘上创建一个临时表
threads_deleting integer 服务器正在执行删除表格的操作
threads_end integer 该状态发生在ALTER TABLE、CREATE VIEW、DELETE、INSERT、SELECT或UPDATE语句的结束,但在这些语句的清理之前
threads_executing integer 线程已经开始执行一个语句
threads_execution_of_init_command integer 线程正在执行在系统变量init_command中的语句
threads_flushing_tables integer 线程正在刷新磁盘
threads_freeing_items integer 线程已经执行完一个命令,通常在该状态之后是状态“cleaning up”
threads_fulltext_initialization integer 服务器正准备执行一个自然语言全文搜索
threads_idle integer 线程调用了SLEEP()
threads_init integer 该状态发生在ALTER TABLE、DELETE、INSERT、SELECT或UPDATE语句的初始化之前。服务器在刷新二进制日志和InnoDB日志的时候也会处于这个状态。
threads_killed integer 发送KILL语句到线程后,当检查到kill标志时,线程会终止。该标志在每个MySQL的主循环中都会被检查,但是在某些情况下,线程死亡可能还需要很短的时间。如果线程被其他线程锁定,那么一旦其他线程释放锁后,kill将立即生效。
threads_logging_slow_query integer 线程正在向慢查询日志(slow-query log)写入一个语句
threads_login integer 连接线程的初始状态,直到客户端成功通过身份验证
threads_manage_keys integer 服务器开启或关闭表索引
threads_opening_tables integer 线程正在尝试打开一个表
threads_optimizing integer 服务器正在执行查询的初始优化
threads_preparing integer 该状态发生在查询优化期间
threads_reading_from_net integer 服务器正在从网络读取数据
threads_removing_duplicates integer 使用SELECT DISTINCT的查询使得MySQL无法在早期优化distinct操作。因此,在将结果发送给客户端之前,MySQL需要额外的阶段来删除所有重复的行。
threads_removing_tmp_table integer 线程在处理SELECT语句后正在删除一个内部临时表。如果没有创建临时表,则不使用此状态。
threads_reopen_tables integer 线程得到了表的锁,但在获得锁之后,底层表结构发生了变化。它释放了锁,关闭了表,并试图重新打开它。
threads_repair_by_sorting integer 修复代码正在使用排序来创建索引
threads_repair_done integer 线程已经完成MyISAM表的多线程修复
threads_repair_with_keycache integer 修复代码正在通过密钥缓存逐个创建密钥。这比repair by sorting慢很多。
threads_replication_master integer replication master的线程状态
threads_rolling_back integer 线程正在回滚事务
threads_searching_rows_for_update integer 线程正在进行第一阶段,在更新之前查找所有匹配的行。如果UPDATE正在更改用于查找相关行的索引,则必须执行此操作。
threads_sending_data integer 线程正在读取和处理SELECT语句的行 ,并将数据发送到客户端。因为在这种状态下发生的操作倾向于执行大量的磁盘访问(读取),所以在一个查询的整个生命周期中,它通常是运行时间最长的状态。
threads_sorting_for_group integer 线程正在执行排序以满足GROUP BY
threads_sorting_for_order integer 线程正在执行排序以满足ORDER BY
threads_sorting_index integer 线程正在排序索引页面,以便在MyISAM表优化操作期间实现更高效的访问
threads_sorting_result integer 对于一个SELECT语句,这类似于creating sort index,但是面向非临时表。
threads_statistics integer 服务器正在计算统计信息来开发一个查询执行计划。如果一个线程长时间处于这种状态,那么服务器可能是磁盘绑定执行其它工作。
threads_updating integer 线程正准备更新表或者正在更新表
threads_waiting_for_lock integer 线程正在等待锁
threads_waiting_for_table_flush integer 线程正在执行FLUSH TABLES并等待所有线程关闭它们的表,或者线程被告知一个表的底层结构已经发生改变,它需要重新打开该表获得新的结构。但是,要重新打开表,必须等到所有其它线程已经关闭相关的表。
threads_waiting_for_tables integer 线程被告知一个表的底层结构已经发生改变,它需要重新打开该表获得新的结构。但是,要重新打开表,必须等到所有其它线程已经关闭相关的表。
这种情况发生在如果另一个线程在该表上已使用FLUSH TABLES或下面的语句之一:FLUSH TABLES、ALTER TABLE、RENAME TABLE、REPAIR TABLE、ANALYZE TABLE或OPTIMIZE TABLE。
threads_waiting_on_cond integer 线程正在等待condition变为true的通用状态。没有具体的状态信息可用。
threads_writing_to_net integer 服务器正在向网络写入数据包
threads_other integer 其它状态

measurement: mysql_users

tags

tag key 描述
host host name
server MySQL服务器的地址
user 用户名

fields

field key 数据类型 描述
connections integer 每个用户的连接数

measurement: mysql_user_stats

tags

tag key 描述
host host name
server MySQL服务器的地址
user 用户名

fields

field key 数据类型 描述
access_denied integer 用户发出的连接被拒绝的次数
binlog_bytes_written integer 写入二进制日志的字节数
busy_time integer 来自该用户的连接有活动的时间(以秒为单位)
bytes_received integer 从该用户的连接中接收到的字节数
bytes_sent integer 发送到用户的字节数
commit_transactions integer 用户发出COMMIT命令的次数
concurrent_connections integer 用户的并发连接数
connected_time integer 用户有连接的时间(以秒为单位)
cpu_time integer 为该用户的连接提供服务的总CPU时间(以秒为单位)
denied_connections integer 拒绝该用户的连接数
empty_queries integer 用户向服务器发送空查询的次数
lost_connections integer 该用户的连接被异常终止的数量
other_commands integer 该用户执行其他命令的次数
rollback_transactions integer 用户发出ROLLBACK命令的次数
rows_fetched integer 提取的行数
rows_updated integer 更新的行数
select_commands integer 该用户执行SELECT命令的次数
table_rows_read integer 用户从表中读取的行数(与rows_fetched不同)
total_connections integer 为该用户创建的总连接数
total_ssl_connections integer 使用SSL的总连接数
update_commands integer 该用户执行UPDATE命令的次数
user string 用户名

measurement: mysql_table_schema

tags

tag key 描述
host host name
server MySQL服务器的地址
schema schema的名称
table 表的名称
column 列的名称

fields

field key 数据类型 描述
auto_increment_column integer 自增列(auto-increment column)的值
auto_increment_column_max integer 自增列(auto-increment column)的最大值

measurement: mysql_innodb

tags

tag key 描述
host host name
server MySQL服务器的地址

fields

field key 数据类型 描述
name string 计数器的名称
count integer 计数器的值


InfluxDB® is a trademark registered by InfluxData Inc. which is not affiliated with, and does not endorse, TSDB for InfluxDB®.

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

评论

-----