meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
groups:mg:private:resonatoren:mg:temperture_monitoring:start [2022/02/15 14:57] – [IQ-Server] fienegroups:mg:private:resonatoren:mg:temperture_monitoring:start [2024/03/20 09:37] (current) – Admin: Syntax-Update (Migration from deprecated "fontcolor" plugin to "color" plugin) klaus
Line 74: Line 74:
  
 <blockquote> <blockquote>
-<fc #008000>//#!/usr/bin/python3//</fc>+<color #008000>//#!/usr/bin/python3//</color>
  
-**<fc #008000>import</fc> <fc #6495ed>board</fc> \\ +**<color #008000>import</color> <color #6495ed>board</color> \\ 
-<fc #008000>import</fc> <fc #6495ed>busio</fc> \\ +<color #008000>import</color> <color #6495ed>busio</color> \\ 
-<fc #008000>import</fc><fc #6495ed> adafruit_bmp280</fc>**+<color #008000>import</color><color #6495ed> adafruit_bmp280</color>**
  
 i2c = busio.I2C(board.SCL, board.SDA)\\ i2c = busio.I2C(board.SCL, board.SDA)\\
 bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x76) bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x76)
  
-<fc #008000>print</fc>(<fc #ff0000>"Temperature: %0.1f C"</fc> % bmp280.temperature)\\ +<color #008000>print</color>(<color #ff0000>"Temperature: %0.1f C"</color> % bmp280.temperature)\\ 
-<fc #008000>print</fc>(<fc #ff0000>"Pressure: %0.1f hPa"</fc> % bmp280.pressure)+<color #008000>print</color>(<color #ff0000>"Pressure: %0.1f hPa"</color> % bmp280.pressure)
 </blockquote> </blockquote>
  
