【问题标题】:Pull data from dynamic measurement name by uisng InfluxQL query使用 InfluxQL 查询从动态测量名称中提取数据
【发布时间】:2021-07-14 17:36:46
【问题描述】:

在我的应用程序中,我向grafana 显示来自influxdb 的指标。我在influxdb db 中有动态名称。例如customer_info_{customerId}。 我的问题是在influxQL 中查询如何使用动态测量名称,以便从中显示指标。

【问题讨论】:

  • 您正在使用不鼓励的架构设计docs.influxdata.com/influxdb/v1.8/concepts/…
  • 您好 Jan Garaj,感谢您的评论。我是grafanaInfluxQL 的新手。我将更改查询并添加tags。如果我将Query variables 添加到grafana,您能否告诉我,然后inluxql 查询将如何更改或如何基于所选变量构建仪表板。如果您可以提供任何文档链接。

标签: grafana influxdb influxql


【解决方案1】:

我会改变结构,所以customerid 将成为measurement 中的一个标签。

然后从 InfluxDB 查询创建 Grafana 仪表板变量customerid

SHOW TAG VALUES WITH KEY = "customerid"

并在 InfluxDB Grafana 面板查询中将其用作 $customerid

SELECT * 
FROM "measurement" 
WHERE 
  "customerid" = $customerid 
  AND $timeFilter

Doc 是你的朋友:https://grafana.com/docs/grafana/latest/datasources/influxdb/influxdb-templates/

【讨论】:

    猜你喜欢
    • 2011-04-19
    • 1970-01-01
    • 2014-08-16
    • 2015-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-25
    • 2013-05-19
    相关资源
    最近更新 更多