This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
[SpainLabsIoT2018] InfluxDB + Telegraf
#21
En la forma de configurar el topic que tiene que leer es donde esta el tema.

El soft de mqtt que comentas no es el que digo, en unas horas lo comento.

En grafana ya te deberia ser muy sencillo. Ves recargando la web si metes nuevos nombres de nodo o diferentes sensores. Ten en cuenta los tiempos que telegraf tiene para indexar os nuevos datos. Grafana es posible que si tienes datos muy juntos (por ejemplo sobre 2-5 segundos) te haga una media entre dos valores para plotear uno solo.
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#22
Lo primero, pedir perdón si los moderadores consideran que estoy dejando poco claro el hilo. Si lo prefieren abro uno nuevo, o intento editar todos en uno.

He estado mirando la configuración de mosquitto y creo que tenía algo mal. Ahora cuando ejecuto mosquitto me sale lo siguiente:

Código:
pi@raspberrypi:~ $ mosquitto -v
1569428807: mosquitto version 1.5.7 starting
1569428807: Using default config.
1569428807: Opening ipv4 listen socket on port 1883.
1569428807: Opening ipv6 listen socket on port 1883.
1569428807: New connection from ::1 on port 1883.
1569428807: New client connected from ::1 as telegraf (c0, k60).
1569428807: No will message specified.
1569428807: Sending CONNACK to telegraf (0, 0)
1569428807: Received SUBSCRIBE from telegraf
1569428807:     sensors/# (QoS 0)
1569428807: telegraf 0 sensors/#
1569428807: Sending SUBACK to telegraf
1569428809: New connection from 192.168.1.174 on port 1883.
1569428809: New client connected from 192.168.1.174 as ESP8266Client (c1, k15).
1569428809: No will message specified.
1569428809: Sending CONNACK to ESP8266Client (0, 0)
1569428809: Received SUBSCRIBE from ESP8266Client
1569428809:     despacho/luz (QoS 0)
1569428809: ESP8266Client 0 despacho/luz
1569428809: Sending SUBACK to ESP8266Client
1569428809: Received PUBLISH from ESP8266Client (d0, q0, r0, m0, 'sensors/Testing/temp', ... (24 bytes))
1569428809: Sending PUBLISH to telegraf (d0, q0, r0, m0, 'sensors/Testing/temp', ... (24 bytes))
1569428809: Received PUBLISH from ESP8266Client (d0, q0, r0, m0, 'sensors/Testing/humedad', ... (20 bytes))
1569428809: Sending PUBLISH to telegraf (d0, q0, r0, m0, 'sensors/Testing/humedad', ... (20 bytes))
1569428820: New connection from ::1 on port 1883.
1569428820: Client telegraf already connected, closing old connection.
1569428820: Socket error on client telegraf, disconnecting.
1569428820: New client connected from ::1 as telegraf (c0, k60).
1569428820: No will message specified.
1569428820: Sending CONNACK to telegraf (1, 0)
1569428824: Received PINGREQ from ESP8266Client
1569428824: Sending PINGRESP to ESP8266Client
1569428827: New connection from ::1 on port 1883.
1569428827: Client telegraf already connected, closing old connection.
1569428827: Socket error on client telegraf, disconnecting.
1569428827: New client connected from ::1 as telegraf (c0, k60).
1569428827: No will message specified.
1569428827: Sending CONNACK to telegraf (1, 0)
1569428830: New connection from ::1 on port 1883.
1569428830: Client telegraf already connected, closing old connection.
1569428830: Socket error on client telegraf, disconnecting.
1569428830: New client connected from ::1 as telegraf (c0, k60).
1569428830: No will message specified.
1569428830: Sending CONNACK to telegraf (1, 0)
1569428837: New connection from ::1 on port 1883.
1569428837: Client telegraf already connected, closing old connection.
1569428837: Socket error on client telegraf, disconnecting.
1569428837: New client connected from ::1 as telegraf (c0, k60).
1569428837: No will message specified.
1569428837: Sending CONNACK to telegraf (1, 0)
1569428839: Received PINGREQ from ESP8266Client
1569428839: Sending PINGRESP to ESP8266Client
1569428839: Received PUBLISH from ESP8266Client (d0, q0, r0, m0, 'sensors/Testing/temp', ... (24 bytes))
1569428839: Sending PUBLISH to telegraf (d0, q0, r0, m0, 'sensors/Testing/temp', ... (24 bytes))
1569428839: Received PUBLISH from ESP8266Client (d0, q0, r0, m0, 'sensors/Testing/humedad', ... (20 bytes))
1569428839: Sending PUBLISH to telegraf (d0, q0, r0, m0, 'sensors/Testing/humedad', ... (20 bytes))
1569428840: New connection from ::1 on port 1883.
1569428840: Client telegraf already connected, closing old connection.
1569428840: Socket error on client telegraf, disconnecting.
1569428840: New client connected from ::1 as telegraf (c0, k60).
1569428840: No will message specified.
1569428840: Sending CONNACK to telegraf (1, 0)

