Browse Source

working prototype

master
Tamás Gérczei 4 months ago
commit
6fd640e84c
4 changed files with 75 additions and 0 deletions
  1. +11
    -0
      README.md
  2. +28
    -0
      docker-compose.yml
  3. +17
    -0
      monitoring.service
  4. +19
    -0
      prometheus.yml

+ 11
- 0
README.md View File

@@ -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
- 0
docker-compose.yml View File

@@ -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
- 0
monitoring.service View File

@@ -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
- 0
prometheus.yml View File

@@ -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

Loading…
Cancel
Save