#!/bin/bash
# Start prometheus server
docker run -d -p 9090:9090 --restart unless-stopped \
-v /home/ubuntu/graph/prometheus:/etc/prometheus \
-v /home/ubuntu/graph/prometheus:/prometheus \
--user $(id -u) --name prometheus prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml
# Start prometheus node exporter which collects node resource metrics
docker run -d -p 9100:9100 --restart unless-stopped \
--user $(id -u) --name node-exporter prom/node-exporter
# Start grafana
docker run -d -p 3000:3000 --restart unless-stopped \
-v /home/ubuntu/graph/grafana:/var/lib/grafana \
--user $(id -u) --name grafana grafana/grafana
Assume that directories exists
/home/ubuntu/graph/prometheus
/home/ubuntu/graph/grafana
#Using graphite seems to be the better option since it allows posting data to it.
#Here is how to start it.
docker run -d --name graphite -p 8080:80 -p 2003:2003 sitespeedio/graphite:1.1.3
then access the web UI at 8080.
Run the following command to post some random data.
while true; do echo "fabric.tong.diceroll;nn=$((RANDOM%30));john=100 $((RANDOM % 100)) -1" | nc -q0 192.168.56.32 2003;sleep 3; done
The above command actually post metric named fabric.tong.diceroll with two tags, one is named nn, one is named john.
No comments:
Post a Comment