Y en telegraf me salen nuevos mensajes:
Código:
pi@raspberrypi:~ $ telegraf --debug
2019-09-25T16:27:00Z I! Starting Telegraf 1.12.1
2019-09-25T16:27:00Z I! Using config file: /etc/telegraf/telegraf.conf
2019-09-25T16:27:00Z I! Loaded inputs: cpu disk kernel mem diskio processes swap system mqtt_consumer
2019-09-25T16:27:00Z I! Loaded aggregators:
2019-09-25T16:27:00Z I! Loaded processors:
2019-09-25T16:27:00Z I! Loaded outputs: influxdb
2019-09-25T16:27:00Z I! Tags enabled: host=raspberrypi
2019-09-25T16:27:00Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"raspberrypi", Flush Interval:10s
2019-09-25T16:27:00Z D! [agent] Initializing plugins
2019-09-25T16:27:00Z W! [inputs.mqtt_consumer] Server "localhost:1883" should be updated to use `scheme://host:port` format
2019-09-25T16:27:00Z D! [agent] Connecting outputs
2019-09-25T16:27:00Z D! [agent] Attempting connection to [outputs.influxdb]
2019-09-25T16:27:00Z D! [agent] Successfully connected to outputs.influxdb
2019-09-25T16:27:00Z D! [agent] Starting service inputs
2019-09-25T16:27:00Z I! [inputs.mqtt_consumer] Connected [localhost:1883]
2019-09-25T16:27:00Z D! [inputs.mqtt_consumer] Session found [localhost:1883]
2019-09-25T16:27:07Z E! [inputs.mqtt_consumer] Error in plugin: connection lost: EOF
2019-09-25T16:27:07Z D! [inputs.mqtt_consumer] Disconnected [localhost:1883]
2019-09-25T16:27:10Z D! [inputs.mqtt_consumer] Connecting [localhost:1883]
2019-09-25T16:27:10Z I! [inputs.mqtt_consumer] Connected [localhost:1883]
2019-09-25T16:27:10Z D! [inputs.mqtt_consumer] Session found [localhost:1883]
2019-09-25T16:27:17Z E! [inputs.mqtt_consumer] Error in plugin: connection lost: EOF
2019-09-25T16:27:17Z D! [inputs.mqtt_consumer] Disconnected [localhost:1883]
2019-09-25T16:27:20Z D! [inputs.mqtt_consumer] Connecting [localhost:1883]
2019-09-25T16:27:20Z I! [inputs.mqtt_consumer] Connected [localhost:1883]
2019-09-25T16:27:20Z D! [inputs.mqtt_consumer] Session found [localhost:1883]
2019-09-25T16:27:20Z D! [outputs.influxdb] Wrote batch of 13 metrics in 260.157542ms
2019-09-25T16:27:20Z D! [outputs.influxdb] Buffer fullness: 18 / 10000 metrics
2019-09-25T16:27:24Z E! [inputs.mqtt_consumer] Error in plugin: connection lost: EOF
2019-09-25T16:27:24Z D! [inputs.mqtt_consumer] Disconnected [localhost:1883]
2019-09-25T16:27:30Z D! [inputs.mqtt_consumer] Connecting [localhost:1883]
2019-09-25T16:27:30Z D! [outputs.influxdb] Wrote batch of 18 metrics in 36.917443ms
2019-09-25T16:27:30Z D! [outputs.influxdb] Buffer fullness: 17 / 10000 metrics

La verdad que ahora mismo no sé si va mejor o peor el asunto
  Responder
#23
Esos errores es porque el mosquitto esta desconectando el cliente de telegraf. No tiene porque ser malo, pero hay que ajustarlo.

Las dudas estan bien aqui.
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#24
Buenas tardes,
por fin tengo funcionando todo y graficando en Grafana. Sé en parte que pasaba y que no pasaba.

Por un lado, eliminé del todo los programas emplean
Código:
apt remove
y
Código:
apt purge

El siguiente paso, reiniciar la RPi e instalar todos los programas reiniciando después de cada uno.

La configuración de Telegraf es la siguiente:

