Skip to content

Commit

Permalink
use docker inspect to get prometheus ip
Browse files Browse the repository at this point in the history
  • Loading branch information
tzach committed Aug 25, 2016
1 parent 0d78c78 commit 17986c3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ ubuntu $ sudo systemctl restart docker
centos $ sudo service docker start
```

Update `prometheus/prometheus.yml` with the targets (server you wish to monitor).
Update `prometheus/prometheus.yml` with the targets (server you wish to monitor).

### Run locally
### Run

```
./start-all-local.sh
./start-all.sh
```

### Run on EC2
### Kill

```
./start-all-ec2.sh
./kill-all.sh
```

### Use
Expand Down
4 changes: 4 additions & 0 deletions kill-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

sudo docker kill agraf aprom
sudo docker rm agraf aprom
4 changes: 3 additions & 1 deletion start-all-ec2.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

source start-all.sh `curl http://169.254.169.254/latest/meta-data/public-ipv4`
echo "This file is deprecated and kept for backward compatibility. You should use start-all.sh directly"

source start-all.sh
4 changes: 3 additions & 1 deletion start-all-local.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

source start-all.sh 127.0.0.1
echo "This file is deprecated and kept for backward compatibility. You should use start-all.sh directly"

source start-all.sh
9 changes: 5 additions & 4 deletions start-all.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/usr/bin/env bash

DB_IP=$1

sudo docker run -d -v $PWD/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -p 9090:9090 prom/prometheus:v1.0.0
sudo docker run -d -v $PWD/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -p 9090:9090 --name aprom prom/prometheus:v1.0.0
sudo docker run -d -i -p 3000:3000 \
-e "GF_AUTH_BASIC_ENABLED=false" \
-e "GF_AUTH_ANONYMOUS_ENABLED=true" \
-e "GF_AUTH_ANONYMOUS_ORG_ROLE=Admin" \
-e "GF_INSTALL_PLUGINS=grafana-piechart-panel" \
grafana/grafana:3.1.0
--name agraf grafana/grafana:3.1.0

sleep 10

DB_IP="$(sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' aprom)"

curl -XPOST -i http://localhost:3000/api/datasources \
--data-binary '{"name":"prometheus", "type":"prometheus", "url":"'"http://$DB_IP:9090"'", "access":"proxy", "basicAuth":false}' \
-H "Content-Type: application/json"
Expand Down

0 comments on commit 17986c3

Please sign in to comment.