Commit 50eef9fc authored by Rousseau Vincent's avatar Rousseau Vincent
Browse files

working conf with influxdb in docker

parent f34be88f
No related merge requests found
Showing with 19 additions and 5 deletions
+19 -5
FROM python:3
COPY . /usr/src/app
RUN mkdir -p /usr/src/app
COPY cpu_influx.py /usr/src/app
COPY requirements.txt /usr/src/app
WORKDIR /usr/src/app
RUN python3 -m pip install -r requirements.txt
......
......@@ -2,11 +2,9 @@ import time
import psutil
from influxdb import InfluxDBClient
influx_client = InfluxDBClient('localhost', 8086, database='cpu-sense')
influx_client = InfluxDBClient('influxdb', 8086, database='cpu-sense')
influx_client.create_database('cpu-sense')
f = open('/sys/class/thermal/thermal_zone0/temp', 'r')
while True:
measurement = [
{
......@@ -17,4 +15,4 @@ while True:
}
]
influx_client.write_points(measurement)
time.sleep(1)
\ No newline at end of file
time.sleep(10)
\ No newline at end of file
......@@ -4,11 +4,25 @@ volumes:
services:
influxdb:
image: influxdb:1.7
restart: always
ports:
- "8086:8086"
volumes:
- 'persitent-storage:/var/lib/influxdb'
grafana:
image: grafana/grafana:5.4.3
restart: always
ports:
- "3000:3000"
volumes:
- 'persitent-storage:/var/lib/grafana'
sensor:
build: .
restart: always
links:
- influxdb
environment:
- INFLUX_HOST=influxdb
depends_on:
- influxdb
- grafana
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