working prototype

This commit is contained in:
Tamás Gérczei 2020-06-15 08:14:23 +02:00
incheckning 6fd640e84c
4 ändrade filer med 75 tillägg och 0 borttagningar

11
README.md Normal file
Visa fil

@ -0,0 +1,11 @@
# monitoring - containerized Prometheus and Grafana on HypriotOS
## usage
- docker volume create prometheus-tsdb
- docker volume create grafana-config
- docker volume create grafana-data
- sudo cp monitoring.service /lib/systemd/system/
- sudo systemctl daemon-reload
- sudo systemctl enable --now monitoring
### tested on HypriotOS v1.12.2 running on a Raspberry Pi 3B+

28
docker-compose.yml Normal file
Visa fil

@ -0,0 +1,28 @@
---
version: '2.1'
volumes:
tsdb:
name: prometheus-tsdb
config:
name: grafana-config
data:
name: grafana-data
services:
prometheus:
container_name: prometheus
hostname: prometheus
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- tsdb:/prometheus:rw
grafana:
container_name: grafana
hostname: grafana
image: grafana/grafana
ports:
- 3000:3000
volumes:
- config:/etc/grafana:rw
- data:/var/lib/grafana:rw

17
monitoring.service Normal file
Visa fil

@ -0,0 +1,17 @@
# /lib/systemd/system/monitoring.service
[Unit]
Description=Monitoring Stack Docker Compose Application
Requires=docker.service
After=docker.service
[Service]
User=pirate
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/pirate/monitoring
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target

19
prometheus.yml Normal file
Visa fil

@ -0,0 +1,19 @@
---
global:
evaluation_interval: 1m
scrape_interval: 1m
scrape_timeout: 10s
rule_files:
- /etc/config/rules
- /etc/config/alerts
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: other_nodes
static_configs:
- targets:
- global:9100
- global:8000