Código:
[[inputs.mqtt_consumer]]
  servers = ["localhost:1883"]
  qos = 0
  topics = ["sensors/#",
  ]
  client_id = "telegraf"
  data_format = "influx"

[[outputs.influxdb]]
  urls = ["http://localhost:8086"]
  database = "arduinosensors"
  retention_policy = ""
  write_consistency = "any"

  timeout = "5s"
  username = "telegraf"
  password = "raspberry"

Con la configuración que dijo Argalleiro no me ha funcionado

Código:
data_format = "value"
data_type = "string"

El siguiente punto es que mosquitto no se ejecutá al iniciar la RPi pero telegraf sí lo hace, por eso cuando lanzaba otra instancia de telegraf siempre la echaba mosquitto. Así que ahora tengo que ver como hacer que mosquitto se lance automáticamente.


[Imagen: Screen-Shot-2019-09-27-at-17-47-50.png]

redimensionar gif online

Ahora ya solo me queda empezar a jugar bien como Grafana y estudiar como poder poner un botón para hacer la típica prueba de accionar un relé.

Un saludo y gracias por toda la ayuda aportada!

-----
EDIT:
Por cierto, por lo que veo Grafana solo sirve para monitorizar no? No se pueden enviar comandos, es solo para visualizar datos. ¿Es correcto?
No sé si para este aspecto sería mejor pasarse a node-red

Un saludo
  Responder
#25
Grafana es visualizador, no se puede poner botones para ejecutar una accion, ojala se pudiera pero de momento nada (seria la leche!).

Puedes hacer eso con node-red y que el nodo este suscrito a un topic con retencion. Con node-red puedes enviar valores a ese topic. Node-red tiene un dashboard que si puedes poner botones y hacer la accion que quieras.
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#26
Pues una pena, porque la verdad que grafana tiene muy buena pinta. El Dashboard que he visto de node-red no tiene tan buena pinta, pero igual eso depende también de las habilidades de cada uno...
  Responder
#27
Es mas sencillo el de node-red pero tiene un monton de opciones. Grafana tiene un desarrollo continuo, en algun momento tiene que aparecer algo que permita tener una comunicación bidireccional.

Saludos,
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#28
Vuelvo a la carga por aquí de nuevo con más problemillas...

Estoy intentando instalar todo en una RPI 2B+, instalo correctamente Influx pero teniendo en cuenta la nueva distro "Buster".

Influx aparece como lanzado:

Código:
$ systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series
  Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor
  Active: active (running) since Sat 2019-12-21 14:17:11 WET; 9min ago
    Docs: https://docs.influxdata.com/influxdb/
Main PID: 314 (influxd)
  Memory: 125.9M
  CGroup: /system.slice/influxdb.service
          └─314 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.099885Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.100416Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.109933Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.110860Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.117466Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.117895Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.124645Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.130511Z
dic 21 14:26:12 raspberrypi influxd[314]: ts=2019-12-21T14:26:12.141445Z
dic 21 14:26:13 raspberrypi influxd[314]: ts=2019-12-21T14:26:13.183444Z
lines 4-19/19 (END)

Sin embargo, cuando intento poner los usuarios, se queda eternamente sin finalizar la acción:

Código:
pi@raspberrypi:~ $ influx -execute "CREATE USER "telegraf" WITH PASSWORD 'telegraf' WITH ALL PRIVILEGES;"

Además, si lanzo tanto influx como influxd, no aparece nada por terminal, en versiones anteriores si que me salía como una especie de CLI.

¿Alguien ha notado algún fallo en las últimas actualizaciones de influx?

Gracias

EDIT:

Al final he vuelto a poner una RPi3 B+ y se nota bastante el procesador. Así que la RPI2 vuelve al cajón...
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  [SpainLabsIoT2018] Caso real: Nodos ESP8266 grafisoft 78 26,394 09-04-2020, 03:33 PM
Último mensaje: grafisoft
  [SpainLabsIoT2018] Empezamos - Servidor MQTT grafisoft 14 9,825 25-09-2019, 08:11 PM
Último mensaje: grafisoft
  APORTE [SpainLabsIoT2018] ESP8266 NodeMCU - Ajustando su consumo (hack) grafisoft 10 8,963 24-04-2019, 04:49 PM
Último mensaje: grafisoft
  [SpainLabsIoT2018] Nodo ESP8266 - Smart Sensors Shield grafisoft 16 7,968 02-07-2018, 08:55 PM
Último mensaje: grafisoft
  [SpainLabsIoT2018] Grafana - Actualizar a la ultima version grafisoft 0 1,732 02-04-2018, 07:46 PM
Último mensaje: grafisoft