Skip to content

Commit

Permalink
add prometheus + grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
abcprintf committed Dec 31, 2023
1 parent 5b02e28 commit 028ae86
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prometheus-grafana/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!docker-compose.yml
!prometheus.yml
!.gitignore
60 changes: 60 additions & 0 deletions prometheus-grafana/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: '3.8'

networks:
monitoring:
driver: bridge

volumes:
prometheus_data: {}

services:
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
expose:
- 9100
networks:
- monitoring

prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
expose:
- 9090
networks:
- monitoring

grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
volumes:
- ./grafana_data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=secret
expose:
- 3000
ports:
- 3000:3000
networks:
- monitoring
18 changes: 18 additions & 0 deletions prometheus-grafana/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
global:
scrape_interval: 1m

scrape_configs:
- job_name: 'prometheus'
scrape_interval: 1m
static_configs:
- targets: ['localhost:9090']

- job_name: 'node'
static_configs:
- targets: ['node-exporter:9100']

# remote_write:
# - url: '<Your Prometheus remote_write endpoint>'
# basic_auth:
# username: '<Your Grafana Username>'
# password: '<Your Grafana API key>'

0 comments on commit 028ae86

Please sign in to comment.