Servidores IoT con Raspberry Pi

Paso a paso para instalar un servidor de IoT en una Raspberry Pi con el software más típico para estos casos:

  • grafana (Gráficas de influxdb y diferentes fuentes con soporte para plugins)
  • influxdb (BBDD de tiempo)
  • node-red (Conector tipo IFTTT)
  • telegraf (Agente de servicios para alimentar influxdb)
  • mosquitto (MQTT Broker y clienpara hacer de intermediario entre dispositivos y controladores)

#dokumentazioa, referentziak (sois cracks!)

  • https://medium.com/@petey5000/monitoring-your-home-network-with-influxdb-on-raspberry-pi-with-docker-78a23559ffea
  • https://www.circuits.dk/install-grafana-influxdb-raspberry/
  • https://blog.monstermuffin.org/making-a-raspberry-pi-grafana-monitor/
  • https://gist.github.com/xoseperez/e23334910fb45b0424b35c422760cb87
  • http://www.oznetnerd.com/installing-setting-up-influxdb-telegraf-grafana/
  • https://hobbytronics.pk/installing-mosquitto-broker-on-raspberry-pi/

#raspia garbitu eta eguneratu

sudo apt-get remove libreoffice* wolfram* minecraft-pi sonic-pi scratch nuscratch smartsim   python-minecraftpi python3-minecraftpi claws-mail claws-mail-i18n python-pygame --purge -y
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get dist-upgrade

#grafana instalatu

sudo apt install apt-transport-https curl
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.2.4_armhf.deb
sudo dpkg -i grafana_5.2.4_armhf.deb
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo /bin/systemctl start grafana-server
sudo systemctl status grafana-server

#grafana pluginak instalatu

sudo grafana-cli plugins install grafana-clock-panel
sudo grafana-cli plugins install natel-discrete-panel
sudo grafana-cli plugins install briangann-gauge-panel
sudo grafana-cli plugins install vonage-status-panel
sudo grafana-cli plugins install neocat-cal-heatmap-panel

#influxdb instalatu

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
sudo systemctl start influxdb
influxd config
influx -precision rfc3339

#frogatu ea influx ondo dabilen... (204 erantzuna eman behar du)

curl -sL -I localhost:8086/ping

#usuario y BBDD para Telegraf (no está del todo bien...)

CREATE DATABASE "telegraf"
CREATE USER "telegraf" WITH PASSWORD 'telegraf_password' WITH ALL PRIVILEGES

#telegraf instalatu

sudo apt install telegraf

#telegraf konfiguratu

sudo nano /etc/telegraf/telegraf.conf
sudo service telegraf restart

#MQTT instalatu

sudo apt install mosquitto mosquitto-clients

# modifica servicio mosquitto

# https://gist.github.com/josuesantos93/6bfab1dd28a47efc8606517e45143824

#node-red instalatu

sudo apt install nodered
sudo systemctl enable nodered.service