Commit 14ae967f authored by Rousseau Vincent's avatar Rousseau Vincent
Browse files

use env variable

parent 50eef9fc
No related merge requests found
Showing with 5 additions and 9 deletions
+5 -9
import time
import os
import psutil
from influxdb import InfluxDBClient
influx_client = InfluxDBClient('influxdb', 8086, database='cpu-sense')
influx_host = os.getenv('INFLUX_HOST', 'localhost')
influx_client = InfluxDBClient(host=influx_host, database='cpu-sense')
influx_client.create_database('cpu-sense')
while True:
......@@ -15,4 +17,4 @@ while True:
}
]
influx_client.write_points(measurement)
time.sleep(10)
\ No newline at end of file
time.sleep(1)
\ No newline at end of file
......@@ -3,12 +3,8 @@ volumes:
persitent-storage:
services:
influxdb:
image: influxdb:1.7
image: influxdb:1.7-alpine
restart: always
ports:
- "8086:8086"
volumes:
- 'persitent-storage:/var/lib/influxdb'
grafana:
image: grafana/grafana:5.4.3
restart: always
......@@ -19,8 +15,6 @@ services:
sensor:
build: .
restart: always
links:
- influxdb
environment:
- INFLUX_HOST=influxdb
depends_on:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment