Prosjekt Velkomstskjerm

Fra Bitraf
Revisjon per 27. aug. 2019 kl. 13:29 av Tingo (diskusjon | bidrag) (Raspberry Pi: endret navn navn på Pi'en og lagt til her)
Hopp til navigering Hopp til søk
bilde av skjerm

Skjermen i hjørnet skal vise en velkomstmelding med kul grafikk når folk logger in med checkin.

Infoskjerm-grafana.jpg

Infoskjermen er nå operativ. Den kjører en webside som viser en playlist fra lokal grafana-server. For å redigere grafana-sidene logger du inn på http://iot2.bitraf.no:3000


Teknisk info

Løsningen består av to deler, En Raspberry Pi koblet til TV'en som viser en webside, og en server som står for alt det andre.

Raspberry Pi

navn: infoskjerm.local

Server

navn: iot2.bitraf.no

Serveren kjører Grafana[1] (grafana-server), samt følgende komponenter fra TICK stack

  • Telegraf[2] - agent, datainnsamling
  • Influxdb[3] - database for tids-serie data
  • Kapacitor[4] - prosessering av data

Tjenestene har følgende navn

  • grafana-server.service
  • influxdb.service
  • kapacitor.service
  • telegraf.service

Chronograf[5] er ikke i bruk, siden vi benytter Grafana.

Databaser

Følgende databaser er definert i influxdb

> show databases
name: databases
name
----
_internal
telegraf
mqtt_bitraf
bitraf-maskiner

I mqtt_bitraf er følgende serier definert

> show series on mqtt_bitraf
key
---
bitraf_bool,host=iot2,topic=/bitraf/door/2floor/isopen
bitraf_bool,host=iot2,topic=/bitraf/door/3office/isopen
bitraf_bool,host=iot2,topic=/bitraf/door/3workshop/isopen
bitraf_bool,host=iot2,topic=/bitraf/door/4floor/isopen
bitraf_bool,host=iot2,topic=/bitraf/door/frontdoor/isopen
bitraf_int,host=iot2,topic=/bitraf/door/frontdoor/open
bitraf_int,host=iot2,topic=/public/chime/uptime
bitraf_string,host=iot2,topic=public/infoscreen/wtf
mqtt_consumer,host=iot2,topic=/public/smutcave/humidity
mqtt_consumer,host=iot2,topic=/public/smutcave/temperature
mqtt_consumer,host=iot2,topic=bitraf/currentsensor/shopbot
mqtt_consumer,host=iot2,topic=bitraf/humidity/1
mqtt_consumer,host=iot2,topic=bitraf/humidity/2/value
mqtt_consumer,host=iot2,topic=bitraf/temperature/1
mqtt_consumer,host=iot2,topic=bitraf/temperature/2/value
mqtt_consumer,host=iot2,topic=bitraf/temperature/3/value
ping,host=iot2,url=10.13.37.248
ping,host=iot2,url=10.13.37.47
ping,host=iot2,url=boxy3.local
ping,host=iot2,url=boxy4.local
ping,host=iot2,url=http://boxy3.local
ping,host=iot2,url=http://boxy4.local

I bitraf-maskiner er følgende serier definert

> show series on "bitraf-maskiner"
key
---
nvidia_smi,compute_mode=Default,host=Multimedia-maskin,index=0,name=GeForce\ GTX\ 570,pstate=P0,uuid=GPU-5566aa51-b932-0d56-cc06-b6ae94dc6e5f
nvidia_smi,compute_mode=Default,host=Multimedia-maskin,index=0,name=GeForce\ GTX\ 570,pstate=P12,uuid=GPU-5566aa51-b932-0d56-cc06-b6ae94dc6e5f
nvidia_smi,compute_mode=Default,host=Multimedia-maskin,index=0,name=GeForce\ GTX\ 570,pstate=P8,uuid=GPU-5566aa51-b932-0d56-cc06-b6ae94dc6e5f
win_cpu,host=Multimedia-maskin,instance=0,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=1,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=2,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=3,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=4,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=5,objectname=Processor
win_cpu,host=Multimedia-maskin,instance=_Total,objectname=Processor
win_disk,host=Multimedia-maskin,instance=C:,objectname=LogicalDisk
win_disk,host=Multimedia-maskin,instance=D:,objectname=LogicalDisk
win_disk,host=Multimedia-maskin,instance=E:,objectname=LogicalDisk
win_diskio,host=Multimedia-maskin,instance=0\ C:,objectname=PhysicalDisk
win_diskio,host=Multimedia-maskin,instance=1\ D:,objectname=PhysicalDisk
win_diskio,host=Multimedia-maskin,instance=2\ E:,objectname=PhysicalDisk
win_mem,host=Multimedia-maskin,objectname=Memory
win_net,host=Multimedia-maskin,instance=Realtek\ PCIe\ GBE\ Family\ Controller,objectname=Network\ Interface
win_perf_counters,host=Multimedia-maskin,instance=Realtek\ PCIe\ GBE\ Family\ Controller,objectname=Network\ Interface
win_swap,host=Multimedia-maskin,instance=_Total,objectname=Paging\ File
win_system,host=Multimedia-maskin,objectname=System

Vedlikehold

2019-08-27
environment sensors data was not showing in grafana again. Restarted the telegraf service. Tingo (diskusjon) 27. aug. 2019 kl. 11:39 (CEST)
2019-07-30 
the graphs didn't update on the Pi (update in Grafana was ok). Rebooted the Pi. Tingo (diskusjon) 30. jul. 2019 kl. 09:54 (CEST)
2019-07-26 
the graphs didn't update on the Pi (update in Grafana was ok). Rebooted the Pi. Tingo (diskusjon) 26. jul. 2019 kl. 12:36 (CEST)
2019-07-03 
the graphs didn't update on the Pi (update in Grafana was ok). Rebooted the Pi. Tingo (diskusjon) 3. jul. 2019 kl. 16:29 (CEST)
2019-07-01 
environment sensors data was not showing in grafana again. Restarted the telegraf service. Tingo (diskusjon) 3. jul. 2019 kl. 16:27 (CEST)
2019-06-21 
front door activity was showing "no data points". restarted telegraf service via tingo@iot2:~$ sudo systemctl restart telegraf, but that didn't have any effect. Tingo (diskusjon)
Ok, with patience the data shows up. Tingo (diskusjon) 21. jun. 2019 kl. 13:21 (CEST)
2019-05-09 
environment sensors data was not showing in grafana again. I had to restart the telegraf service via
tingo@iot2:~$ sudo systemctl restart telegraf
in addition, I had to refresh the browser window on the Pi (connected a keyboard and did Ctrl-R). Tingo (diskusjon) 9. mai 2019 kl. 19:48 (CEST)
2019-04-12 
environment sensors data was not showing in grafana again. As usual, a
tingo@iot2:~$ sudo systemctl restart telegraf
fixed the problem. Tingo (diskusjon) 12. apr. 2019 kl. 15:52 (CEST)
2019-01-29 
I also needed to restart the playlist on the welcome screen. Tingo (diskusjon) 29. jan. 2019 kl. 14:39 (CET)
environment sensors data was not showing in grafana again. The telegraf service reported
tingo@iot2:~$ systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-10-12 00:22:04 CEST; 3 months 18 days ago
     Docs: https://github.com/influxdata/telegraf
 Main PID: 448 (telegraf)
    Tasks: 18 (limit: 4915)
   CGroup: /system.slice/telegraf.service
           └─448 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/te

Jan 29 12:44:30 iot2 telegraf[448]: 2019-01-29T11:44:30Z E! Error in plugin [inputs.mqtt_consume
Jan 29 12:44:30 iot2 telegraf[448]: error: pingresp not received, disconnecting
Jan 29 12:44:30 iot2 telegraf[448]: MQTT Client will try to reconnect
Jan 29 12:44:30 iot2 telegraf[448]: 2019-01-29T11:44:30Z I! MQTT Client Connected
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailabl

so I restarted the service via

tingo@iot2:~$ sudo systemctl restart telegraf

it looks better now

tingo@iot2:~$ systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-01-29 14:26:32 CET; 8s ago
     Docs: https://github.com/influxdata/telegraf
 Main PID: 29968 (telegraf)
    Tasks: 14 (limit: 4915)
   CGroup: /system.slice/telegraf.service
           ├─29968 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/
           └─29981 /bin/ping -c 1 -n -s 16 -i 1 -W 1 -w 10 10.13.37.47

Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! Loaded aggregators:
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! Loaded processors:
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! Loaded outputs: influxdb
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! Tags enabled: host=iot2
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! Agent Config: Interval:10s, Quiet:
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! MQTT Client Connected
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! MQTT Client Connected
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! MQTT Client Connected
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! MQTT Client Connected
Jan 29 14:26:33 iot2 telegraf[29968]: 2019-01-29T13:26:33Z I! MQTT Client Connected

Maybe telegraf needs to be restarted every time the mqtt server is restarted? Tingo (diskusjon) 29. jan. 2019 kl. 14:32 (CET)

2018-10-12 
grafana-server.service was not enabled on the server, so it didn't start automatically when the server got restarted. Fixed. --Tingo (diskusjon) 12. okt. 2018 kl. 09:16 (UTC)
2018-09-18 
measurement mqtt_consumer i mqtt_bitraf hadde data som ikke var oppdatert, selv om alle de andre i samme database var oppdatert. "Løst" ved å restarte telegraf vha. sudo systemctl restart telegraf. --Tingo (diskusjon) 18. sep. 2018 kl. 14:32 (UTC)

Referanser