设置telegraf配置文件以启用数据输入

问题描述

我想利用grafana来监视数据,并利用FLUX查询语言的数学能力。 为此,我设置了一个influxdb和grafana服务器,并安装了telegraf。

user@Logger-0271:~$ influx
Connected to http://localhost:8086 version 1.8.2
InfluxDB shell version: 1.8.2
> show databases
name: databases
name
----
_internal
localdb
brunosdb
telegraf
> use brunosdb
Using database brunosdb
> show measurements
name: measurements
name
----
flowrate
ruecklauftemp
vorlauftemp

在grafana中,选择InfluxDB作为查询语言(见下文),我可以将测量结果绘制得很好。但是,如果选择FLUX,则只能在telegraf数据库中绘制测量值。

> use telegraf
Using database telegraf
> show measurements
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system

InfluxDB作为查询语言:

enter image description here

FLUX作为查询语言:

enter image description here

enter image description here

我尝试将数据手动插入InfluxDB的telegraf数据库中,但它并不显示为grafana测量值。

如何将数据输入InfluxDB,然后在grafana中使用FLUX进行计算并绘制数据?我读过输入必须在配置文件中定义,但我不知道如何...

解决方法

我能够通过更改配置文件的[[inputs.mqtt_consumer]]部分来启用MQTT数据导入。