scripts/fogcutter/docker/monitoring/launch.sh

63 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/bash
# Assumes pew-net exists
# Assumes mounted dirs are created as non-root user
# Prometheus + Node Exporter + cAdvisor + Grafana
docker network create pew-monitoring-net
# grafana-cli plugins install grafana-piechart-panel
2019-09-08 16:17:15 -04:00
sudo chown 472:472 $PWD/grafana/{grafana-data,provisioning} \
&& \
docker run \
--name monitoring_grafana \
--detach \
--restart unless-stopped \
2019-09-16 23:07:53 -04:00
--env GF_SERVER_DOMAIN="seaturtle.pw" \
--env GF_SERVER_ROOT_URL="%(protocol)s://%(domain)s/grafana/" \
--user 472 \
2019-09-08 16:17:15 -04:00
--volume $PWD/grafana/grafana-data:/var/lib/grafana:rw \
--volume $PWD/grafana/provisioning:/etc/grafana/provisioning:rw \
--network pew-monitoring-net \
2019-11-23 11:50:00 -05:00
grafana/grafana:6.3.7 \
&& \
docker network connect pew-net monitoring_grafana
2019-09-08 16:17:15 -04:00
sudo chown nobody:nogroup $PWD/prometheus/prometheus-data \
&& \
docker run \
--name monitoring_prometheus \
--detach \
--restart unless-stopped \
2019-09-08 16:17:15 -04:00
--volume $PWD/prometheus/prometheus-data:/prometheus:rw \
--volume $PWD/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro \
--volume $PWD/prometheus/alert.rules:/etc/prometheus/alert.rules:ro \
--network pew-monitoring-net \
2019-11-23 11:50:00 -05:00
prom/prometheus:v2.14.0 --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus \
--storage.tsdb.retention.size=200GB
docker run \
--name monitoring_node-exporter \
--detach \
--restart unless-stopped \
--cap-add SYS_TIME \
--pid host \
--volume /:/host:ro,rslave \
--network pew-monitoring-net \
quay.io/prometheus/node-exporter:v0.18.1 --path.rootfs=/host
docker run \
--name monitoring_cadvisor \
--detach \
--restart unless-stopped \
--volume /:/rootfs:ro \
--volume /var/run:/var/run:ro \
--volume /sys:/sys:ro \
--volume /var/lib/docker:/var/lib/docker:ro \
--volume /dev/disk:/dev/disk:ro \
--network pew-monitoring-net \
2019-11-23 11:50:00 -05:00
google/cadvisor:v0.33.0
# alert manager