infuluxdb查询以返回给定时间板上的记录
我正在使用时间序列分析,我正在使用涌入数据库来绘制有趣的图形。
用例
因此,这是我正在建立一个物联网项目来监视我的办公桌工厂的 。每次水分降至10%时,我都会触发泵并在InfuxdB上注册该活动。每次泵开时,都会注册另一个活动。
这是行协议中的一点
,该行程得以保存活动,操作=泵,传感器= 628CFBDDF5D8735E30504021,控制器= 61DD1BFA47E99385A5555555555555533,org = 61C06A2ADCFA2554DDA76676666616166161C 799,type = on count = 1i 1653406685616
activities,action=pump,sensor=628cfbddf5d8735e30504021,controller=61dd1bfa47e99385a55d4853,org=61c06a2adcfa254dda756796,service=61c06a7edcfa254dda756799,type=off count=1i 1653406871246
As you can see, I have a few ids stored as tags and only count= 1存储在现场。
挑战
因此,这是我想绘制NO图的 。在过去30天的时间里,泵每天每天都会切换泵。 我尝试了几种方法,但无法找到解决此问题的方法。
我真的希望这种用例可以实现。谢谢
Im using time series analysis and I'm using influx db to plot interesting graphs.
So here's the use case
I'm building an IOT project to monitor my desk plant. every time the moisture goes down to 10%, I trigger to turn on the pump and register that activity on influxdb as well. every time pump goes off, another activity is registered.
Here is the point in the line protocol which gets saved
activities,action=pump,sensor=628cfbddf5d8735e30504021,controller=61dd1bfa47e99385a55d4853,org=61c06a2adcfa254dda756796,service=61c06a7edcfa254dda756799,type=on count=1i 1653406685616
activities,action=pump,sensor=628cfbddf5d8735e30504021,controller=61dd1bfa47e99385a55d4853,org=61c06a2adcfa254dda756796,service=61c06a7edcfa254dda756799,type=off count=1i 1653406871246
As you can see, I have a few ids stored as tags and only count=1 is stored in the field.
So here is the challenge
I want to plot a graph of no. of times the pump was switched VS every day for the past 30 days.
I've tried a few approaches but could not come to find a way to solve this issue.
I really hope this kind of use case is possible to achieve. Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试以下查询:
查询返回计数字段键中的非NULL字段值的数量并将其分为一半(假设每个开关都大致带有一个开关关闭)。它涵盖了20xx-xx-xxt 00:00:00:和20xx-xx-xxt23:59:29z之间的时间范围,并且组为24小时的时间间隔和每个标签。
如果您需要精确的打开事件,则可以更新上方的查询:
类似地,请参阅“关闭案例:
请参阅更多详细信息此处。
You could try following query:
The query returns the number of non-null field values in the count field key and divide it to half (assuming that every switch on comes with a switch off roughly). It covers the time range between 20XX-XX-XXT00:00:00Z and 20XX-XX-XXT23:59:29Z and groups results into 24-hour time intervals and per tag.
If you need exact switch on occurrences, then you could update above query:
Similarly for switch off case:
See more details here.