Line 246: Line 246:
  
  
-=== Configuring for collectd ===+===== IQ-Server ===== 
 +Only Admins are allowed to create a database and users on the institute's server. \\ 
 +You have to write the login data you receive from your admin and the hostname (probably "https://log.iqo.uni-hannover.de" in the configfile for collectd, e.g. with\\ 
 +''sudo nano /etc/collectd/collectd.conf''\\ 
 +The given security level "Sign" allows data processing of signed data over the default port "25826" if the correct login data is given. Some examples are given below.\\ 
 + 
 +The rest of collectd.conf is identical to the one for working with the Mg-Server (only Plugins used are syslog, network and python). You can find more information [[https://collectd.org/wiki/index.php/Networking_introduction|here]]. 
 + 
 + 
 +==== Configuring for collectd ====
  
 Stop the influxdb server by running: Stop the influxdb server by running:
Line 255: Line 264:
 The configuration file is ''/etc/influxdb/influxdb.conf''. The documentation can be found here: [[https://docs.influxdata.com/influxdb/v1.6/administration/config/]] The configuration file is ''/etc/influxdb/influxdb.conf''. The documentation can be found here: [[https://docs.influxdata.com/influxdb/v1.6/administration/config/]]
  
-The config file we use is {{ :groups:mg:mg:influxdb.txt |this}}.+The config file for the Mg-Server is {{ :groups:mg:mg:influxdb.txt |here}}.
  
 The interesting part is: The interesting part is:
Line 273: Line 282:
 magnesium: influxMG magnesium: influxMG
 </code> </code>
-This is the username and password for any external collectd services to authenticate with the influxdb database.+This is the username and password for any external collectd services to authenticate with the influxdb database.\\ 
 +To load InfluxDB with your new configurations, enter 
 + 
 +<code> 
 +echo $INFLUXDB_CONFIG_PATH /etc/influxdb/influxdb.conf 
 +</code>
  
 +and start the process with ''influxd'' or - as a second option - start the process always with ''influxd -config /etc/influxdb/influxdb.conf''.
  
 === types.db === === types.db ===
Line 299: Line 314:
 </code> </code>
  
-==== IQ-Server ==== 
-Only Admins are allowed to create a database and users on the institute's server.  
-==== Configure CollectD ==== 
-You have to write the login data you receive from your admin and the hostname (probably "https://log.iqo.uni-hannover.de" in the configfile for collectd, e.g. with\\ 
-''sudo nano /etc/collectd/collectd.conf''\\ 
-The given security level "Sign" allows data processing of signed data over the default port "25826" if the correct login data is given. Some examples are given below.\\ 
- 
-The rest of collectd.conf is identical to the one for working with the Mg-Server (only Plugins used are syslog, network and python). You can find more information [[https://collectd.org/wiki/index.php/Networking_introduction|here]]. 
- 
-==== Configure InfluxDB ==== 
-Enter your security level, database name, port, directory of saved data and additional configurations in ''sudo nano /etc/'' in the paragraph [[collectd]]. 
 ==== Automated Backups ==== ==== Automated Backups ====
  
Line 445: Line 449:
  
 <blockquote> <blockquote>
-<fc #008000>//#!/usr/bin/python3//</fc>+<color #008000>//#!/usr/bin/python3//</color>
  
-**<fc #008000>import</fc> <fc #6495ed>board</fc> \\ +**<color #008000>import</color> <color #6495ed>board</color> \\ 
-<fc #008000>import</fc> <fc #6495ed>busio</fc> \\ +<color #008000>import</color> <color #6495ed>busio</color> \\ 
-<fc #008000>import</fc><fc #6495ed>adafruit_bmp280</fc>\\ +<color #008000>import</color> <color #6495ed>adafruit_bmp280</color>\\ 
-<fc #008000>import</fc><fc #6495ed>sys</fc>\\ +<color #008000>import</color> <color #6495ed>sys</color>\\ 
-<fc #008000>import</fc><fc #6495ed>Adafruit_DHT</fc>\\+<color #008000>import</color> <color #6495ed>Adafruit_DHT</color>\\
  
 i2c = busio.I2C(board.SCL, board.SDA)\\ i2c = busio.I2C(board.SCL, board.SDA)\\
Line 462: Line 466:
  
 \\ \\
-**<fc #008000>print</fc>(<fc #ff0000>"Pressure: %0.1f hPa"</fc> % pressure)**\\+**<color #008000>print</color>(<color #ff0000>"Pressure: %0.1f hPa"</color> % pressure)**\\
 \\ \\
-**<fc #008000>if</fc> humidity <fc #008000>is not</fc> <fc #ff00ff>None</fc> <fc #008000>and</fc> temperature <fc #008000>is not</fc> <fc #ff00ff>None</fc>: **\\+**<color #008000>if</color> humidity <color #008000>is not</color> <color #ff00ff>None</color> <color #008000>and</color> temperature <color #008000>is not</color> <color #ff00ff>None</color>: **\\
 \\ \\
 **temperature = (bmp280.temperature + temperature)/2\\ **temperature = (bmp280.temperature + temperature)/2\\
-<fc #008000>print</fc>(<fc #ff0000>"Temperature: %0.1f C"</fc> % temperature)\\ +<color #008000>print</color>(<color #ff0000>"Temperature: %0.1f C"</color> % temperature)\\ 
-<fc #008000>print</fc>(<fc #ff0000>"Humidity: %0.1f g/m3"</fc> % humidity)**\\+<color #008000>print</color>(<color #ff0000>"Humidity: %0.1f g/m3"</color> % humidity)**\\
 \\ \\
-**<fc #008000>else</fc>:\\+**<color #008000>else</color>:\\
 \\ \\
-      print(<fc #ff0000>"Failed to read AM2302 sensor! Check connections!"</fc>)\\+      print(<color #ff0000>"Failed to read AM2302 sensor! Check connections!"</color>)\\
       sys.exit(1)**\\       sys.exit(1)**\\
          
 </blockquote> </blockquote>
  
-Plugin Network in configfile of collectd:+Plugin Network in configfile of collectd:\\ 
   <Plugin network>   <Plugin network>
           <Server "https//log.iqo.uni-hannover.de" "25826">           <Server "https//log.iqo.uni-hannover.de" "25826">
Line 485: Line 490:
           </Server>           </Server>
   </Plugin>   </Plugin>
 +
 +
 +   
 === To Do === === To Do ===
 +
   * if bind address already in use find PID with ''netstat -tulpn'' and kill process e.g. with ''sudo kill 1258''   * if bind address already in use find PID with ''netstat -tulpn'' and kill process e.g. with ''sudo kill 1258''
-  * TSM files safed in /var/lib/influxdb/data+  * types db file in /usr/local/share/collectd needs to be copied to server! otherwise influxd won't even start and listens to server forever