从Grafana的InfluxDB获得总共两个系列的数据 [英] Obtaining a total of two series of data from InfluxDB in Grafana

查看:639
本文介绍了从Grafana的InfluxDB获得总共两个系列的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这时我很困惑.我在Influx和Grafana的最深处花了一两天,以绘制一些对我的需求至关重要的图表.但是,对于最后一个,我需要总计两个指标(列值中有两个增量计数).我们称它们为notifications.one和notifications.two.在我希望它们显示的图形中,将这两个图形合起来可以很好地工作,一条图形线显示(notifications.one + notifications.two)而不是两个单独的图形.

I am perplexed at this point. I spent a day or three in the deep end of Influx and Grafana, to get some graphs plotted that are crucial to my needs. However, with the last one I need to total up two metrics (two increment counts, in column value). Let's call them notifications.one and notifications.two. In the graph I would like them displayed, it would work well as a total of the two, a single graph line, showing (notifications.one + notifications.two) instead of two separate ones.

我尝试使用通常的SELECT sum(value) from两者,但没有从中获取任何数据(确实存在!). Influx文档中还提到了merge(),但我也无法使它正常工作.

I tried with the usual SELECT sum(value) from the two, but I don't get any data from it (which does exist!). There is also merge() mentioned in the documentation of Influx, but I cannot get this to work either.

用于合并的文档要求如下:

The documentation for merge requires something like:

SELECT mean(value) FROM /notifications.*/ WHERE ...

这也以平坦的零线形式出现.

This also, comes back as a flat zero line.

我希望我的问题具有一定的分量,因为我还没有足够的知识来尽可能地传达问题.

I hope my question carries some weight, since I have far from enough knowledge to convey the problem as good as possible.

谢谢.

推荐答案

在InfluxDB 0.9中,无法合并跨度量的查询结果.默认情况下,在一个测量中,所有系列都将合并,但是不能在所有测量中合并任何系列.参见 https://influxdb.com/docs/v0.9/concepts/详情请参见08_vs_09.html#joins .

In InfluxDB 0.9 there is no way to merge query results across measurements. Within a measurement all series are merged by default, but no series can be merged across measurements. See https://influxdb.com/docs/v0.9/concepts/08_vs_09.html#joins for more detail.

针对0.9的更好模式是代替两个度量:notifications.onenotifications.two,具有一个度量notifications,其中foo=onefoo=two作为该单个度量的标签.然后,合并值的查询仅为SELECT MEAN(value) FROM notifications,然后每个系列的查询为SELECT MEAN(value) FROM notifications GROUP BY foo

A better schema for 0.9 is instead of two measurements: notifications.one and notifications.two, have one measurement notifications with foo=one and foo=two as tags on that single measurement. Then the query for the merged values is just SELECT MEAN(value) FROM notifications and the per-series query is then SELECT MEAN(value) FROM notifications GROUP BY foo

这篇关于从Grafana的InfluxDB获得总共两个系列的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