Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8a4b9ef4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8a4b9ef4
编写于
4月 20, 2022
作者:
sangshuduo
提交者:
GitHub
4月 20, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: add section how to verify prometheus/taosadapter works (#11668)
[TD-14920]
上级
a329af8f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
2 deletion
+60
-2
docs-cn/09-third-party/02-prometheus.md
docs-cn/09-third-party/02-prometheus.md
+60
-2
未找到文件。
docs-cn/09-third-party/02-prometheus.md
浏览文件 @
8a4b9ef4
...
...
@@ -4,7 +4,6 @@ title: Prometheus
---
import Prometheus from "../14-reference/_prometheus.mdx"
import DeployTaosAdapter from "./_deploytaosadapter.mdx"
Prometheus 是一款流行的开源监控告警系统。Prometheus 于2016年加入了 Cloud Native Computing Foundation (云原生云计算基金会,简称 CNCF),成为继 Kubernetes 之后的第二个托管项目,该项目拥有非常活跃的开发人员和用户社区。
...
...
@@ -29,6 +28,65 @@ Prometheus 提供了 `remote_write` 和 `remote_read` 接口来利用其它数
重启 Prometheus 后可参考以下示例验证从 Prometheus 向 TDengine 写入数据并能够正确读出。
### 使用 TDengine CLI 查询写入数据
```
这里需要给出 Prometheus 端 写入和查询 TDengine的示例
taos> show databases;
name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status |
====================================================================================================================================================================================================================================================================================
test | 2022-04-12 08:07:58.756 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ms | 0 | ready |
log | 2022-04-20 07:19:50.260 | 2 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ms | 0 | ready |
prometheus_data | 2022-04-20 07:21:09.202 | 158 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready |
db | 2022-04-15 06:37:08.512 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ms | 0 | ready |
Query OK, 4 row(s) in set (0.000585s)
taos> use prometheus_data;
Database changed.
taos> show stables;
name | created_time | columns | tags | tables |
============================================================================================
metrics | 2022-04-20 07:21:09.209 | 2 | 1 | 1389 |
Query OK, 1 row(s) in set (0.000487s)
taos> select * from metrics limit 10;
ts | value | labels |
=============================================================================================
2022-04-20 07:21:09.193000000 | 0.000024996 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:14.193000000 | 0.000024996 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:19.193000000 | 0.000024996 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:24.193000000 | 0.000024996 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:29.193000000 | 0.000024996 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:09.193000000 | 0.000054249 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:14.193000000 | 0.000054249 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:19.193000000 | 0.000054249 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:24.193000000 | 0.000054249 | {"__name__":"go_gc_duration... |
2022-04-20 07:21:29.193000000 | 0.000054249 | {"__name__":"go_gc_duration... |
Query OK, 10 row(s) in set (0.011146s)
```
### 使用 prompql-cli 验证 Prometheus 使用 remote_read 从 TDengine 读取数据
安装 promql-cli
```
go install github.com/nalbury/promql-cli@latest
```
在 TDengine 和 taosAdapter 服务运行状态对 Prometheus 数据进行查询
```
ubuntu@shuduo-1804 ~ $ promql-cli --host "http://127.0.0.1:9090" "sum(up) by (job)"
JOB VALUE TIMESTAMP
prometheus 1 2022-04-20T08:05:26Z
node 1 2022-04-20T08:05:26Z
```
暂停 taosAdapter 服务后对 Prometheus 数据进行查询
```
ubuntu@shuduo-1804 ~ $ sudo systemctl stop taosadapter.service
ubuntu@shuduo-1804 ~ $ promql-cli --host "http://127.0.0.1:9090" "sum(up) by (job)"
VALUE TIMESTAMP
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录