InfluxDB 任务计算/插入值

发布于 2025-01-18 02:27:44 字数 93 浏览 3 评论 0原文

我试图在定期的间隔中计算/插入我的infuxdb 2.0.8。

对于一个过度简化的示例:如何每小时评估1+1并将结果插入数据库?

I am trying to calculate/insert a value into my InfluxDB 2.0.8 on a regular interval....can this be done with a task?

For a over simplified example: How can I evaluate 1+1 once an hour and insert the result into the database?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缪败 2025-01-25 02:27:44

我认为您很清楚任务的一般内在信息以及如何设置任务。那么,唯一缺少的是如何生成不是查询而产生的数据行。方法array.rows()对此很方便。

这是一个例子 - 我没有尝试。

import "array"
option task = {name: "oneplusone", every: 1h}

array.from(rows: [
    {_time: now(), _measurement: "calculation", _field: "result", _value: 1+1}
])|> to(bucket: "mybucket")

I assume you are well aware of the general intrinsics of tasks and how to set up a task. The only thing missing then is how to generate data rows that do not result from querying. The method array.rows() comes handy for this.

Here is an example - I did not try it.

import "array"
option task = {name: "oneplusone", every: 1h}

array.from(rows: [
    {_time: now(), _measurement: "calculation", _field: "result", _value: 1+1}
])|> to(bucket: "mybucket")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文