-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobservability-tools.sh
executable file
·56 lines (43 loc) · 1.4 KB
/
observability-tools.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -ou pipefail
docker rm --force --volumes db_subsetter_prometheus
docker rm --force --volumes db_subsetter_grafana
set -e
# TODO try to avoid using --network host
docker run \
--detach \
--network host \
--name db_subsetter_prometheus \
--volume $(pwd)/prometheus-config.yml:/etc/prometheus/prometheus.yml \
prom/prometheus:v2.6.0
# Can download a point-in-time snapshot of what previous load testing metrics were from S3, then:
# unzip -r /path/to/<snapshot-id>
# chmod 777 -R /path/to/<snapshot-id>
# --volume /path/to/<snapshot-id>/:/prometheus \
# TODO try to avoid using --network host
docker run \
--detach \
--network host \
--name db_subsetter_grafana \
grafana/grafana:5.4.2
sleep 5
curl \
-X POST \
-H 'Content-Type: application/json' \
--data '{"name": "prometheus", "type": "prometheus", "url": "http://localhost:9090", "access": "browser", "jsonData": { "timeInterval": "500ms" } }' \
admin:admin@localhost:3000/api/datasources
echo ""
curl \
-X POST \
-H 'Content-Type: application/json' \
--data @grafana-dashboard.json \
admin:admin@localhost:3000/api/dashboards/db
echo ""
curl \
-X PUT \
-H 'Content-Type: application/json' \
--data '{ "homeDashboardId": 1 }' \
admin:admin@localhost:3000/api/user/preferences
echo ""
echo ""
echo "You can now view your DBSubsetter metrics at http://localhost:3000 (user: admin, password: admin)"