12 KiB
| title | description |
|---|---|
| 系统监控 | 监控 TDengine 的运行状态 |
TDengine 通过 taosKeeper 将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度等信息定时写入指定数据库。TDengine 还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息进行记录。系统管理员可以从 CLI 直接查看这个数据库,也可以在 WEB 通过图形化界面查看这些监测信息。
这些监测信息的采集缺省是打开的,但可以修改配置文件里的选项 monitor 将其关闭或打开。
TDinsight - 使用监控数据库 + Grafana 对 TDengine 进行监控的解决方案
监控数据库将提供更多的监控项,您可以从 TDinsight Grafana Dashboard 了解如何使用 TDinsight 方案对 TDengine 进行监控。
我们提供了一个自动化脚本 TDinsight.sh 对 TDinsight 进行部署。
下载 TDinsight.sh:
wget https://github.com/taosdata/grafanaplugin/raw/master/dashboards/TDinsight.sh
chmod +x TDinsight.sh
准备:
-
TDengine Server 信息:
- TDengine RESTful 服务:对本地而言,可以是
http://localhost:6041,使用参数-a。 - TDengine 用户名和密码,使用
-u-p参数设置。
- TDengine RESTful 服务:对本地而言,可以是
-
Grafana 告警通知
-
使用已经存在的 Grafana Notification Channel
uid,参数-E。该参数可以使用curl -u admin:admin localhost:3000/api/alert-notifications |jq来获取。./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E <notifier uid>
-
运行程序并重启 Grafana 服务,打开面板:http://localhost:3000/d/tdinsight。
更多使用场景和限制请参考TDinsight 文档。
log 库
TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db,可以在 taoskeeper 配置文件中修改,具体参考 taoskeeper 文档)。taoskeeper 启动后会自动创建 log 库,并将监控数据写入到该数据库中。
cluster_info 表
cluster_info 表记录集群信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| first_ep | VARCHAR | 集群 first ep | |
| first_ep_dnode_id | INT | 集群 first ep 的 dnode id | |
| version | VARCHAR | tdengine version。例如:3.0.4.0 | |
| master_uptime | FLOAT | 当前 master 节点的uptime。单位:天 | |
| monitor_interval | INT | monitor interval。单位:秒 | |
| dbs_total | INT | database 总数 | |
| tbs_total | BIGINT | 当前集群 table 总数 | |
| stbs_total | INT | 当前集群 stable 总数 | |
| dnodes_total | INT | 当前集群 dnode 总数 | |
| dnodes_alive | INT | 当前集群 dnode 存活总数 | |
| mnodes_total | INT | 当前集群 mnode 总数 | |
| mnodes_alive | INT | 当前集群 mnode 存活总数 | |
| vgroups_total | INT | 当前集群 vgroup 总数 | |
| vgroups_alive | INT | 当前集群 vgroup 存活总数 | |
| vnodes_total | INT | 当前集群 vnode 总数 | |
| vnodes_alive | INT | 当前集群 vnode 存活总数 | |
| connections_total | INT | 当前集群连接总数 | |
| topics_total | INT | 当前集群 topic 总数 | |
| streams_total | INT | 当前集群 stream 总数 | |
| protocol | INT | 协议版本,目前为 1 | |
| cluster_id | NCHAR | TAG | cluster id |
d_info 表
d_info 表记录 dnode 状态信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| status | VARCHAR | dnode 状态 | |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
m_info 表
m_info 表记录 mnode 角色信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| role | VARCHAR | mnode 角色, leader 或 follower | |
| mnode_id | INT | TAG | master node id |
| mnode_ep | NCHAR | TAG | master node endpoint |
| cluster_id | NCHAR | TAG | cluster id |
dnodes_info 表
dnodes_info 记录 dnode 信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| uptime | FLOAT | dnode uptime | |
| cpu_engine | FLOAT | taosd cpu 使用率,从 /proc/<taosd_pid>/stat 读取 |
|
| cpu_system | FLOAT | 服务器 cpu 使用率,从 /proc/stat 读取 |
|
| cpu_cores | FLOAT | 服务器 cpu 核数 | |
| mem_engine | INT | taosd 内存使用率,从 /proc/<taosd_pid>/status 读取 |
|
| mem_system | INT | 服务器可用内存 | |
| mem_total | INT | 服务器内存总量,单位 KB | |
| disk_engine | INT | ||
| disk_used | BIGINT | data dir 挂载的磁盘使用量,单位 bytes | |
| disk_total | BIGINT | data dir 挂载的磁盘总容量,单位 bytes | |
| net_in | FLOAT | 网络吞吐率,从 /proc/net/dev 中读取的 received bytes。单位 kb/s |
|
| net_out | FLOAT | 网络吞吐率,从 /proc/net/dev 中读取的 transmit bytes。单位 kb/s |
|
| io_read | FLOAT | io 吞吐率,从 /proc/<taosd_pid>/io 中读取的 rchar 与上次数值计算之后,计算得到速度。单位 kb/s |
|
| io_write | FLOAT | io 吞吐率,从 /proc/<taosd_pid>/io 中读取的 wchar 与上次数值计算之后,计算得到速度。单位 kb/s |
|
| io_read_disk | FLOAT | 磁盘 io 吞吐率,从 /proc/<taosd_pid>/io 中读取的 read_bytes。单位 kb/s |
|
| io_write_disk | FLOAT | 磁盘 io 吞吐率,从 /proc/<taosd_pid>/io 中读取的 write_bytes。单位 kb/s |
|
| req_select | INT | 两个间隔内发生的查询请求数目 | |
| req_select_rate | FLOAT | 两个间隔内的查询请求速度 = req_select / monitorInterval |
|
| req_insert | INT | 两个间隔内发生的写入请求,包含的单条数据数目 | |
| req_insert_success | INT | 两个间隔内发生的处理成功的写入请求,包含的单条数据数目 | |
| req_insert_rate | FLOAT | 两个间隔内的单条数据写入速度 = req_insert / monitorInterval |
|
| req_insert_batch | INT | 两个间隔内发生的写入请求数目 | |
| req_insert_batch_success | INT | 两个间隔内发生的成功的批量写入请求数目 | |
| req_insert_batch_rate | FLOAT | 两个间隔内的写入请求数目的速度 = req_insert_batch / monitorInterval |
|
| errors | INT | 两个间隔内的出错的写入请求的数目 | |
| vnodes_num | INT | dnode 上 vnodes 数量 | |
| masters | INT | dnode 上 master node 数量 | |
| has_mnode | INT | dnode 是否包含 mnode | |
| has_qnode | INT | dnode 是否包含 qnode | |
| has_snode | INT | dnode 是否包含 snode | |
| has_bnode | INT | dnode 是否包含 bnode | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
data_dir 表
data_dir 表记录 data 目录信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| name | NCHAR | data 目录,一般为 /var/lib/taos |
|
| level | INT | 0、1、2 多级存储级别 | |
| avail | BIGINT | data 目录可用空间 | |
| used | BIGINT | data 目录已使用空间 | |
| total | BIGINT | data 目录空间 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
log_dir 表
log_dir 表记录 log 目录信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| name | NCHAR | log 目录名,一般为 /var/log/taos/ |
|
| avail | BIGINT | log 目录可用空间 | |
| used | BIGINT | log 目录已使用空间 | |
| total | BIGINT | log 目录空间 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
temp_dir 表
temp_dir 表记录 temp 目录信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| name | NCHAR | temp 目录名,一般为 /tmp/ |
|
| avail | BIGINT | temp 目录可用空间 | |
| used | BIGINT | temp 目录已使用空间 | |
| total | BIGINT | temp 目录空间 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
vgroups_info 表
vgroups_info 表记录虚拟节点组信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| vgroup_id | INT | vgroup id | |
| database_name | VARCHAR | vgroup 所属的 database 名字 | |
| tables_num | BIGINT | vgroup 中 table 数量 | |
| status | VARCHAR | vgroup 状态 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
vnodes_role 表
vnodes_role 表记录虚拟节点角色信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| vnode_role | VARCHAR | vnode 角色,leader 或 follower | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
log_summary 表
log_summary 记录日志统计信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| error | INT | error 总数 | |
| info | INT | info 总数 | |
| debug | INT | debug 总数 | |
| trace | INT | trace 总数 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
grants_info 表
grants_info 记录授权信息。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| expire_time | BIGINT | 认证过期时间,企业版有效,社区版为 bigint 最大值 | |
| timeseries_used | BIGINT | 已用测点数 | |
| timeseries_total | BIGINT | 总测点数,开源版本为 bigint 最大值 | |
| dnode_id | INT | TAG | dnode id |
| dnode_ep | NCHAR | TAG | dnode endpoint |
| cluster_id | NCHAR | TAG | cluster id |
keeper_monitor 表
keeper_monitor 记录 taoskeeper 监控数据。
| field | type | is_tag | comment |
|---|---|---|---|
| ts | TIMESTAMP | timestamp | |
| cpu | FLOAT | cpu 使用率 | |
| mem | FLOAT | 内存使用率 | |
| identify | NCHAR | TAG |
taosadapter_restful_http_request_total 表
taosadapter_restful_http_request_total 记录 taosadapter rest 请求信息,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| gauge | DOUBLE | 监控指标值 | |
| client_ip | NCHAR | TAG | client ip |
| endpoint | NCHAR | TAG | taosadpater endpoint |
| request_method | NCHAR | TAG | request method |
| request_uri | NCHAR | TAG | request uri |
| status_code | NCHAR | TAG | status code |
taosadapter_restful_http_request_fail 表
taosadapter_restful_http_request_fail 记录 taosadapter rest 请求失败信息,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| gauge | DOUBLE | 监控指标值 | |
| client_ip | NCHAR | TAG | client ip |
| endpoint | NCHAR | TAG | taosadpater endpoint |
| request_method | NCHAR | TAG | request method |
| request_uri | NCHAR | TAG | request uri |
| status_code | NCHAR | TAG | status code |
taosadapter_restful_http_request_in_flight 表
taosadapter_restful_http_request_in_flight 记录 taosadapter rest 实时请求信息,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| gauge | DOUBLE | 监控指标值 | |
| endpoint | NCHAR | TAG | taosadpater endpoint |
taosadapter_restful_http_request_summary_milliseconds 表
taosadapter_restful_http_request_summary_milliseconds 记录 taosadapter rest 请求汇总信息,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| count | DOUBLE | ||
| sum | DOUBLE | ||
| 0.5 | DOUBLE | ||
| 0.9 | DOUBLE | ||
| 0.99 | DOUBLE | ||
| 0.1 | DOUBLE | ||
| 0.2 | DOUBLE | ||
| endpoint | NCHAR | TAG | taosadpater endpoint |
| request_method | NCHAR | TAG | request method |
| request_uri | NCHAR | TAG | request uri |
taosadapter_system_mem_percent 表
taosadapter_system_mem_percent 表记录 taosadapter 内存使用情况,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| gauge | DOUBLE | 监控指标值 | |
| endpoint | NCHAR | TAG | taosadpater endpoint |
taosadapter_system_cpu_percent 表
taosadapter_system_cpu_percent 表记录 taosadapter cpu 使用情况,该表为 schemaless 方式创建的表,时间戳字段名为 _ts。
| field | type | is_tag | comment |
|---|---|---|---|
| _ts | TIMESTAMP | timestamp | |
| gauge | DOUBLE | 监控指标值 | |
| endpoint | NCHAR | TAG | taosadpater endpoint |