meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
groups:mg:mg:temperture_monitoring [2018/08/20 09:28] – [Database and Visualisation] rholst | groups:mg:mg:temperture_monitoring [2018/09/04 12:40] (current) – removed ssauer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Temperature Monitoring with Raspberry Pi ====== | ||
- | FIXME add grafana | ||
- | |||
- | FIXME add overview of all important files and services | ||
- | |||
- | FIXME Write down account names and passwords somewhere | ||
- | |||
- | FIXME add overview of the general structure of the setup | ||
- | |||
- | FIXME add " | ||
- | |||
- | FIXME add console prompt to code segments | ||
- | |||
- | The monitoring setup was developed by Etiénne Wodey. It is explained in {{ : | ||
- | |||
- | Short version: the raspberry pi reads out temperature sensors connected via one-wire bus, sends the data via LAN to an [[https:// | ||
- | |||
- | ===== Magnesium Server ===== | ||
- | |||
- | hostname '' | ||
- | ===== Raspbery Pi ===== | ||
- | |||
- | ==== Basic principle ==== | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | ==== Hardware setup ==== | ||
- | |||
- | FIXME pictures and schematics | ||
- | |||
- | ==== Installing Raspbian ==== | ||
- | |||
- | ==== Enabling One-Wire-Bus ==== | ||
- | |||
- | Edit ''/ | ||
- | < | ||
- | sudo nano / | ||
- | </ | ||
- | and add the line | ||
- | < | ||
- | dtoverlay=w1-gpio | ||
- | </ | ||
- | |||
- | Edit ''/ | ||
- | < | ||
- | sudo nano / | ||
- | </ | ||
- | and add the lines | ||
- | < | ||
- | w1-gpio | ||
- | w1-therm | ||
- | </ | ||
- | |||
- | Reboot the System: | ||
- | < | ||
- | sudo reboot | ||
- | </ | ||
- | |||
- | There should be folders '' | ||
- | < | ||
- | ls -l / | ||
- | </ | ||
- | |||
- | Check if there are devices connected: | ||
- | < | ||
- | ls -l / | ||
- | </ | ||
- | Replace '' | ||
- | |||
- | There should be folders named something like '' | ||
- | |||
- | In case the folders or the files don't exist, make sure your devices are connected correctly, the steps above were done and/or reboot the system. | ||
- | |||
- | ==== collectd ==== | ||
- | |||
- | https:// | ||
- | |||
- | '' | ||
- | |||
- | install collectd: | ||
- | < | ||
- | sudo apt-get update | ||
- | sudo apt-get install collectd | ||
- | </ | ||
- | |||
- | check the status of the daemon: | ||
- | < | ||
- | sudo systemctl status collectd | ||
- | </ | ||
- | |||
- | if the status is running, stop the daemon: | ||
- | < | ||
- | sudo systemctl stop collectd | ||
- | </ | ||
- | |||
- | to view all systemlog messages by collectd: | ||
- | < | ||
- | journalctl -u collectd -b | ||
- | </ | ||
- | |||
- | The collectd configuration file is located at / | ||
- | < | ||
- | sudo nano / | ||
- | </ | ||
- | Copy the contents of {{ : | ||
- | |||
- | Make sure to adjust the name of the server in the network plugin section to your needs. | ||
- | |||
- | ==== Python Plugin ==== | ||
- | |||
- | The temperature sensors are read out by a python module using the python plugin for collectd. Place the script {{ : | ||
- | |||
- | The collectd module reads '' | ||
- | |||
- | ==== Starting collectd ==== | ||
- | |||
- | Start the collectd service using: | ||
- | < | ||
- | sudo systemctl start collectd | ||
- | </ | ||
- | |||
- | Check if it runs without errors by reading | ||
- | < | ||
- | sudo systemctl status collectd | ||
- | </ | ||
- | or checking | ||
- | < | ||
- | journalctl -u collectd -b | ||
- | </ | ||
- | |||
- | <note important> | ||
- | |||
- | ===== influxdb ===== | ||
- | |||
- | [[https:// | ||
- | |||
- | ==== Setup ==== | ||
- | |||
- | set up as decribed in [[https:// | ||
- | |||
- | ==== Creating the database ==== | ||
- | |||
- | Create a database in which you later wish to store the temperatures measured, for now we call it '' | ||
- | |||
- | In influxDB execute: | ||
- | < | ||
- | CREATE DATABASE collectd_test | ||
- | </ | ||
- | |||
- | Check if it was created properly using: | ||
- | < | ||
- | USE collectd_test | ||
- | </ | ||
- | |||
- | Exit using | ||
- | < | ||
- | EXIT | ||
- | </ | ||
- | |||
- | ==== Configuring for collectd ==== | ||
- | |||
- | Stop the influxdb server by running: | ||
- | < | ||
- | sudo systemctl stop influxd | ||
- | </ | ||
- | |||
- | The configuration file is ''/ | ||
- | |||
- | The config file we use is {{ : | ||
- | |||
- | The interesting part is: | ||
- | < | ||
- | [[collectd]] | ||
- | enabled = true | ||
- | bind-address = ": | ||
- | database = " | ||
- | security-level = " | ||
- | </ | ||
- | |||
- | This enables the collectd plugin for influx and writes to the database we specify without any privileges required. | ||
- | |||
- | adjust the configuration file to be the same as above. | ||
- | |||
- | ==== types.db ==== | ||
- | |||
- | The collectd plugin for influx requires a types.db document. Copy this from ''/ | ||
- | |||
- | ==== Restarting the server ==== | ||
- | |||
- | Start the server by typing < | ||
- | |||
- | To check if there are values being written into the database, use another terminal or ssh to log into influx: | ||
- | < | ||
- | influx | ||
- | </ | ||
- | and check for values in the database: | ||
- | < | ||
- | USE collectd_test | ||
- | SHOW SERIES | ||
- | </ | ||
- | |||
- | If something is displayed, try listing those values by using | ||
- | < |