ITPub博客

首页 > 数据库 > 国内数据库 > 如何使用 taosKeeper 做好监控工作,时序数据库 TDengine 3.0 监控工具详解

如何使用 taosKeeper 做好监控工作,时序数据库 TDengine 3.0 监控工具详解

原创 国内数据库 作者:TDengine 时间:2023-04-14 09:58:55 0 删除 编辑

小 T 导读:taosKeeper 是 TDengine 3.0 的运行状态指标监控工具,通过简单的几项配置即可获取 TDengine 的运行状态信息。其使用 TDengine RESTful 接口,所以不需要安装 TDengine 客户端即可使用。本文将详细解读 taosKeeper 的详细语法规则,方便有需要的用户开展应用。

时序数据库 TDengine( Time Series Database ) 通过 taosKeeper 将服务器的 CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度等信息定时写入指定数据库,也支持对重要的系统操作(比如登录、创建、删除数据库等)以及各种错误报警信息进行记录。系统管理员可以从命令行直接查看该数据库,也可以在 Web 端通过图形化界面查看这些监测信息。这些监测信息的采集缺省是打开的,也可以通过修改配置文件里的选项 monitor 来关闭。

taosKeeper 安装方式:单独编译 taosKeeper 并安装,详情请参考 taosKeeper 仓库(https://github.com/taosdata/taoskeeper)。

配置和运行方式

taosKeeper 需要在操作系统终端中执行,该工具支持三种配置方式:命令行参数、环境变量和配置文件。优先级为:命令行参数、环境变量、配置文件参数。

需要注意的是,在运行 taosKeeper 之前要确保 TDengine 集群与 taosAdapter 已经正确运行,并且 TDengine 已经开启监控服务。监控配置可参考相关文档,具体的配置项包括  monitor、monitorFqdn、monitorPort、monitorInterval 和 telemetryReporting。

命令行参数启动

可以直接执行 taosKeeper,也可以在执行命令时提供命令行参数。

$ taosKeeper

环境变量启动

通过设置环境变量达到控制启动参数的目的,通常在容器中运行时使用。

$ export TAOS_KEEPER_TDENGINE_HOST=192.168.64.3$ taoskeeper

具体参数列表请参照  taoskeeper -h 输入结果。

配置文件启动

执行以下命令即可快速体验 taosKeeper。当不指定 taosKeeper 配置文件时,优先使用  /etc/taos/keeper.toml配置,否则将使用默认配置。

$ taoskeeper -c <keeper config file>

具体配置文件示例请参考:https://docs.taosdata.com/reference/taosKeeper/

获取监控指标

taosKeeper 作为 TDengine 监控指标的导出工具,可以将 TDengine 产生的监控数据记录在指定数据库中,并提供导出接口。

查看监控结果集

$ taos# 如上示例,使用 log 库作为监控日志存储位置> use log;> select * from cluster_info limit 1;

结果示例:

           ts            |            first_ep            | first_ep_dnode_id |   version    |    master_uptime     | monitor_interval |  dbs_total  |  tbs_total  | stbs_total  | dnodes_total | dnodes_alive | mnodes_total | mnodes_alive | vgroups_total | vgroups_alive | vnodes_total | vnodes_alive | connections_total |  protocol   |           cluster_id           |=============================================================================================================================================================================================================================================================================================================================================================================== 2022-08-16 17:37:01.629 | hlb:6030                       |                 1 | 3.0.0.0      |              0.27250 |               15 |           2 |          27 |          38 |            1 |            1 |            1 |            1 |             4 |             4 |            4 |            4 |                14 |           1 | 5981392874047724755            |Query OK, 1 rows in database (0.036162s)

导出监控指标

$ curl

部分结果集:

# HELP taos_cluster_info_connections_total # TYPE taos_cluster_info_connections_total countertaos_cluster_info_connections_total{cluster_id="5981392874047724755"} 16# HELP taos_cluster_info_dbs_total # TYPE taos_cluster_info_dbs_total countertaos_cluster_info_dbs_total{cluster_id="5981392874047724755"} 2# HELP taos_cluster_info_dnodes_alive # TYPE taos_cluster_info_dnodes_alive countertaos_cluster_info_dnodes_alive{cluster_id="5981392874047724755"} 1# HELP taos_cluster_info_dnodes_total # TYPE taos_cluster_info_dnodes_total countertaos_cluster_info_dnodes_total{cluster_id="5981392874047724755"} 1# HELP taos_cluster_info_first_ep # TYPE taos_cluster_info_first_ep gaugetaos_cluster_info_first_ep{cluster_id="5981392874047724755",value="hlb:6030"} 1

TDinsight

除了 taosKeeper,TDengine 还提供了 TDinsight——使用监控数据库 + Grafana 对 TDengine 进行监控的解决方案,下文将浅谈一下 TDinsight 的前期部署和准备。在部署时,我们首先需要下载自动化脚本  TDinsight.sh:

wget

准备:

  1. TDengine Server 信息:
    • TDengine RESTful 服务:使用参数  -a指定。如果是运行在同一主机,通常是  。
    • TDengine 用户名和密码,使用  -u -p 指定。
  2. Grafana 告警通知
    • 使用已经存在的 Grafana Notification Channel  uid,参数  -E。该参数可以使用  curl -u admin:admin localhost:3000/api/alert-notifications |jq 来获取。JSON 解析工具  jq 可能需要单独安装。
sudo ./TDinsight.sh -a  -u root -p taosdata -E <notifier uid>

运行程序并重启 Grafana 服务,打开面板: 可以查看 TDengine 服务运行状态。

监控数据库为用户提供了更多的监控项,与 taosKeeper 共同筑牢 TDengine 数据监控的城墙。在下一篇文章中,我们将会详解解说如何使用 TDinsight 方案对 TDengine 进行监控,敬请期待。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70014783/viewspace-2945694/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
TDengine 是一个 AI 驱动的物联网工业大数据平台,旗下有两款产品:TDengine TSDB——高性能、分布式的时序数据库和 TDengine IDMP——AI 原生的工业数据管理平台。

注册时间:2022-03-07

  • 博文量
    547
  • 访问量
    502122