Wiki GeRgOsNet Notes d’administration système, réseau et domotique

Vous consultez une ancienne version, enregistrée le 19 octobre 2021 par GreG. Voir la version actuelle.

Influxdb Grafana Telegraf Jeedom

Migration depuis l’ancien wiki MediaWiki

  • Installation d’influxdb
apt-get install curl gnupg python3-pip
curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian stretch stable" > /etc/apt/sources.list.d/influxdata.list
apt update
apt install influxdb
systemctl start influxdb
  • Configuration InfluxDB
 influx

CREATE DATABASE telegraf
CREATE USER telegraf WITH PASSWORD 'DsdZdjk29'
GRANT ALL ON telegraf TO telegraf
quit
  • Installation de telegraf
apt install telegraf
systemctl start telegraf
  • Configuration de telegraf
pico /etc/telegraf/telegraf.conf

On modifie

[[outputs.influxdb]]
 database = "telegraf"
 urls = [ "http://127.0.0.1:8086" ]
 username = "telegraf"
 password = "mot de passe"

On relance

systemctl restart telegraf
  • Installation de Grafana
apt-get install -y software-properties-common
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
apt update
apt install grafana
  • Configuration de grafana
pico /etc/grafana/grafana.ini
domain = domain.truc.fr
enable_gzip = true
root_url = http://domain.truc.fr

On demarre grafana

/etc/init.d/grafana-server restart
systemctl enable grafana-server

Rendez-vous dans grafana pour ajouter votre base influx

http://www.greg.re/configure_influxdb_grafana.png

  • Configuration de Jeedom :

On récupère la gateway ici : https://github.com/neuhausj/JeedomTools/tree/master

On configure la gateway :

###########################
#    SCRIPT SETTINGS
###########################
# Set the port where you want the bridge service to run
PORT_NUMBER = 1234
# InfluxDB Server parameters
INLUXDB_SERVER_IP = '192.168.0.198'
INLUXDB_SERVER_PORT = 8086
INFLUXDB_USERNAME = 'telegraf'
INFLUXDB_PASSWORD = 'mot de passe'
INFLUXDB_DB_NAME = 'telegraf'
###########################

Une fois le script modifié, il faut donc le lancer :

pip3 install influxdb
python3.7 Bridge_Jeedom_InfluxDB.py &

Lancer automatiquement le script :

pico /lib/systemd/system/Bridge.service

[Unit]
Description=Bridge_Jeedom_InfluxDB.service
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python3.7 /home/carmelo/Bridge_Jeedom_InfluxDB.py

[Install]
WantedBy=multi-user.target

On recharge :

systemctl daemon-reload

On active :

systemctl enable Bridge.service
systemctl start Bridge.service